Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2007
    Posts
    8
    Plugin Contributions
    0

    Default Restricted access to Payment Modules

    Hi :)

    Is the following possible (without lots of if..then..else PHP code) ?

    I'm in the UK and want to take card payments using Nochex whenever possible. The Nochex APC module works great and the checkout system procedure looks professional.

    Alas, Nochex have a limit of £100 per transaction, and is only available to UK buyers unless I open a Merchant account (which at £50 is beyond my means until the shop starts to pay for itself!).

    So, whilst I'm happy to keep PayPal as an option for all buyers, I need Nochex to disappear from the payment types if the buyer is non-UK or the cart value is more than £100.

    Any ideas? :D

    Cheers,
    Gavin.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Restricted access to Payment Modules

    Two things to do:

    1. Create a Zone Definition for UK only. Be sure to add UK-AllZones to its details.
    Edit your nochex payment module settings via the admin->modules page, and select your UK zone in the Payment Zone field to restrict the module to only work if the customers' address matches the defined zone.

    2. Edit the PHP file for your nochex payment module.
    In it you'll find a line that says:
    Code:
          if ($check_flag == false) {
    Add the line shown below above that line, so that it looks like this:
    Code:
          if ($_SESSION['currency'] == 'GBP' && $currencies->value($_SESSION['cart']->total, true, 'GBP') > 100 ) $check_flag = false;
          if ($check_flag == false) {
    This should restrict it so that if the cart's value is greater than 100 GBP, the module will be disabled.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Dec 2007
    Posts
    8
    Plugin Contributions
    0

    Default Re: Restricted access to Payment Modules

    Quote Originally Posted by DrByte View Post
    Two things to do:
    Wow you're a star - I'll be sure to give that a go, thanks!

    I did a bunch of these kind of things a few years back with osCommerce (can't even remember its old name now) but I've long forgotten it all - thanks for the leg-up :)
    Last edited by gdhgdh; 3 Jan 2008 at 09:18 PM. Reason: typos

  4. #4
    Join Date
    Dec 2007
    Posts
    8
    Plugin Contributions
    0

    Default Re: Restricted access to Payment Modules

    Lovely job.

    For the purposes of reference, the only thing that needed to be added here was to amend the start of the function thusly:

    function update_status() {
    global $order, $db, $currencies;

    i.e. adding $currencies, else you get a PHP non-member object error

    Thanks again :)

  5. #5
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Restricted access to Payment Modules

    Yes - correct - good catch.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Dec 2007
    Posts
    8
    Plugin Contributions
    0

    Default Re: Restricted access to Payment Modules

    Heh, almost there - found an edge case... it's only checking the value of the cart contents, not including shipping.. so if the cart is £99 and shipping pushes it over 100, Nochex payment will fail...

    If $currencies->value($_SESSION['cart']->total is purely the cart contents minus shipping, how do I get the shipping value?

 

 

Similar Threads

  1. v139f access to database restricted by host
    By buildingblocks in forum General Questions
    Replies: 4
    Last Post: 5 May 2014, 01:02 AM
  2. Restricted Access?
    By seakwatkins in forum General Questions
    Replies: 11
    Last Post: 13 Sep 2011, 06:34 AM
  3. Products New Field/Restricted Access/Disable Payment
    By yakbuttertea in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 9 Mar 2009, 08:26 AM
  4. admin user with restricted access
    By pasher in forum General Questions
    Replies: 3
    Last Post: 20 Nov 2007, 04:40 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