TeeCee-UK Posted August 26, 2005 Share Posted August 26, 2005 Hi, Is it possible to create an infobox which contains an add to cart button, that only appears when you are on product_info.php? I would have thought someone would have contributed such an infobox already but i can't seem to find one. Can anyone point me in the direction of how to accomplish this as I have limited knowledge of php. Regards Tom Link to comment Share on other sites More sharing options...
Guest Posted August 26, 2005 Share Posted August 26, 2005 Just modify the add to cart one. In catalog\include\column_left.php (or column_right.php wherever the cart is in) replace the code like this: ?if (isset($HTTP_GET_VARS['products_id'])) ? ?require(DIR_WS_BOXES . 'shopping_cart.php'); What I do as others suggested was to show the cart box only if there is something in it so I use this: ?if ($cart->count_contents() > 0) { ? ?require(DIR_WS_BOXES . 'shopping_cart.php'); ?} Link to comment Share on other sites More sharing options...
TeeCee-UK Posted August 26, 2005 Author Share Posted August 26, 2005 Thanks for the help, I understand that this code will help me show the infobox when in product_info.php but the main problem I have is moving the "Add to cart" button from product_info.php to includes/boxes/shopping_cart.php and still retaining the functionality that allows it to add a product to the cart when clicked. At the moment I have just moved the following code: echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); What additional code do I need to move in order for the button to do something when it is clicked? Thank you again. Tom Link to comment Share on other sites More sharing options...
Guest Posted August 26, 2005 Share Posted August 26, 2005 oh I see so you need the button inside the box of shopping_cart file. Ok near the end of the shopping_cart.php file in the boxes directory is where the info_box_contents[] array is loaded with a string. That string could also contain the code you mentioned. Now the problem is the shopping cart contains all items (not just one) the customer added. So you want to have a button there just for the last item? If so, use the 'products_id' parameter passed from $HTTP_GET_VARS['products_id']) and fill the info_box_contents[] array with just that. Use the 'text' field for it. Link to comment Share on other sites More sharing options...
TeeCee-UK Posted August 31, 2005 Author Share Posted August 31, 2005 oh I see so you need the button inside the box of shopping_cart file. Ok near the end of the shopping_cart.php file in the boxes directory is where the info_box_contents[] array is loaded with a string. That string could also contain the code you mentioned. Now the problem is the shopping cart contains all items (not just one) the customer added. So you want to have a button there just for the last item? If so, use the 'products_id' parameter passed from $HTTP_GET_VARS['products_id']) and fill the info_box_contents[] array with just that. Use the 'text' field for it. <{POST_SNAPBACK}> Great that is what I wanted to know. Still getting the hang of PHP but it is slowly becoming clear. Thank you very much. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.