Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    711
    Plugin Contributions
    0

    Default Hundreds of Visitors with Large Carts

    Hi All,
    Running 1.5.5e on PHP7. Wondering if there's a way to prevent this from happening. I'm getting hundreds of international visitors with hundreds of items in their basket. I would imagine it's taking a toll on the server be-it a small one but a toll none the less. I'm not so much concerned about that at this point, just irritated by the traffic showing up in who's online and user tracking.

    Thank You, John

  2. #2
    Join Date
    Jul 2012
    Posts
    14,858
    Plugin Contributions
    17

    Default Re: Hundreds of Visitors with Large Carts

    So as you may know, the ability of real/live visitors to add product to their cart (and purchase) is not directly prevented by such "imaginary" customers possibly placing all available product in their cart. First one to check out wins. So yes, just affecting resources and "observations" of the site traffic.

    Such "international" traffic is unfortunately common, but also may be coming from one of the potentially "trouble" areas. It could also be a regular bot's way of indexing. Thing is, whatever is visiting is not providing information that ZC can use to classify the visit as coming from a spider. Basically, to not see that traffic in the who's online and user tracking areas, the visitor has to not be counted as a session deserving visitor. This can be through the filters that ZC provides and the associated spiders.txt file and/or as a rule to accessing the server (cPanel or htaccess) to block a specific list of visitors (though this list may need to periodically be updated and considered in the event a valid customer may be in the affected area(s)).
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  3. #3
    Join Date
    Aug 2009
    Location
    North Idaho, USA
    Posts
    1,836
    Plugin Contributions
    1

    Default Re: Hundreds of Visitors with Large Carts

    On some of those International visitors, we use DrByte's 'block bad bot' plugin when we can identify a specific User-Agent that we choose to be not important for our business purpose.
    Rick
    ChainWeavers (dot) com

  4. #4
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    711
    Plugin Contributions
    0

    Default Re: Hundreds of Visitors with Large Carts

    Yeah, they aren't registering as bots, each have different user agents and 99% of them are international. Unfortunately some are originating from countries which are currently in the ConfigServer Firewall CC_DENY list. So, it's just been a game of deleting each session that I see and blocking the IP in htaccess, but they seem to have an unlimited supply of IP's.

  5. #5
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    711
    Plugin Contributions
    0

    Default Re: Hundreds of Visitors with Large Carts

    I have written a solution! Create a database table by running following sql

    Code:
    CREATE TABLE `bannedIPS` (
      `id` int(11) NOT NULL,
      `banip` varchar(16) NOT NULL DEFAULT ''
    );
    then in includes/templates/YOUR_TEMPLATE/common/html_header.php
    just below the lines
    Code:
    $zco_notifier->notify('NOTIFY_HTML_HEAD_START', $current_page_base, $template_dir);
    
    // Prevent clickjacking risks by setting X-Frame-Options:SAMEORIGIN
    header('X-Frame-Options:SAMEORIGIN');
    add

    Code:
    //BOF Bot Cart Builder Stopper
    $visitorIP = $_SERVER['REMOTE_ADDR'];
        
    if(sizeof($_SESSION['cart']->get_products()) > 50){
        $db->Execute("INSERT INTO bannedIPS (banip) VALUES ('" . $visitorIP . "')");
    }
    
    $bannedIPLQ = $db->Execute("SELECT * FROM bannedIPS");
    $bannedIPS = array();
    while(!$bannedIPLQ->EOF){
        $bannedIPS[] = trim($bannedIPLQ->fields['banip']);
        $bannedIPLQ->MoveNext();
    }
    
    if(in_array($visitorIP, $bannedIPS)){
        header('location:https://www.google.com');
    }
    //EOF Bot Cart Builder Stopper
    The number 50 can be changed to whatever suits your site best. This is the count of the total number of different products currently in the visitors cart. They can still have 100 of an individual product, but can't have more than 50 different products. We have (in 10 years) never had a customer purchase 50 different products at one time, but I know that each business is different.

    Thanks, John

  6. #6
    Join Date
    Aug 2009
    Posts
    355
    Plugin Contributions
    0

    Default Re: Hundreds of Visitors with Large Carts

    your solution might turn out very useful to me one day. Thank you!

  7. #7
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    6,823
    Plugin Contributions
    94

    Default Re: Hundreds of Visitors with Large Carts

    Maybe randomize the number 50 so that it's between (say) 35 and 50, so they don't figure out your algorithm so quickly.
    That Software Guy, Plugin Moderator. Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Contributions: Quantity Discounts, Better Together, SMS on Sale, Gift Wrap at Checkout, and more.

  8. #8
    Join Date
    Feb 2007
    Location
    Pennsylvania
    Posts
    711
    Plugin Contributions
    0

    Default Re: Hundreds of Visitors with Large Carts

    SWGuy. Good call! See revised code...

    Code:
    //BOF Bot Cart Builder Stopper
    $visitorIP = $_SERVER['REMOTE_ADDR'];
    
    //set min and max values here
    $itemsInBasket = rand(35, 50);
    
    if(sizeof($_SESSION['cart']->get_products()) > $itemsInBasket){
        $db->Execute("INSERT INTO bannedIPS (banip) VALUES ('" . $visitorIP . "')");
    }
    
    $bannedIPLQ = $db->Execute("SELECT * FROM bannedIPS");
    $bannedIPS = array();
    while(!$bannedIPLQ->EOF){
        $bannedIPS[] = trim($bannedIPLQ->fields['banip']);
        $bannedIPLQ->MoveNext();
    }
    
    if(in_array($visitorIP, $bannedIPS)){
        header('location:https://www.google.com');
        http_response_code(404);
        die();
    }
    //EOF Bot Cart Builder Stopper
    Thanks, John

 

 

Similar Threads

  1. v139h Large Store with large # of Categories - better to Link or Copy Products?
    By Emily1972 in forum Basic Configuration
    Replies: 1
    Last Post: 31 May 2012, 11:52 AM
  2. Problem with "Keep Cart" add-on w/ very large carts
    By bodyjewelrystores in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 2 Aug 2011, 04:53 PM

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