Wednesday, May 30, 2012

Magento - Position of validate message

Once I had a problem with position of the validate message "This is a required field." which should be close of hidden field. I need to add validation to some block, but it was from outside the parent blocks of input element. I was looking for how it work, and found simple solution: parent block should has CSS class «field-row».

<span class="field-row">
<input class="required-entry" id="some_id" type="hidden" />
</span>

Wednesday, May 23, 2012

Magento - error on recover data from backup

When I made backup of Magento (v1.5) and recover data from this backup then I got following error:

Magento: Recoverable Error: Argument 1 passed to Mage_Core_Model_Store::setWebsite() must be an instance of Mage_Core_Model_Website


I found solution (on this page):

SET FOREIGN_KEY_CHECKS=0;
UPDATE `core_store` SET store_id = 0 WHERE code='admin';
UPDATE `core_store_group` SET group_id = 0 WHERE name='Default';
UPDATE `core_website` SET website_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';
SET FOREIGN_KEY_CHECKS=1;