Forums / Setting Up Categories, Products, Attributes / Product with Pre-requisite, No New Customers?

Product with Pre-requisite, No New Customers?

Locked

Views: 719

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
5 Jan 2010, 3:52 PM
#1
jacdesigner avatar

jacdesigner

Zen Follower

Join Date:
Jun 2005
Location:
Austin, Texas, US
Posts:
205
Plugin Contributions:
0

Product with Pre-requisite, No New Customers?

My client has a particular special product offering for "repeat customers only". At this time, I just have this setup as a separate product with a description that states it is a deal for returning customers, however there are always a few new customers who order it anyway.

Is there a better way to prevent new customers who have never ordered any product before from purchasing a particular item? Do I need to create a new product type? Perhaps this is where customer groups come in, but in all my Zen projects I have never yet worked with groups so I am not certain.

I have searched far and wide and can't seem to find any suggestions on this particular need. Any advice appreciated.

Site details: https://www.rockbodyfit.com
Version: 1.3.9
Pre-req is only that they have purchased a product before and are not a brand new registrant with no prior orders.

This message brought to you by Jac.
Happily developing sites with Zen Cart since 2003.

5 Jan 2010, 4:51 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Product with Pre-requisite, No New Customers?

You could write a function to validate the product and the customer to check if they have ordered before and if not then prevent checkout ...

If you look in the header_php.php of the checkout pages, you will see where the validation of the cart is done ... you can add in your validation there as well ...

The checkout_shipping for example:
/includes/modules/pages/checkout_shipping/header_php.php

shows the validation as:

// Validate Cart for checkout
  $_SESSION['valid_to_checkout'] = true;
  $_SESSION['cart']->get_products(true);
  if ($_SESSION['valid_to_checkout'] == false) {
    $messageStack->add('header', ERROR_CART_UPDATE, 'error');
    zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
  }

You can add your own validation beneath that to check if the customer has had a previous order and if the product is in the cart ... if not, set a message and return them to the cart to remove it or, you can remove it for them ...

You might also add a validation to the shopping_cart page on the product for when a customer is not logged in or not allowed to checkout with the product ... this could also be done on the product_info page as well ...

Easy smeazy, eh? :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

5 Jan 2010, 5:08 PM
#3
jacdesigner avatar

jacdesigner

Zen Follower

Join Date:
Jun 2005
Location:
Austin, Texas, US
Posts:
205
Plugin Contributions:
0

Re: Product with Pre-requisite, No New Customers?

Thanks, Linda, Much appreciated reply.

Where in this code do I specify the product this applies for? I just want to make sure I don't apply this pre-req to ALL orders in checkout, since that would mean no one could ever place a first-time order for the other products.

Thanks.

This message brought to you by Jac.
Happily developing sites with Zen Cart since 2003.

5 Jan 2010, 5:18 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Product with Pre-requisite, No New Customers?

You would test all orders, and only if they have the product in their cart and have not bought before would the filter happen.

It might be fastest to first test for the presence of the product (I think there is a function for it, something like zen_product_in_cart() ); only if this is true do you need to check on the customer's prior orders.