Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add to Cart - Know product ID, but can't figure it out


Guest

Recommended Posts

Right now the normal way of adding something to the cart would be the product_info.php page and click on the ADD TO CART image. I looked in the coding of the product_info.php and it shows

 

<?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_template_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>

 

I am very confused. I want some TEXT so that when they click on some TEXT that it takes the underlying product id information and adds it to the cart. For example, lets say I have item ID 90. When the user clicks the text "add to cart" on a normal page on the website, it will add the item ID 90 to the cart and take them to the cart.

 

I can't seem to figure this out and I know it is something so simple. :)

 

 

I have tried the following:

 

<?php echo tep_draw_hidden_field('products_id', '90') . tep_template_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>

 

However, when I list a bunch like this (say I have products_id 85 to 90 on the same page with the 5 add to cart buttons) then no matter what it will take the last one (in this case 90). If I changed the last one to 89, then no matter what ADD TO CART button I press, ID 89 gets put to the cart.

 

Any suggestions on making a custom page listing only specific items and having the "add to cart" button near the specific items and having the specific item that was clicked go to the cart?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...