Zen Cart Logo
Forums / General Questions / Restricting a category to a certain zone?

Restricting a category to a certain zone?

Locked

Views: 1,597

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
29 May 2009, 8:47 PM
#1
stlnyc avatar

stlnyc

Zen Follower

Join Date:
Oct 2008
Posts:
179
Plugin Contributions:
0

Restricting a category to a certain zone?

I'm trying to set one of my categories to only be available to people in our home state of NY. How do I set this up? I can't seem to find it anywhere.

30 May 2009, 11:46 AM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Restricting a category to a certain zone?

How will your store know where I'm from unless I register first? Until a customer registers and says specifically "I am in NY", all info will be displayed.

So if I browse anonymously, and see something I like in the NY category and add it to my cart, will it disappear once I register and say I'm in NJ ?

30 May 2009, 1:15 PM
#3
stlnyc avatar

stlnyc

Zen Follower

Join Date:
Oct 2008
Posts:
179
Plugin Contributions:
0

Re: Restricting a category to a certain zone?

Is that possible? If yes, than how?

30 May 2009, 1:27 PM
#4
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Restricting a category to a certain zone?

Do you intentialy want to annoy your customers?

30 May 2009, 5:00 PM
#5
stlnyc avatar

stlnyc

Zen Follower

Join Date:
Oct 2008
Posts:
179
Plugin Contributions:
0

Re: Restricting a category to a certain zone?

It's against the law to ship liquor over state lines, but the owners of my store want to offer liquor to people within NY (our home state).

How could I set this up?

30 May 2009, 9:05 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Restricting a category to a certain zone?

You could do quite a bit of customization where if the customer is not logged in then the directory and products will not show ...

If logged in, you will know their region and you could keep the block if not NY ...

However, what if Grandma lives in Washington but is buying for Little Red Ridinghood's wedding to the Woodsman and he lives in New York?

Is the "cannot buy" based on Billing Address or Shipping Address?

If on Shipping Address, then the premise on how to block the Category and Products is not going to work very well ...

Am I, from Ohio, allowed to "know" you sell the booze to New Yorkers?

30 May 2009, 9:26 PM
#7
stlnyc avatar

stlnyc

Zen Follower

Join Date:
Oct 2008
Posts:
179
Plugin Contributions:
0

Re: Restricting a category to a certain zone?

Ha, you can certainly know that we sell booze to us crazy NYers.

So, yes the idea would be so that we can't ship to someone out of NY. Someone can certainly send a gift from another state to someone in NY, but not the other way around.

So if blocking a whole category isn't really possible, is blocking individual products doable?

I plan on putting a note in the description that we can't ship the liquor items, but that doesn't always stop people.

31 May 2009, 5:23 AM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Restricting a category to a certain zone?

Are all the bottles kept in their own category?

If so, is this the master_categories_id?

You could put a test on the shipping that if the address is no in the right zone ... as in not NY ... then the order cannot be completed when 1 or more bottles are in the cart ...

There is a function in the shopping_cart class for:

  /**
   * Method to calculate the number of items in a cart based on an abitrary property
   *
   * $check_what is the fieldname example: 'products_is_free'
   * $check_value is the value being tested for - default is 1
   * Syntax: $_SESSION['cart']->in_cart_check('product_is_free','1');
   *
   * @param string product field to check
   * @param mixed value to check for
   * @return integer number of items matching restraint
   */
  function in_cart_check($check_what, $check_value='1') {

Put the test in the header of the checkout_payment and if it fails the test, give a mess and go back to the checkout_shipping until they fix it ...

You might also add a message to the shopping_cart page that if one of the products is in the cart it displays a message that "this order can only be shipped to NY you boozer ..." or something of that nature ... :cool:

31 May 2009, 4:16 PM
#9
stlnyc avatar

stlnyc

Zen Follower

Join Date:
Oct 2008
Posts:
179
Plugin Contributions:
0

Re: Restricting a category to a certain zone?

yes, all the bottles are in there own category.

And that code in the last post, how would I turn off the said category in that code?

31 May 2009, 5:26 PM
#10
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Restricting a category to a certain zone?

We have used hidden categories in the past for specific CUSTOMERS (members of a loyalty club who can access this category that offers specials to club members only), but I come back to the point where you will only know what restrictions to apply AFTER a customer is logged in.

Very often, an "anonymous" user starts to fill a cart, and is prompted only for login or registration only when they proceed to checkout.

Your difficulty will thus be:-

  1. If you "hide" the category containing booze until the point where a shipping address is entered, your new customer will be well into the checkout process before your zenshop knows whether the booze category is either displayable, or must still remain hidden. I doubt if customers are going to get to the penultimate step of checkout, then suddenly see a message which says something like: "Oh, by the way, now that we see you want to deliver to NY, how about buying some liquor too?".

  2. If you "enable" the category, but prevent final checkout if the cart contains booze and the delivery address is not NY, you will end up with a lot of irritated customers.

The only way - as I see it - that you should be looking at, is by asking the visitor to confirm the following, the minute they enter your booze category, to view booze products... and this can probably be done with something as simple as a "required" radio button attribute that is appended to each booze product ->>>

"As we are only able to ship our alcoholic beverages to NY addresses, please confirm that this product is being shipped to a NY address. Click the button to confirm."

As a "policeman", you could then apply the conditional code that Ajeh describes - so that if they do reach checkout shipping and the address is not NY - (even though they selected the attribute earlier) -, they are asked to remove the product from their cart.

31 May 2009, 8:50 PM
#11
ajeh avatar

ajeh

Oba-san

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

Re: Restricting a category to a certain zone?

You are looking at a few issues here ...

Do you want to "hide" the category for the booze or do you want to "stop" the checkout based on a bottle being in the cart when the shipping address is not NY?

To me, I wouldn't want to hide the products as I want my friend in PA to tell me they saw the booze that we could send to harry over in NY ...

I would warn guests when the product is added to the cart and warn logged in customers if their address is not NY until the shipping is changed that they cannot checkout and block the checkout ...

So, I would want to stop them on the checkout if they don't send to NY ...

This takes a bit of coding, but once done, it is done and I have happy customers who can "see" whatever I sell and try to "buy" whatever I sell but cannot checkout unless their shipping address is correct or not based on is the booze in the cart or not ...

Now, without sitting down and writing the code for this, it would take a lot of guess work to say everything that has to be done ... it is more "time consuming" than hard to do ...

But ... it can be done and should not be a horrible ordeal ...

The code I posted can be used to test the products in the cart for anything to do with the products table ...

That can help you to figure out if 1 or more Products have a master_categories_id == XX where XX is the categories_id for these Products ...