在 Magento 产品页面上显示一次价格
我只想在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这取决于您想保留哪一个。页面顶部的价格通常作为“产品类型数据”的一部分显示。查看
template/catalog/product/view/type/simple.phtml
,您应该在其中看到$this->getPriceHtml($_product);
。目录页底部的价格有点复杂。如果您查看
layout/catalog.xml
,就会发现价格块 (product.clone_prices) 已添加到product.info.options.wrapper.bottom
块中,其中然后添加到product.info.container1
和product.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 blockproduct.info.options.wrapper.bottom
, which is then added toproduct.info.container1
andproduct.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
一种更简洁的方法是删除 local.xml 布局文件中的块,而不是按照 Joseph 的建议从catalog.xml 本身删除克隆的价格:
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:
价格块是在布局文件 (XML) 中定义的,您只需从模板文件中调用它们即可显示它们。
在您的情况下,您似乎可能在同一个块中或在一个文件和两个相关部分/视图中的两个相关 XML 文件中定义了它们两次。这意味着当您调用函数
$this->getPriceHtml($_product);
XMl 解析器会从两个不同的文件(绑定到某个块)加载价格两次。我还在
catalog.xml
文件中注意到了这一点:如果这是您正在寻找的内容,那么只需尝试 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:If this is what you are looking for then just experiment with blocks within XML files.