1

I want to change the template just for one category. My first template referece which is work for list_rent.phtml is the following one:

  <referenceBlock name='category.products.list'>
      <action method='setTemplate'>
          <argument name='template' xsi:type='string'>Magento_Catalog::product/list_rent.phtml</argument>
     </action>
  </referenceBlock>

but when I try to set the template for details_rent.phtml it doesn't work, even I use the same syntax and details_rent.phtml is located in product/view and list_rent in product

  <referenceBlock name='product.info.details'>
      <action method='setTemplate'>
          <argument name='template' xsi:type='string'>Magento_Catalog::product/view/details_rent.phtml</argument>
      </action>
  </referenceBlock> 

Can anyone give me a suggestion?

0

1 Answer 1

0

You can try with below code,

Use reference Name as category.products.list

<referenceBlock name='category.products.list'>
      <action method='setTemplate'>
          <argument name='template' xsi:type='string'>Magento_Catalog::product/view/details_rent.phtml</argument>
      </action>
  </referenceBlock> 
4
  • you have try with above code inside backend category page layout update field? Commented Nov 7, 2016 at 8:51
  • i need to referace this :<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.details" template="product/view/details.phtml" after="product.info.media">
    – user46750
    Commented Nov 7, 2016 at 8:52
  • you have to reference this block inside category page? Commented Nov 7, 2016 at 8:54
  • by default details.phtml is call from this referance in catalog_product_view.xml -<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.details" template="product/view/details.phtml" after="product.info.media"> What i try to do is to call a diferent phtml just for one category in my backend category - layout update xml
    – user46750
    Commented Nov 7, 2016 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.