Sometimes you need to override the class Magento\ConfigurableProduct\Helper\Product\Options\Loader.php . This may be necessary, for example, to fix the Call to undefined method Magento\Catalog\Model\Product\Type\Simple\Interceptor::getConfigurableAttributeCollection() issue. A custom Magento 2 extension is often the best place for this override. Follow these steps:…
Overriding TierPriceBox.php for configurable products (Magento 2)
If you want to customize Magento 2 tier prices on configurable product pages, you may need to override the vendor/magento/module-configurable-product/Pricing/Render/TierPriceBox.php class. Here is how: Add the following content to the di.xml file in your extension:
|
1 2 3 |
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> <preference for="Magento\ConfigurableProduct\Pricing\Render\TierPriceBox" type="Vendor\Module\Pricing\Render\TierPriceBox" /> </config> |
Now create the class…
Magento and Polyfills: Is your store secure? (Magento 1 / 2)
It was recently reported that the new owner of the Polyfill project had injected Malware into the polyfill.js file. If your Magento 1 or Magento 2 store uses the Polyfill JavaScript, this may pose a serious threat to your store…
Fixing the Magento 2 Cosmic Sting vulnerability (APSB24-40)
Fakt: The “Cosmic Sting” Sicherheitsproblem betrifft nahezu 75% aller Magento 2 Shopsvulnerability could allow attackers to read private files and, in combination with a recently discovered Linux vulnerability, potentially execute code remotely. That could give attackers extensive control over an…
Extension styles are not applied in Hyvä (Magento 2)
When you install an extension, such as a Hyvä compatibility module, its styles (usually from tailwind-source.css) may not immediately be picked up by Hyvä and Tailwind. To include those styles, run the following command from your Magento 2 root directory:…
Dynamically changing the SKU of a configurable product in Hyvä (Magento 2)
In Hyvä (and Magento generally), the displayed SKU does not change automatically when a shopper selects different options for a configurable product. A small code change can fix this. Override the file /vendor/hyva-themes/magento2-default-theme/Magento_ConfigurableProduct/templates/product/view/type/options/js/configurable-options.phtml in your Hyvä child theme as follows:…
Creating a modal dialog with a close button in Hyvä (Magento 2)
Hyvä makes it easy to create custom modal dialogs. Start by building your Hyvä modal like this:
|
1 2 3 4 5 6 7 8 9 10 11 |
$heroicons = $viewModels->require(\Hyva\Theme\ViewModel\HeroiconsOutline::class); $modalDialog = $viewModels->require(\Hyva\Theme\ViewModel\Modal::class) ->createModal() ->withDialogRefName('unique-name') ->withContent(' <div class="absolute top-4 right-4 rounded-t dark:border-gray-600"> <button @click="hide" type="button" class="h-10 w-10 rounded-full p-2">' . $heroicons->renderHtml('x') . '</button> </div>' . 'testcontent') ->addDialogClass('relative sm:w-1/2 md:w-1/2 lg:w-1/2 xl:1/2 2xl:1/2','m-2'); |
You can open the dialog with any HTML element. The following example uses a span element rendered as a Hyvä question mark…
Unlocking an indexer (Magento 2)
Sometimes one or more Magento 2 indexes become locked and cannot be rebuilt using the normal command:
|
1 |
php bin/magento indexer:reindex |
The message might look like this: Product EAV index is locked by another reindex process. Skipping. To resolve it, unlock or invalidate…
Integrating Icecat data into Magento 2
Want to enrich your Magento 2 product catalog with data from icecat (https://icecat.biz)? No problem! With the official icecat Magento 2 extension (https://packagist.org/packages/icecat/magento2-extension), you can enhance existing product information or import new products from icecat with relatively little effort. I…
Installing Hyvä language packs (Magento 2)
Language packs are already available for Hyvä in a number of languages. You can install them with Composer as usual. Find the available languages at https://docs.hyva.io/hyva-themes/building-your-theme/localization.html; more are being added over time. At the time of writing, Hyvä for Magento…