Кнопка Magento 1.9 Продолжить не переходит к следующему разделу на странице оформления заказа на странице


Я использую magento 1.9.3 пытаюсь добавить новые шаги после shipping method, вызванного DELIVERY INSTRUCTIONS, я ссылаюсь на эту ссылку [https://www.fontis.com.au/blog/adding-step-onepage-checkout].

Я сделал все то же самое в этой ссылке.

Но DELIVERY INSTRUCTIONS Кнопка Продолжить не переходит к шагу тритона. Показывает некоторую ошибку в консоли, как это

enter image description here

Это мой deliveryinstructions.phtml код

<form id="co-deliveryinstructions-form" action="">
    <div id="checkout-deliveryinstructions-load">
       <!-- Content loaded dynamically -->
    </div>
    <script type="text/javascript">
    //<![CDATA[
        var deliveryinstructionsMethod = new DeliveryinstructionsMethod('co-deliveryinstructions-form', "<?php echo $this->getUrl('checkout/onepage/saveDeliveryinstructionsMethod') ?>");
    //]]>
    </script>
    <div id="onepage-checkout-deliveryinstructions-additional-load">
        <?php echo $this->getChildHtml('additional') ?>
    </div>
    <div class="buttons-set" id="deliveryinstructions-buttons-container">
        <p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
        <button type="button" class="button" onclick="deliveryinstructionsMethod.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
        <span id="deliveryinstructions-please-wait" class="please-wait" style="display:none;">
            <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo Mage::helper('core')->quoteEscape($this->__('Loading next step...')) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Loading next step...')) ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
        </span>
    </div>
</form>

И мои вторые вопросы

Добавить заголовок прогресса в YOUR CHECKOUT PROGRESS

enter image description here

Skin\frontend\base\default\js\opcheckout.js

setShippingMethod: function() {
        //this.nextStep();
        this.gotoSection('deliveryinstructions', true);
        //this.accordion.openNextSection(true);
    },

    //code added
    setDeliveryinstructions: function() {
        //this.nextStep();
        this.gotoSection('payment', true);
        //this.accordion.openNextSection(true);
    },
    //code added

Как я могу исправить эти две ошибки...?

Заранее благодарю

Author: Ramesh S, 2017-07-29

1 answers

Наконец-то я получил ответ на 1-й вопрос. Но я хочу добавить вкладку YOUR CHECKOUT PROGRESS. Ответ на 1-й вопрос - добавить новую функцию в skin\frontend\base\default\js\opcheckout.js

После shipping method строки no - 550 to 600 добавьте следующий код

var DeliveryinstructionsMethod = Class.create();
DeliveryinstructionsMethod.prototype = {
    initialize: function(form, saveUrl){
        this.form = form;
        if ($(this.form)) {
            $(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
        }
        this.saveUrl = saveUrl;
        this.validator = new Validation(this.form);
        this.onSave = this.nextStep.bindAsEventListener(this);
        this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
    },

    validate: function() {
        var methods = document.getElementsByName('deliveryinstructions');
        if (methods.length==0) {
            alert(Translator.translate('Your order cannot be completed at this time as there is no shipping methods available for it. Please make necessary changes in your shipping address.').stripTags());
            return false;
        }

        if(!this.validator.validate()) {
            return false;
        }

        for (var i=0; i<methods.length; i++) {
            if (methods[i].checked) {
                return true;
            }
        }
        alert(Translator.translate('Please specify shipping method.').stripTags());
        return false;
    },

    save: function(){

        if (checkout.loadWaiting!=false) return;
        if (this.validate()) {
            checkout.setLoadWaiting('shipping-method');
            new Ajax.Request(
                this.saveUrl,
                {
                    method:'post',
                    onComplete: this.onComplete,
                    onSuccess: this.onSave,
                    onFailure: checkout.ajaxFailure.bind(checkout),
                    parameters: Form.serialize(this.form)
                }
            );
        }
    },

    resetLoadWaiting: function(transport){
        checkout.setLoadWaiting(false);
    },

    nextStep: function(transport){
        var response = transport.responseJSON || transport.responseText.evalJSON(true) || {};

        if (response.error) {
            alert(response.message.stripTags().toString());
            return false;
        }

        if (response.update_section) {
            $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
        }

        payment.initWhatIsCvvListeners();

        if (response.goto_section) {
            checkout.gotoSection(response.goto_section, true);
            checkout.reloadProgressBlock();
            return;
        }

        if (response.payment_methods_html) {
            $('checkout-payment-method-load').update(response.payment_methods_html);
        }

        checkout.setShippingMethod();
    }
};

И deliveryinstructions.phtml

<form id="co-deliveryinstructions-form" action="">
    <div id="checkout-deliveryinstructions-load">
       <!-- Content loaded dynamically -->
    </div>
    <script type="text/javascript">
    //<![CDATA[
        var deliveryinstructionsMethod = new DeliveryinstructionsMethod('co-deliveryinstructions-form', "<?php echo $this->getUrl('checkout/onepage/saveDeliveryinstructions') ?>");
    //]]>
    </script>
    <div id="onepage-checkout-deliveryinstructions-additional-load">
        <?php echo $this->getChildHtml('additional') ?>
    </div>
    <div class="buttons-set" id="deliveryinstructions-buttons-container">
        <p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
        <button type="button" class="button" onclick="deliveryinstructionsMethod.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
        <span id="deliveryinstructions-please-wait" class="please-wait" style="display:none;">
            <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo Mage::helper('core')->quoteEscape($this->__('Loading next step...')) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Loading next step...')) ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
        </span>
    </div>
</form>
 1
Author: Ramesh S, 2017-08-01 12:48:07