这对我来说听起来很有趣,所以我决定尝试一下。
我通过修改文件让它工作:
app/code/community/OrganicInternet/SimpleConfigurableProducts/Catalog/Product/Price.php
(为了理智,将其复制到 code/local/... 目录树;D)
由于您不想要实际的“Price From:”文本,您可以注释掉这些行:
if ($product->getMaxPossibleFinalPrice() != $product->getFinalPrice()) {
$extraHtml .= $this->__('Price From:');
}
现在这里是有趣的地方。我基本上是通过更改这一行来复制他们自己的插入方法:
return substr_replace($priceHtml, $extraHtml, strpos($priceHtml, $htmlToInsertAfter)+strlen($htmlToInsertAfter),0);
进入这些行:
$finalHtml = substr_replace($priceHtml, $extraHtml, strpos($priceHtml, $htmlToInsertAfter)+strlen($htmlToInsertAfter),0);
if ($product->getMaxPossibleFinalPrice() != $product->getFinalPrice()) {
$finalPriceHtml = ' - $' . strval(number_format($product->getMaxPossibleFinalPrice(),2,'.',','));
$finalPriceInsertAfter = strval(number_format($product->getFinalPrice(),2,'.',','));
$finalHtml = substr_replace($finalHtml, $finalPriceHtml, strpos($finalHtml, $finalPriceInsertAfter)+strlen($finalPriceInsertAfter),0);
}
return $finalHtml;
基本上复制了他们插入配置价格标签的原始方法,但这次在默认价格之后插入了最高价格。但是,它不适用于多币种商店,您必须抓住商店货币运营商并根据使用的货币更改 number_format。您可能可以使用内置的货币格式方法,但我不熟悉它,因为我没有在多货币商店工作过。
试一试,如果有任何问题,请告诉我。