Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2005
    Posts
    555
    Plugin Contributions
    4

    Default Disable Payment option if first order, for fraud prevention.. a little help please...

    Code:
    $this->enabled = ((MODULE NAME HERE == 'True') ? true : false);
    
    global $cart;
    if (!IS_ADMIN_FLAG && $_SESSION['cart']->show_total() >= 5000) {
      $this->enabled = false;
    }
    Hello,
    Can anyone help with the above please...
    Credit card fraud is currently rife in Japan, we have reported 5 people to the police here, who basically tell you if we do anything or not, we will not let you know, and you can not follow up.

    Considering we dont even get an incident number or similar, Im pretty sure all their notes, just go through the shredder as soon as we leave, despite them saying yes this is absolutely fraud.

    Im trying to disable a credit card module if its the customers first order, and found the above on the forum which will disable the order if its over a certain value.
    Can anyone please help with the query to find out if its the customers first order...
    More specficically this line ->show_total() >= 5000)

    Thanks in advance.
    My humble contributions....
    Info at a Glance Admin, Alternative Header & Improved Whos Online + Currently working on the next!
    If you have to think..... your obviously looking at the admin :)

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,699
    Plugin Contributions
    9

    Default Re: Disable Payment option if first order, for fraud prevention.. a little help pleas

    you could try something like:

    PHP Code:
    // from
    $this->enabled = ((MODULE NAME HERE == 'True') ? true false);

    global 
    $cart;
    if (!
    IS_ADMIN_FLAG && $_SESSION['cart']->show_total() >= 5000) {
      
    $this->enabled false;
    }
    //to:
    $this->enabled = ((MODULE NAME HERE == 'True') ? true false);

    global 
    $cart$db;
    $customers_orders $db->Execute("SELECT orders_id 
                                                      FROM " 
    TABLE_ORDERS 
                                                      WHERE customers_id = " 
    . (int)$_SESSION['customer_id']);

    if (!
    IS_ADMIN_FLAG && $customers_orders->EOF) {
      
    $this->enabled false;

    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #3
    Join Date
    Jul 2012
    Posts
    16,739
    Plugin Contributions
    17

    Default Re: Disable Payment option if first order, for fraud prevention.. a little help pleas

    If using any production release to date of zen Cart 1.5.x (version was not stated in this thread) then could use the built in function: zen_count_customer_orders to check on the number of orders the customer has had.

    The function has been found in includes/functions/functions_customers.php

    The call could be:
    zen_count_customer_orders($_SESSION['customer_id'])

    And could look like the below using the above code from the OP:
    Code:
    $this->enabled = ((MODULE NAME HERE == 'True') ? true : false);
    
    // global $cart; // <--- the code to the left is not necessary for this portion of the code, can't speak for below all of this. 
    if (!IS_ADMIN_FLAG && zen_count_customer_orders($_SESSION['customer_id'] ?? 0) > 0) {
      $this->enabled = false;
    }
    While I don't really see a specific need to have the fallback to 0 if the customer_id is not set, I included it for those situations where something else has been modified away from default expected code.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Mar 2005
    Posts
    555
    Plugin Contributions
    4

    Default Re: Disable Payment option if first order, for fraud prevention.. a little help pleas

    Excellent, thanks very much will give it a go :)
    My humble contributions....
    Info at a Glance Admin, Alternative Header & Improved Whos Online + Currently working on the next!
    If you have to think..... your obviously looking at the admin :)

  5. #5
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,723
    Plugin Contributions
    124

    Default Re: Disable Payment option if first order, for fraud prevention.. a little help pleas

    Another way to go would be the Optional Payment Method plugin:

    https://www.zen-cart.com/downloads.php?do=file&id=1930
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. Disable Payment option if zero order history? Fraud prevention
    By Reesy in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 8 Jul 2021, 12:17 AM
  2. v154 Disable Check/money order payment option for International orders
    By stug69 in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 6 Jul 2015, 12:16 AM
  3. Help Needed - MaxMind Fraud Prevention
    By lastlokean in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 29 Nov 2012, 12:22 AM
  4. Replies: 1
    Last Post: 14 Oct 2010, 12:33 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR