只需添加這段代碼在你的
應用程序/設計/前端/預設/ [TEMPLATE_NAME] /template/catalog/product/view.phtml文件 我不得不增加兩個新領域對於寬度&高度就這樣
<label for="height"><?php echo "Height" ?></label>
<input type="text" name="height" id="height" maxlength="30" value="1" title="<?php echo 'Height' ?>" class="input-text" />
<label for="width"><?php echo "Width" ?></label>
<input type="text" name="width" id="width" maxlength="30" value="1" title="<?php echo 'Width' ?>" class="input-text" />
還添加這些PHP代碼
<?php $br_special_price = $_product->getSpecialPrice();
$br_old_price = $_product->getPrice();
$an_id = $_product->getId();
$special_priceID="product-price-".$an_id;
$old_priceID="old-price-".$an_id;
?>
而且這個腳本在文件
<script type="text/javascript">
var mq= 0;
function respondToChange(event) {
mq= Math.ceil($('width').getValue() * $('height').getValue() * <?php echo $br_special_price;?>);
document.getElementById('<?php echo $special_priceID; ?>').innerHTML = '£ '+mq;
mq1= Math.ceil($('width').getValue() * $('height').getValue() * <?php echo $br_old_price;?>);
document.getElementById('<?php echo $old_priceID; ?>').innerHTML = '£ '+mq1;
}
$('width').observe('change', respondToChange);
$('height').observe('change', respondToChange);
</script>
年底有這個代碼的問題。您可以在所有產品頁面中反映價格。但是你不能將這些更新的特價賣給購物車。舊價值將反映在購物車中。希望任何人更新此代碼。
無用然後如果沒有反映到購物車 – itsazzad 2013-06-21 14:40:51