This is a discussion on Individual Product Shipping Prices - v1.0 within the New osCommerce Contributions forums, part of the osCommerce 2.2 Forums category; if no products exists in the shopping-box and if then the user like to pop-up the shipping-cost ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| ||||
| ||||
| if no products exists in the shopping-box and if then the user like to pop-up the shipping-cost information - an sql-error are displayed. I corrected the code so that the individual shipping methods (defined within the product) only displayed if the box is not empty. ============================= backup backup backup backup backup ============================= catalog/includes/classes/shipping.php --------------------------------------- Find (around row 20-58): // INDIV_SM BEGIN (this is messy i know) global $cart; // New to fix attributes bug $cart_products = $cart->get_products(); $real_ids = array(); foreach($cart_products as $prod){ $real_ids[] = tep_get_prid($prod['id']); } $sql = "SELECT shipping_methods FROM ".TABLE_PRODUCTS." WHERE products_id IN (".implode(',',$real_ids).") AND shipping_methods IS NOT NULL AND shipping_methods ''"; $query = mysql_query($sql); // End new bug fix $allow_mod_array = array(); while($rec = mysql_fetch_array($query)){ if(empty($allow_mod_array)) $startedempty = true; $methods_array = array(); $methods_array = explode(';',$rec['shipping_methods']); if(!empty($methods_array)){ foreach($methods_array as $method){ $allow_mod_array[] = $method; } } if($startedempty){ $startedempty = false; }else{ $temp_array = array(); foreach($allow_mod_array as $val){ $temp_array[$val]++; } $allow_mod_array = array(); foreach($temp_array as $key => $val){ if($val > 1){ $allow_mod_array[] = $key; } } } } // INDIV_SM END and replaced it with: // INDIV_SM BEGIN (this is messy i know) global $cart; // New to fix attributes bug $cart_products = $cart->get_products(); if (tep_not_null($cart_products)) { $real_ids = array(); foreach($cart_products as $prod){ $real_ids[] = tep_get_prid($prod['id']); } $sql = "SELECT shipping_methods FROM ".TABLE_PRODUCTS." WHERE products_id IN (".implode(',',$real_ids).") AND shipping_methods IS NOT NULL AND shipping_methods ''"; $query = mysql_query($sql); // End new bug fix $allow_mod_array = array(); while($rec = mysql_fetch_array($query)){ if(empty($allow_mod_array)) $startedempty = true; $methods_array = array(); $methods_array = explode(';',$rec['shipping_methods']); if(!empty($methods_array)){ foreach($methods_array as $method){ $allow_mod_array[] = $method; } } if($startedempty){ $startedempty = false; }else{ $temp_array = array(); foreach($allow_mod_array as $val){ $temp_array[$val]++; } $allow_mod_array = array(); foreach($temp_array as $key => $val){ if($val > 1){ $allow_mod_array[] = $key; } } } } } // INDIV_SM END second change (around row 63-73): Find: // INDIV_SM START $temp_array = $this->modules; $this->modules = array(); foreach($temp_array as $val){ if(mysql_num_rows($query)==0 || in_array(str_replace('.php','',$val),$allow_mod_ar ray)) { $this->modules[] = $val; } } // INDIV_SM END and replace it with: // INDIV_SM START if (tep_not_null($cart_products)) { $temp_array = $this->modules; $this->modules = array(); foreach($temp_array as $val){ if(mysql_num_rows($query)==0 || in_array(str_replace('.php','',$val),$allow_mod_ar ray)) { $this->modules[] = $val; } } } // INDIV_SM END Thats all. Hope this solve it for everyone, within my shop it works. ;-)) I've attached my shipping.php -- use winmerge or other tools to compare it with your own version! I've installed some other contribution that changed this file. kind regards peter More...
__________________ Michael Sasek osCMax Developer osCMax Templates - Hundreds of premium quality templates. New designs every month! xShop for osCMax - Windows Based osCMax administration. Improved workflow, security, speed and convenience osCMax Hosting - From basic hosting to High Availability, Load Balanced arrays, the most experienced osCMax host. |
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Individual Product Shipping Prices - v1.0 | michael_s | New osCommerce Contributions | 0 | 02-13-2007 02:11 PM |
| Individual Product Shipping Prices - v1.0 | michael_s | New osCommerce Contributions | 0 | 02-13-2007 10:00 AM |
| Individual Product Shipping Methods | michael_s | New osCommerce Contributions | 0 | 01-20-2007 09:10 PM |
| Individual product shipping? | countingsheep | osCMax v2 Features Discussion | 0 | 05-18-2006 01:43 PM |
| Shipping Options/Individual Shipping | Anonymous | osCMax v1.7 Discussion | 0 | 04-01-2004 02:10 PM |