[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
ordering non-unique [item-code]
Hello,
My DB design (MySQL) is a little different, it seems, and I'm not sure how
to go about placing items in a shopping basket.
Here is the situation.
Each product has a unique product_id. However, each product can have
multiple versions of itself. Products in my case are magazine subscriptions,
and each magazine can sell either as 1 year subscription or 2 year
subscription, etc. So you have 1 product, but it sells in multiple versions
(and prices).
So on my flypage, where I show details about the magazine, and all
variations of it that can be ordered I do this:
[sql type=list query="
SELECT sub_length, issues_per_year, price
FROM product_term
WHERE product_id = '[item-code]'"]
<INPUT TYPE=radio NAME="mv_order_item" VALUE="[item-code]">
[sql-param issues_per_year]
[sql-param sub_length]
$[sql-param price]
[order [item-code]]Add to Cart
This would give a user the choice to order, say, a 1 year subscription OR a
2 year subscription.
So 2 choices, two things that a customer can order.
Both choices have the same [item-code]
So the problem is that when a customer clicks on the 'Add to Cart' link, I
will be able to tell the product_id of the product in the cart (using
[item-code]), but I will not be able to tell which variation of the product
the customer ordered.
Was it the 1 year OR the 2 year subscription?
Is there any way to make this work?
Is there any way to pass a field other than [item-code] to the [order] tag?
I tried creating another unique field (term_id) which I added to each
version of the product like this:
(products table):
product_id | term_id | product_name ...
164 | 164-1 | PC Magazine
164 | 164-2 | PC Magazine
Which is tied to another table with values for that variation of the
product, like this:
(product_term table):
product_id | term_id | subscription_length | no_issues | price
164 | 164-1 | 1 year | 12 | 19.99
164 | 164-2 | 2 years | 12 | 29.99
So I tried doing [order [sql-param term_id]]Add to Cart - but that did not
work, of course, because MiniVend couldn't find a product with
code/key/product_id 164-1 or 164-2 :(
Hilfe bitte, if you have any ideas.
Thanks,
Otis