Thread: disable cod

Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    634
    Plugin Contributions
    0

    Default disable cod

    into products table I'm add a new field named products_fornitore, so I can add the name of my supplier into the admin products. How can I disable shipping methods only for certain products (ie products_fornitore=abc?)?
    Thanks a lot.

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

    Default Re: Changing shipping methods based on item weight??

    There is a function in the shopping_cart class that you can use to count how many are in the cart based on a field in the products table, example to get the number of Products with products_fornitore=abc you could use:
    Code:
    $chk_abc = $_SESSION['cart']->in_cart_check('products_fornitore', 'abc');
    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!

  3. #3
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    634
    Plugin Contributions
    0

    Default Re: Changing shipping methods based on item weight??

    You're simply great!
    all works fine with this script:
    PHP Code:
    // escludi il porto assegnato per abc
    $chk_abc $_SESSION['cart']->in_cart_check('products_fornitore''abc');

          if ( (
    $this->enabled == true) && ( $chk_abc != 'abc' ) ) $this->enabled false;


      } 

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

    Default Re: Changing shipping methods based on item weight??

    While it may work for you ... it doesn't make a lot of sense as $chk_abc should be a value ...

    The only reason it might work is that 'abc' would evaluate to 0 ...
    $chk_abc != 'abc'

    see if changing that to:
    $chk_abc != 0

    works as well ...
    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. #5
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    634
    Plugin Contributions
    0

    Default Re: Changing shipping methods based on item weight??

    but for other products with different 'products_fornitore' it works well.
    My other question is: if I have more than 1 'products_fornitore' to check?
    it: it would to ceck if products_fornitore is = abc, or bba or ggt

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

    Default Re: Changing shipping methods based on item weight??

    You can test each one:
    Code:
    $chk_xyz = $_SESSION['cart']->in_cart_check('products_fornitore', 'xyz');
    I use the variable $chk_xyz to match the thing I am looking for just for clarity and so I have a count for that particular number of Products in the shopping_cart for the tested value ...

    I could use $fred as the variable but that isn't very clear in 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!

  7. #7
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    634
    Plugin Contributions
    0

    Default disable cod

    I've added a field into db, named products_fornitore, that I change by admin.
    I would disable cod only when products_fornitore is "motorola".
    Is it possible? What modify I made into cod.php file?
    Thanks a lot.

  8. #8
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    634
    Plugin Contributions
    0

    Default Re: disable cod

    is it possible to disable cod only for certain customer (based on email)?

  9. #9
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    634
    Plugin Contributions
    0

    Default Re: Changing shipping methods based on item weight??

    I would disable cash on delivery only for certain customer (based on email).
    I've just try with
    $chk_abc = $_SESSION['cart']->in_cart_check(''customers_email_address', '[email protected]');

    if ( ($this->enabled == true) && ( $chk_abc != '[email protected]' ) ) $this->enabled = false;


    }

    but it don't work. Help me with a suggestion

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

    Default Re: Changing shipping methods based on item weight??

    The cart does not hold the email address ...

    You can use the:
    Code:
    global $order;
    $chk_abc = $order->customer['email_address'];
    then proceed from 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!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Disable COD Payment
    By mdo82 in forum Built-in Shipping and Payment Modules
    Replies: 12
    Last Post: 18 Jun 2014, 01:18 PM
  2. v139h Disable COD When Customer Opts for USPS?
    By bi11i in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 17 Dec 2012, 12:04 PM
  3. v150 Need some Help in COD. COD fee depending on order price
    By bratsangels in forum Built-in Shipping and Payment Modules
    Replies: 20
    Last Post: 16 Sep 2012, 12:53 PM
  4. Cod
    By godspeed27 in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 25 Jun 2006, 05:28 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