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
Tag: magento2
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
Class ‘MagentoSetupApplication’ not found, after executing “git reset –hard”
I executed git reset –hard, but now I get: I executed composer update in hope that this fixes it, but it doesnt. How can I fix? Answer It turned out that git reset –hard destroyed my setup folder for unknown reasons and not even git pull fixed it. So I had to copy the folder from another project. Now it
Javascript not triggered
I want to trigger the js function when the class subcat-tab is clicked, but it seems not to be working. I don’t have any error messages but nothing is happening. I’m under a phtml file from Magento 2. …
How can I make an amount instance from float in Magento 2?
There is a customly generated float called $price, which should be displayed as the price for a product in a product list in Magento 2. For displaying a price with taxes excluded/included, the method …
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