2012-08-03 59 views
2

基本上我是网页设计师。我是magento CMS的新手。我参与了一个新的magento电子商务项目。Magento购物车 - 动态定价

我想在我的产品页面中进行动态定价。

在我的网站我卖窗帘布,所以我想动态计费像

用户可以给宽度和特定产品 我有平方英尺一个固定的价格的高度我需要乘以用户提供的宽度和高度才能得到平方英尺的值。

例如,请参阅此链接。

参考网站网址:http://www.woodyattcurtains.com/net-curtains-voiles-c2/net-curtains-c3/ellie-white-net-curtains-p3

我希望我的产品页面完全一样。我在magento中搜索了很多扩展以轻松实现这一结果。但是很不幸。 在magento中有没有免费的扩展来实现这一点?否则,请指导我通过任何类型的编码来开发此结果。

回答

-2

只需添加这段代码在你的

应用程序/设计/前端/预设/ [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 = '&#163; &nbsp;'+mq; 
mq1= Math.ceil($('width').getValue() * $('height').getValue() * <?php echo $br_old_price;?>); 
document.getElementById('<?php echo $old_priceID; ?>').innerHTML = '&#163; &nbsp;'+mq1; 
} 
$('width').observe('change', respondToChange); 
$('height').observe('change', respondToChange); 
</script> 

年底有这个代码的问题。您可以在所有产品页面中反映价格。但是你不能将这些更新的特价卖给购物车。旧价值将反映在购物车中。希望任何人更新此代码。

+1

无用然后如果没有反映到购物车 – itsazzad 2013-06-21 14:40:51