user471987
user471987

Reputation: 119

Display Price Once on Magento Product Page

I want to show the product price only once on the Magento product page. Currently, it is displayed twice.

I tried to change app/design/frontend/base/default/template/catalog/product/price.phtml, but didn't get it. I also tried app/design/frontend/base/default/template/catalog/view.phtml, but when I edited price.phtml the price is not up.

So how can I do it? Any ideas?

Thanks.

Upvotes: 6

Views: 24577

Answers (3)

Simon H
Simon H

Reputation: 2495

Instead of deleting the cloned price from the catalog.xml itself, as suggested by Joseph, a more clean way is to remove the block in your local.xml layout file:

<catalog_product_view>  
   <reference name="product.info.container2">
      <remove name="product.clone_prices"/>
   </reference>
</catalog_product_view>

Upvotes: 4

Matthew Morek
Matthew Morek

Reputation: 2834

Price blocks are defined within layout files (XML), you just need to call them from within the template files to get them to show.

In your case it seems that you might have possibly defined them twice from two related XML files within the same block, or within one file and two related sections/views. This means that when you call a function $this->getPriceHtml($_product); XMl parser loads the price twice from two different files (tied to a certain block).

Also I've noticed this within catalog.xml file:

<block type="catalog/product_view" name="product.clone_prices" as="prices" template="catalog/product/view/price_clone.phtml"/>

If this is what you are looking for then just experiment with blocks within XML files.

Upvotes: 0

Joe Mastey
Joe Mastey

Reputation: 27099

This depends on which one you want to keep. The price at the top of the page is generally displayed as part of the "product type data". Take a look at template/catalog/product/view/type/simple.phtml, where you should see $this->getPriceHtml($_product);.

The price at the bottom of the catalog page is a little more complicated. If you take a look at layout/catalog.xml, the price block (product.clone_prices) is added to the block product.info.options.wrapper.bottom, which is then added to product.info.container1 and product.info.container2. Depending on the product, one of these will be echoed on the page. You can, however, just remove the line for product.clone_prices and that should remove the price.

Hope that helps!

Thanks, Joe

Upvotes: 12

Related Questions