Load product attributes more performant

Recently I had performance issues when importing several ten tausend products. The problem was, that I always used the “normal” product entity model to load attribute values. The following snippet shows, how to load product attributes directly instead. Therefore I use the product resource singleton.

Option value position (select value sort order)

This Magento shell script sorts the values of a given attribute after the order of values in a given CSV file (sets option value position).

So it is not necessary to set the values via BE-Interface. The value matching to find the respective option-id is done by using the value of the Storeview specified in REFERENCESTORE and the attribute […]

Query Magento database object oriented

Naturally you can query Magento database directly as described in my earlier post about querying Magento database. But a much smarter way is it, to use exiting Magento objects and constructs like that:

This is a simplified version of a function (better to say shell script class) that sets attribute value positions for a certain […]

Get product attribute ID in Magento

This is how to get product EAV attribute ID without querying the database directly:

 

Create database tables in setup scripts

The following snippet shows, how to create database tables in a setup script. It uses no direct queries against the database but the an object oriented way Magento does such things. (This snipped assumes  that your resource setup model is derived from Mage_Core_Model_Resource_Setup)

As you can see, it is also possible to add indexes and […]

Stop running indexes of Magento

Sometimes Magento indexes hang up unexpectedly. They are shown as running in Magento backend but looking at the process status (@see https://www.ask-sheldon.com/list-processes-after-cpu-usage/), you recognize that the respective process doesn’t do anything. Other common problems are, that there are payment transactions failures when price index is running (catalog_product_price @see http://magento.stackexchange.com/questions/260/price-re-index-causes-db-deadlocks-during-checkout) or that the search doesn’t work properly, […]