osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

Limiting one item per customer - narrowed to actions in head

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 ...


Go Back   osCommerce and osCMax shopping cart software forums > osCommerce 2.2 Forums > osCommerce 2.2 Modification Help

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 12-08-2002, 05:57 PM
Anonymous
Guest
 
Posts: n/a
Default Limiting one item per customer - narrowed to actions in head

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;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #2  
Old 12-09-2002, 04:25 AM
Anonymous
Guest
 
Posts: n/a
Default

Instead of looking to disable the cart function after 1 purchase try sending to buy know directly to the checkout
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #3  
Old 12-09-2002, 05:42 PM
Anonymous
Guest
 
Posts: n/a
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #4  
Old 03-29-2004, 01:33 AM
Member
 
Join Date: Nov 2003
Location: Greece
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
vandiike
Default

Hi I am trying to do the similar, did you find any good solution?

Regads

Mike
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -8. The time now is 09:59 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax