2

within the following file I can see below shown code:

File:

frontend/default/ves_fashion/template/common/list/default.phtml

Code:

<div class="price">
<?php echo $this->getPriceHtml($_product, true, $price_prefix) ?>
</div>

If I navigate to

frontend/default/ves_fashion/template/catalog/product/price.phtml

and make some changes to the price.phtml file, I can see the changes on two parts:

  1. The price which is shown for each product in the product overview section.
  2. The price which is shown for one product in the detail view.

How can I change the template that two different price templates are loaded - one for the overview section, and a different one for the detailed section?

I tried to rename

<?php echo $this->getPriceHtml($_product, true, $price_prefix) ?>

to

<?php echo $this->getPricelistHtml($_product, true, $price_prefix) ?>

And clone price.phtml as pricelist.phtml, but this is not working correctly.

Thanks for your help!

  • please try this <?php echo $this->getPriceHtml($_product, true, $price_prefix) ->setTemplate('common/list/default.phtml');?> – Amit Bera May 11 '15 at 10:15
  • This results in: Call to a member function setTemplate() on a non-object – Torben May 11 '15 at 10:21
0

You can use addPriceBlockType, so for example:

<reference name="product_list">
   <action method="addPriceBlockType">
      <type>simple</type>
      <block>catalog/product_price</block>
      <template>catalog/product/list/custom-price.phtml</template>
   </action>
</reference>
| improve this answer | |
  • Hey Mayers, and where do i put this xml code reference? – Torben May 11 '15 at 10:15
  • In your layout xml : <catalog_category_layered> ...code here.. </catalog_category_layered> and <catalog_category_default> .. code here... </catalog_category_default> – Mayers May 11 '15 at 10:22
  • I added it to both blocks directly before </catalog_category_default> and </catalog_category_layered>. I still use $this->getPriceHtml but the shop still takes template/catalog/product/price.phtml and not custom-price.html ... What is missing? Do you have an idea? – Torben May 11 '15 at 10:46
  • Hi Torben, it's hard to say without looking at the code. If you're not familiar with Magento, I would advise giving this to a Magento developer, as understanding layouts takes some practise. – Mayers May 11 '15 at 12:42

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.