Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2012
    Posts
    213
    Plugin Contributions
    1

    Idea or Suggestion enable a payment option when condition is meet

    I want to enable the online-bank payment option only when admin orders as customer via place order button .

    IS IT possible ? IF it is , then what is the process /logic ?

    Please Advice ,

    Thanks in advance

    Regards
    Diptimoy

  2. #2
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: enable a payment option when condition is meet

    Modify the payment module to only be enabled when the IP address is that of the admin.

    As a quick fix you can hard code it directly into the module...
    ----------

    As a better more flexible version
    I add a new key to the module to hold a list of admin IP addresses
    PHP Code:
         $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Admin IP\'s to allow access', 'MODULE_PAYMENT_PHONEORDER_ADMINIP', '123.123.123.123', 'Enter the Admin IP\'s that are allowed to access this module.<br />Separate multiple IP\'s with a comma.<br />No Spaces.', '6', '60', now());"); 
    Then I add something like this to the module to disable if not from an admin IP
    PHP Code:
    // disable if NOT accessed from an ADMIN IP address
          
    if (!in_array($_SESSION['customers_ip_address'], explode(',',MODULE_PAYMENT_PHONEORDER_ADMINIP))) {
            
    $this->enabled false;
          } 
    nb: You need to edit the code to suit your module, cannot use as it

  3. #3
    Join Date
    Apr 2012
    Posts
    213
    Plugin Contributions
    1

    Idea or Suggestion Re: enable a payment option when condition is meet

    Quote Originally Posted by gilby View Post
    Modify the payment module to only be enabled when the IP address is that of the admin.

    As a quick fix you can hard code it directly into the module...
    ----------

    As a better more flexible version
    I add a new key to the module to hold a list of admin IP addresses
    PHP Code:
         $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Admin IP\'s to allow access', 'MODULE_PAYMENT_PHONEORDER_ADMINIP', '123.123.123.123', 'Enter the Admin IP\'s that are allowed to access this module.<br />Separate multiple IP\'s with a comma.<br />No Spaces.', '6', '60', now());"); 
    Then I add something like this to the module to disable if not from an admin IP
    PHP Code:
    // disable if NOT accessed from an ADMIN IP address
          
    if (!in_array($_SESSION['customers_ip_address'], explode(',',MODULE_PAYMENT_PHONEORDER_ADMINIP))) {
            
    $this->enabled false;
          } 
    nb: You need to edit the code to suit your module, cannot use as it


    Thank you very much . want to know will this logic be same if admin has dynamic IP or it has nothing to do with IP being static or dynamic

  4. #4
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: enable a payment option when condition is meet

    Quote Originally Posted by diptimoy View Post
    Thank you very much . want to know will this logic be same if admin has dynamic IP or it has nothing to do with IP being static or dynamic
    Well the admin users IP has to be listed in the mod for it to work

    Dynamic IP suggests you get a different IP each time you connect to the internet
    That would be difficult to work with.

    I have an ADSL line that is listed as a Dynamic IP
    It has never altered in the 10 years I have had it

    Whereas my mobile phone get different IP addresses all the time

  5. #5
    Join Date
    Sep 2008
    Posts
    220
    Plugin Contributions
    0

    Default Re: enable a payment option when condition is meet

    Quote Originally Posted by gilby View Post
    Well the admin users IP has to be listed in the mod for it to work

    Dynamic IP suggests you get a different IP each time you connect to the internet
    That would be difficult to work with.

    I have an ADSL line that is listed as a Dynamic IP
    It has never altered in the 10 years I have had it

    Whereas my mobile phone get different IP addresses all the time
    is this solution to the problem only by checking IP adress? Because if the IP changes, then i have to change my ip before making this work. Isnt there any other solutions?

  6. #6
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: enable a payment option when condition is meet

    Quote Originally Posted by navido View Post
    is this solution to the problem only by checking IP adress? Because if the IP changes, then i have to change my ip before making this work. Isnt there any other solutions?
    There could be other solutions, but A bit more context will help us.
    How are you mainly accessing the admin?
    Is it via an ADSL connection?
    or a mobile phone (sim) connection?
    via Fixed computer, hand held device?
    from the same location? or are you constantly mobile?

  7. #7
    Join Date
    Sep 2008
    Posts
    220
    Plugin Contributions
    0

    Default Re: enable a payment option when condition is meet

    I access admin allways from my laptop.
    it is from an ADSL connection yes. Not a mobile phone. It is a fixed computer.

    Mostly two locations..but when i am abroad on a trip i need it there also.

  8. #8
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: enable a payment option when condition is meet

    Quote Originally Posted by navido View Post
    I access admin allways from my laptop.
    it is from an ADSL connection yes. Not a mobile phone. It is a fixed computer.

    Mostly two locations..but when i am abroad on a trip i need it there also.
    OK, thanks
    I use the IP address as I want to "confine" access to specific computers in a specific room.
    You could still use this while you are "home"
    While "away" you would need to change the IP address for the mod. Takes about 30 seconds as it is visible in the admin header, so you could cut and paste this IP address and paste it into the payment module via the admin.

    Otherwise I would suggest setting a session variable in the "login as customer" mod
    So when you use this mod this session variable is "set"
    and then this can be checked against a set value in the payment module, similar to the code above.
    This ties the payment module to the use of the login as customer module (anywhere)

    It is do-able but I have NOT tried this as I don't require it.

 

 

Similar Threads

  1. v138a Which plugin can meet the payment of bank transfer?
    By fanisme in forum Addon Payment Modules
    Replies: 1
    Last Post: 28 Feb 2013, 06:22 PM
  2. How to Enable Payment Method when Total is Zero?
    By Decostyle in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 26 Oct 2009, 06:09 PM
  3. Customer gets discount when choose a certain payment option?
    By Kruna in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 13 Oct 2009, 02:24 PM
  4. How prevent auto-selection of payment option when only 1 payment option available
    By DogTags in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 3 Jun 2006, 01:24 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