Magento has lots of features as an ecommerce application. No doubt that’s why it is too popular too. These days most of the clients (end customers/users) prefer Magento by themselves. But there are some pitfalls within it. Once explore it specialy working as a developer (programmer), you will be in a trouble in such way that you are no more going to use Magento for any purpose because you will stucked in such a problem which neither can be solved nor you can directly change Magento’s code itself. Saying so, I don’t mean that we cannot solve those problems. Indeed we can solve the problems sometimes by hacking the core codes and in the other times by changing some values directly from the database. Since Magento is designed and developed with EAV (Entities, Attributes & Values) model, it is really difficult to find a particular data/value within the database too. And most of the times we extend its features by creating our own modules.

Anyway, here I am going to present a hack to solve a problem.

For SEO friendly URLS, Magento has a field for a Product and Category to create custom SEO friendly URL keys. But when you have multiple stores, then you cannot normally have different URL keys for different stores because the field url_key is ‘GLOBAL’ by default. For products, you can update the url_key attribute’s is_default field to ‘Store Views‘ from Attribute Management. But for the category’s url_key field, you don’t have that option in Magento. But the field does exist in the database with the same attribute code but having different backend_model so you need to go to the database directly and change the ‘is_global’ field 1 to 0.

- First of all, access your Magento database from phpmyadmin (or any MySQL client).
- Then run the following query:

SELECT * FROM eav_attribute WHERE attribute_code LIKE ’%url_key%’;

Then you will have following results:

  • 479 9   url_key NULL    catalog/category_attribute_backend_urlkey   varchar         text    URL key
  • 481 10  url_key NULL    catalog/product_attribute_backend_urlkey    varchar         text    URL key

- First attribute is for the category and second one is for the products. So note down the attribute_id of the first record (in my case 479).
- Then run the following query:

SELECT attribute_id, is_global FROM catalog_eav_attribute WHERE attribute_id=479;

To make sure if it has ’1′ by default or not because ’1′ is the value to make the attribute GLOBAL.

- If it is ’1′ then run the following query to update the value to ’0′:

UPDATE catalog_eav_attribute SET is_global=’0′ WHERE attribute_id=479;

- Now clean the cache and try to edit a category with different stores and see the field URL Key. This will now have ‘Store View’ scope.

Publicado en Artículos

SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction
Sometimes deadlock issues can be caused on the database.

This might happen if you are running a lot of custom scripts and killing the scripts before the database connection gets chance to close

If you login to MySQL from CLI and run the command


Publicado en Artículos

Quiere contactar con nosotros?

Envíenos un Esta dirección de correo electrónico está siendo protegida contra los robots de spam. Necesita tener JavaScript habilitado para poder verlo. o llámenos a (+34) 698 259 856