سؤال

I understand this is probably very simple, but I have thoroughly confused myself and am hoping someone has a few minutes to provide clarity.

I would like to apply some very, very custom stuff to a specific product.

I have created this file:

\app\design\frontend\company\store_theme\Magento_Catalog\layout\catalog_product_view_id_4.xml

I would like to copy this file (details-product-4.phtml), and heavily alter it to do what I need to do:

\app\design\frontend\company\store_theme\Magento_Catalog\templates\product\view\details.phtml

How do I use the XML layout file to point to "details-product-4.phtml"?

هل كانت مفيدة؟

المحلول

Take a look at vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml and see what it is you want to change.

You might want to keep some of it and move bits around. If you want to change the template for the whole thing you can do this:

 <referenceBlock name="content">
   <action method="setTemplate">
     <argument name="template" xsi:type="string">Namespace_Module::path/to/details-product-4.phtml</argument>
   </action>
 </referenceBlock>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top