0

Good Afternoon All,

I am having trouble with overloading a template for Magento 2 "module-catalog" module. My overload in the child theme would be the 4th overload in the chain and it is not working.

(1) module-catalog (vendor folder - default layout and template)

Template - vendor/magento/module-catalog/view/base/templates/product/price/amount/default.phtml

Layout - vendor/magento/module-catalog/view/base/layout/catalog_product_prices.xml

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<block class="Magento\Framework\Pricing\Render\RendererPool" name="render.product.prices">
    <arguments>
        <argument name="default" xsi:type="array">
            <item name="default_render_class" xsi:type="string">Magento\Catalog\Pricing\Render\PriceBox</item>
            <item name="default_render_template" xsi:type="string">Magento_Catalog::product/price/default.phtml</item>
            <item name="default_amount_render_class" xsi:type="string">Magento\Framework\Pricing\Render\Amount</item>
            <item name="default_amount_render_template" xsi:type="string">Magento_Catalog::product/price/amount/default.phtml</item>
            <item name="prices" xsi:type="array">
                <item name="special_price" xsi:type="array">
                    <item name="render_template" xsi:type="string">Magento_Catalog::product/price/special_price.phtml</item>
                </item>
                <item name="tier_price" xsi:type="array">
                    <item name="render_template" xsi:type="string">Magento_Catalog::product/price/tier_prices.phtml</item>
                </item>
                <item name="final_price" xsi:type="array">
                    <item name="render_class" xsi:type="string">Magento\Catalog\Pricing\Render\FinalPriceBox</item>
                    <item name="render_template" xsi:type="string">Magento_Catalog::product/price/final_price.phtml</item>
                </item>
                <item name="custom_option_price" xsi:type="array">
                    <item name="amount_render_template" xsi:type="string">Magento_Catalog::product/price/amount/default.phtml</item>
                </item>
                <item name="configured_price" xsi:type="array">
                    <item name="render_class" xsi:type="string">Magento\Catalog\Pricing\Render\ConfiguredPriceBox</item>
                    <item name="render_template" xsi:type="string">Magento_Catalog::product/price/configured_price.phtml</item>
                </item>
            </item>
            <!--<item name="adjustments" xsi:type="array"></item>-->
        </argument>
    </arguments>
</block>

(2) Custom module (app/code) overloads layout and template

Template - app/code/ABC/ConfigurableProduct/view/base/templates/product/price/amount/default.phtml

Layout - app/code/ABC/ConfigurableProduct/view/base/layout/catalog_product_prices.xml

<referenceBlock name="render.product.prices">
  <arguments>
    <argument name="default" xsi:type="array">
      <item name="default_amount_render_template" xsi:type="string">ABC_ConfigurableProduct::product/price/amount/default.phtml</item>
    </argument>
  </arguments>
</referenceBlock>

(3) base theme overload of module template

base Theme Template - app/design/frontend/ABC/Default/ABC_ConfigurableProduct/templates/product/price/amount/default.phtml

Up to this point all the over loads work.

(4) Child Theme created for "default" named "uk"

copied "app/design/frontend/ABC/Default/ABC_ConfigurableProduct/templates/product/price/amount/default.phtml"

to

"app/design/frontend/ABC/uk/ABC_ConfigurableProduct/templates/product/price/amount/default.phtml"

overload has not worked for category page but works fine for product page and changes show, this template swaps the view postion of taxed and untaxed prices around when both are shown, nothing complicated. I am not sure why this is not working for category page. I may be missing some layout but I am not sure what I have missed or which bit of layout to pull up to make this work on the category page. Any help would be greatly appreciated.

Thank you in advance.

0

It has been a while, but I did discover the issue with regards to the template not overloading correctly for the category pages and though I would post.

It appears that the previous creator of the theme created a new category param for theme assignment and the failed to remove the DB entries for the values that were assigned, when the field was taken out. The issue only showed once I was attempting to create and assign child themes. A clean up was required for the left over data values to resolve the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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