| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Where to place the common ajax functions for shipping module plugin | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
Where to place the common ajax functions for shipping module plugin
Where should I place my common ajax functions and can you please give me sample url on ajax calls?
I have got a new shipping methods but I don't know where should I place the ajax related functions specific to my plugin only?
__________________
Regards, Aneel Sarwar X-Cart version: 5.2.10 Windows: 7 Modules: Free version modules |
|||||||||
#2
|
|||||||||
|
|||||||||
Re: Where to place the common ajax functions for shipping module plugin
Please note the following sample ajax call code. I have to use autocomplete jquery library thatswhy I am doing it normal jQuery way instead of some conventional X-Cart way:
jQuery("document").ready(function(){ jQuery("#shippingaddress-city").autocomplete('test', { extraParams: { countrycode: function() { return jQuery("#shippingaddress-country-code").val();}, city: function() { return jQuery("#shippingaddress-city").val(); } }, minChars: 0, max: 200, multiple:false, scrollHeight: 220, autoFill: false, mustMatch: false, selectFirst:true, cacheLength:1 }); jQuery("#shippingaddress-zipcode").autocomplete('test', { extraParams: { countrycode: function() { return jQuery("#shippingaddress-country-code").val();}, zip: function() { return jQuery("#shippingaddress-zipcode").val(); } }, minChars: 0, max: 200, multiple:false, scrollHeight: 220, autoFill: false, mustMatch: false, selectFirst:false, cacheLength:1 }); });
__________________
Regards, Aneel Sarwar X-Cart version: 5.2.10 Windows: 7 Modules: Free version modules |
|||||||||
#3
|
|||||||||
|
|||||||||
Re: Where to place the common ajax functions for shipping module plugin
I think it may work if you add this js file to the list of js files loaded by the widget class.
However, it would be better if you could wrap it up into a "controller" and make XC5 autoload it - search for "core.autoload(" in other js files.
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
#4
|
|||||||||
|
|||||||||
Re: Where to place the common ajax functions for shipping module plugin
Sorry for not explaining clearly. I gave the example of jquery because I wanted to insert some xcart specific url to the autocomplete jquery function. So I mean to say that what sort of url should it be. Any example url? And where should I place the php related function which is going to be processed because this url is called.
__________________
Regards, Aneel Sarwar X-Cart version: 5.2.10 Windows: 7 Modules: Free version modules |
|||||||||
#5
|
|||||||||
|
|||||||||
Re: Where to place the common ajax functions for shipping module plugin
It can be any URL pointing to a valid controller class. It's the controller and the view classes that should implement the AJAX logic.
If you need json response, use the WidgetsCollection controller as the example. If you need html response (I believe so), check how the checkout controller reloads page sections.
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
#6
|
|||||||||
|
|||||||||
Re: Where to place the common ajax functions for shipping module plugin
Can you please give me some sample url of how it should be for the controller function or some documentation link which is giving an example of how to write the controller for a new plugin/shipping method?
__________________
Regards, Aneel Sarwar X-Cart version: 5.2.10 Windows: 7 Modules: Free version modules |
|||||||||
#7
|
|||||||||
|
|||||||||
Re: Where to place the common ajax functions for shipping module plugin
Hello!
Please use the documentation at http://kb.x-cart.com/ for reference. The article on creating a new controller is here: http://kb.x-cart.com/display/XDD/Creating+new+page
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
#8
|
|||||||||
|
|||||||||
Re: Where to place the common ajax functions for shipping module plugin
Thanks! Got it working with the controller functions
__________________
Regards, Aneel Sarwar X-Cart version: 5.2.10 Windows: 7 Modules: Free version modules |
|||||||||
|
|||
X-Cart forums © 2001-2020
|