I'm facing some issues with orders placed by bots.
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.
- I created the file Blockbots_Observer.xml on /html/app/etc/modules;
- I created the file Config.xml on /html/app/code/local/Blockbots/Observer/etc;
- 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?
-
Use Webfirewall that is the best solution.You have to prevent the bot at network level, not Application LevelAmit Bera– Amit Bera ♦2019年07月16日 14:12:04 +00:00Commented 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– Caleb2020年03月16日 13:28:02 +00:00Commented Mar 16, 2020 at 13:28
1 Answer 1
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/
-
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– Caleb2020年03月16日 13:29:28 +00:00Commented Mar 16, 2020 at 13:29
Explore related questions
See similar questions with these tags.