New answers tagged

1

Your plugin class should look like this: <?php namespace Vendor\Module\Plugin\Helper; use Magento\Catalog\Model\Product; class Data { /** * @param \Magento\ConfigurableProduct\Helper\Data $subject * @param callable $proceed * @param Product $currentProduct * @param array $allowedProducts * @return array */ public ...


0

yes.you code should be ok.but I want cache it.and if has updated in backend,I want update "spConfig": getJsonConfig() ?>,then after visit the product page,it need cache the data again.


0

Try adding cacheable="false" argument to the block that you have assigned the .phtml template in your layout .XML file <block class=".." name="..." template="..." cacheable="false" /> This will remove the block from the caching list, basically. More details can be found here


0


2

To create any plugin, you need to put this code into di.xml file : app\code\Vendor\Extension\etc\di.xml <config> <type name="{ObservedType}"> <plugin name="{pluginName}" type="{PluginClassName}" sortOrder="1" disabled="false"/> </type> </config> Where : type ...


Top 50 recent answers are included