Forums / Built-in Shipping and Payment Modules / COD only apply to certain user group

COD only apply to certain user group

Locked

Views: 1,600

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
21 Oct 2010, 10:14 AM
#1
yosemirza avatar

yosemirza

New Zenner

Join Date:
Aug 2009
Posts:
25
Plugin Contributions:
0

COD only apply to certain user group

Need some help. I am wondering if COD payment can be applied only to certain user group. Thanks

21 Oct 2010, 4:47 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: COD only apply to certain user group

You could customize the payment module and change the:
$this->enabled

to false when the customer is not in the right Group ...

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!

21 Oct 2010, 4:55 PM
#3
yosemirza avatar

yosemirza

New Zenner

Join Date:
Aug 2009
Posts:
25
Plugin Contributions:
0

Re: COD only apply to certain user group

Thanks Linda for quick reply.

Could you give some example code. I am not so sure how to do.

Here is the code I see on cod payment module.

        if ($check_flag == false) {
          $this->enabled = false;
        }
      }

// disable the module if the order only contains virtual products
      if ($this->enabled == true) {
        if ($order->content_type != 'physical') {
          $this->enabled = false;
        }
      }
    }

Thank you

21 Oct 2010, 5:51 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: COD only apply to certain user group

You could customize the code in the COD Payment module for:
/includes/modules/payment/cod.php

by using:

      if ((int)MODULE_PAYMENT_COD_ORDER_STATUS_ID > 0) {
        $this->order_status = MODULE_PAYMENT_COD_ORDER_STATUS_ID;
      }

// bof: only show for group_id = 2
      global $db;
      $chk_group_query = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
      if ($chk_group_query->fields['customers_group_pricing'] != 2) {
        $this->enabled = false;
      }
// eof: only show for group_id = 2

      if (is_object($order)) $this->update_status();

Just check the group_id for what Group you want this to work for and set it where I have it set to 2 ...

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!

21 Oct 2010, 6:01 PM
#5
yosemirza avatar

yosemirza

New Zenner

Join Date:
Aug 2009
Posts:
25
Plugin Contributions:
0

Re: COD only apply to certain user group

It is working perfectly...Thank you for your great help Linda..

21 Oct 2010, 6:12 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: COD only apply to certain user group

You are most welcome ... thanks for the update that this customizaiton of the COD Payment module to only show for one Customer Group using the Group Pricing was able to work for you ... :smile:

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!