在 Magento 产品页面上显示一次价格

发布于 2024-09-19 02:37:03 字数 303 浏览 3 评论 0原文

我只想在 Magento 产品页面上显示一次产品价格。目前,它显示两次。

我尝试更改app/design/frontend/base/default/template/catalog/product/price.phtml, 但没有得到它。我也尝试了app/design/frontend/base/default/template/catalog/view.phtml,但是当我编辑price.phtml时,价格没有上涨。

那么我该怎么做呢?有什么想法吗?

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

此岸叶落 2024-09-26 02:37:03

这取决于您想保留哪一个。页面顶部的价格通常作为“产品类型数据”的一部分显示。查看 template/catalog/product/view/type/simple.phtml,您应该在其中看到 $this->getPriceHtml($_product);

目录页底部的价格有点复杂。如果您查看 layout/catalog.xml,就会发现价格块 (product.clone_prices) 已添加到 product.info.options.wrapper.bottom 块中,其中然后添加到 product.info.container1product.info.container2。根据产品的不同,其中之一将在页面上回显。但是,您可以仅删除 Product.clone_prices 行,这样就会删除价格。

希望有帮助!

谢谢,

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

月亮坠入山谷 2024-09-26 02:37:03

一种更简洁的方法是删除 local.xml 布局文件中的块,而不是按照 Joseph 的建议从catalog.xml 本身删除克隆的价格:

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

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>
机场等船 2024-09-26 02:37:03

价格块是在布局文件 (XML) 中定义的,您只需从模板文件中调用它们即可显示它们。

在您的情况下,您似乎可能在同一个块中或在一个文件和两个相关部分/视图中的两个相关 XML 文件中定义了它们两次。这意味着当您调用函数 $this->getPriceHtml($_product); XMl 解析器会从两个不同的文件(绑定到某个块)加载价格两次。

我还在 catalog.xml 文件中注意到了这一点:

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

如果这是您正在寻找的内容,那么只需尝试 XML 文件中的块即可。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文