Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Bug in Oscommerce 2.3.3 in calculation of the shipping costs with mixed products


Snoopy10

Recommended Posts

Posted

Hello Oscommerce developers,

 

I think I've found a bug in Oscommerce 2.3.

If you want to buy mixed products both virtual and real Produke, then with the shipping-method table.php the virtual products are added to the shipping costs. Only the shipping method item.php considers this.

 

This requires the payment method PayPal Express has to be adjusted.

 

Affected files:

catalog / checkout_shipping.php

catalog / mobile_checkout_shipping.php

catalog / ext / modules / payment / paypal / express.php

 

This code fixes the bug:

 

##################################################################

catalog/checkout_shipping.php and catalog/mobile_checkout_shipping.php

 

Find:

$total_count = $cart->count_contents();

 

Add below:

 

//BOF remove virtual products

$products = $cart->get_products();

for ($i=0, $n=sizeof($products); $i<$n; $i++)

{

 

if (isset($order->products[$i]['attributes'])) {

reset($order->products[$i]['attributes']);

while (list($option, $value) = each($order->products[$i]['attributes'])) {

$virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$order->products[$i]['id'] . "' and pa.options_values_id = '" . (int)$value['value_id'] . "' and pa.products_attributes_id = pad.products_attributes_id");

$virtual_check = tep_db_fetch_array($virtual_check_query);

 

if ($virtual_check['total'] > 0) {

$total_weight -= $products[$i]['weight']*$products[$i]['quantity'];

$total_count -= $products[$i]['quantity'];

}

}

}

 

}

 

//EOF remove virtual products

 

#####################################################################

catalog/ext/modules/payment/paypal/express.php

 

Find 3-times:

 

$total_count = $cart->count_contents();

 

add below:

 

//BOF remove virtual products

$products = $cart->get_products();

for ($i=0, $n=sizeof($products); $i<$n; $i++)

{

 

if (isset($order->products[$i]['attributes'])) {

reset($order->products[$i]['attributes']);

while (list($option, $value) = each($order->products[$i]['attributes'])) {

$virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$order->products[$i]['id'] . "' and pa.options_values_id = '" . (int)$value['value_id'] . "' and pa.products_attributes_id = pad.products_attributes_id");

$virtual_check = tep_db_fetch_array($virtual_check_query);

 

if ($virtual_check['total'] > 0) {

$total_weight -= $products[$i]['weight']*$products[$i]['quantity'];

$total_count -= $products[$i]['quantity'];

}

}

}

 

}

 

//EOF remove virtual products

 

Yours sincerely

 

Bernhard Bauer

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...