我希望不要太大胆地寻求帮助。我卖瓶装酒,我想在瓶(商品)的价格下显示一瓶的换算价格。

我的想法是这样的

如果属性'显示拍摄价格'说'是的',然后它应该找出最新的价格是什么 价格 或者 特价.

然后我有几个选择 体积.

如果属性 体积 有选项 1升 它应该将价格除以25(40毫升射击)。

0.7升 价格/17,5。

0.5升 价格/12,5。

结果应四舍五入为整数。

有帮助吗?

解决方案

$coreHelper = Mage::helper('core');
$shotPrice = $_product->getFinalPrice() / ($volume * 25);
$displayShotPrice = $coreHelper->formatPrice($shotPrice);

现在你只需打印 $displayShotPrice

其他提示

如果有人需要和我一样,这里是我的最终代码,我使用权重属于卷。

<?php if($_product->getData('attribute_show_shot_price')==1): ?>
                <?php $coreHelper = Mage::helper('core');

                $weight=$_product->getweight(); 

                $shotPrice = $_product->getFinalPrice() * 40 / $weight;
                $displayShotPrice = $coreHelper->formatPrice($shotPrice); ?>

                <?php echo $displayShotPrice ?>
        <?php endif; ?> 
.

许可以下: CC-BY-SA归因
scroll top