Magneto 1 – Customer database full of spam

So, one day, I noticed one of my servers was sending a ton of emails out to dodgy looking ….@mail.ru   or  ….@list.ru  addresses.  UH OH!

At first I thought the mail server on my webserver had been compromised. On further investigation I managed to see to that the contents of these mails were account registration validation emails.  Looking in the Magento admin (Customers>Manage Customers) I saw them…thousands of new customer registrations – with Russian copy in the name fields and, on the whole [something]@mail.ru  or  [something]@list.ru   addresses but also some with [something]@gmail.com.

Continue reading Magneto 1 – Customer database full of spam

Magento 1.9x Write to Custom Log File

To write information to your own custom log file, say to trace errors in a custom module, track odd behaviour or record that a certain event has happened, you use Mage::log()

Mage::log(‘<WHAT TO WRITE IN THE LOG>’, null, ‘FILENAME.log’, true);

If you want to log the output of an array, use print_r but with the second parameter set to true – this converts the output to a string.

e.g. Mage::log(print_r($myArray,true), null, ‘FILENAME.log’, true);

Magento: Get store address, phone number or other config information

Here is how to get the the store config information for the phone number:

<?php echo Mage::getStoreConfig(‘general/store_information/phone’);?>

And for the address:

<?php echo Mage::getStoreConfig(‘general/store_information/address’);?>

In fact you can get all sorts of interesting “config” data out using this  getStoreConfig method.

Continue reading Magento: Get store address, phone number or other config information

Mysql: Change the full text index minimum word length

So you are trying to do a fulltext search but your searches for “cat” or “dog” always return zero results, even though you have articles all about cats and dogs. By default the minimum search text length for full index searches is 4 characters, anything less than that returns nothing, zip, nada, jack-all.  You need to change the minimum word length.

This can throw people using something like Magento whose product types or names are short, such as “bag”,”cup”, or “mug”.  The problem isn’t actually in Magento but a server setting. You might be kind of stuck if you are using a shared hosting environment – you can contact your hosting service and ask nicely.

Continue reading Mysql: Change the full text index minimum word length

Magento Cookies not Working in Chrome or Opera on Frontend

So, I was testing the “this site is using cookies” functionality in Magento. It worked fine on a local environment but failed to work on a test “live” IP address site. I say failed, but it worked fine in IE and Firefox whereas in Chrome hitting the “I agree to cookies” button didn’t set a cookie and redirected. I eventually solved it. Continue reading Magento Cookies not Working in Chrome or Opera on Frontend