本文整理汇总了PHP中Mage_Eav_Model_Entity_Setup::getAttributeGroupId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Eav_Model_Entity_Setup::getAttributeGroupId方法的具体用法?PHP Mage_Eav_Model_Entity_Setup::getAttributeGroupId怎么用?PHP Mage_Eav_Model_Entity_Setup::getAttributeGroupId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Eav_Model_Entity_Setup
的用法示例。
在下文中一共展示了Mage_Eav_Model_Entity_Setup::getAttributeGroupId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
$installer = $this;
$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$attribute_set_name = 'default';
$group_name = 'General';
$attribute_code = 'salepages';
$attribute_set_id = $installer->getAttributeSetId('catalog_product', $attribute_set_name);
$attribute_group_id = $installer->getAttributeGroupId('catalog_product', $attribute_set_id, $group_name);
$attribute_id = $installer->getAttributeId('catalog_product', $attribute_code);
$installer->addAttributeToSet($entityTypeId = 'catalog_product', $attribute_set_id, $attribute_group_id, $attribute_id);
$installer->endSetup();
示例2: 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();
示例3: array
<?php
/**
* @author Amasty Team
* @copyright Copyright (c) 2015 Amasty (https://www.amasty.com)
* @package Amasty_Xnotif
*/
$installer = new Mage_Eav_Model_Entity_Setup($this->_resourceName);
$installer->startSetup();
$installer->addAttribute('catalog_product', 'amxnotif_hide_alert', array('type' => 'int', 'backend' => '', 'frontend' => '', 'label' => 'Hide Stock Alert Block', 'input' => 'select', 'class' => '', 'source' => 'eav/entity_attribute_source_boolean', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => '', 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'unique' => false, 'is_configurable' => false));
$attributeId = $installer->getAttributeId('catalog_product', 'amxnotif_hide_alert');
foreach ($installer->getAllAttributeSetIds('catalog_product') as $attributeSetId) {
try {
$attributeGroupId = $installer->getAttributeGroupId('catalog_product', $attributeSetId, 'General');
} catch (Exception $e) {
$attributeGroupId = $installer->getDefaultAttributeGroupId('catalog_product', $attributeSetId);
}
$installer->addAttributeToSet('catalog_product', $attributeSetId, $attributeGroupId, $attributeId);
}
$installer->endSetup();
示例4: 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();
示例5: 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();
示例6: array
<?php
$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$catalogProduct = 'catalog_product';
$attributeCode = 'ism_newstoremembers_price';
$setup->addAttribute($catalogProduct, $attribute_code, array('input' => 'text', 'label' => 'Newstore Member Price', 'backend' => '', 'frontend_class' => 'validate-number', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'searchable' => 0, 'filterable' => 0, 'sort_order' => 30, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'is_configurable' => 1, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
//add new attribute in prices attribute set
$groupName = 'prices';
$attributeSetName = 'default';
$attributeSetId = $setup->getAttributeSetId($catalogProduct, $attributeSetName);
$attributeGroupId = $setup->getAttributeGroupId($catalogProduct, $attributeSetId, $groupName);
$attributeId = $setup->getAttributeId($catalogProduct, $attributeCode);
$setup->addAttributeToSet($catalogProduct, $attributeSetId, $attributeGroupId, $attributeId);
$installer->endSetup();
$group = Mage::getModel('customer/group')->setData(array('customer_group_code' => 'Newstore Members Group', 'tax_class' => 3))->save();
Mage::getModel('core/config')->saveConfig('ism_newstore_members/newstore_members_group', "0", 'defaut', $group->getId());
示例7: _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;
}