Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to merge these two kinds of source codes?


tomliuwhite

Recommended Posts

Posted

In catalog\includes\application_top.php.

1. case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

/*

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

*/

//BOF price-break-1.11.2

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id'])) + $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']);

//EOF price-break-1.11.2

 

2. case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id']) && ($HTTP_POST_VARS['products_id']==(int)$HTTP_POST_VARS['products_id'])) {

//++++ QT Pro: Begin Changed code

$attributes=array();

if (isset($HTTP_POST_VARS['attrcomb']) && (preg_match("/^\d{1,10}-\d{1,10}(,\d{1,10}-\d{1,10})*$/",$HTTP_POST_VARS['attrcomb']))) {

$attrlist=explode(',',$HTTP_POST_VARS['attrcomb']);

foreach ($attrlist as $attr) {

list($oid, $oval)=explode('-',$attr);

if (is_numeric($oid) && $oid==(int)$oid && is_numeric($oval) && $oval==(int)$oval)

$attributes[$oid]=$oval;

}

}

if (isset($HTTP_POST_VARS['id']) && is_array($HTTP_POST_VARS['id'])) {

foreach ($HTTP_POST_VARS['id'] as $key=>$val) {

if (is_numeric($key) && $key==(int)$key && is_numeric($val) && $val==(int)$val)

$attributes=$attributes + $HTTP_POST_VARS['id'];

}

}

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $attributes))+1, $attributes);

//++++ QT Pro: End Changed Code

How to merge these two kinds of source codes? Many thanks in advance.

Archived

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

×
×
  • Create New...