Results 1 to 10 of 13

Hybrid View

  1. #1
    Join Date
    Apr 2010
    Posts
    39
    Plugin Contributions
    0

    Default Disable COD Payment

    I am wondering if it is possible to disable the COD Payment method for some customers.
    For example, I stand a code at some shipping method so it is not visible when a particular item is in your shopping cart.
    I did this with the following code:

    Code:
          // disable one product for shipping
          if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_id','144') > 0)) { 
              $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'False') ? true : false);
          }
    Is it possible to use this code in the payment methods?
    So that i select on a customers_id.
    And I do not want to select a product, but a logged customer.

    Is this possible ?

  2. #2
    Join Date
    Apr 2014
    Posts
    154
    Plugin Contributions
    0

    Default Re: Disable COD Payment

    Quote Originally Posted by mdo82 View Post
    I am wondering if it is possible to disable the COD Payment method for some customers.
    For example, I stand a code at some shipping method so it is not visible when a particular item is in your shopping cart.
    I did this with the following code:

    Code:
          // disable one product for shipping
          if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_id','144') > 0)) { 
              $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'False') ? true : false);
          }
    Is it possible to use this code in the payment methods?
    So that i select on a customers_id.
    And I do not want to select a product, but a logged customer.

    Is this possible ?
    Yes anything is possible with the code. But you won't use that same code if what you were asking. You would want to check for "$_SESSION['customer_id']". If you have alot of customers to do this for then use "in_array($_SESSION['customer_id'], explode(',', 'the,customer,ids,here'))". And if you wanted to get admin level control, you could add a define in your configuration table so you wouldn't have to go in the files to add more ids or remove some.

  3. #3
    Join Date
    Apr 2010
    Posts
    39
    Plugin Contributions
    0

    Default Re: Disable COD Payment

    Quote Originally Posted by yaritai View Post
    Yes anything is possible with the code. But you won't use that same code if what you were asking. You would want to check for "$_SESSION['customer_id']". If you have alot of customers to do this for then use "in_array($_SESSION['customer_id'], explode(',', 'the,customer,ids,here'))". And if you wanted to get admin level control, you could add a define in your configuration table so you wouldn't have to go in the files to add more ids or remove some.
    I did it as follows:


    Code:
    	if (strstr($_SESSION['customers_id'],'3739')){
          $this->enabled = ((MODULE_PAYMENT_COD_STATUS == '') ? true : false); 
    	}
    This is unfortunately not succeed.
    If someone has an idea.
    I do want to disable this shipping method for 1 customer

  4. #4
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Disable COD Payment

    Quote Originally Posted by mdo82 View Post
    I did it as follows:


    Code:
        if (strstr($_SESSION['customers_id'],'3739')){
          $this->enabled = ((MODULE_PAYMENT_COD_STATUS == '') ? true : false); 
        }
    This is unfortunately not succeed.
    If someone has an idea.
    I do want to disable this shipping method for 1 customer
    Easy fix: Change
    $this->enabled = ((MODULE_PAYMENT_COD_STATUS == '') ? true : false);
    to
    $this->enabled = false ;
    (leave the rest of you code as-is)


    Cheers
    RodG

  5. #5
    Join Date
    Apr 2010
    Posts
    39
    Plugin Contributions
    0

    Default Re: Disable COD Payment

    Quote Originally Posted by RodG View Post
    Easy fix: Change
    $this->enabled = ((MODULE_PAYMENT_COD_STATUS == '') ? true : false);
    to
    $this->enabled = false ;
    (leave the rest of you code as-is)

    Cheers
    RodG

    Thanks for the information.
    Unfortunately will not succeed me.

    I change the file /httpdocs/includes/modules/payment/cod.php, but the option remains.
    I work probably in the wrong file?

    Thanks for the info so far.

  6. #6
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Disable COD Payment

    Quote Originally Posted by mdo82 View Post
    Thanks for the information.
    Unfortunately will not succeed me.

    I change the file /httpdocs/includes/modules/payment/cod.php, but the option remains.
    I work probably in the wrong file?

    Thanks for the info so far.
    It's the right file.

    Q1. Where in the code are you placing your additions?

    Q2. Have you verified that the check for the customerID is matching? (I suggest changing
    if (strstr($_SESSION['customers_id'],'3739')){
    to
    if (!strstr($_SESSION['customers_id'],'3739')){

    .... This will/should cause the *opposite* to what you want... In other words if the code is working it will disable COD for everyone except customer with the id '3739'

    This will verify that the toggle/switch itself is working, which in turn means there is something not working with your customerID check.

    Cheers
    RodG
    Last edited by RodG; 15 Jun 2014 at 04:48 PM.

 

 

Similar Threads

  1. 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
  2. disable cod
    By 100asa in forum General Questions
    Replies: 16
    Last Post: 20 Oct 2011, 05:07 PM
  3. Cod payment
    By Joe1 in forum Addon Payment Modules
    Replies: 0
    Last Post: 16 Apr 2011, 04:25 PM

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