This is a discussion on Limiting one item per customer - narrowed to actions in head within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; Okay, I've been fighting this all weekend. I only want customers to be able to buy one item at a ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Okay, I've been fighting this all weekend. I only want customers to be able to buy one item at a time. I doing subscriptions through the cart. I have everything set including the nasty PayPal link. My problem is, everywhere else it still says that the customer has ordered more then one item, even if they were only charged for one. I figure if I can limit the solution in the Add and Update functions, it will solve my problem. How can I change this code to check to see if there already is an item in the cart and stop if there is. Like if (i>1) kind of thing, but I'm not sure of the variables. I can do the errors and redirects needed, I'm just not sure how to get it to check the cart. Thank you. Code: // customer wants to update the product quantity in their shopping cart
case 'update_product' : for ($i=0; $i<sizeof($HTTP_POST_VARS['products_id']);$i++) {
if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) {
$cart->remove($HTTP_POST_VARS['products_id'][$i]);
} else { // if PHP3, make correction for lack of multidimensional array in PHP3
if (ereg('^3\.', phpversion())) {
reset($HTTP_POST_VARS);
while (list($key, $value) = each($HTTP_POST_VARS)) {
if (is_array($value)) {
while (list($key2, $value2) = each($value)) {
if (ereg ("(.*)\]\[(.*)", $key2, $var)) {
$id2[$var[1]][$var[2]] = $value2;
}
}
}
}
$attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : '';
} else {
$attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';
}
$cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes);
}
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters), 'NONSSL'));
break;
// customer adds a product from the products page
case 'add_product' : if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {
$cart->add_cart($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']);
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters), 'NONSSL'));
break;
|
|
#2
| |||
| |||
| Instead of looking to disable the cart function after 1 purchase try sending to buy know directly to the checkout |
|
#3
| |||
| |||
| That makes sense, but then they could still navigate back. I want to make it final. The reason is because the way the store is set up, they could add a monthly and a yearly and make it through PayPal, and then I would be forced to lose a lot of money. I couldn't go back and negotiate the price. It would be like signing a contract. If I only let them get to PayPal with one item, with coding, that works but then in the email, order history and confirmation page, it shows that they bought two items. Very unprofessional. |
|
#4
| |||
| |||
| Hi I am trying to do the similar, did you find any good solution? Regads Mike |
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how do you hide item prices until customer has logged in? | CLK | osCMax v1.7 Discussion | 0 | 12-15-2005 04:57 PM |
| Login page keeps popping up for certain edit actions | mgrooten | osCMax v1.7 Installation | 9 | 10-31-2005 09:02 AM |
| Limiting One per Customer | Aza | osCommerce 2.2 Modification Help | 2 | 09-06-2005 01:07 PM |
| limiting UPS shipping options | superman | osCommerce 2.2 Modification Help | 0 | 11-11-2003 09:57 AM |
| How to edit <head> | pgowder | osCommerce 2.2 Modification Help | 5 | 01-03-2003 09:00 AM |