Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

XCart 5 - Enable/Disable Shipping & Payment Methods Based On Country Selected

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 01-26-2016, 08:13 PM
  aneel13's Avatar 
aneel13 aneel13 is offline
 

Senior Member
  
Join Date: Jul 2015
Location: Dubai
Posts: 148
 

Default XCart 5 - Enable/Disable Shipping & Payment Methods Based On Country Selected

I want to decide at run time during country selection, to show only my shipping method for limited countries and disable rest of the shipping methods, even if they are suppose to be shown for countries conflicting with my plugin.

E.g. My plugin is enabled for USA, GBR. Then in that case only my shipping and payment methods should be shown for those countries and rest of all the shipping and payment methods should be disabled. Please let me know how to go about it
__________________
Regards,
Aneel Sarwar
X-Cart version: 5.2.10
Windows: 7
Modules: Free version modules
Reply With Quote
  #2  
Old 01-27-2016, 05:14 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: XCart 5 - Enable/Disable Shipping & Payment Methods Based On Country Selected

Without testing, just taking a glance at the code, it looks like the template is default/en/shipping_list.tpl

In that template I see {foreach:getRates(),rate}

I believe I see this getRates() method defined in XLite\View\ShippingList.php

There may be a more elegant solution, but my starting point would be to attempt to expand the logic of this getRates() method. Right now it is a simple return, we could start modifying it like this (psuedocode warning):

Code:
protected function getRates() { $rates = $this->getModifier()->getRates(); $modified_rates = array(); foreach ($rates as $rate) { if ($rate *meets condition*) { $modified_rates[] = $rate; } } return $modified_rates; }

Again, this is just a quick look, not sure if these files or methods are even related to your task!

-Mike
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:59 PM.

   

 
X-Cart forums © 2001-2020