Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Dec 2010
    Posts
    6
    Plugin Contributions
    0

    customer issue Disable product for some countries.

    Hello i need major help with this. Please move this topic if i post in wrong place.

    I've got a product that is now legal to sell in sweden but legal in all other countries. Can i disable so Swedish persons can't order just this particular product?

    I also want to say that im a very green when it comes to coding so if you have a solution please explain it for me =)

  2. #2
    Join Date
    Dec 2010
    Posts
    6
    Plugin Contributions
    0

    Default Re: Disable product for some countries.

    bump (sorry this is urgent)

  3. #3
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Disable product for some countries.

    If you look at the function file:
    /includes/functions/functions_general.php

    and find the function zen_get_buy_now_button ...

    you will see the code comments:
    Code:
    // 0 = normal shopping
    // 1 = Login to shop
    // 2 = Can browse but no prices
    before the default code:
    Code:
            default:
            // proceed normally
            break;
    add the new case statements and change that to read:
    Code:
    // cannot be added to the cart
    //do not show if not logged in
    case ($_SESSION['customer_id'] < 1 && $product_id == 12):
    return '<a href="' . zen_href_link(FILENAME_LOGIN, '', 'SSL') . '">' .  TEXT_LOGIN_TO_SHOP_BUTTON_REPLACE . '</a>';
    break;
    case ($_SESSION['customer_country_id'] == 204 && $product_id == 12):
    return 'Invalid Switzerland';
    break;
    and can add the code:
    Code:
    
    // cannot be added to the cart
    //do not show if not logged in
    case ($_SESSION['customer_id'] < 1 && $product_id == 12):
    return '<a href="' . zen_href_link(FILENAME_LOGIN, '', 'SSL') . '">' .  TEXT_LOGIN_TO_SHOP_BUTTON_REPLACE . '</a>';
    break;
    case ($_SESSION['customer_country_id'] == 204 && $product_id == 12):
    return 'Invalid Switzerland';
    break;
    
            default:
            // proceed normally
            break;
    Now the customer has to be:
    1 logged in to add products_id 12 to the cart

    2 once logged in, they must NOT be from Switzerland
    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!

  4. #4
    Join Date
    Dec 2010
    Posts
    6
    Plugin Contributions
    0

    Default Re: Disable product for some countries.

    Can you please change the code for SWEDEN ?

    Thanks!

  5. #5
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Disable product for some countries.

    If you look up the Country Switzerland, you will see that its countries_id is 204 ...

    If you look up the Country Sweden, you will see that its countries_id is 203 ...

    So, to adapt the code for another country the customer_country_id needs to be tested against that Country's countries_id ...
    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!

 

 

Similar Threads

  1. v151 Only allow certain shipping methods for some countries?
    By doooomed in forum Built-in Shipping and Payment Modules
    Replies: 8
    Last Post: 1 Oct 2013, 12:30 AM
  2. Disable UPS Ground for some states?
    By brushwoodnursery in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 19 Nov 2011, 05:48 PM
  3. UK & Some EU Countries for Shipping, Help Required
    By Kennym in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 19 Jul 2010, 03:43 PM
  4. force shipping type by item, limiting some product to certain countries
    By fishingmaniac in forum Built-in Shipping and Payment Modules
    Replies: 22
    Last Post: 7 Jan 2010, 12:02 AM
  5. Shipping, Free for some, different countries
    By atsak in forum Built-in Shipping and Payment Modules
    Replies: 10
    Last Post: 10 Sep 2007, 04:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg