Magento在更改Shipping method单选按钮时未更新运费

时间:2017-05-15 10:01:06

标签: magento-1.9 magento2

我更改了送货方式,如截图中所示,但magento不会使用计算的总运费来刷新内页。我认为这是版本1.9中的错误。在这里你可以看到截图.Magento ver。 1.9.2.4

当我从一种送货方式更改单选按钮时,onestepcheckout不会刷新带有计算成本的内页。 enter image description here

如何使用javascript刷新内页。

由于

1 个答案:

答案 0 :(得分:0)

在available.phtml文件中添加以下代码

<?php if (!($_shippingRateGroups)): ?>
    <strong><?php echo Mage::helper('oscheckout')->__('Sorry, no quotes are available for this order at this time.') ?></strong>
<?php else: ?>
    <dl class="shipment-methods">

        <?php $methodcount = count($_shippingRateGroups); $check_default = 1;  foreach ($_shippingRateGroups as $code => $_rates): ?>
            <dd><?php echo $this->getCarrierName($code) ?></dd>
            <?php foreach ($_rates as $_rate): ?>
                <dt style="margin-bottom: 5px;">
                    <?php if ($_rate->getErrorMessage()): ?>
                        <ul class="messages"><li class="error-msg"><ul><li><?php echo $_rate->getErrorMessage() ?></li></ul></li></ul>
                    <?php else: ?>
                        <input <?php echo $check_default == 1 ? 'checked="checked"':'' ?> name="shipping_method" type="radio" class="validate-one-required-by-name" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" />
                        <label for="s_method_<?php echo $_rate->getCode() ?>"> <?php echo $_rate->getMethodTitle() ?>
                            <strong>
                                <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
                                <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>

                                <?php echo $_excl; ?>
                                <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
                                (<?php echo Mage::helper('oscheckout')->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
                                <?php endif; ?>
                            </strong>
                        </label>
                    <?php endif ?>
                </dt>
            <?php  endforeach; $check_default++; ?>
        <?php endforeach; ?>
    </dl>
<?php endif;
 ?> 

在同一个文件中添加此脚本

<script type="text/javascript">
    <?php  if($methodcount >= 1): ?>
    document.observe('dom:loaded', function(){
        shipping.loadReview();
        var payment_methods = $('ajax-payment-methods');
        //payment_methods.update('<div class="ajax-load">&nbsp;</div>');
        payment.reloadPaymentBlock();
//      reloadPaymethod();
    });
    <?php  endif; ?>
    $$('dl.shipment-methods input').invoke('observe', 'click', function() {
        shipping.loadReview();
        var payment_methods = $('ajax-payment-methods');
        //payment_methods.update('<div class="ajax-load">&nbsp;</div>');
        payment.reloadPaymentBlock();
//      reloadPaymethod();
    });

</script>