Forums / Templates, Stylesheets, Page Layout / Hide products based on country

Hide products based on country

Locked

Started by devdude51 on 5 Jan 2007, 6:07 AM · Views: 1,718

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
5 Jan 2007, 6:07 AM
#1
devdude51 avatar

devdude51

New Zenner

Join Date:
Jan 2007
Posts:
8
Plugin Contributions:
0

Hide products based on country

I've inherited a Zen cart system and have spent the last day or so becoming familiar with it. Suffice it to say, I'm still trying to figure things out. Hopefully someone can help me with my first "task".

I've been asked to restrict certain products from being purchased (can be hidden entirely or just not be able to purchase them) if the buyer's country is not the US. Seems like a relatively simple thing to do, but I can't find where to do this. Any help?

Paul

5 Jan 2007, 7:45 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Hide products based on country

This is not built into Zen Cart ...

You could, however, customize the code so that products from various countries cannot be added to the cart once someone is logged in ...

Setting the cart up that the customer must login to shop would help ...

Then you would need something that indicates what country can buy what product added to the products table ... either a zone or a list of countries etc. that you can test for ...

Then you could alter the function that draws the add to cart buttons so that it looks first at the products settings on the country or countries and if the customer is not allowed to purchase the product would be blocked from being added to the cart ...

Then as a safety, you would want to build in a verification test for if during checkout the customer changes the address and now is not allowed to purchase some of the products in the cart ...

This would require quite a bit of customization but it can be built into the code ...

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!

8 Jan 2007, 3:20 PM
#3
devdude51 avatar

devdude51

New Zenner

Join Date:
Jan 2007
Posts:
8
Plugin Contributions:
0

Re: Hide products based on country

Thank you for the help - that is what I thought I might need to do. One more question - I haven't been able to find out where to access the code in the system. Can you point me in the right direction. Thanks!

Paul

8 Jan 2007, 3:31 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Hide products based on country

The first place to start is the function that displays the price ...

This is a function used everywhere for "displayed" price ... you can add a case statement to check the customer's country as they would be logged in to see prices ... and if the wrong country then return something like "You snooze you lose" vs the price ... :smile:

The function zen_get_products_display_price is in the:
/includes/functions/functions_prices.php

NOTE: there is not an override for this file ... be sure to save the original and your changed file for future updates ...

Next, you would need to manage the products validation in the checkout_something pages for if the address changes ... and decide is it based on shipping, billing or both addresses ... and that validation would need to remove those products from the cart ...

In the header_php.php files you will see the section marked:
// Validate Cart for checkout

You could include your own validation right after that ...

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!

8 Jan 2007, 11:52 PM
#5
devdude51 avatar

devdude51

New Zenner

Join Date:
Jan 2007
Posts:
8
Plugin Contributions:
0

Re: Hide products based on country

Awesome - thanks for the info. I'll see how far I can get with it now :blink: