1

I write because I wanted to see if it was possible to enable a type of payment method like the "check / money order" just for a specific group of customers.

My idea was to enable, from the backend, the "check / money order", then go to the file that showed on the checkout page and then hide it with an if in php.

My question was, in what page I can set the if?

Otherwise to show this type of payment only for a specific group of customers how could I do?

Thanks for any help

2

You need to add your field by a custom system.xml which adds this field and you need to observe the event payment_method_is_activedeclared in Mage_Payment_Model_Method_Abstract line 660-675. In your observer you need to do the check for the allowed customer groups. Or you use the following extension: https://github.com/riconeitzel/PaymentFilter

| improve this answer | |
  • There is a good guide where I can follow precisely these passages? The extension, for now, I prefer not to use it. Thank you. – Gabriel91 May 11 '16 at 15:20
  • 1
    You can have a look into the code of the extension. However it assigns the payment methods to customer groups (which is a more generic approach), see https://github.com/riconeitzel/PaymentFilter/blob/master/app/code/community/RicoNeitzel/PaymentFilter/Block/Adminhtml/Group/Form.php and for the filtering see https://github.com/riconeitzel/PaymentFilter/blob/master/app/code/community/RicoNeitzel/PaymentFilter/Model/Observer.php lines 144-174. – luemic May 11 '16 at 15:25
  • The two links are not valid...Could you paste it again please? Thanks. – Gabriel91 May 11 '16 at 15:28
  • Strange direct linking to the files does not work. Hoever if you open the link to the extension above] you can navigate to the files. – luemic May 11 '16 at 15:40
  • Or you can look here: magento.stackexchange.com/questions/33047/… – luemic May 11 '16 at 15:45
0

SOLUTION: Past this code in app/code/core/Mage/Payment/Model/Method/Checkmo.php

$isLoggedIn = Mage::getSingleton('customer/session')->isLoggedIn();
/* If customer is logged in */
if($isLoggedIn) :
    /* Get the logged in customer's group ID */
    $customerGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
    /* Check if the logged in customer's group ID matches with the ID you are after */
    /* Customer group IDs are listed against each group under Admin > Customers > Customer Groups */
    if($customerGroupId == 8) :

    ****Content of class Mage_Payment_Model_Method_Checkmo extends Mage_Payment_Model_Method_Abstract****

endif;
endif;

in this way the type of payment can be viewed only customer ID group that you want .

| improve this answer | |
  • I have two payment gateway, one payment gateway for one dedicated customer, how to add condition for that. eg: Arun (arun@gmail) can able to pay via both payment gateway other customer only one payment gateway to pay. – zus Jan 21 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.