Php 如何加上「;“最终销售”;购物车页面magento中“特殊价格”旁边
我想添加“最终销售”的销售项目旁边的特殊价格在购物车页面。 我补充说Php 如何加上「;“最终销售”;购物车页面magento中“特殊价格”旁边,php,magento,Php,Magento,我想添加“最终销售”的销售项目旁边的特殊价格在购物车页面。 我补充说 <span class="price-label"><?php echo $this->__('Final Sale') ?></span> 在 template/checkout/cart/item/default.phtml 但我得到的是购物车页面中所有商品的最终销售。 我只想为销售项目添加最终销售。 我怎样才能做到这一点?使用Transate内联 通过系统->配置-
<span class="price-label"><?php echo $this->__('Final Sale') ?></span>
在
template/checkout/cart/item/default.phtml
但我得到的是购物车页面中所有商品的最终销售。
我只想为销售项目添加最终销售。
我怎样才能做到这一点?使用Transate内联 通过系统->配置->开发人员->内联翻译打开它
您可以通过单击它并将文字更改为“最终销售”来更改它所说的内容。您实际上可以通过观察者来执行此操作。要使用的事件是
core\u block\u abstract\u to\u html\u after
,然后您可以通过以下方式获取该块的html:
$transport = $observer->getTransport();
$html = $transport->getHtml();
// do some stuff here to determine which items you need to edit the label for.
// after editing the label, maybe with DomDocument and xpath, set the new html at the end
// of your observer like so:
$transport->setHtml($html);
我一直使用这种方法,因为我不喜欢在更改很小的时候修改模板文件。您好,谢谢您的回答,这并没有解决我的问题。我只想在购物车页面中为销售项目添加最终销售。