I want to override js function on shipping method sectionoverride USPS shipping method namePayment Javascript Class - Override nextStep methodExclude a specific categoryAutomatically select shipping method in Admin OrderVarien's product.js method override is not workinghow to override available.phtml file of shipping methodCustom Payment Method Error - Call to a member function getMethodInstance() on a non-objectCheckout/Onepage Redirect to Cart PageWhich event to observe for building Magento Extension for fraud detection ?Trigger function on close in window.js Magento 1.9

Exception propagation: When to catch exceptions?

When quoting someone, is it proper to change "gotta" to "got to" without modifying the rest of the quote?

How to make a language evolve quickly?

No such column 'DeveloperName' on entity 'RecordType' after Summer '19 release on sandbox

How to select certain lines (n, n+4, n+8, n+12...) from the file?

spatiotemporal regression

is it permitted to swallow spit on a fast day?

What's the "magic similar to the Knock spell" referenced in the Dungeon of the Mad Mage adventure?

Intersecting with the x-axis / intersecting the x-axis

Translation of the latin word 'sit' in Thomas Aquinas' works

Renting a house to a graduate student in my department

What food production methods would allow a metropolis like New York to become self sufficient

How are one-time password generators like Google Authenticator different from having two passwords?

Is it nonsense to say B -> [A -> B]?

Was Mohammed the most popular first name for boys born in Berlin in 2018?

What is the name of meteoroids which hit Moon, Mars, or pretty much anything that isn’t the Earth?

date -d 'previous Monday" to display the preceding Monday

What is wrong with my code? RGB potentiometer

Why should password hash verification be time constant?

How can I avoid subordinates and coworkers leaving work until the last minute, then having no time for revisions?

Can 'sudo apt-get remove [write]' destroy my Ubuntu?

Why use steam instead of just hot air?

How to evaluate sum with one million summands?

Which other programming languages apart from Python and predecessor are out there using indentation to define code blocks?



I want to override js function on shipping method section


override USPS shipping method namePayment Javascript Class - Override nextStep methodExclude a specific categoryAutomatically select shipping method in Admin OrderVarien's product.js method override is not workinghow to override available.phtml file of shipping methodCustom Payment Method Error - Call to a member function getMethodInstance() on a non-objectCheckout/Onepage Redirect to Cart PageWhich event to observe for building Magento Extension for fraud detection ?Trigger function on close in window.js Magento 1.9






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I want to override js function on shipping method section :
i checked on inspect Element below is the function is calling on click on continue
button Can you please help me to find out where i can get that function



onclick="shippingMethod.save()




<checkout_onepage_index>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/custom.js</name></action>
</reference>
</checkout_onepage_index>


path : skinfrontendpackagethemejscustom.js



// shipping method
var ShippingMethod = Class.create();
ShippingMethod.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('shipping_method');
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()
alert('tttttttttttttttttttt');
if (checkout.loadWaiting!=false) return;
if (this.validate())
checkout.setLoadWaiting('shipping-method');
var request = 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)
if (transport && transport.responseText)
try
response = eval('(' + transport.responseText + ')');

catch (e)
response = ;



if (response.error)
alert(response.message);
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();




Can you please help me to find out the exact location & file name










share|improve this question
























  • The function is defined at skinfrontendbasedefaultjsopcheckout.js around line 624. Here shippingMethod is class and save() is the function.

    – Jaimin Sutariya
    Jul 24 '17 at 8:00











  • can you please paste the code here of what you are referring line no 624

    – magento12345
    Jul 24 '17 at 8:04











  • I have added the code which you want to change in the answer below. Please check.

    – Jaimin Sutariya
    Jul 24 '17 at 8:13

















2















I want to override js function on shipping method section :
i checked on inspect Element below is the function is calling on click on continue
button Can you please help me to find out where i can get that function



onclick="shippingMethod.save()




<checkout_onepage_index>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/custom.js</name></action>
</reference>
</checkout_onepage_index>


path : skinfrontendpackagethemejscustom.js



// shipping method
var ShippingMethod = Class.create();
ShippingMethod.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('shipping_method');
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()
alert('tttttttttttttttttttt');
if (checkout.loadWaiting!=false) return;
if (this.validate())
checkout.setLoadWaiting('shipping-method');
var request = 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)
if (transport && transport.responseText)
try
response = eval('(' + transport.responseText + ')');

catch (e)
response = ;



if (response.error)
alert(response.message);
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();




Can you please help me to find out the exact location & file name










share|improve this question
























  • The function is defined at skinfrontendbasedefaultjsopcheckout.js around line 624. Here shippingMethod is class and save() is the function.

    – Jaimin Sutariya
    Jul 24 '17 at 8:00











  • can you please paste the code here of what you are referring line no 624

    – magento12345
    Jul 24 '17 at 8:04











  • I have added the code which you want to change in the answer below. Please check.

    – Jaimin Sutariya
    Jul 24 '17 at 8:13













2












2








2


2






I want to override js function on shipping method section :
i checked on inspect Element below is the function is calling on click on continue
button Can you please help me to find out where i can get that function



onclick="shippingMethod.save()




<checkout_onepage_index>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/custom.js</name></action>
</reference>
</checkout_onepage_index>


path : skinfrontendpackagethemejscustom.js



// shipping method
var ShippingMethod = Class.create();
ShippingMethod.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('shipping_method');
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()
alert('tttttttttttttttttttt');
if (checkout.loadWaiting!=false) return;
if (this.validate())
checkout.setLoadWaiting('shipping-method');
var request = 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)
if (transport && transport.responseText)
try
response = eval('(' + transport.responseText + ')');

catch (e)
response = ;



if (response.error)
alert(response.message);
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();




Can you please help me to find out the exact location & file name










share|improve this question
















I want to override js function on shipping method section :
i checked on inspect Element below is the function is calling on click on continue
button Can you please help me to find out where i can get that function



onclick="shippingMethod.save()




<checkout_onepage_index>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/custom.js</name></action>
</reference>
</checkout_onepage_index>


path : skinfrontendpackagethemejscustom.js



// shipping method
var ShippingMethod = Class.create();
ShippingMethod.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('shipping_method');
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()
alert('tttttttttttttttttttt');
if (checkout.loadWaiting!=false) return;
if (this.validate())
checkout.setLoadWaiting('shipping-method');
var request = 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)
if (transport && transport.responseText)
try
response = eval('(' + transport.responseText + ')');

catch (e)
response = ;



if (response.error)
alert(response.message);
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();




Can you please help me to find out the exact location & file name







magento-1.9 prototype-js






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 24 '17 at 8:47







magento12345

















asked Jul 24 '17 at 7:53









magento12345magento12345

171217




171217












  • The function is defined at skinfrontendbasedefaultjsopcheckout.js around line 624. Here shippingMethod is class and save() is the function.

    – Jaimin Sutariya
    Jul 24 '17 at 8:00











  • can you please paste the code here of what you are referring line no 624

    – magento12345
    Jul 24 '17 at 8:04











  • I have added the code which you want to change in the answer below. Please check.

    – Jaimin Sutariya
    Jul 24 '17 at 8:13

















  • The function is defined at skinfrontendbasedefaultjsopcheckout.js around line 624. Here shippingMethod is class and save() is the function.

    – Jaimin Sutariya
    Jul 24 '17 at 8:00











  • can you please paste the code here of what you are referring line no 624

    – magento12345
    Jul 24 '17 at 8:04











  • I have added the code which you want to change in the answer below. Please check.

    – Jaimin Sutariya
    Jul 24 '17 at 8:13
















The function is defined at skinfrontendbasedefaultjsopcheckout.js around line 624. Here shippingMethod is class and save() is the function.

– Jaimin Sutariya
Jul 24 '17 at 8:00





The function is defined at skinfrontendbasedefaultjsopcheckout.js around line 624. Here shippingMethod is class and save() is the function.

– Jaimin Sutariya
Jul 24 '17 at 8:00













can you please paste the code here of what you are referring line no 624

– magento12345
Jul 24 '17 at 8:04





can you please paste the code here of what you are referring line no 624

– magento12345
Jul 24 '17 at 8:04













I have added the code which you want to change in the answer below. Please check.

– Jaimin Sutariya
Jul 24 '17 at 8:13





I have added the code which you want to change in the answer below. Please check.

– Jaimin Sutariya
Jul 24 '17 at 8:13










2 Answers
2






active

oldest

votes


















0














shippingMethod is created in app/design/frontend/base/default/template/checkout/onepage/shipping_method.phtml



class ShippingMethid is in skin/frontend/base/default/js/opcheckout.js
somewhere at 591 line.



And this is how you can override JS methods:
https://stackoverflow.com/questions/13379034/how-to-override-product-js-file-in-magento



This also works: https://stackoverflow.com/questions/11941257/overriding-extending-the-magento-core-javascript-files






share|improve this answer























  • can you please paste the code here of what you are referring line no 591

    – magento12345
    Jul 24 '17 at 8:04











  • i followed the above steps but its not override the function in my custom .js

    – magento12345
    Jul 24 '17 at 9:12












  • how you have done that?

    – Konrad Siamro
    Jul 25 '17 at 10:30


















0














skin/frontend/package/theme/js/opcheckout.js //shipping method






share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f186100%2fi-want-to-override-js-function-on-shipping-method-section%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    shippingMethod is created in app/design/frontend/base/default/template/checkout/onepage/shipping_method.phtml



    class ShippingMethid is in skin/frontend/base/default/js/opcheckout.js
    somewhere at 591 line.



    And this is how you can override JS methods:
    https://stackoverflow.com/questions/13379034/how-to-override-product-js-file-in-magento



    This also works: https://stackoverflow.com/questions/11941257/overriding-extending-the-magento-core-javascript-files






    share|improve this answer























    • can you please paste the code here of what you are referring line no 591

      – magento12345
      Jul 24 '17 at 8:04











    • i followed the above steps but its not override the function in my custom .js

      – magento12345
      Jul 24 '17 at 9:12












    • how you have done that?

      – Konrad Siamro
      Jul 25 '17 at 10:30















    0














    shippingMethod is created in app/design/frontend/base/default/template/checkout/onepage/shipping_method.phtml



    class ShippingMethid is in skin/frontend/base/default/js/opcheckout.js
    somewhere at 591 line.



    And this is how you can override JS methods:
    https://stackoverflow.com/questions/13379034/how-to-override-product-js-file-in-magento



    This also works: https://stackoverflow.com/questions/11941257/overriding-extending-the-magento-core-javascript-files






    share|improve this answer























    • can you please paste the code here of what you are referring line no 591

      – magento12345
      Jul 24 '17 at 8:04











    • i followed the above steps but its not override the function in my custom .js

      – magento12345
      Jul 24 '17 at 9:12












    • how you have done that?

      – Konrad Siamro
      Jul 25 '17 at 10:30













    0












    0








    0







    shippingMethod is created in app/design/frontend/base/default/template/checkout/onepage/shipping_method.phtml



    class ShippingMethid is in skin/frontend/base/default/js/opcheckout.js
    somewhere at 591 line.



    And this is how you can override JS methods:
    https://stackoverflow.com/questions/13379034/how-to-override-product-js-file-in-magento



    This also works: https://stackoverflow.com/questions/11941257/overriding-extending-the-magento-core-javascript-files






    share|improve this answer













    shippingMethod is created in app/design/frontend/base/default/template/checkout/onepage/shipping_method.phtml



    class ShippingMethid is in skin/frontend/base/default/js/opcheckout.js
    somewhere at 591 line.



    And this is how you can override JS methods:
    https://stackoverflow.com/questions/13379034/how-to-override-product-js-file-in-magento



    This also works: https://stackoverflow.com/questions/11941257/overriding-extending-the-magento-core-javascript-files







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jul 24 '17 at 8:00









    Konrad SiamroKonrad Siamro

    946624




    946624












    • can you please paste the code here of what you are referring line no 591

      – magento12345
      Jul 24 '17 at 8:04











    • i followed the above steps but its not override the function in my custom .js

      – magento12345
      Jul 24 '17 at 9:12












    • how you have done that?

      – Konrad Siamro
      Jul 25 '17 at 10:30

















    • can you please paste the code here of what you are referring line no 591

      – magento12345
      Jul 24 '17 at 8:04











    • i followed the above steps but its not override the function in my custom .js

      – magento12345
      Jul 24 '17 at 9:12












    • how you have done that?

      – Konrad Siamro
      Jul 25 '17 at 10:30
















    can you please paste the code here of what you are referring line no 591

    – magento12345
    Jul 24 '17 at 8:04





    can you please paste the code here of what you are referring line no 591

    – magento12345
    Jul 24 '17 at 8:04













    i followed the above steps but its not override the function in my custom .js

    – magento12345
    Jul 24 '17 at 9:12






    i followed the above steps but its not override the function in my custom .js

    – magento12345
    Jul 24 '17 at 9:12














    how you have done that?

    – Konrad Siamro
    Jul 25 '17 at 10:30





    how you have done that?

    – Konrad Siamro
    Jul 25 '17 at 10:30













    0














    skin/frontend/package/theme/js/opcheckout.js //shipping method






    share|improve this answer



























      0














      skin/frontend/package/theme/js/opcheckout.js //shipping method






      share|improve this answer

























        0












        0








        0







        skin/frontend/package/theme/js/opcheckout.js //shipping method






        share|improve this answer













        skin/frontend/package/theme/js/opcheckout.js //shipping method







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jul 24 '17 at 8:02









        PЯINCƏPЯINCƏ

        8,55431147




        8,55431147



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f186100%2fi-want-to-override-js-function-on-shipping-method-section%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form