Forum Moderators: coopster
At the moment I have a product page with a nice pic and an add to cart button.
Once clicked the button contains an id number
(cart_new.php?action=add&id=2)
that drags all the info for that id out of the database and displays that info on the next page.
Once on that page the customer then decides how many they want of that product by changing the quantity box.
What I would like to do is this but not sure on the best way.
--------------------
Product page contains small table
1 pack = 3.99
2 packs = 6.99
then a text field for the number of packs ie 1 or 2 and then a button.
Ideally I would like that button to generate a new id so that it drags out the info for either 1 pack price or the 2 packs price.
thanks for any help.
First,
... a product page with a nice pic and an add to cart button .. Once clicked ... displays that info on the next page ... the customer then decides how many they want of that product by changing the quantity box.
So you have two pages, two clicks, to get an item to the cart. Why can't you compartmentalize your add to cart form and have the "add to cart" on the first page?
The second problem,
... the customer then decides how many they want of that product by changing the quantity box.
Since your pricing is not simply "product X quantity" I suggest something else, see explanation below.
What I suggest is a different approach to your first page. Instead of a second page, compile a "compartmentalized" version of your product form. Something like
$thisForm = getOrderLine('12345');
.. where '12345' is the product id of the product. You can call this in your initial search results/all products page,
while ($row=mysql_fetch_array($result)) {
$pid=$row[0];
$searchResults . = getOrderLine($pid);
}
Or your details pages, as above (just put "$form" on the details page.)
Now your "next page" will always lead to a "cart summary" which will itemize all the items in the cart with tools to remove items or return to shopping. Less clicks.
As for the "packs," this should be (if they aren't already) "options" for the base product. I say this because it simplifies your calculations, as it's not simply product price X quantity.
table products
id¦product_id¦title.......
1¦123¦Widget
table product_options
id¦option_id¦product_id¦sequence¦op_title¦op_price....
1¦12345¦123¦1¦1 pack¦3.99
2¦12346¦123¦2¦2 packs¦6.99
...
Then, in your getOrderLine function, for these types of options you create this as a select list instead of a textual input field.
Save your quantity field for the "top limit" of the packs discount. For example, if it's this,
2¦12347¦123¦3¦more than 3 packs¦5.99
They can enter a quantity and your calculation is quantity X price(option 12347).
It's always a Good Idea to eliminate as many points of user input as possible. A text box is fine, but you have to validate it/cleanse it server side as it's a point at which the user can ruin your day with invalid input.
I know this is probably more than you're asking, but restructuring NOW can avert many complications for you in the future, this is what I'd do.