osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

Individual Product Shipping Prices - v1.0

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 ...


Go Back   osCommerce and osCMax shopping cart software forums > osCommerce 2.2 Forums > New osCommerce Contributions

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 02-23-2007, 05:13 PM
michael_s's Avatar
osCMax Developer

 
Join Date: Jul 2002
Location: Phoenix, AZ
Posts: 9,557
Thanks: 65
Thanked 278 Times in 264 Posts
Rep Power: 10
michael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond repute
Post Individual Product Shipping Prices - v1.0

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.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread



Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


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


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
Copyright 2008 osCMax