New Zenner
- Join Date:
- Oct 2008
- Posts:
- 21
- Plugin Contributions:
- 0
Add a product to the cart from a custom page?
The site I'm currently working on has an optional scheme the customer can sign up for which requires a membership fee...
First the customer completes a 3 page wizard (Custom pages) the last of which automatically adds the membership fee (A hidden product) to their basket.
Initially I achieved this with:
<form name="multiple_products_cart_quantity" action="index.php?action=multiple_products_add_product" method="post" enctype="multipart/form-data">
<input type="hidden" name="products_id[123]" value="1" />
<input type='submit' name='submit' value='Continue' />
</form>
The problem is if the customer mistakenly goes back to the previous page it will add the fee again...
What I'd like to do, is only allow 1 membership fee to be added at any one time. I think the onetime_membership_charge mod does this at sign up with:
// bof push membership product to cart webomat
$my_membership_fee = MY_MEMBERSHIP_FEE;
$sql = "insert into " . TABLE_CUSTOMERS_BASKET . "
(customers_basket_id, customers_id, products_id, customers_basket_quantity, customers_basket_date_added)
values ('','" . (int)$_SESSION['customer_id'] . "', $my_membership_fee, '1', '" . date('Ymd') . "')";
$db->Execute($sql);
// eof push membership product
This doesn't seem to work if I just drop the code into my custom page (and yes, I've defined MY_MEMBERSHIP_FEE etc...).
I'm guessing I might need to include another file to access the database in this way, any ideas? :dontgetit