Creating an OO Shopping Cart

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I'm creating my own Object Oriented PHP Shopping Cart.

I'm confused about the best way to call the functions of the class given the "static" nature of the web.

For example, if I have a function addItem($code), how will this be called from the catalog or product description pages where the BUY buttons are?

On the product description page (say for product ABC213), there will be a BUY button, but when the button is clicked, obviously I cannot immediately call $cart->addItem('ABC213'). So how is this done?

I thought of making the BUY button link to the cart itself, like so, but doesn't this mitigate the whole point of designing with classes:

<a href="Cart.php?action=add&code=ABC123&goto=viewcart">BUY</a>
The Cart.php would then redirect the user to view the contents of the shopping cart.

Do you have any tips, or are there any resources that may help me think more clearly about this?

My aim is to build a Cart that is very flexible that I can use in many situations in the future.

Thanks for your help.

S.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux