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

XC4.3.2 Mod use different shipping methods for a country that belong to several zones

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 06-30-2011, 09:09 AM
 
man0n man0n is offline
 

Member
  
Join Date: Nov 2006
Posts: 24
 

Post XC4.3.2 Mod use different shipping methods for a country that belong to several zones

When your courier offers you different services to send to same country,
you will need to define different zones for the same country and create different shipping rates for the different zones.

By example if UPS Express saver service (by plane) the zone for Germany have zone 6
and UPS Standard (by road) the zone for Germany is zone 5.
THe logic of Xcart will be to list the shipping method of the first zone it found.
This mod will list all available shipping method of the zones that belong to the destination country.


At file shipping/shipping.php line 415 after foreach ($product_providers as $provider) {
sustitute apropiate lines by this:
Code:
414 foreach ($product_providers as $provider) { 415 // man0n customization 416 $provider_condition = " AND provider='$provider'"; 417 $customer_zones = func_get_customer_zone_ship2($customer_info, $provider, "D"); 418 $shipping = $shipping && func_query_first_cell(str_replace('{{weight}}', $weight_array[$provider],$shipping_query)." AND zoneid IN ('".implode("','", array_keys($customer_zones))."') ".$provider_condition);

At file include/func/func.cart.php line 73 after function func_get_customer_zone_ship add:
Code:
// man0n customization function func_get_customer_zone_ship2 ($username, $provider, $type) { global $sql_tbl; global $single_mode; $zones = func_get_customer_zones_avail($username, $provider, "S"); $zone = 0; # default zone if (is_array($zones)) { $provider_condition = ($single_mode) ? "" : " AND provider='".addslashes($provider)."'"; $tmp = func_query_column("SELECT zoneid FROM $sql_tbl[shipping_rates] WHERE zoneid IN ('".implode("','", array_keys($zones))."') $provider_condition AND type='$type' GROUP BY zoneid"); if (is_array($tmp) && !empty($tmp)) { $unused = $zones; # remove not available zones foreach($tmp as $v) { if (isset($unused[intval($v)])) unset($unused[intval($v)]); } if (!empty($unused)) { foreach($unused as $k => $v) unset($zones[$k]); } reset($zones); // $zone = key($zones); #extract first zone } } return $zones; } function func_get_customer_zone_ship3 ($username, $provider, $type,$shippingid) { global $sql_tbl; global $single_mode; $zones = func_get_customer_zones_avail($username, $provider, "S"); $zone = 0; # default zone if (is_array($zones)) { $provider_condition = ($single_mode) ? "" : " AND provider='".addslashes($provider)."'"; $tmp = func_query_column("SELECT zoneid FROM $sql_tbl[shipping_rates] WHERE shippingid=$shippingid and zoneid IN ('".implode("','", array_keys($zones))."') $provider_condition AND type='$type' GROUP BY zoneid"); if (is_array($tmp) && !empty($tmp)) { $unused = $zones; # remove not available zones foreach($tmp as $v) { if (isset($unused[intval($v)])) unset($unused[intval($v)]); } if (!empty($unused)) { foreach($unused as $k => $v) unset($zones[$k]); } reset($zones); $zone = key($zones); #extract first zone } } return $zone; }

At line 1135
After
if (($shipping_type == "D") || ($shipping_type == "R" && $shipping_cost > 0)) {
sustitute:
Code:
$customer_zone = func_get_customer_zone_ship($customer_info, $provider, $shipping_type);
by:
Code:
// man0n customization $customer_zone = func_get_customer_zone_ship3($customer_info, $provider, $shipping_type,$shipping_id);


If you need help let me know.
__________________
Manuel G.
x-cart 4.3.2 PRO
cordobafactory.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not 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 10:40 AM.

   

 
X-Cart forums © 2001-2020