asago Posted March 29, 2005 Posted March 29, 2005 Has anyone made a modification so that multiple products can be added to the cart at one time using checkboxes? This would be useful in the instance of an online media store... For example.. digital music let's say your search results presented 3 products... it would be usefule to be able to add them all to your cart bys checking checkboxes... like this: [] product1...... 0.99 [] product2...... 0.99 [] product3...... 0.99 [Add to Cart Button] Anyone done this mod? I am in need for this functionality....
JohnA Posted March 29, 2005 Posted March 29, 2005 Please look at the contributions first. I've added a modification for the 'ADD MULTI PRODUCTS REVIVED' last week
asago Posted March 29, 2005 Author Posted March 29, 2005 Thanks JohnA - I installed the contrib... but there is no "add to cart" button - and why is there two checkboxes next to each item?
Guest Posted April 22, 2005 Posted April 22, 2005 Hello John, Many people are having a problem with the checkbox contribution. The "add to cart" button does not work when installed. Is there anything that could have been left out of the instructions?
boxtel Posted April 22, 2005 Posted April 22, 2005 Hello John, Many people are having a problem with the checkbox contribution. The "add to cart" button does not work when installed. Is there anything that could have been left out of the instructions? <{POST_SNAPBACK}> add multiple works fine but you need to take your current installation into account. for instance you cannot simply add forms over forms. I have it myself and it is quite easy. Treasurer MFC
Guest Posted April 22, 2005 Posted April 22, 2005 I have the standard oscommerce installation. I followed the steps that are in the contribution, which I assumed are the steps you take to make the contribution work. If not, whats the point in making the contribution. If I could understand PHP enough to understand it all, I wouldnt be here using the contribution. As there are a few people having the same problem I would guess this be an issue that someone would like to fix, or at least constructively advise. I have not had problems with other contributions because they come with clear instruction how to install them with the standard installation. And there is no point in coming onto the forum saying... I have it myself and it is quite easy... when clearly people are looking for help and dont find it that easy. well done to you, now if someone can help.....
boxtel Posted April 23, 2005 Posted April 23, 2005 I have the standard oscommerce installation. I followed the steps that are in the contribution, which I assumed are the steps you take to make the contribution work. If not, whats the point in making the contribution. If I could understand PHP enough to understand it all, I wouldnt be here using the contribution. As there are a few people having the same problem I would guess this be an issue that someone would like to fix, or at least constructively advise. I have not had problems with other contributions because they come with clear instruction how to install them with the standard installation. And there is no point in coming onto the forum saying... I have it myself and it is quite easy... when clearly people are looking for help and dont find it that easy. well done to you, now if someone can help..... <{POST_SNAPBACK}> point taken, in products_listing module (back it up first) : 1) just above this statement : <?php $info_box_contents = array(); you add this statement : <form name="cart_multi" method="post" action="<?php echo tep_href_link(FILENAME_SHOPPING_CART, tep_get_all_get_params(array('action')) . 'action=add_multi', 'NONSSL'); ?>"> NOTE: this statement is OUTSIDE of the <?php ?> tags so plain html 2) just after the same statement : <?php $info_box_contents = array(); you add this : $p_index = 0; 3) just after this statement : while ($listing = tep_db_fetch_array($listing_query)) { you add this statement : $p_index++; 4) in the standard osc you have this statement to add the buy now button. $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> '; so we add the checkbox like this : <input type="checkbox" class="checkbox" name="add_id['.$p_index.']" value="1"> so the complete statement would become : $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> <input type="checkbox" class="checkbox" name="add_id['.$p_index.']" value="1">'; 5) now we need to add the button to do the multiple add and we need to close the form: so before we display the paging stuff at the bottom : if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) { we add the button table with : ?> <table align="center" width="100%" cellspacing="0" cellpadding="4" class="borderWhite"> <tr> <td align="right" width="40%" nowrap class="main"><?php echo ADD_MULTIPLE_PRODUCTS; ?></td> <td align="center" class="main" valign="middle"> <img src="images/arrow_south_east.gif" alt="<?php echo ADD_MULTIPLE_PRODUCTS; ?>" title="<?php echo ADD_MULTIPLE_PRODUCTS; ?>"></td> <td align="left" width="140px"class="main"><?php echo tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> </tr> </table> <?php } echo '</form>'; you will have to replace the image filenames and the text constants. 6) the last thing is to add the action into application top : there just above this statement : case 'buy_now' : if (isset($_GET['products_id'])) { you add : case 'add_multi': for ($i=0; $i<=sizeof($_POST['products_id']);$i++) { $cart->add_cart($_POST['products_id'][$i+1], $cart->get_quantity(tep_get_uprid($_POST['products_id'][$i+1], $_POST['id'][$i+1]))+($_POST['add_id'][$i+1]), $_POST['id'][$i+1]); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; Treasurer MFC
boxtel Posted April 23, 2005 Posted April 23, 2005 point taken,in products_listing module (back it up first) : 1) just above this statement : <?php $info_box_contents = array(); you add this statement : <form name="cart_multi" method="post" action="<?php echo tep_href_link(FILENAME_SHOPPING_CART, tep_get_all_get_params(array('action')) . 'action=add_multi', 'NONSSL'); ?>"> NOTE: this statement is OUTSIDE of the <?php ?> tags so plain html 2) just after the same statement : <?php $info_box_contents = array(); you add this : $p_index = 0; 3) just after this statement : while ($listing = tep_db_fetch_array($listing_query)) { you add this statement : $p_index++; 4) in the standard osc you have this statement to add the buy now button. $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> '; so we add the checkbox like this : <input type="checkbox" class="checkbox" name="add_id['.$p_index.']" value="1"> so the complete statement would become : $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> <input type="checkbox" class="checkbox" name="add_id['.$p_index.']" value="1">'; 5) now we need to add the button to do the multiple add and we need to close the form: so before we display the paging stuff at the bottom : if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) { we add the button table with : ?> <table align="center" width="100%" cellspacing="0" cellpadding="4" class="borderWhite"> <tr> <td align="right" width="40%" nowrap class="main"><?php echo ADD_MULTIPLE_PRODUCTS; ?></td> <td align="center" class="main" valign="middle"> <img src="images/arrow_south_east.gif" alt="<?php echo ADD_MULTIPLE_PRODUCTS; ?>" title="<?php echo ADD_MULTIPLE_PRODUCTS; ?>"></td> <td align="left" width="140px"class="main"><?php echo tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> </tr> </table> <?php } echo '</form>'; you will have to replace the image filenames and the text constants. 6) the last thing is to add the action into application top : there just above this statement : case 'buy_now' : if (isset($_GET['products_id'])) { you add : case 'add_multi': for ($i=0; $i<=sizeof($_POST['products_id']);$i++) { $cart->add_cart($_POST['products_id'][$i+1], $cart->get_quantity(tep_get_uprid($_POST['products_id'][$i+1], $_POST['id'][$i+1]))+($_POST['add_id'][$i+1]), $_POST['id'][$i+1]); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; <{POST_SNAPBACK}> realize I forgot 1 statement : in product_listing.php : just after the just added : $p_index++; add this statement : ?> <input type="hidden" name="products_id[<?php echo $p_index; ?>]" value="<?php echo $listing['products_id']; ?>"> <?php Treasurer MFC
Laney Posted April 23, 2005 Posted April 23, 2005 Hey Amanda, can I take a look at your store to see how this works? thanks, Elaine point taken "There are only 10 types of people in this world: those who understand binary, and those who don't. "
boxtel Posted April 24, 2005 Posted April 24, 2005 Hey Amanda, can I take a look at your store to see how this works? thanks, Elaine point taken <{POST_SNAPBACK}> sure http://www.crystallight.com.tw/crystals-cr...rs-C-21_84.html Treasurer MFC
Laney Posted April 24, 2005 Posted April 24, 2005 Very nice! Elaine sure http://www.crystallight.com.tw/crystals-cr...rs-C-21_84.html <{POST_SNAPBACK}> "There are only 10 types of people in this world: those who understand binary, and those who don't. "
Guest Posted April 24, 2005 Posted April 24, 2005 Thanks for your help and all the time you spent explaining. I still cannot get the page to work with the button though. I did wonder one thing whilst trying your modification: Should there be something before the script you gave in part 5 that added the button and closed the form? It seems like there is a } without a {. It would be great if you could paste the whole version of the product_listing.php file. Thank you again for your help.
starflyer Posted April 25, 2005 Posted April 25, 2005 finally! thanks for the help boxtel. neway, open your product_listing.php files and try changing: <?php } ?> <form name="cart_multi" method="post" action="<?php echo tep_href_link(FILENAME_SHOPPING_CART, tep_get_all_get_params(array('action')) . 'action=add_multi', 'NONSSL'); ?>"> <?php } to: <?php } ?> <form name="cart_multi" method="post" action="<?php echo tep_href_link(FILENAME_SHOPPING_CART, tep_get_all_get_params(array('action')) . 'action=add_multi', 'NONSSL'); ?>"> <?php so, delete that second }. its around line 29. worked for me after that.
boxtel Posted April 25, 2005 Posted April 25, 2005 finally! thanks for the help boxtel. neway, open your product_listing.php files and try changing: <?php } ?> <form name="cart_multi" method="post" action="<?php echo tep_href_link(FILENAME_SHOPPING_CART, tep_get_all_get_params(array('action')) . 'action=add_multi', 'NONSSL'); ?>"> <?php } to: <?php } ?> <form name="cart_multi" method="post" action="<?php echo tep_href_link(FILENAME_SHOPPING_CART, tep_get_all_get_params(array('action')) . 'action=add_multi', 'NONSSL'); ?>"> <?php so, delete that second }. its around line 29. worked for me after that. <{POST_SNAPBACK}> yes, sorry my mistake, I have the button table in a condition so it does not show when there are no checkboxes on the page, when all items are "call for price" for instance. That was what the closing } was for. Treasurer MFC
vitalchip Posted April 25, 2005 Posted April 25, 2005 I've been trying to get this mod to work as well, I've downloaded 4 versions and the only one that works is the original version with no images etc! I was very interested in the post by boxtel and set about modifying my product_listing module, sadly I quickly discovered that none of the mentioned lines exist in my file! e.g. $info_box_contents = array(); (not there but I do have $list_box_contents = array(); ) while ($listing = tep_db_fetch_array($listing_query)) { (nope..) I was thinking there must be some difference in the versions we are working off? Any thoughts?
Guest Posted April 26, 2005 Posted April 26, 2005 I finally got it to work but the top product won't add to the cart for some reason, this is my product_listing code: <?php /* $Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id'); if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table> <?php } ?> <form name="cart_multi" method="post" action="<?php echo tep_href_link(FILENAME_SHOPPING_CART, tep_get_all_get_params(array('action')) . 'action=add_multi', 'NONSSL'); ?>"> <?php $list_box_contents = array(); $p_index = 0; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_text = TABLE_HEADING_MODEL; $lc_align = ''; break; case 'PRODUCT_LIST_NAME': $lc_text = TABLE_HEADING_PRODUCTS; $lc_align = ''; break; case 'PRODUCT_LIST_MANUFACTURER': $lc_text = TABLE_HEADING_MANUFACTURER; $lc_align = ''; break; case 'PRODUCT_LIST_PRICE': $lc_text = TABLE_HEADING_PRICE; $lc_align = 'right'; break; case 'PRODUCT_LIST_QUANTITY': $lc_text = TABLE_HEADING_QUANTITY; $lc_align = 'right'; break; case 'PRODUCT_LIST_WEIGHT': $lc_text = TABLE_HEADING_WEIGHT; $lc_align = 'right'; break; case 'PRODUCT_LIST_IMAGE': $lc_text = TABLE_HEADING_IMAGE; $lc_align = 'center'; break; case 'PRODUCT_LIST_BUY_NOW': $lc_text = TABLE_HEADING_BUY_NOW; $lc_align = 'center'; break; } if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) { $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text); } $list_box_contents[0][] = array('align' => $lc_align, 'params' => 'class="productListing-heading"', 'text' => ' ' . $lc_text . ' '); } if ($listing_split->number_of_rows > 0) { $rows = 0; $listing_query = tep_db_query($listing_split->sql_query); while ($listing = tep_db_fetch_array($listing_query)) { $p_index++; ?> <input type="hidden" name="products_id[<?php echo $p_index; ?>]" value="<?php echo $listing['products_id']; ?>"> <?php $rows++; if (($rows/2) == floor($rows/2)) { $list_box_contents[] = array('params' => 'class="productListing-even"'); } else { $list_box_contents[] = array('params' => 'class="productListing-odd"'); } $cur_row = sizeof($list_box_contents) - 1; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { $lc_align = ''; switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_align = ''; $lc_text = ' ' . $listing['products_model'] . ' '; break; case 'PRODUCT_LIST_NAME': $lc_align = ''; if (isset($HTTP_GET_VARS['manufacturers_id'])) { //custom for kingunderground if($HTTP_GET_VARS['cPath'] == '21') { //it is the EP/LP section $lc_text = '<a href="#" onClick="MM_openBrWindow(\'/catalog/popup_description.php?products_id='.$listing['products_id'].'\',\'desc\',\'scrollbars=auto,resizable=yes,width=500,height=500\')">' . $listing['products_name'] . '</a>'; } else { //any other section, just audio links $lc_text = '<span class="prodList">' . $listing['products_name'] . '</span>'; } } else { if($HTTP_GET_VARS['cPath'] == '21') { //it is the EP/LP section $lc_text = '<a href="java script: MM_openBrWindow(\'/catalog/popup_description.php?products_id='.$listing['products_id'].'\',\'desc\',\'scrollbars=auto,resizable=yes,width=500,height=500\');">' . $listing['products_name'] . '</a>'; } else { //any other section, just audio links $lc_text = '<span class="prodList">' . $listing['products_name'] . '</span>'; } } break; case 'PRODUCT_LIST_MANUFACTURER': $lc_align = ''; $lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> '; break; case 'PRODUCT_LIST_PRICE': $lc_align = 'right'; if (tep_not_null($listing['specials_new_products_price'])) { $lc_text = ' <s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> '; } else { $lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' '; } break; case 'PRODUCT_LIST_QUANTITY': $lc_align = 'right'; $lc_text = ' ' . $listing['products_quantity'] . ' '; break; case 'PRODUCT_LIST_WEIGHT': $lc_align = 'right'; $lc_text = ' ' . $listing['products_weight'] . ' '; break; case 'PRODUCT_LIST_IMAGE': $lc_align = 'center'; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; } else { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> '; } break; case 'PRODUCT_LIST_BUY_NOW': $lc_align = 'center'; $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> <input type="checkbox" class="checkbox" name="add_id['.$p_index.']" value="1">'; break; } $list_box_contents[$cur_row][] = array('align' => $lc_align, 'params' => 'class="productListing-data"', 'text' => $lc_text); } } new productListingBox($list_box_contents); } else { $list_box_contents = array(); $list_box_contents[0] = array('params' => 'class="productListing-odd"'); $list_box_contents[0][] = array('params' => 'class="productListing-data"', 'text' => TEXT_NO_PRODUCTS); new productListingBox($list_box_contents); } ?> <table align="center" width="100%" cellspacing="0" cellpadding="4" class="borderWhite"> <tr> <td align="right" width="140px"class="main"><?php echo tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> </tr> </table> <?php echo '</form>'; if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table> <?php } ?> I will be eternally thankful for any help! PS Vitalchip, I also have list_box_contents it is the same script, however... while ($listing = tep_db_fetch_array($listing_query)) is in the original script so maybe you need to download it again.
Allan Taylor Posted April 30, 2005 Posted April 30, 2005 I have a solution for the add to cart problems people are having. At the top of the product_listing_multi.php file, you will find the line: if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) { The problem is with this line. change the line to be: if ($listing_split->number_of_rows > 0) { and everything should work for you. I'm not sure where the PREV_NEXT_BAR_LOCATION is suppossed to be set, but it is not set anywhere in my installation of OScommerce. This causes the top table (which shows how many products are being displayed) to be dropped. Since the opening form statement is in this block, the form is never correctly started. I think this is a bug in the newer distribution of OScommerce. I checked with the original product_listing.php file and noticed that the table was not displaying. I made the same change, and suddenly the top table was displaying correctly. Maybe someone with more knowledge can tell us where the deleted part of the line is suppossed to be set (which file) and I can figure out why it is not being set. Good luck everyone.
boxtel Posted April 30, 2005 Posted April 30, 2005 I have a solution for the add to cart problems people are having. At the top of the product_listing_multi.php file, you will find the line: if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) { The problem is with this line. change the line to be: if ($listing_split->number_of_rows > 0) { and everything should work for you. I'm not sure where the PREV_NEXT_BAR_LOCATION is suppossed to be set, but it is not set anywhere in my installation of OScommerce. This causes the top table (which shows how many products are being displayed) to be dropped. Since the opening form statement is in this block, the form is never correctly started. I think this is a bug in the newer distribution of OScommerce. I checked with the original product_listing.php file and noticed that the table was not displaying. I made the same change, and suddenly the top table was displaying correctly. Maybe someone with more knowledge can tell us where the deleted part of the line is suppossed to be set (which file) and I can figure out why it is not being set. Good luck everyone. <{POST_SNAPBACK}> these values are set in your admin section -> product listing -> last item Treasurer MFC
boxtel Posted April 30, 2005 Posted April 30, 2005 I finally got it to work but the top product won't add to the cart for some reason, this is my product_listing code:<?php /* $Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright ? 2003 osCommerce Released under the GNU General Public License */ I will be eternally thankful for any help! PS Vitalchip, I also have list_box_contents it is the same script, however... while ($listing = tep_db_fetch_array($listing_query)) is in the original script so maybe you need to download it again. <{POST_SNAPBACK}> compare this to what you have in application_top.php case 'add_multi': for ($i=0; $i<=sizeof($_POST['products_id']);$i++) { $cart->add_cart($_POST['products_id'][$i+1], $cart->get_quantity(tep_get_uprid($_POST['products_id'][$i+1], $_POST['id'][$i+1]))+($_POST['add_id'][$i+1]), $_POST['id'][$i+1]); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; Treasurer MFC
Allan Taylor Posted April 30, 2005 Posted April 30, 2005 Thanks Boxtel, Man do I feel stupid. I even looked there, but it didn't register. After I read your post, I suddenly came to my senses and moved the form statement out of the if statement and now everything works as it should! Thanks again!
Ken Wood Posted May 3, 2005 Posted May 3, 2005 add multiple works fine but you need to take your current installation into account.for instance you cannot simply add forms over forms. I have it myself and it is quite easy. <{POST_SNAPBACK}> I also have the problem of the "Add_cart" function not working after I installed the contrib. It`s gotta be a problem in the application_top I figure. Anyway, I`m asking because the solution offered here is made for the people who want to utilize the add_multiple function - I don`t use it so I guess I have to take different meassures to make this button work (or replace it by the - working - "Buy_now" button if that would help). Can anybody please help me out! This bugs since more then three weeks now and nobody seems to know! Thanks so much, Ken
mandavia Posted May 4, 2005 Posted May 4, 2005 I got it working thanks to these posts, but I was going to use this for downloadable items. Has anyone configured it so that the product download attribute can be passed on with check box? I think this would normally occur in shopping_cart.php. Otherwise it assumes there are no product options and doesn't allow the download. Any help is appreciated. Sujal.
boxtel Posted May 4, 2005 Posted May 4, 2005 I got it working thanks to these posts, but I was going to use this for downloadable items. Has anyone configured it so that the product download attribute can be passed on with check box? I think this would normally occur in shopping_cart.php. Otherwise it assumes there are no product options and doesn't allow the download. Any help is appreciated. Sujal. <{POST_SNAPBACK}> well, if one or more of the products has attibutes, this solution may be limited. you would have to decide what to do if so. Then take that action in application top in the add_multi case. either not add those and give a message or add them with a default attribute or maybe even better, make the attributes selectable in the shopping cart. another option would be to not show a checkbox for products with attributes so that those can only be put into the cart 1 at a time via product info. Treasurer MFC
boxtel Posted May 4, 2005 Posted May 4, 2005 well, if one or more of the products has attibutes, this solution may be limited.you would have to decide what to do if so. Then take that action in application top in the add_multi case. either not add those and give a message or add them with a default attribute or maybe even better, make the attributes selectable in the shopping cart. another option would be to not show a checkbox for products with attributes so that those can only be put into the cart 1 at a time via product info. <{POST_SNAPBACK}> the last option would be easiest with this code : if (!tep_has_product_attributes($listing['products_id'])) { $lc_text .= '</tr><tr><td align="center" valign="middle"><input type="checkbox" class="checkbox" name="add_id['.$p_index.']" value="1"></td></tr><td>' .tep_draw_separator('pixel_trans.gif', '100%', '5') . '</td>'; } else { $lc_text .= '</tr><tr><td>' . tep_draw_separator('pixel_trans.gif', '100%', '25') . '</td>'; } Treasurer MFC
Ken Wood Posted May 4, 2005 Posted May 4, 2005 Sujal/Mandavia - I`m sorry but I have no idea. But I might have found a solution for MY problem: This is a part of includes/application_top.php as it appeared after I built in the contribution "Product Listing with attributes". // 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']); As you can see in the last line it looks like a value is expected to be added to determine the quantity. This is a part of the original code: $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']); As you can see the value to be added is not taken from a variable but simply set to be "1" - it couldn`t be any other anyway, as there (sadly) is no way to select a quantity on a product page anyway - you just press "Add to cart" and 1 (one) item is added. Now if you replace the new code with the old one, you can both buy from the product list as well as from the product page. I hope this solves it - it seems to work but I have not tested it under every circumstance and I hope I don`t introduce new malfunctions with this little change. What`s your opinion? Ken
Recommended Posts
Archived
This topic is now archived and is closed to further replies.