PDA

View Full Version : 'buy now' button on category page?


yoyoman
April 7th, 2004, 10:31 PM
When my products display on the category display page, I would like to add a button that will add the item directly to the cart and bypass the details page, for those customers who already know exactly what they want.

What is the best way to do this? The items on this page are all drawn directly from the db, so it has to be done dynamically instead of in html... should each one have a <form></form> or can I do a direct link? And what variables would I pull into the direct link... store.php?crn=notsure&someOtherVariable=help%20me%please!

And now the really fun part - some items have options which require them to go to the product page and input the details, so I need to run an if statement on the product first to determine whether they can order it directly or not. How do I run an if just to see if the item has any options attached to it?

I think this is totally doable and it will make my client and I very happy.

:confused:

TLHPaul
July 28th, 2004, 03:07 PM
Has anyone managed this?

I'd like to do this too but I'm not sure of the best way to go about it. I know I need to modify the show_product.php template, and I need to somehow get two form actions passed in ('more detail' and 'add to cart'). Even rough instructions would help.

Also, I'd like to remove the 'more detail' link if the 'long description' field is empty. I expect that one will be easier to figure out, but if anyone's already done it......


Thanks!

Jamie
August 16th, 2004, 01:16 PM
Hi,

I just posted this tutorial to explain it:

http://www.ldev.com/forums/showthread.php?t=1446

Regarding your question about an if statement, you can use any field name that you see on a product record in the template file. You would do something like this:

<? if ($Description) { ?>
put your html here
<? } ?>

Thanks,
Jamie