ttoomey Posted June 2, 2004 Share Posted June 2, 2004 I'm try to make it so that when a user selects one item in the shopping cart for removal and clicks the update button, another item will also be deleted. I narrowed the code down to this part of application_top.php: case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) { if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) { $cart->remove($HTTP_POST_VARS['products_id'][$i]); } else { if (PHP_VERSION < 4) { // if PHP3, make correction for lack of multidimensional array. reset($HTTP_POST_VARS); while (list($key, $value) = each($HTTP_POST_VARS)) { if (is_array($value)) { while (list($key2, $value2) = each($value)) { if (ereg ("(.*)\]\[(.*)", $key2, $var)) { $id2[$var[1]][$var[2]] = $value2; } } } } $attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : ''; } else { $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : ''; } $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; I added this code if (($HTTP_POST_VARS['products_id']['150']) && (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array())) { $cart->remove($HTTP_POST_VARS['products_id']['165']); } just above the cart->remove line, yet it doesn't delete the other product it only deletes the selected product. Is there another way to make multiple products delete from the shopping_cart.php by just clicking on one of the remove checkboxes? Assault If you want to find it you'll have to google "Assault T-Shirts" because posting my damn url in my signature is against the forum rules. T-Shirts with an edge Powered by OSCommerce + about 20 different custom addons and some Wordpress Link to comment Share on other sites More sharing options...
ttoomey Posted June 3, 2004 Author Share Posted June 3, 2004 Does anyone know of a way to do this so that by checking one product in the cart will delete another? Assault If you want to find it you'll have to google "Assault T-Shirts" because posting my damn url in my signature is against the forum rules. T-Shirts with an edge Powered by OSCommerce + about 20 different custom addons and some Wordpress Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.