| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Different Checkout Fields On Change Country Event | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
Different Checkout Fields On Change Country Event
I am looking into developing a new shipping module. But I am stucked in 2 initial areas of its developments:
1) I want the checkout fields (billing/shipping) change based on country selected. And the criteria for each country I am going to get from a service/API which will include which fields to show/hide and which fields are required/non-required. Meaning this has to be achieved in a way that as soon as the country changes, the service/API is called and based on its response the checkout fields against that country are shown in the checkout page along with a different validation rules. Please help me out, that how it could be achieved in X-Cart? 2) Another issue is that I want to keep the shipping/payment/review section hidden until the shipping/billing address fields are completely validated against my service/API. So what I am looking for is adding a next/continue button just below the checkout fields and only if the address is successfully validated against my service then only showing the right area which includes the shipping/payment/review section. The thing is I can't get the shipping charges for my shipping module until I validate my address fields against the service/API thatswhy, I am planning to keep it hidden until some charges are populated. Please let me know how this can be achieved aswell? Regards, Aneel
__________________
Regards, Aneel Sarwar X-Cart version: 5.2.10 Windows: 7 Modules: Free version modules |
|||||||||
#2
|
|||||||||
|
|||||||||
Shipping Rates/Charges area dependent on user address
I want the shipping method to become visible only after I have validated the checkout address through some service/API and show some message like 'shipping address not validated' until the address is not validated to calculate rates.
Problem is that even with all shipping methods disabled from admin side, its still showing one shipping module active in front-end, don't know why. I want to see the X-Cart default state when all shipping methods are disabled.
__________________
Regards, Aneel Sarwar X-Cart version: 5.2.10 Windows: 7 Modules: Free version modules |
|||||||||
#3
|
|||||||||
|
|||||||||
Re: Shipping Rates/Charges area dependent on user address
Actually when all shipping methods are disabled, you should be seeing the message stating "Shipping methods are not available" on the checkout page. I attached a screenshot from my fresh XC 5.2.5 installation.
Which exactly shipping methods do you see in the customer front-end? Thank you.
__________________
Best regards, Igor Pudovkin X-Cart hosting team |
|||||||||
|
#4
|
|||||||||
|
|||||||||
Re: Different Checkout Fields On Change Country Event
Yes I got that issue fixed when all shipping methods are disabled. Someone please help me out with the two issues posted in my first post. Those are the major hurdles preventing me to proceed with the plugin development.
__________________
Regards, Aneel Sarwar X-Cart version: 5.2.10 Windows: 7 Modules: Free version modules |
|||||||||
#5
|
|||||||||
|
|||||||||
Re: Different Checkout Fields On Change Country Event
Hello Aneel,
You can do both the points through a custom module only. X-Cart 5 has no such settings/services that you need. Quote:
The checkout page is made of separate widgets and it is possible to trigger an AJAX widget reload through JavaScript. So, you may use the same technique that is used to reload the widget with shipping methods upon changing address fields. I'm not sure if I can name you exact files as there are many files used in that process. Quote:
You may do this by assigning a CSS class to the container HTML tag and adding CSS that hides the sections if the container doesn't have the class. Or you can go deeper and do the changes on the template level. The base widget that renders the checkout pane is \XLite\View\Checkout
__________________
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: Different Checkout Fields On Change Country Event
Thanks for the response. Still its not clear how to go about. Let me give details on the problem again.
1) If I change country on checkout page, then an ajax call happens which first runs the service/API and gets the response and after the service response the fields needs to be changed on the frontend (e.g. for US no postal field, for UK no city field etc.). Meaning should I change the HTML at frontend accordingly as soon as I get the service response? But then the problem is the backend validation rules will apply differently, I need to change them aswell when place order is clicked. So what to call after my service response? Should I call some xcart function to update the fields which will automatically update the frontend html and backend validation rules? 2) I will make a separate ticket on the second issue. Because first one is dependent on it.
__________________
Regards, Aneel Sarwar X-Cart version: 5.2.10 Windows: 7 Modules: Free version modules |
|||||||||
#7
|
|||||||||
|
|||||||||
Re: Different Checkout Fields On Change Country Event
This is a complex modification and I'm not sure if I can explain it in a few words here in forums.
X-Cart reloads the HTML code from the server, so you don't need to manipulate the HTML code directly. Instead, you should customize the PHP classes that render the widgets. Use developer tools built-into your browser to see what AJAX requests are sent to reload the widgets - the requests look like the following one: http://xcart/xc5/src/cart.php?target=checkout&action=&widget=%5CXLite%5 CView%5CCheckout%5CShippingMethod...43806902 9519
__________________
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: Different Checkout Fields On Change Country Event
Thanks. Do you mean to say that each of the widgets are loaded one by one through the server and I shouldn't manipulate the html directly but instead go for making changes to PHP classes and refreshing the widget by calling them through an additional ajax call?
The screen shot which you had attached is not available. Can you please attach that again. Atleast now I feel more confident on which is the correct way of going about this task Can you also let me know which widget is responsible for refreshing the first part of checkout which is the shipping address fields?
__________________
Regards, Aneel Sarwar X-Cart version: 5.2.10 Windows: 7 Modules: Free version modules |
|||||||||
#9
|
|||||||||
|
|||||||||
Re: Different Checkout Fields On Change Country Event
One more thing, if I am developing a new shipping module which is expected to perform the actions which I had previously stated. Then which areas of the xcart package can I touch so that when I export my plugin it has all the changes which are made by me.
Obviously I don't want to touch the core files, I believe it would be something like extending the core files in my plugin if I am not wrong.
__________________
Regards, Aneel Sarwar X-Cart version: 5.2.10 Windows: 7 Modules: Free version modules |
|||||||||
#10
|
|||||||||
|
|||||||||
Re: Different Checkout Fields On Change Country Event
Quote:
Yes, this is how the checkout page works now - PHP is the part that renders the HTML, JavaScript just loads the updated HTML form the server and replaces it in the browser. Quote:
It is not a screenshot It is a sample link for such a request - how it looks on my local server. Quote:
The widget that renders the first column with the address is this one: \XLite\View\Checkout\ShippingAddress Quote:
Yes, you should not change core files. But you can use the ability to "decorate" them instead. Please search for "IDecorator" at http://kb.x-cart.com/ for articles on this matter.
__________________
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 |
|||||||||
|
|
|||
X-Cart forums © 2001-2020
|