Skip to content
Advertisement

Tag: magento2

Detect Success Page on Magento 2

Is there a way to check if am I on Success page on Magento 2? I know in Magento 1 we can check and compare the action name, for example. But in Magento 2, there is something similar? Answer One way would be via URL. In your Class use this in construct: With $this->_urlInterface->getCurrentUrl() you get the current url, so

Overriding Magento_SalesRule ResourceModel by preferences throws error: Type Error occurred when creating object

Error Message in debug.log: [2020-11-10 07:57:17] main.CRITICAL: Type Error occurred when creating object: MagentoSalesRuleModelResourceModelRule, Argument 3 passed to MagentoSalesRuleModelResourceModelRule::__construct() must be an instance of MagentoSalesRuleModelResourceModelCoupon, instance of RMSameCouponMultipleDiscountsModelResourceModelCoupon given, called in /home/rehan/lab/testrm/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 116 [] [] I am trying to override: MagentoSalesRuleModelResourceModelCoupon.php to remove ‘unique coupon’ restriction: from construct() method. My app/code/Vendor/Module/Model/ResourceModel/Coupon.php looks like: my di.xml file looks like:

Magento 2.4 Custom form post is redirecting 404 or search

I have problem with custom made form that should make post request to custom controller, it’s redirecting me to search page and i have no idea why. When i try to paste action url into browser it’s working corectlly. my form phtml: get action method: controller is located in vendormoduleControllerListsIndex.php file in html for me it looks ok: after pressing

How to pass storeUrl to default Magento oauth script?

I’m trying to create my first Magento 2 extension and integration and I’ve been following the guide in their docs here. All good so far, I’ve completed the auth handshake, stored all the required keys for api requests and can make requests back to my extension fine. Looking at the OauthClient.php script provided at the foot of the tutorial, the

PHP Bold String Before Specific Char

I have product title with this standard: “Brand name – item title” and I need to transform this string like this: Brand name item title So I need 2 things to handle: replace the first dash in the string with “br” and apply bold to the text before the first dash. I have reached only the first part of the

Magento 2 Category SEO friendly URLS

I have a Magento 2 website and require some direction with setting up sub-category urls to be SEO friendly. The Navigation menu work just fine i.e Grooming Kit www.mywebsite.com/product-grooming-kit.html the issue i’m having is with sub-categories in the left sidebar filters which when a specific category is clicked on it displays as following url with a number id www.mywebsite.com/product-grooming-kit.html?grooming-kit=32 I

Magento 2 Attribute Not Show In Navigation

I have a problem when applying magento 2.1.9 to my project. My attribute is ab_size I have created that attribute with code blow. With config in the backend. Enable filter (with result) done Category Is Anchor done Reindex done Enable Category flat done Enable Product flat done Reindex all data done Clear cache done Use magento clean doesn’t have any

Advertisement