Skip to content

url-rewrite

Auto Added by WPeMatico

Getting ` 1452 Cannot add or update a child row: a foreign key constraint fails` on Magento 2.4.7-p1

I did a magento update from 2.4.6-p3 -> 2.4.7-p1 and now I cannot create programmatically a product. Once I am doing: $product = $this->product->setData($productData); $this->resourceModelProduct->save($product); I’m getting this error message: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a… Read More »Getting ` 1452 Cannot add or update a child row: a foreign key constraint fails` on Magento 2.4.7-p1

Magento 2: Nginx Rewrite Rule for Updated Media Base URL

I recently updated my media base URL to {{unsecure_base_url}}media/version1234567/. While attempting to create a rewrite rule in Nginx, I’ve encountered some difficulties. For a single URL, I used the following configuration which works as expected: location = /media/version1234567/wysiwyg/banners/WebsiteBanners2/HomePageBanners/Snom_Web_May_HP.png { return… Read More »Magento 2: Nginx Rewrite Rule for Updated Media Base URL

Select configurable product option, Magento 2

I have a module that redirects the url of a simple product to the configurable product. For this I have this: events.xml <?xml version=”1.0″?> <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:ObjectManager/etc/config.xsd”> <event name=”controller_action_predispatch_catalog_product_view”> <observer name=”vendor_redirectsimpletoconfigurable_products_observer_predispatch” instance=”VendorRedirectSimpleToConfigurableObserverPredispatch”/> </event> </config> Predispatch.php <?php declare(strict_types=1); namespace VendorRedirectSimpleToConfigurableObserver; use… Read More »Select configurable product option, Magento 2