TransWikia.com

billing.save(); shipping.save(); functions override in Magento

Magento Asked by Mohamed Badawy on November 8, 2021

I need to override billing.save(); & shipping.save(); functions but I don’t know in which files they have their declarations in Magento.

I am new in Magento directory.

Can you please help me?

One Answer

These prototype js objects use in checkout. They defines in skin/frontend/base/default/js/opcheckout.js file. and adds to resulting html in onepage.html file using script html tag:

<script type="text/javascript" src="<?php echo $this->getSkinUrl('js/opcheckout.js') ?>"></script>

To override save functions' logic you can add your own billing.phtml and shipping.phtml files in own theme and there add new logic for save method. For example to override billing.save() logic you need to add new javascript tag with following code : if ('Billing' in window){ Object.extend(Billing, { save: function(){ //put your changes here } }) }

or, also you can just override any function after object will be created, example put this code after var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');:

billing.save = function() {
    //your code here
}

Answered by Ihor Shapoval on November 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP