RAH Posted July 8, 2008 Share Posted July 8, 2008 Hi, I have 2 contributions installed for Oscommerce that affect the Product Info page, one creates a list of product attributes so that customers can add the quantities of each attribute required (different weights), this uses a add_mult function in the application_top.php file that comes with the contribution. The other contribution is used to create another product attribute that is a text box so the customer can 'write a note' about the product, this one is designed to use the default add_product function in application_top.php. My problem is that they use different means of parsing the product info contents and I don't know how to make both work together. Here is the function that came with the contribution that adds quantities of each attribute, this is found in the application_top.php file:- // BOF QUANTITY PRODUCT INFO // customer adds multiple products from the product_info page 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'][$x] => (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)); //$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], ($c)))+($qty),($c), $HTTP_POST_VARS['id']); $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; //EOF QUANTITY PRODUCT INFO This is the default add_product function found in application_top.php:- // 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'])) + $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['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 see this in action by going to www.deanforestfayre.co.uk/shop you will need to login with the username test and password test, if you go to a product, choose a quantity and add a message and add to the basket the message does not arrive, this is using the add_mult function at present, if I change it to use the add_product function the message arrives in the basket, and the price total is correct but the quantity is always set to 1. I need to combine the two functions. Any ideas? Thanks. Quote Link to comment Share on other sites More sharing options...
themistral Posted July 8, 2008 Share Posted July 8, 2008 Have you tried posting on the forums at the osCommerce site? http://forums.oscommerce.com/ Quote Link to comment Share on other sites More sharing options...
themistral Posted July 8, 2008 Share Posted July 8, 2008 Ok - I've been looking this over. Can you post the instructions for adding the case statement add_mult - it may help! Cheers! Quote Link to comment Share on other sites More sharing options...
RAH Posted July 9, 2008 Author Share Posted July 9, 2008 Hi, Does this help? Around Line 330 (adding the new case of action='add_mult'): Find: // 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'])) { Above this ADD: // customer adds multiple products from the product_info page 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'][$x] => (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; Quote Link to comment Share on other sites More sharing options...
themistral Posted July 10, 2008 Share Posted July 10, 2008 I think there may be an extra } in the code for the case "add_mult". That's the only thing I can think of... Any joy on the osCommerce forum? Quote Link to comment Share on other sites More sharing options...
RAH Posted July 11, 2008 Author Share Posted July 11, 2008 Where is the extra } - I can't see it. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.