Skip to content
Advertisement

Tag: magento2

does not extend MagentoFrameworkDataObject

I have exception when I ceate model.Here is that exception: Magento version is 2.4.4 Training4VendorModelTraining4_Vendor2Product Training4VendorModelResourceModelTraining4_Vendor2Product Training4VendorModelResourceModelTraining4_Vendor2ProductCollection in Training4VendorModelTraining4_Vendor2Product,I have already extends MagentoFrameworkModelAbstractModel,I don’t know why that exception occur Answer did you add dependency in di.xml

Nginx Php-fpm 7.3 Can’t read PHP files from a particular folder

We have a Magento 2 website. For some reason our Nginx/PHP-FPM is unable to read files from MAGEROOT/pub/ folder other than index.php. We are getting the following error in Nginx Log “Unable to open primary script: /home/goodprice/public_html/releases/current/pub/get.php (No such file or directory)” and the browser shows No input file specified. Here is the partial Nginx config file. This causes a

Custom ViewModel is not found

Whenever I try to use my own custom ViewModel the module stops working. Error: main.CRITICAL: Class LithContactsViewModelAdditionalInfo does not exist [] [] The file structure is simple: Inside the viewfrontendlayout I created a file contact_index_index.xml Where I defined a new block inside a referenceContainer with a static message – Works fine. But when I add an argument, to pass in

How to include multiple html file in another phtml file?

I would like to include several file in Magento 2 in one phtml file. The project was in laravel at first and looks like this : https://i.imgur.com/XpUbynf.png So now I need to import all the project in a Magento 2 project but the semantic is different. I have tried this so far but doesnt work : https://i.imgur.com/hewweJg.png The files I’m

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

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