虽然从功能的角度来看@jholloman 的答案是正确的,但您可能会考虑以原型的方式执行此操作,而是继承Product.OptionsPrice并使用该新类。这是来自app\design\frontend\base\default\template\catalog\product\view.phtml第 36 行(我认为您需要更改它):  
原来的
<script type="text/javascript">
    var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
</script>
修改的
<script type="text/javascript">
    var MyOptionPrice = Class.create(Product.OptionsPrice, { // inherit from Product.OptionsPrice
        formatPrice: function($super, price) { // $super references the original method (see link below)
            if (price % 1 === 0) { 
                this.priceFormat.requiredPrecision = 0; 
            }
            return $super(price);
        }        
    });
    var optionsPrice = new MyOptionPrice(<?php echo $this->getJsonConfig() ?>); // use yours instead
</script>
使用wrap()(这样,您不必更改原始方法名称):
<script type="text/javascript">
    Product.OptionsPrice.prototype.formatPrice = Product.OptionsPrice.prototype.formatPrice.wrap(function(parent, price) {
        if (price % 1 === 0) { 
            this.priceFormat.requiredPrecision = 0; 
        }
        return parent(price);        
    });
    var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
</script>
请参阅有关 Prototype 的继承和$super var的链接。
同样,我看到了与 Magento 中使用的@jholloman 建议类似的代码,所以按照他的方式进行是没有问题的,但我想你可能想知道如何按照 Prototype 的方式进行操作。