Help - Search - Members - Calendar
Full Version: Generating an Add to Cart Button that uses my database?
HTMLHelp Forums > Web Authoring > Web Site Functionality
colinkites2000
Hi Everyone,

I've been plugging away at taking our website (www.abraDELETETHISmetal.com) to take online orders. The original plan was to use PHPCart (www.phpcart.net) to generate the code for an "ADD TO CART" button that I would add beside each of my items in the tables. I tested this and it worked fine, except that updating a lot of pricing was going to be labor-intensive. I would need to change the price in the HTML table listing and then change the pricing of the PHPCart button as well. So I decided it would be nice to have some dynamic tables through MySQL/PHP so that we could make bulk updates quickly in excel and also to add new items this way to the tables. That seems to be working well. At this point, I can update the pricing (and other information) quickly and easily using the database but since the PHPCart button is not linked to the database, I would need to also make the adjustment for that. Also, the thought of hand entering 1000 items to make the order button begs me to research this before going through with that.

Ideally, I would like to be able to have the order button call my database and determine the pricing and item description from that. Is this possible? PHP? Software? I am competent in HTML and just getting started in PHP/MySQL. It is essential to keep the look of the site nearly identical and hopefully use our current database.

Any insights greatly appreciated.

Sincerely,
Colin
Brian Chandler
Yes, it's very easy, and this is what a database is for.

What format does the phpcart button look like now?

Probably you need to replace the "hard text" with a call to a php function you are going to write called something like

showproduct($pcode)

where the argument pcode is the product code to use to identify all of your products.

Then you* write the function which looks a bit like

get DB record for $pcode
echo this that and the other, using the various bits of info in the db record.

* Yes, _you_ have to write it, but ask for help. The more specific the question the easier it is to answer.

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.