0

I'm facing some issues with orders placed by bots.

enter image description here

I noticed that all orders are made by a specific phone number and also by a specific street. So I looked for a way to block orders that are made with that phone number or this street.

I found the following link https://www.ashsmith.io/2012/12/making-use-of-observers-in-magento/.
I followed the steps to create an observer with the event sales_order_place_before, to compare the parameters sent in the order to the parameters that I want to block.

  1. I created the file Blockbots_Observer.xml on /html/app/etc/modules;
  2. I created the file Config.xml on /html/app/code/local/Blockbots/Observer/etc;
  3. Finally, I created the file Observer.php on /html/app/code/local/Blockbots/Observer/Model;

After all these steps, the implementation did not work (I am still receiving orders from bots).

Here is the code on files:

Blockbots_observer.xml: enter image description here

Config.xml: enter image description here

Observer.php: enter image description here

What could be wrong with implementation? Any idea how I can fix it?

2
  • Use Webfirewall that is the best solution.You have to prevent the bot at network level, not Application Level
    – Amit Bera
    Commented Jul 16, 2019 at 14:12
  • This is not a suitable fix, as bots often come in swarms with each having its own address. We have the same issue, bot swarms 'tasting' credit cards on our store, always using the same address but each having a different IP.
    – Caleb
    Commented Mar 16, 2020 at 13:28

1 Answer 1

0

block the bot ip Address range from accessing your website.

in .htaccess file:

order allow,deny
deny from yourparticularip

or you can do it in your index.php

$banned = array('xx.xxx.x.x');
if(in_array($_SERVER['REMOTE_ADDR'], $banned))
{
exit();
}

here is the reference:https://bobcares.com/blog/magento-block-ip-address/

1
  • This is not a suitable response to this issue, as bots usually come from many different IP addresses. Block the street, zip, or phone number of an individual scammer is the easiest way to block them.
    – Caleb
    Commented Mar 16, 2020 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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