当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Eav_Model_Entity_Setup::addAttributeGroup方法代码示例

本文整理汇总了PHP中Mage_Eav_Model_Entity_Setup::addAttributeGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Eav_Model_Entity_Setup::addAttributeGroup方法的具体用法?PHP Mage_Eav_Model_Entity_Setup::addAttributeGroup怎么用?PHP Mage_Eav_Model_Entity_Setup::addAttributeGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Eav_Model_Entity_Setup的用法示例。


在下文中一共展示了Mage_Eav_Model_Entity_Setup::addAttributeGroup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addAttributeGroup

 /**
  * Add Attribute Group
  *
  * @param mixed $entityTypeId
  * @param mixed $setId
  * @param string $name
  * @param int $sortOrder
  * @return integer The ID of the last created attribute group
  * @see Mage_Eav_Model_Entity_Setup::addAttributeGroup($entityTypeId, $setId, $name, $sortOrder=null)
  */
 public function addAttributeGroup($entityTypeId, $setId, $name, $sortOrder = null)
 {
     // add the attribute group
     Mage_Eav_Model_Entity_Setup::addAttributeGroup($entityTypeId, $setId, $name, $sortOrder);
     // load the ID of the last created attribute group
     return $this->_conn->lastInsertId();
 }
开发者ID:BGCX067,项目名称:faett-package-svn-to-git,代码行数:17,代码来源:Setup.php

示例2: array

$installer = $this;
$installer->startSetup();
// 1. Install Catalog Category Attributes
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->removeAttribute('catalog_category', 'display_on_homepage');
$entityTypeId = $setup->getEntityTypeId('catalog_category');
$attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $setup->getAttributeGroup($entityTypeId, $attributeSetId, "General Information");
$setup->addAttribute('catalog_category', 'display_on_homepage', array('group' => "General Information", 'input' => 'select', 'type' => 'int', 'label' => 'Display On Homepage?', 'visible' => 1, 'required' => 0, 'source' => 'eav/entity_attribute_source_boolean', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
// 2. Install Catalog Product Attributes
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('catalog_product');
$attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
if (!$setup->getAttributeGroup($entityTypeId, $attributeSetId, "CandyClub Subscription", "attribute_group_id")) {
    $setup->addAttributeGroup($entityTypeId, $attributeSetId, "CandyClub Subscription", 1);
}
$attributeGroupId = $setup->getAttributeGroup($entityTypeId, $attributeSetId, "CandyClub Subscription", "attribute_group_id");
$installer->removeAttribute('catalog_product', 'is_subscription');
$installer->addAttribute('catalog_product', 'is_subscription', array('label' => 'Is Subscription Product?', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'input' => 'boolean', 'type' => 'int', 'unique' => '0', 'required' => '0', 'used_in_product_listing' => '1', 'visible' => '1', 'user_defined' => '1', 'source' => 'eav/entity_attribute_source_boolean', 'note' => ''));
$installer->addAttributeToSet($entityTypeId, $attributeSetId, $attributeGroupId, 'is_subscription');
$installer->removeAttribute('catalog_product', 'qty_multiplier');
$installer->addAttribute('catalog_product', 'qty_multiplier', array('label' => 'Qty Multiplyer', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'input' => 'text', 'type' => 'int', 'unique' => '0', 'required' => '0', 'used_in_product_listing' => '1', 'visible' => '1', 'user_defined' => '1', 'note' => ''));
$installer->addAttributeToSet($entityTypeId, $attributeSetId, $attributeGroupId, 'qty_multiplier');
// 3. Install Order Item Attributes
$setup = new Mage_Sales_Model_Mysql4_Setup();
$setup->getConnection()->dropColumn($setup->getTable("sales/order_item"), "box_id");
$setup->addAttribute("order_item", "box_id", array('type' => 'int'));
$setup->getConnection()->dropColumn($setup->getTable("sales/quote_item"), "box_id");
$setup->addAttribute("quote_item", "box_id", array('type' => 'int'));
$setup->getConnection()->dropColumn($setup->getTable("sales/order_item"), "box_sku");
开发者ID:Rodrifer,项目名称:candyclub,代码行数:30,代码来源:mysql4-install-0.1.1.php

示例3:

 *
 * ==============================================================
 *                 MAGENTO EDITION USAGE NOTICE
 * ==============================================================
 * This package designed for Magento COMMUNITY edition
 * Apptha does not guarantee correct work of this extension
 * on any other Magento edition except Magento COMMUNITY edition.
 * Apptha does not provide extension support in case of
 * incorrect edition usage.
 * ==============================================================
 *
 * @category    Apptha
 * @package     Apptha_Marketplace
 * @version     1.7
 * @author      Apptha Team <developers@contus.in>
 * @copyright   Copyright (c) 2015 Apptha. (http://www.apptha.com)
 * @license     http://www.apptha.com/LICENSE.txt
 * 
 */
/**
 * This file is used to create attribute group
 */
$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
/**
 * Adding attribute group
 */
//Mage_Eav_Model_Entity_Setup   addAttributeGroup  (mixed $entityTypeId, mixed $setId, string $name, [int $sortOrder = null])
$setup->addAttributeGroup('catalog_product', 'Default', 'Custom Attribute', 1000);
$installer->endSetup();
开发者ID:igorvasiliev4,项目名称:magento_code,代码行数:31,代码来源:mysql4-upgrade-1.7.1-1.8.0.php

示例4: array

<?php

/**
 * Created by JetBrains PhpStorm.
 * User: Alesioo
 * Date: 12.12.12
 * Time: 16:24
 * To change this template use File | Settings | File Templates.
 */
/* @var $installer Mage_Core_Model_Resource_Setup */
$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
Mage::getConfig()->saveConfig('cms/wysiwyg/enabled', 'hidden');
/**
 * Adding Different Attributes
 */
$setup->addAttributeGroup('catalog_product', 'Default', 'Video', 1000);
$setup->addAttribute('catalog_product', 'videobox', array('group' => 'Video', 'input' => 'textarea', 'type' => 'text', 'label' => 'Video url 1', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 1, 'note' => 'ex. http://vimeo.com/47480346  or http://www.youtube.com/watch?v=KckzPvtTnkU', 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
$setup->addAttribute('catalog_product', 'customtabtitle', array('group' => 'Custom Tab', 'input' => 'text', 'type' => 'text', 'label' => 'Custom Tab Title', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 1, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
$setup->addAttribute('catalog_product', 'customtab', array('group' => 'Custom Tab', 'input' => 'textarea', 'type' => 'text', 'label' => 'Custom Tab', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 1, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
$installer->endSetup();
开发者ID:jacobfire,项目名称:robotics,代码行数:22,代码来源:mysql4-install-0.1.0.php

示例5: array

 
<?php 
$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
/**
 * Adding Different Attributes
 */
// adding attribute group
$setup->addAttributeGroup('catalog_product', 'Default', 'General', 1000);
// the attribute added will be displayed under the group/tab Special Attributes in product edit page
$setup->addAttribute('catalog_product', 'half_price', array('group' => 'General', 'input' => 'text', 'type' => 'text', 'label' => 'Half Price Text', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 1, 'filterable' => 0, 'comparable' => 1, 'visible_on_front' => 1, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
$installer->endSetup();
开发者ID:bigtailbear14,项目名称:rosstheme,代码行数:12,代码来源:mysql4-upgrade-1.4.0-1.4.1.php

示例6: _updateFamily

 /**
  * Update family
  *
  * @param array $data
  *
  * @return $this
  */
 protected function _updateFamily($data)
 {
     /* @var $model Mage_Catalog_Model_Resource_Eav_Attribute */
     $model = Mage::getModel('catalog/resource_eav_attribute');
     $model->load($data['entity_id']);
     if ($model->hasData()) {
         /* @var $familyModel Pimgento_Family_Model_Import */
         $familyModel = Mage::getModel('pimgento_family/import');
         $groups = $this->getRequest()->getCodes($familyModel->getCode());
         $families = explode(',', $data['families']);
         /* Enable different group per attributeset (family)*/
         $familyGroups = explode(',', $data['group']);
         while (count($familyGroups) < count($families)) {
             $familyGroups[] = $familyGroups[0];
         }
         $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
         foreach ($families as $key => $family) {
             if (isset($groups[$family])) {
                 $groupName = ucfirst($familyGroups[$key]);
                 $setup->addAttributeGroup('catalog_product', $groups[$family], $groupName);
                 $id = $setup->getAttributeGroupId('catalog_product', $groups[$family], $groupName);
                 if ($id) {
                     $setup->addAttributeToSet('catalog_product', $groups[$family], $id, $model->getId());
                 }
             }
         }
     }
     return $this;
 }
开发者ID:nocturnalfrog,项目名称:PIMGento,代码行数:36,代码来源:Import.php

示例7: array

<?php

$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
$setup->addAttributeGroup('catalog_product', 'Default', 'Special Attributes', 1000);
$setup->addAttribute('catalog_product', 'test_attribute', array('group' => 'Special Attributes', 'label' => 'Slide', 'type' => 'int', 'input' => 'select', 'backend' => '', 'frontend' => '', 'source' => 'ainstainer_homepage/source_slide', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => false, 'user_defined' => true, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => true, 'visible_in_advanced_search' => true, 'unique' => false));
$installer->endSetup();
开发者ID:sl231,项目名称:magento.ua,代码行数:8,代码来源:upgrade-0.1.4-0.1.5.php

示例8: array

<?php

$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('catalog_product');
$select = $this->_conn->select()->from($this->getTable('eav/attribute_set'))->where('entity_type_id = :entity_type_id');
$sets = $this->_conn->fetchAll($select, array('entity_type_id' => $entityTypeId));
foreach ($sets as $set) {
    $setup->addAttributeToGroup('catalog_product', $set['attribute_set_id'], 'Prices', 'res_prices');
    $setup->addAttributeGroup('catalog_product', $set['attribute_set_id'], 'Inventory');
    $setup->addAttributeToGroup('catalog_product', $set['attribute_set_id'], 'Inventory', 'payperrentals_quantity');
    $setup->addAttributeToGroup('catalog_product', $set['attribute_set_id'], 'Inventory', 'payperrentals_use_serials');
    $setup->addAttributeToGroup('catalog_product', $set['attribute_set_id'], 'Inventory', 'res_serialnumbers');
}
$installer->endSetup();
开发者ID:hueyl77,项目名称:fourwindsgear,代码行数:16,代码来源:mysql4-upgrade-1.1.2-1.1.3.php

示例9: array

<?php

$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
/**
 * Adding Different Attributes
 */
// adding attribute group
$setup->addAttributeGroup('catalog_product', 'Default', 'Bundle Option', 3);
// the attribute added will be displayed under the group/tab Special Attributes in product edit page
$setup->addAttribute('catalog_product', 'isbundle', array('group' => 'Bundle Option', 'input' => 'boolean', 'type' => 'int', 'label' => 'Is Bundle', 'backend' => '', 'visible' => 0, 'required' => 0, 'user_defined' => 1, 'searchable' => 0, 'filterable' => 0, 'comparable' => 1, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
$installer->endSetup();
开发者ID:KinesthetixAnalytics,项目名称:massoft,代码行数:13,代码来源:mysql4-install-0.1.0.php

示例10: array

<?php

$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
/**
 * Add the custom product attributes 
 */
$entityTypeId = Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId();
// workspace preference
$setup->addAttribute($entityTypeId, 'web2print_workspace_preference', array('group' => 'Chili Web2print', 'input' => 'text', 'type' => 'text', 'label' => 'Workspace preference', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'unique' => false, 'apply_to' => 'simple,configurable,virtual,bundle,downloadable', 'is_configurable' => false, 'frontend' => 'web2print/entity_attribute_frontend_resourcebrowser', 'note' => 'Workspaces'));
// view preference
$setup->addAttribute($entityTypeId, 'web2print_view_preference', array('group' => 'Chili Web2print', 'input' => 'text', 'type' => 'text', 'label' => 'View preference', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'unique' => false, 'apply_to' => 'simple,configurable,virtual,bundle,downloadable', 'is_configurable' => false, 'frontend' => 'web2print/entity_attribute_frontend_resourcebrowser', 'note' => 'ViewPreferences'));
// document constraints
$setup->addAttribute($entityTypeId, 'web2print_document_constraint', array('group' => 'Chili Web2print', 'input' => 'text', 'type' => 'text', 'label' => 'Document constraints', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'unique' => false, 'apply_to' => 'simple,configurable,virtual,bundle,downloadable', 'is_configurable' => false, 'frontend' => 'web2print/entity_attribute_frontend_resourcebrowser', 'note' => 'DocumentConstraints'));
/**
 * Add the custom category attributes 
 */
$categoryTypeId = Mage::getModel('eav/entity')->setType('catalog_category')->getTypeId();
// add attribute group
$categoryTypeId = $installer->getEntityTypeId('catalog_category');
$attributeSetId = $installer->getDefaultAttributeSetId($categoryTypeId);
$setup->addAttributeGroup($categoryTypeId, $attributeSetId, 'Chili Web2Print', 5);
// workspace preference
$setup->addAttribute($categoryTypeId, 'web2print_workspace_preference', array('group' => 'Chili Web2print', 'input' => 'text', 'type' => 'text', 'label' => 'Workspace preference', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'frontend' => 'web2print/entity_attribute_frontend_resourcebrowser', 'note' => 'Workspaces'));
$setup->addAttribute($categoryTypeId, 'web2print_view_preference', array('group' => 'Chili Web2print', 'input' => 'text', 'type' => 'text', 'label' => 'View preference', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'frontend' => 'web2print/entity_attribute_frontend_resourcebrowser', 'note' => 'ViewPreferences'));
$setup->addAttribute($categoryTypeId, 'web2print_document_constraint', array('group' => 'Chili Web2print', 'input' => 'text', 'type' => 'text', 'label' => 'Document constraints', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'frontend' => 'web2print/entity_attribute_frontend_resourcebrowser', 'note' => 'DocumentConstraints'));
$installer->endSetup();
开发者ID:finelinePG,项目名称:finelink-dev,代码行数:28,代码来源:mysql4-upgrade-0.1.0-0.1.1.php

示例11: array

$config = array('position' => 1, 'required' => 0, 'label' => 'Comprimento (cm)', 'type' => 'int', 'input' => 'text', 'apply_to' => 'simple,bundle,grouped,configurable', 'note' => 'Comprimento da embalagem do produto (Para cálculo dos Correios)');
$setup->addAttribute('catalog_product', $codigo, $config);
// Add volume to prduct attribute set
$codigo = 'volume_altura';
$config = array('position' => 1, 'required' => 0, 'label' => 'Altura (cm)', 'type' => 'int', 'input' => 'text', 'apply_to' => 'simple,bundle,grouped,configurable', 'note' => 'Altura da embalagem do produto (Para cálculo dos Correios)');
$setup->addAttribute('catalog_product', $codigo, $config);
// Add volume to prduct attribute set
$codigo = 'volume_largura';
$config = array('position' => 1, 'required' => 0, 'label' => 'Largura (cm)', 'type' => 'int', 'input' => 'text', 'apply_to' => 'simple,bundle,grouped,configurable', 'note' => 'Largura da embalagem do produto (Para cálculo dos Correios)');
$setup->addAttribute('catalog_product', $codigo, $config);
$codigo = 'postmethods';
$config = array('position' => 1, 'required' => 0, 'label' => 'Serviços de Entrega', 'type' => 'text', 'input' => 'multiselect', 'source' => 'pedroteixeira_correios/source_postMethods', 'backend' => 'eav/entity_attribute_backend_array', 'apply_to' => 'simple,bundle,grouped,configurable', 'note' => 'Selecione os serviços apropriados para o produto.');
$setup->addAttribute('catalog_product', $codigo, $config);
$codigo = 'fit_size';
$config = array('position' => 1, 'required' => 0, 'label' => 'Diferença do Encaixe (cm)', 'type' => 'varchar', 'input' => 'text', 'apply_to' => 'simple,bundle,grouped,configurable', 'note' => 'Exemplo: Se 1 item mede 10cm de altura, e 2 itens encaixados medem 11cm. A diferença é de 1cm.');
$setup->addAttribute('catalog_product', $codigo, $config);
$codigo = 'posting_days';
$config = array('position' => 1, 'required' => 0, 'label' => 'Prazo de Postagem', 'type' => 'int', 'input' => 'text', 'apply_to' => 'simple,bundle,grouped,configurable', 'note' => 'O prazo total é o Prazo dos Correios acrescido do maior Prazo de Postagem dos produtos no carrinho.');
$setup->addAttribute('catalog_product', $codigo, $config);
// Add Correios Tab
$setIds = $setup->getAllAttributeSetIds('catalog_product');
$attributes = array('volume_comprimento', 'volume_altura', 'volume_largura', 'postmethods', 'fit_size', 'posting_days');
foreach ($setIds as $setId) {
    $setup->addAttributeGroup('catalog_product', $setId, 'Correios', 2);
    $groupId = $setup->getAttributeGroupId('catalog_product', $setId, 'Correios');
    foreach ($attributes as $attribute) {
        $attributeId = $setup->getAttributeId('catalog_product', $attribute);
        $setup->addAttributeToGroup('catalog_product', $setId, $groupId, $attributeId);
    }
}
$installer->endSetup();
开发者ID:rafaelpatro,项目名称:correios,代码行数:31,代码来源:install-4.7.0.php

示例12: createLightSpeedAttributeSet

 public function createLightSpeedAttributeSet()
 {
     // Find the Default Product attribute set.
     $collection = Mage::getResourceModel('eav/entity_attribute_set_collection')->setEntityTypeFilter($this->getProductEntityTypeId()->getId())->addFieldToFilter('attribute_set_name', 'Default');
     $default_attribute_set = $collection->getFirstItem();
     // Create a attribute set called "LIGHTSPEED_PRODUCT_ATTRIBUTE_SET" based off of the Default product attribute set.
     $lightspeed_attribute_set_name = "LIGHTSPEED_PRODUCT_ATTRIBUTE_SET";
     $attrSet = Mage::getModel('eav/entity_attribute_set');
     $attrSet->setAttributeSetName($lightspeed_attribute_set_name);
     $attrSet->setEntityTypeId($this->getProductEntityTypeId()->getId());
     try {
         $attrSet->save();
     } catch (Mage_Core_Exception $e) {
         $this->_fault('filters_invalid', $e->getMessage());
     }
     $attrSet = $attrSet->initFromSkeleton($default_attribute_set->getId());
     $attrSet->save();
     $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
     // Create a group called LIGHTSPEED_ATTRIBUTES for the
     $setup->addAttributeGroup('catalog_product', $attrSet->getId(), 'LIGHTSPEED_ATTRIBUTES');
     $attrSet->save();
     // Create the attributes to be put into the LIGHTSPEED_ATTRIBUTES group.
     $product_colour_code = 'LIGHTSPEED_PRODUCT_COLOR';
     $product_size_code = 'LIGHTSPEED_PRODUCT_SIZE';
     $this->createAttribute($product_colour_code, 'Color');
     // Colour is spelt Color, the American way.
     $this->createAttribute($product_size_code, 'Size');
     $attribute_group = $setup->getAttributeGroup('catalog_product', $attrSet->getId(), 'LIGHTSPEED_ATTRIBUTES');
     $colour_attribute = $setup->getAttribute('catalog_product', $product_colour_code);
     $size_attribute = $setup->getAttribute('catalog_product', $product_size_code);
     $attrSet->save();
     // Add attributes to attribute set.
     $setup->addAttributeToSet($entityTypeId = 'catalog_product', $attrSet->getId(), $attribute_group['attribute_group_id'], $colour_attribute['attribute_id']);
     $setup->addAttributeToSet($entityTypeId = 'catalog_product', $attrSet->getId(), $attribute_group['attribute_group_id'], $size_attribute['attribute_id']);
     return $attrSet->getId();
 }
开发者ID:macosxvn,项目名称:techheroes,代码行数:36,代码来源:Api.php

示例13: array

<?php

/**
 * Dc_BrandManager
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 *
 * @category   Dc
 * @package    Dc_BrandManager
 * @copyright  Copyright (c) 2012-2015 Damián Culotta. (http://www.damianculotta.com.ar/)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttributeGroup(Mage_Catalog_Model_Category::ENTITY, 'Default', 'Extra Options', 10);
$_attribute_set_id = $setup->getDefaultAttributeSetId(Mage_Catalog_Model_Category::ENTITY);
$_attribute_group_id = $setup->getAttributeGroupId(Mage_Catalog_Model_Category::ENTITY, $_attribute_set_id, 'Extra Options');
$setup->addAttribute('catalog_category', 'brand_icon', array('type' => 'varchar', 'backend' => 'catalog/category_attribute_backend_image', 'frontend' => '', 'label' => 'Brand Icon', 'input' => 'image', 'class' => '', 'source' => '', 'global' => 0, 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'default' => 0, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 1, 'unique' => 0, 'position' => 1));
$setup->addAttributeToGroup(Mage_Catalog_Model_Category::ENTITY, $_attribute_set_id, $_attribute_group_id, 'brand_icon', '10');
$installer->endSetup();
开发者ID:perichus,项目名称:magento-dc-brandmanager,代码行数:25,代码来源:upgrade-0.1.0-0.2.0.php

示例14: array

<?php

$installer = $this;
$installer->startSetup();
// 1. Install Catalog Product Attributes
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('catalog_product');
$attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
if (!$setup->getAttributeGroup($entityTypeId, $attributeSetId, "CandyClub Catalog", "attribute_group_id")) {
    $setup->addAttributeGroup($entityTypeId, $attributeSetId, "CandyClub Catalog", 1);
}
$attributeGroupId = $setup->getAttributeGroup($entityTypeId, $attributeSetId, "CandyClub Catalog", "attribute_group_id");
$installer->removeAttribute('catalog_product', 'most_popular');
$installer->addAttribute('catalog_product', 'most_popular', array('label' => 'Most Popular', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'input' => 'boolean', 'type' => 'int', 'unique' => '0', 'required' => '0', 'used_in_product_listing' => '1', 'visible' => '1', 'user_defined' => '1', 'source' => 'eav/entity_attribute_source_boolean', 'note' => ''));
$installer->addAttributeToSet($entityTypeId, $attributeSetId, $attributeGroupId, 'most_popular');
$installer->removeAttribute('catalog_product', 'best_value');
$installer->addAttribute('catalog_product', 'best_value', array('label' => 'Best Value', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'input' => 'boolean', 'type' => 'int', 'unique' => '0', 'required' => '0', 'used_in_product_listing' => '1', 'visible' => '1', 'user_defined' => '1', 'source' => 'eav/entity_attribute_source_boolean', 'note' => ''));
$installer->addAttributeToSet($entityTypeId, $attributeSetId, $attributeGroupId, 'best_value');
$installer->removeAttribute('catalog_product', 'seal');
$installer->addAttribute('catalog_product', 'seal', array('group' => 'Images', 'label' => 'Seal', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'input' => 'media_image', 'type' => 'varchar', 'unique' => '0', 'required' => '0', 'used_in_product_listing' => '1', 'visible' => '1', 'user_defined' => '1', 'note' => '', 'frontend' => 'catalog/product_attribute_frontend_image'));
//$installer->addAttributeToSet($entityTypeId, $attributeSetId, $attributeGroupId, 'seal');
$installer->removeAttribute('catalog_product', 'subscription_plan');
$installer->addAttribute('catalog_product', 'subscription_plan', array('label' => 'Subscription Plan', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'input' => 'text', 'type' => 'varchar', 'unique' => '0', 'required' => '0', 'used_in_product_listing' => '1', 'visible' => '1', 'user_defined' => '1', 'note' => ''));
$installer->addAttributeToSet($entityTypeId, $attributeSetId, $attributeGroupId, 'subscription_plan');
$installer->removeAttribute('catalog_product', 'retail_value');
$installer->addAttribute('catalog_product', 'retail_value', array('label' => 'Retail Value', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'input' => 'price', 'type' => 'decimal', 'unique' => '0', 'required' => '0', 'used_in_product_listing' => '1', 'visible' => '1', 'user_defined' => '1', 'note' => '', 'backend_model' => 'catalog/product_attribute_backend_price'));
$installer->addAttributeToSet($entityTypeId, $attributeSetId, $attributeGroupId, 'retail_value');
$installer->removeAttribute('catalog_product', 'you_save');
$installer->addAttribute('catalog_product', 'you_save', array('label' => 'You Save', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'input' => 'text', 'type' => 'varchar', 'unique' => '0', 'required' => '0', 'used_in_product_listing' => '1', 'visible' => '1', 'user_defined' => '1', 'note' => ''));
$installer->addAttributeToSet($entityTypeId, $attributeSetId, $attributeGroupId, 'you_save');
$installer->endSetup();
开发者ID:Rodrifer,项目名称:candyclub,代码行数:31,代码来源:mysql4-upgrade-0.1.1-0.1.2.php

示例15: array

Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
/**
 * Adding a lookup table for Divido
 */
$conn = $installer->getConnection();
$lookup_table = $conn->newTable($installer->getTable('callback/lookup'));
$lookup_table->addColumn('lookup_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), 'Id')->addColumn('salt', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false), 'Salt')->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('nullable' => false, 'unsigned' => true), 'Quote ID');
$lookup_table->addIndex($installer->getIdxName('callback/lookup', array('quote_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), array('quote_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE));
$conn->createTable($lookup_table);
/**
 * Adding Divido attributes to products
 */
$groupName = 'Divido';
$entityTypeId = $setup->getEntityTypeId('catalog_product');
$defaultAttrSetId = $setup->getDefaultAttributeSetId($entityTypeId);
// adding attribute group
$setup->addAttributeGroup($entityTypeId, $defaultAttrSetId, $groupName, 1000);
$groupId = $setup->getAttributeGroupId($entityTypeId, $defaultAttrSetId, $groupName);
// Add attributes
$planOptionAttrCode = 'divido_plan_option';
$setup->addAttribute($entityTypeId, $planOptionAttrCode, array('label' => 'Available on finance', 'type' => 'varchar', 'input' => 'select', 'backend' => 'eav/entity_attribute_backend_array', 'frontend' => '', 'source' => 'pay/source_option', 'default' => 'default_plans', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => true, 'user_defined' => true, 'searchable' => true, 'filterable' => false, 'comparable' => false, 'visible_on_front' => true, 'unique' => false));
$planOptionAttrId = $setup->getAttributeId($entityTypeId, $planOptionAttrCode);
$setup->addAttributeToGroup($entityTypeId, $defaultAttrSetId, $groupId, $planOptionAttrId, null);
$planSelectionAttrCode = 'divido_plan_selection';
$setup->addAttribute($entityTypeId, $planSelectionAttrCode, array('label' => 'Selected plans', 'type' => 'varchar', 'input' => 'multiselect', 'backend' => 'eav/entity_attribute_backend_array', 'frontend' => '', 'source' => 'pay/source_defaultprodplans', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => false, 'user_defined' => true, 'searchable' => true, 'filterable' => false, 'comparable' => false, 'visible_on_front' => true, 'unique' => false));
$planSelectionAttrId = $setup->getAttributeId($entityTypeId, $planSelectionAttrCode);
$setup->addAttributeToGroup($entityTypeId, $defaultAttrSetId, $groupId, $planSelectionAttrId, null);
$installer->endSetup();
开发者ID:DividoFinancialServices,项目名称:divido-magento,代码行数:31,代码来源:mysql4-install-0.1.0.php


注:本文中的Mage_Eav_Model_Entity_Setup::addAttributeGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。