leelee2023 Posted December 20, 2009 Share Posted December 20, 2009 Hi everyone, I'm currently using a combination of Add quantity box to product info page and Shopping Cart as Tooltip. The first allows for more than 1 of each product to be added to the shopping cart, whilst the second is a popup confirming entry of item going into the cart. I've modified the second one to show more information of purely the item being added to the cart. I want Product Name, Quantity, Cost... but currently I've been only able to retrieve the name via the variable $product_info['products_name'].. but I can't find how to pass the other 2 variables into this script. The modified code for the quantity contrib is as below: application_top: // customer adds a product from the products page case 'add_product' : if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) { if (tep_has_product_attributes($_POST['products_id']) && PRODUCT_LIST_OPTIONS != 'true' && basename($PHP_SELF) != FILENAME_PRODUCT_INFO) tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_POST['products_id'])); $add_quantity = (isset($_POST['cart_quantity']) ? (int)$_POST['cart_quantity'] : 1); $cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $_POST['id']))+$add_quantity, $_POST['id']); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; product_info: <td class="main" align="right"><?php /// product quantity drop down $product_quantity = tep_get_products_stock($_GET['products_id']); if ($product_quantity > MAX_QTY_IN_CART) { $product_quantity = MAX_QTY_IN_CART ; } ; $products_quantity_array = array(); for ($i=1; $i<=$product_quantity; $i++) { $products_quantity_array[]=array('id' => $i, 'text' => $i); }; echo tep_draw_hidden_field('products_id', $product_info['products_id']) . TEXT_PRODUCT_QUANTITY . tep_draw_pull_down_menu('cart_quantity',$products_quantity_array,1) . ' ' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> <!-- product quantity drop down --> If anyone has any ideas, this would be most greatly appreciated!! Link to comment Share on other sites More sharing options...
leelee2023 Posted December 30, 2009 Author Share Posted December 30, 2009 I'm still struggling with this, so if anyone has any clues that would be most useful! Thanks :D Link to comment Share on other sites More sharing options...
germ Posted December 31, 2009 Share Posted December 31, 2009 I'm still struggling with this, so if anyone has any clues that would be most useful! Thanks :D As far as I know there are only two ways to pass variables from page to page. 1. Thru the URL string, like: http://yoursite.com/catalog/product_info.php?products_id=632 Doing it that way you can retrive it's value thru code like this: $your_variable = $HTTP_GET_VARS['products_id']; 2. Make it a session variable. Code similar to this: $your_variable = SOME_VALUE; if ( ! tep_session_is_registered('your_variable') ) { tep_session_register('your_variable'); } Then on the "other page" you just reference it with $your_variable Doing it thru the URL string can be "risky" with some things because people can manually type whatever they want into the browser address bar, or alter whatever is there. Keep that in mind. HTH :) If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.