rs2k Posted October 10, 2008 Posted October 10, 2008 I tried to move the "Add to cart" button from the bottom of the page to under the product image and now it won't work. When you click on it nothing happens. I've tried moving it to many different parts of the page without success. Any idea why?
lindsayanng Posted October 10, 2008 Posted October 10, 2008 you arent moving the entire chunk of code then.. make sure you do ALL of the code for the button.. I did it successfully. A great place for newbies to start Road Map to oscommerce File Structure DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways! HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you Proud Memeber of the CODE BREAKERS CLUB!!
sLaV- Posted October 10, 2008 Posted October 10, 2008 Looks like your moving the add to cart button BEFORE your making the database call to find out which product is being viewed ... and hence you dont have the product id value yet to add it to the cart
rs2k Posted October 10, 2008 Author Posted October 10, 2008 you arent moving the entire chunk of code then.. make sure you do ALL of the code for the button.. I did it successfully. Hmm, in desperation I moved about 20 lines around the code to the top of the page. It still did not work.
rs2k Posted October 10, 2008 Author Posted October 10, 2008 As a test I put 4 Buy Now buttons on this page. The HTML code for all four buttons look like this in page source: <!-- <tr> <td height="30"><a href="http://www.url.com/prod-name-p-82.html?action=buy_now"><img src="includes/languages/english/images/buttons/button_buy_now.gif" border="0" alt="Buy Now" title=" Buy Now " width="60" height="14"></a> </tr> --> Only the bottom one works.
lindsayanng Posted October 10, 2008 Posted October 10, 2008 why are your buttons hardcoded?? Are you using a template? A great place for newbies to start Road Map to oscommerce File Structure DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways! HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you Proud Memeber of the CODE BREAKERS CLUB!!
rs2k Posted October 10, 2008 Author Posted October 10, 2008 why are your buttons hardcoded?? Are you using a template? Here is the php code: <tr> <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> </tr> I'm not using a template.
shooter-boy Posted October 10, 2008 Posted October 10, 2008 You have likely moved the button out of the actual form tags... Can you post the whole source of the page, not just the button code? Thanks, Rob Rob Bell - Inspired Graphix Customising osCommerce in Australia, and the world! View my profile for web and email links. I'm sorry, but i cannot offer Free support via PM etc, and osCommerce forums prohibit me from putting any reference to paid support in my signauture. However viewing my profile may provide links to my website or something like that which you may find useful.
rs2k Posted October 10, 2008 Author Posted October 10, 2008 You have likely moved the button out of the actual form tags... Can you post the whole source of the page, not just the button code? Thanks, Rob That was the problem. While moving some things around I got the form tag moved as well. Thank you!
shooter-boy Posted October 10, 2008 Posted October 10, 2008 That was the problem. While moving some things around I got the form tag moved as well. Thank you! Gotta be careful in there :D An easy mistake to make... ;) Rob Rob Bell - Inspired Graphix Customising osCommerce in Australia, and the world! View my profile for web and email links. I'm sorry, but i cannot offer Free support via PM etc, and osCommerce forums prohibit me from putting any reference to paid support in my signauture. However viewing my profile may provide links to my website or something like that which you may find useful.
lindsayanng Posted October 10, 2008 Posted October 10, 2008 your add to cart should look like this: <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> Your button just has a link, but no statements to tell the cart which product to pull form the DB to put into the cart.. That is NOT the stock cart button... Either you coded it yourself, got it from a bad contribution, or something else../ A great place for newbies to start Road Map to oscommerce File Structure DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways! HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you Proud Memeber of the CODE BREAKERS CLUB!!
shooter-boy Posted October 10, 2008 Posted October 10, 2008 your add to cart should look like this: <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> Your button just has a link, but no statements to tell the cart which product to pull form the DB to put into the cart.. That is NOT the stock cart button... Either you coded it yourself, got it from a bad contribution, or something else../ The OP has already said this is resolved - the only problem was that he moved the submit button out of the form tags. Why is everyone trying to overcomplicate this? Rob Rob Bell - Inspired Graphix Customising osCommerce in Australia, and the world! View my profile for web and email links. I'm sorry, but i cannot offer Free support via PM etc, and osCommerce forums prohibit me from putting any reference to paid support in my signauture. However viewing my profile may provide links to my website or something like that which you may find useful.
lindsayanng Posted October 10, 2008 Posted October 10, 2008 i am trying to point out the proper way to code your add to cart button to avoid future issues.. hardcoding links is not a good idea in ecommerce A great place for newbies to start Road Map to oscommerce File Structure DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways! HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you Proud Memeber of the CODE BREAKERS CLUB!!
shooter-boy Posted October 10, 2008 Posted October 10, 2008 i am trying to point out the proper way to code your add to cart button to avoid future issues.. hardcoding links is not a good idea in ecommerce The OP post their code, and it is correct - it is not being hardcoded... They post a snippet from "view source" which may have caused some confusion. Reading the posts in this thread would have shown that, including the OP's post of the functions being used. Anyway, all that aside, the issue is resolved. Rob Rob Bell - Inspired Graphix Customising osCommerce in Australia, and the world! View my profile for web and email links. I'm sorry, but i cannot offer Free support via PM etc, and osCommerce forums prohibit me from putting any reference to paid support in my signauture. However viewing my profile may provide links to my website or something like that which you may find useful.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.