wormington Posted July 4, 2008 Share Posted July 4, 2008 Hi I have tried asking the relative contribution threads to try and solve my problem on the osCommerce forum with no joy, so I'm trying here, here it is my problem- I've added the Attribute Qty Product Info contribution which allows you to have a table of attributes with a quantity box along with the Option Type Feature contribution which allows you to add a text box to the product_info page. The layout looks great but when products are added to the cart the text box entry is not added if I have the following in the product_info.php page (this posts the form) <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_mult')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0"> If I change the above to <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0"> the text box contents are added as an attribute to the cart but the quantity shows as 1 even if it's not, (the price shows correctly for the number of products ordered. As far as I can work out it's down to these bits of code in application_top.php, can anyone help me sort this out as I'm mystified. case 'add_mult' : if (is_array($HTTP_POST_VARS['a'])){ reset($HTTP_POST_VARS['quantity']); reset($HTTP_POST_VARS['a']); $x=0; if (is_array($HTTP_POST_VARS['a'])){ foreach(($HTTP_POST_VARS['a']) as $key => $value){ $c = array((int)$HTTP_POST_VARS['b'] => (int)$value); if (is_array($HTTP_POST_VARS['quantity'])){ $qty = (int)$HTTP_POST_VARS['quantity'][$x]; $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], ($c)))+($qty),($c)); $x++; } } } } else { 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']); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; and // customer adds a product from the products page 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']); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; You can have a look at http://www.deanforestfayre.co.uk/shop you will need to login to the store using test as the username and test as the password I have been going around in circles for days with this and it's the last thing I need to get sorted, I would really appreciate any help in this, thanks Link to comment https://forums.phpfreaks.com/topic/113209-combining-two-bits-of-code/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.