The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Generating an Add to Cart Button that uses my database?, Custom Shopping Cart
colinkites2000
post May 14 2009, 04:04 PM
Post #1


Member
***

Group: Members
Posts: 59
Joined: 11-July 08
Member No.: 6,143



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post May 15 2009, 02:00 AM
Post #2


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



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.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
mentep
post Apr 4 2012, 06:31 PM
Post #3





Group: Members
Posts: 1
Joined: 4-April 12
Member No.: 16,851



QUOTE(Brian Chandler @ May 15 2009, 03:00 AM) *

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.


Hi,

I know this post is very old - but it's relevant to my current situation.

I need to create a way to add an "add to cart" button to my current online store. From what I've read so far this is possible via the db. Should I just add a new field to the db table for each product or is there a more efficient way?

Here is the unique info from the db that I need to call: id:ac1006of price:1850

Ultimately when a customer clicks on the product and arrives on the individual product page - I would like for them to see the "add to cart" button on the product page.

Hopefully your still active on WDG,

Thanks,

Mentep
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Apr 5 2012, 10:54 PM
Post #4


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



Well, yes, you need to add some program to generate the 'add to cart' button, which needs to refer to the db, and you need to implement the cart, which means remembering the current cart selection, either using cookies, or passing around arguments, or passing around an id to a database cart table.

I don't see how adding a field to the product table helps in any way.

It is straightforward programming, but you need to be able to look at the existing program to add it in. There is no simple "piece of code" anyone can give you which just "drops in".
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 29th March 2024 - 10:11 AM