Skip to content

Instantly share code, notes, and snippets.

@St0iK
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save St0iK/3645aa8415add5fc84d6 to your computer and use it in GitHub Desktop.

Select an option

Save St0iK/3645aa8415add5fc84d6 to your computer and use it in GitHub Desktop.
Magento update script & Updating attributes
<?php
$this->startSetup();
/** Update previous attributes
* S.O.S we need to use frontend_label instead of 'label'
* http://www.webguys.de/magento/eav-attribute-setup/
*
* Column full name instead of column alias on updateAttribute
*
**/
$this->updateAttribute(Mage_Catalog_Model_Category::ENTITY,'seo_title', 'frontend_label', 'SEO Title (Landing page)');
$this->updateAttribute(Mage_Catalog_Model_Category::ENTITY,'seo_text', 'frontend_label', 'SEO Content (Landing page)');
// Add new attributes
$this->addAttribute(Mage_Catalog_Model_Category::ENTITY, 'seo_title_listing', array(
'group' => 'SEO Content',
'input' => 'text',
'type' => 'varchar',
'label' => 'SEO Title (Listing page)',
'backend' => '',
'visible' => true,
'required' => false,
'visible_on_front' => true,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
$this->addAttribute(Mage_Catalog_Model_Category::ENTITY, 'seo_text_listing', array(
'group' => 'SEO Content',
'input' => 'textarea',
'type' => 'text',
'label' => 'SEO Text (Listing page)',
'backend' => '',
'visible' => true,
'required' => false,
'visible_on_front' => true,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
$this->endSetup();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment