Here you go, a simple function that retrieves all products in a collection and then loops over them and deletes them 🙂

Mind you this is horribly slow 😛

So I am busy writing an import script and had imported some 3000 products already when I decided to test a new configurable in the browser. Turns out it was giving a 404 so I decided to reindex catalog_url using the command line:

After a while I got a Magento indexer.php out of memory error which is strange because I have this server specifically setup for this import with a royal 3GB memory limit in php.ini.

So I checked out indexer.php to see what it was doing and it includes abstract.php. There, I found this function:

The first line looks for a .htaccess in the Magento root folder and proceeds to load anything starting with php_value. And guess what I found in said .htaccess file:

What the hell is that doing there, and why the frack is a shell script loading that??!?!?!
Fixed with a simple # infront of said line and my indexing proceeded without problems…

A lot of times when you’re working with Magento you will want to get a Magento attribute id by name/label because you need to use ids instead of values in many places. A lot of tutorials on the net will tell you to log into the admin section and look at the url to discover an attribute’s id. This, of course, is not going to work for you if you are trying to write imports/whatnot. So I went on a search and eventually came up with this little function. It’s pretty darn simple but it does the job. You are free to use the 2 lines of code that really matter anywhere in Magento but I like to write functions and this one went into a helper for example.

manufacturer-attribute-id

 

 

Just need to store this somewhere in case I need it again for work. This config will sync a (Magento) website to another server and exclude a few directories as well.

Lsyncd.conf

Lsyncd.exclude

Then we need to increase inotify.max_user_watches since we are dealing with a huge site (for after reboot):

And add at the end:

To change the running server without rebooting (this is not permanent unless to you changed sysctl.conf as well!)