本文整理汇总了PHP中Mage_Eav_Model_Entity_Setup类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Eav_Model_Entity_Setup类的具体用法?PHP Mage_Eav_Model_Entity_Setup怎么用?PHP Mage_Eav_Model_Entity_Setup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Eav_Model_Entity_Setup类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: catalogProductPrepareSave
public function catalogProductPrepareSave($event)
{
$productData = $event->getRequest()->getPost('product');
if ($productData) {
foreach (Mage::helper('davidjordan_lazyloadingoption')->getAttributeCodes() as $attributeCode) {
if (empty($productData[$attributeCode])) {
$post = $event->getRequest()->getPost();
if (!empty($post['product']["{$attributeCode}_visible_input"])) {
$label = $post['product']["{$attributeCode}_visible_input"];
$attributeModel = Mage::getModel('catalog/resource_eav_attribute')->loadByCode(4, $attributeCode);
$foundVal = array_reduce($attributeModel->getSource()->getAllOptions(false), function ($acc, $val) use($label) {
return $acc ?: ($val['label'] == $label ? $val['value'] : $acc);
}, "");
if ($foundVal) {
$productData[$attributeCode] = $foundVal;
} else {
$setup = new Mage_Eav_Model_Entity_Setup('core_write');
$setup->addAttributeOption(array('attribute_id' => $attributeModel->getId(), 'values' => array($label)));
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
$optionValueId = $connection->lastInsertId();
$optionId = $connection->fetchOne("SELECT option_id FROM " . $setup->getTable('eav/attribute_option_value') . " WHERE value_id = ?", $optionValueId);
$productData[$attributeCode] = $optionId;
}
$event->getProduct()->setData($attributeCode, $productData[$attributeCode]);
} elseif ($origData = $event->getProduct()->getOrigData($attributeCode)) {
$event->getProduct()->setData($attributeCode, $origData);
}
}
}
}
}
开发者ID:suspiciousfellow,项目名称:Lazyloadingoption,代码行数:31,代码来源:Observer.php
示例2: _addAttributeToAttributeSet
protected function _addAttributeToAttributeSet($attributeSetId, $attributeCode)
{
$setup = new \Mage_Eav_Model_Entity_Setup('core_setup');
$attributeId = $setup->getAttributeId('catalog_product', $attributeCode);
$attributeGroupId = $setup->getDefaultAttributeGroupId('catalog_product', $attributeSetId);
$setup->addAttributeToSet('catalog_product', $attributeSetId, $attributeGroupId, $attributeId);
}
开发者ID:eniuz,项目名称:EAVCleaner,代码行数:7,代码来源:MessdataCommand.php
示例3: createAttribute
public function createAttribute($object)
{
$attributeId = Mage::getModel('eav/entity_attribute')->getIdByCode('catalog_product', $object['attribute_code']);
if ($attributeId) {
Mage::getModel('eav/entity_attribute')->load($attributeId)->delete();
}
$model = Mage::getModel('catalog/resource_eav_attribute');
$data = array('attribute_code' => $object['attribute_code'], 'attribute_model' => $object['attribute_model'], 'backend_model' => $object['backend_model'], 'backend_type' => $object['backend_type'], 'backend_table' => $object['backend_table'], 'frontend_model' => $object['frontend_model'], 'frontend_input' => $object['frontend_input'], 'frontend_label' => $object['frontend_label'], 'frontend_class' => $object['frontend_class'], 'source_model' => $object['source_model'], 'is_required' => $object['is_required'], 'is_user_defined' => $object['is_user_defined'], 'default_value' => $object['default_value'], 'is_unique' => $object['is_unique'], 'note' => $object['note'], 'frontend_input_renderer' => $object['frontend_input_renderer'], 'is_global' => $object['is_global'], 'is_visible' => $object['is_visible'], 'is_searchable' => $object['is_searchable'], 'is_filterable' => $object['is_filterable'], 'is_comparable' => $object['is_comparable'], 'is_visible_on_front' => $object['is_visible_on_front'], 'is_html_allowed_on_front' => $object['is_html_allowed_on_front'], 'is_used_for_price_rules' => $object['is_used_for_price_rules'], 'is_filterable_in_search' => $object['is_filterable_in_search'], 'used_in_product_listing' => $object['used_in_product_listing'], 'used_for_sort_by' => $object['used_for_sort_by'], 'is_configurable' => $object['is_configurable'], 'apply_to' => $object['apply_to'], 'is_visible_in_advanced_search' => $object['is_visible_in_advanced_search'], 'position' => $object['position'], 'is_wysiwyg_enabled' => $object['is_wysiwyg_enabled'], 'is_used_for_promo_rules' => $object['is_used_for_promo_rules']);
$model->addData($data);
$model->setEntityTypeId($this->typeId);
try {
$model->save();
echo $model->getAttributeCode() . " ..........................ok. ID: " . $model->getId() . "\n";
$model->setSourceModel($object['source_model']);
// TODO: check why need it, and how fix it for right set source_model
$model->save();
} catch (Exception $ex) {
echo "Error: " . $ex->getMessage() . "\n";
}
//add attribute options
if (empty($object['options'])) {
echo "Model " . $model->getAttributeCode() . " saved ..........................ok. \n";
return;
}
$option['attribute_id'] = $model->getId();
foreach ($object['options'] as $opt) {
$option['value']['option'][0] = $opt;
//mage::d($option); //die;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttributeOption($option);
}
echo "Model " . $model->getAttributeCode() . " saved. options added ..........................ok. \n";
}
开发者ID:CherylMuniz,项目名称:fashion,代码行数:33,代码来源:lensattrs_a.php
示例4: _prepareCollection
/**
* prepare collection for block to display
*
* @return Magestore_Customerattribute_Block_Adminhtml_Customerattribute_Grid
*/
protected function _prepareCollection()
{
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('customer');
$tbl_faq_item = Mage::getSingleton('core/resource')->getTableName('customerattribute/customerattribute');
$collection = Mage::getResourceModel('eav/entity_attribute_collection')->setEntityTypeFilter($entityTypeId);
$collection->getSelect()->join(array('table_attribute' => $tbl_faq_item), 'main_table.attribute_id=table_attribute.attribute_id');
$this->setCollection($collection);
return parent::_prepareCollection();
}
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:15,代码来源:Grid.php
示例5: addoptions
/**
* Create attribute options
*
* @param string $attributeId
* @param array $attributeOptions
* @return int
*/
public function addoptions($attributeId, $attributeOptions)
{
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
foreach ($attributeOptions as $label) {
$option = array();
$option['attribute_id'] = $attributeId;
$option['value'] = array(array(0 => $label));
$setup->addAttributeOption($option);
}
return true;
}
开发者ID:adrianoaguiar,项目名称:magja-catalog-ext,代码行数:18,代码来源:Api.php
示例6: deletarAtributo
public function deletarAtributo($id_opcao)
{
$attribute_code = Mage::getStoreConfig('cores/config/codigo_cor');
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', $attribute_code);
$options = $attribute->getSource()->getAllOptions();
$option_id = $id_opcao;
$options['delete'][$option_id] = true;
$options['value'][$option_id] = true;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttributeOption($options);
}
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:11,代码来源:Cores.php
示例7: getAttributeList
public function getAttributeList()
{
if (!self::$_attributes) {
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$attrs = Vikont_Data2data_Helper_Db::getTableValues('eav/attribute', array('attribute_id', 'attribute_code'), array('entity_type_id=' . self::getEntityTypeId()));
foreach ($attrs as $attr) {
$data = $setup->getAttribute(self::getEntityTypeId(), $attr['attribute_id']);
self::$_attributes[$attr['attribute_code']] = array('backend' => $data['backend_model'], 'type' => $data['backend_type'], 'table' => $data['backend_table'], 'frontend' => $data['frontend_model'], 'input' => $data['frontend_input'], 'label' => $data['frontend_label'], 'frontend_class' => $data['frontend_class'], 'source' => $data['source_model'], 'required' => $data['is_required'], 'user_defined' => $data['is_user_defined'], 'default' => $data['default_value'], 'unique' => $data['is_unique'], 'note' => $data['note'], 'global' => $data['is_global']);
}
}
return self::$_attributes;
}
开发者ID:rcclaudrey,项目名称:dev,代码行数:12,代码来源:Category.php
示例8: _prepareColumns
protected function _prepareColumns()
{
$this->addColumn('real_order_id', array('header' => Mage::helper('sales')->__('Order #'), 'width' => '80px', 'type' => 'text', 'index' => 'increment_id'));
if (!Mage::app()->isSingleStoreMode()) {
$this->addColumn('store_id', array('header' => Mage::helper('sales')->__('Purchased From (Store)'), 'index' => 'store_id', 'type' => 'store', 'store_view' => true, 'display_deleted' => true));
}
$this->addColumn('created_at', array('header' => Mage::helper('sales')->__('Purchased On'), 'index' => 'created_at', 'type' => 'datetime', 'width' => '100px'));
$this->addColumn('billing_name', array('header' => Mage::helper('sales')->__('Bill to Name'), 'index' => 'billing_name'));
$this->addColumn('shipping_name', array('header' => Mage::helper('sales')->__('Ship to Name'), 'index' => 'shipping_name'));
// Add Column Customer Attribute to Order grid create by Hoatq
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('customer');
$tbl_faq_item = Mage::getSingleton('core/resource')->getTableName('customerattribute/customerattribute');
$models = Mage::getModel('customer/attribute')->getCollection();
$models->getSelect()->join(array('table_attribute' => $tbl_faq_item), 'main_table.attribute_id=table_attribute.attribute_id');
//->addFieldToFilter('main_table.attribute_id',$customerattributeId);
$models->addFieldToFilter('show_on_grid_order', 1);
$i = 0;
if ($i == 0) {
foreach ($models as $model) {
$index = 'customer_' . $model->getAttributeCode();
$frontend_input = $model->getFrontendInput();
if ($frontend_input != 'file' && $frontend_input != 'image') {
if ($frontend_input == 'boolean') {
$this->addColumn($index, array('header' => Mage::helper('sales')->__('Customer ' . str_replace('_', ' ', $model->getAttributeCode())), 'index' => $index, 'align' => 'center', 'type' => 'options', 'options' => array(0 => 'No', 1 => 'Yes')));
} elseif ($frontend_input == 'multiselect') {
$this->addColumn($index, array('header' => Mage::helper('sales')->__('Customer ' . str_replace('_', ' ', $model->getAttributeCode())), 'index' => $index, 'align' => 'center', 'type' => 'options', 'options' => Mage::helper('customerattribute')->getOptions($show['attribute_id']), 'renderer' => 'Magestore_Customerattribute_Block_Adminhtml_Sales_Order_Renderer_Multiselect', 'filter' => false));
} elseif ($frontend_input == 'select') {
$this->addColumn($index, array('header' => Mage::helper('sales')->__('Customer ' . str_replace('_', ' ', $model->getAttributeCode())), 'index' => $index, 'type' => 'options', 'options' => Mage::helper('customerattribute')->getOptions($model->getId())));
} elseif ($frontend_input == 'date') {
$this->addColumn($index, array('header' => Mage::helper('sales')->__('Customer ' . str_replace('_', ' ', $model->getAttributeCode())), 'index' => $index, 'type' => 'date', 'format' => Mage::helper('customerattribute')->getDateFormat1(), 'filter' => false));
} else {
$this->addColumn($index, array('header' => Mage::helper('sales')->__('Customer ' . str_replace('_', ' ', $model->getAttributeCode())), 'index' => $index));
}
}
}
$i++;
}
// -----------------------------------
$this->addColumn('base_grand_total', array('header' => Mage::helper('sales')->__('G.T. (Base)'), 'index' => 'base_grand_total', 'type' => 'currency', 'currency' => 'base_currency_code'));
$this->addColumn('grand_total', array('header' => Mage::helper('sales')->__('G.T. (Purchased)'), 'index' => 'grand_total', 'type' => 'currency', 'currency' => 'order_currency_code'));
$this->addColumn('status', array('header' => Mage::helper('sales')->__('Status'), 'index' => 'status', 'type' => 'options', 'width' => '70px', 'options' => Mage::getSingleton('sales/order_config')->getStatuses()));
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
$this->addColumn('action', array('header' => Mage::helper('sales')->__('Action'), 'width' => '50px', 'type' => 'action', 'getter' => 'getId', 'actions' => array(array('caption' => Mage::helper('sales')->__('View'), 'url' => array('base' => '*/sales_order/view'), 'field' => 'order_id')), 'filter' => false, 'sortable' => false, 'index' => 'stores', 'is_system' => true));
}
$this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
return $this;
}
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:50,代码来源:Grid.php
示例9: _prepareColumns
protected function _prepareColumns()
{
$i = 0;
$this->addColumn('entity_id', array('header' => Mage::helper('customerattribute')->__('ID'), 'align' => 'right', 'width' => '50px', 'index' => 'entity_id'));
$this->addColumn('name', array('header' => Mage::helper('customerattribute')->__('Name'), 'align' => 'left', 'width' => '150px', 'index' => 'name'));
$this->addColumn('email', array('header' => Mage::helper('customerattribute')->__('Email'), 'align' => 'left', 'width' => '150px', 'index' => 'email'));
$groups = Mage::getResourceModel('customer/group_collection')->addFieldToFilter('customer_group_id', array('gt' => 0))->load()->toOptionHash();
$this->addColumn('group', array('header' => Mage::helper('customerattribute')->__('Group'), 'width' => '100', 'index' => 'group_id', 'type' => 'options', 'options' => $groups));
if ($i == 0) {
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('customer');
$tbl_faq_item = Mage::getSingleton('core/resource')->getTableName('customerattribute/customerattribute');
$shows = Mage::getModel('customer/attribute')->getCollection();
$shows->getSelect()->join(array('table_attribute' => $tbl_faq_item), 'main_table.attribute_id=table_attribute.attribute_id')->order('sort_order ASC');
//->addFieldToFilter('main_table.attribute_id',$customerattributeId);
$shows->addFieldToFilter('show_on_grid_customer', 1);
foreach ($shows as $show) {
if ($show['frontend_input'] == 'select') {
$this->addColumn($show['attribute_code'], array('header' => Mage::helper('customerattribute')->__($show['frontend_label']), 'align' => 'left', 'type' => 'options', 'options' => Mage::helper('customerattribute')->getOptions($show['attribute_id']), 'index' => $show['attribute_code']));
} else {
if ($show['frontend_input'] == 'multiselect') {
$this->addColumn($show['attribute_code'], array('header' => Mage::helper('customerattribute')->__($show['frontend_label']), 'align' => 'left', 'type' => 'options', 'options' => Mage::helper('customerattribute')->getOptions($show['attribute_id']), 'index' => $show['attribute_code'], 'renderer' => 'Magestore_Customerattribute_Block_Adminhtml_Managecustomer_Renderer_Multiselect', 'filter_condition_callback' => array($this, '_multiSelectFilter')));
} else {
if ($show['frontend_input'] == 'image') {
$this->addColumn($show['attribute_code'], array('header' => Mage::helper('customerattribute')->__($show['frontend_label']), 'align' => 'center', 'type' => 'image', 'width' => 60, 'index' => $show['attribute_code'], 'renderer' => 'Magestore_Customerattribute_Block_Adminhtml_Managecustomer_Renderer_Image', 'filter' => false));
} else {
if ($show['frontend_input'] == 'boolean') {
$this->addColumn($show['attribute_code'], array('header' => Mage::helper('customerattribute')->__($show['frontend_label']), 'align' => 'left', 'type' => 'options', 'options' => array(0 => 'No', 1 => 'Yes'), 'index' => $show['attribute_code']));
} else {
if ($show['frontend_input'] == 'file') {
$this->addColumn($show['attribute_code'], array('header' => Mage::helper('customerattribute')->__($show['frontend_label']), 'align' => 'left', 'type' => 'image', 'index' => $show['attribute_code'], 'renderer' => 'Magestore_Customerattribute_Block_Adminhtml_Managecustomer_Renderer_File', 'filter' => false));
} else {
if ($show['frontend_input'] == 'date') {
$this->addColumn($show['attribute_code'], array('header' => Mage::helper('customerattribute')->__($show['frontend_label']), 'align' => 'left', 'type' => 'datetime', 'gmtoffset' => true, 'index' => $show['attribute_code'], 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM)));
} else {
$this->addColumn($show['attribute_code'], array('header' => Mage::helper('customerattribute')->__($show['frontend_label']), 'align' => 'left', 'type' => $show['frontend_input'], 'index' => $show['attribute_code']));
}
}
}
}
}
}
}
$i++;
}
$this->addColumn('action', array('header' => Mage::helper('customerattribute')->__('Action'), 'width' => '100px', 'type' => 'action', 'getter' => 'getId', 'actions' => array(array('caption' => Mage::helper('customerattribute')->__('Edit'), 'url' => array('base' => 'adminhtml/customer/edit'), 'field' => 'id')), 'filter' => false, 'sortable' => false, 'index' => 'stores', 'is_system' => true));
$this->addExportType('*/*/exportCsv', Mage::helper('customerattribute')->__('CSV'));
$this->addExportType('*/*/exportXml', Mage::helper('customerattribute')->__('XML'));
return parent::_prepareColumns();
}
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:50,代码来源:Grid.php
示例10: getAttributeLabel
public function getAttributeLabel($data)
{
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('customer');
$tbl_faq_item = Mage::getSingleton('core/resource')->getTableName('customerattribute/customerattribute');
$customerAttribute = Mage::getResourceModel('eav/entity_attribute_collection')->setEntityTypeFilter($entityTypeId);
$customerAttribute->getSelect()->join(array('table_attribute' => $tbl_faq_item), 'main_table.attribute_id=table_attribute.attribute_id');
$customerAttribute->addFieldToFilter('table_attribute.is_custom', 1);
$customerAttribute->addFieldToFilter('frontend_input', 'date');
foreach ($customerAttribute as $a) {
$data = $this->_filterDates($data, array($a->getAttributeCode(), 'valid_to'));
}
return $data;
}
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:14,代码来源:Data.php
示例11: 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
示例12: getCustomtabInfo
public function getCustomtabInfo($tab)
{
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('customer');
//$storeId=$this->getCustomerAttribute()->getStoreId();
//$group=$this->getCustomerAttribute()->getGroupId();
$tbl_faq_item = Mage::getSingleton('core/resource')->getTableName('customerattribute/customerattribute');
$customerAttribute = Mage::getResourceModel('eav/entity_attribute_collection')->setEntityTypeFilter($entityTypeId);
$customerAttribute->getSelect()->join(array('table_attribute' => $tbl_faq_item), 'main_table.attribute_id=table_attribute.attribute_id');
$customerAttribute->addFieldToFilter('table_attribute.is_custom', 1);
$customerAttribute->addFieldToFilter('table_attribute.custom_tab', $tab);
//if($storeId!=0)
//$customerAttribute->addFieldToFilter('table_attribute.store_id',array('like'=>'%'.$storeId.'%'));
//$customerAttribute->addFieldToFilter('table_attribute.customer_group',array("like"=>'%'.$group.'%'));
return $customerAttribute;
}
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:16,代码来源:Form.php
示例13: editAction
/**
* view and edit item action
*/
public function editAction()
{
$attributeId = $this->getRequest()->getParam('id');
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('customer_address');
$tbl_faq_item = Mage::getSingleton('core/resource')->getTableName('customerattribute/customeraddressattribute');
$models = Mage::getResourceModel('eav/entity_attribute_collection')->setEntityTypeFilter($entityTypeId);
$models->getSelect()->join(array('table_attribute' => $tbl_faq_item), 'main_table.attribute_id=table_attribute.attribute_id');
$models->addFieldToFilter('main_table.attribute_id', $attributeId);
$model = $models->getFirstItem();
// register attribute object
Mage::register('customeraddressattribute_data', $model);
$this->loadLayout();
$this->_setActiveMenu('customer/customerattribute/customeraddressattribute');
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
$this->_addContent($this->getLayout()->createBlock('customerattribute/adminhtml_customeraddressattribute_edit'))->_addLeft($this->getLayout()->createBlock('customerattribute/adminhtml_customeraddressattribute_edit_tabs'));
$this->renderLayout();
}
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:21,代码来源:CustomeraddressattributeController.php
示例14: execute
/**
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->detectMagento($output, true);
if ($this->initMagento()) {
$entityType = $input->getArgument('entityType');
try {
$attributes = \Mage::getModel('eav/config')->getEntityAttributeCodes($entityType);
} catch (\Mage_Core_Exception $e) {
throw new \InvalidArgumentException($e->getMessage());
}
$setup = new \Mage_Eav_Model_Entity_Setup('core_setup');
foreach ($input->getArgument('attributeCode') as $attributeCode) {
if (!in_array($attributeCode, $attributes)) {
$message = sprintf('Attribute: "%s" does not exist for entity type: "%s"', $attributeCode, $entityType);
$output->writeln(sprintf('<comment>%s</comment>', $message));
} else {
$setup->removeAttribute($entityType, $attributeCode);
$output->writeln(sprintf('<info>Successfully removed attribute: "%s" from entity type: "%s"</info>', $attributeCode, $entityType));
}
}
}
}
开发者ID:aedmonds,项目名称:n98-magerun,代码行数:26,代码来源:RemoveCommand.php
示例15: Mage_Eav_Model_Entity_Setup
* This file is part of the Itabs_Debit module.
*
* PHP version 5
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @category Itabs
* @package Itabs_Debit
* @author ITABS GmbH <[email protected]>
* @copyright 2008-2014 ITABS GmbH (http://www.itabs.de)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @version 1.1.6
* @link http://www.magentocommerce.com/magento-connect/debitpayment.html
*/
/**
* Setup script
*/
/* @var $installer Mage_Core_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->updateAttribute('customer', 'debit_payment_acount_update', 'frontend_input', 'date');
$installer->endSetup();
开发者ID:dedlich,项目名称:Magento-DebitPayment,代码行数:31,代码来源:mysql4-upgrade-0.5.0-0.5.1.php
示例16: array
* @package RewardsPoint2
* @copyright Copyright (c) 2009 J2T DESIGN. (http://www.j2t-design.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
$installer = $this;
$attributeInfoFb = Mage::getResourceModel('eav/entity_attribute_collection')->setCodeFilter('rewardsocial_facebook')->getFirstItem();
$attributeInfoGp = Mage::getResourceModel('eav/entity_attribute_collection')->setCodeFilter('rewardsocial_google')->getFirstItem();
$attributeInfoTt = Mage::getResourceModel('eav/entity_attribute_collection')->setCodeFilter('rewardsocial_twitter')->getFirstItem();
$entityTypeId = Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId();
$attributeGroup = Mage::getResourceModel('eav/entity_attribute_set_collection')->addFieldToFilter('attribute_set_name', array('eq' => 'Default'))->addFieldToFilter('entity_type_id', array('eq' => $entityTypeId))->getFirstItem();
if (!$attributeGroup->getAttributeSetId()) {
$installer->addAttributeSet(Mage_Catalog_Model_Product::ENTITY, 'Default');
$attributeGroup = Mage::getResourceModel('eav/entity_attribute_set_collection')->addFieldToFilter('attribute_set_name', array('eq' => 'Default'))->addFieldToFilter('entity_type_id', array('eq' => $entityTypeId))->getFirstItem();
}
if (!$attributeInfoFb->getAttributeId() && !$attributeInfoGp->getAttributeId() && !$attributeInfoTt->getAttributeId() && $attributeGroup->getAttributeSetId()) {
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
/**
* Adding Different Attributes
*/
// adding attribute group
$setup->addAttributeGroup('catalog_product', 'Default', 'J2T Reward Social', 1000);
$entityTypeId = $installer->getEntityTypeId('catalog_product');
$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
// the attribute added will be displayed under the group/tab Special Attributes in product edit page
$setup->addAttribute('catalog_product', 'rewardsocial_facebook', array('group' => 'J2T Reward Social', 'input' => 'text', 'type' => 'text', 'label' => 'Facebook Like Points', 'frontend_class' => 'validate-digits', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 0, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'used_in_product_listing' => true, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
$setup->addAttribute('catalog_product', 'rewardsocial_google', array('group' => 'J2T Reward Social', 'input' => 'text', 'type' => 'text', 'label' => 'Google + Points', 'frontend_class' => 'validate-digits', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 0, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'used_in_product_listing' => true, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
$setup->addAttribute('catalog_product', 'rewardsocial_twitter', array('group' => 'J2T Reward Social', 'input' => 'text', 'type' => 'text', 'label' => 'Twitter Share Points', 'frontend_class' => 'validate-digits', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 0, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'used_in_product_listing' => true, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
$installer->endSetup();
}
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:31,代码来源:mysql4-install-1.0.0.php
示例17: importAttributeInsideGroup
public function importAttributeInsideGroup($attribute_group_id, $attributeSetId, $attribute_code, $attribute_sort_order)
{
$mapobj = Mage::getModel('customimport/customimport');
$attributeGroupId = $mapobj->getAttributeGroupByExternalId($attribute_group_id, $attributeSetId);
// $attribute_group_id is external group id
if ($attributeGroupId) {
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$attribute_id = $setup->getAttributeId('catalog_product', $attribute_code);
if (!$attribute_id) {
$this->customHelper->reportError($this->customHelper->__("Attribute code %s is missing during attribute group %s import", $attribute_code, $attribute_group_id));
} else {
$attribute_exists = $mapobj->isAttributeExistsInGroup($attribute_id, $attributeGroupId);
if ($attribute_exists) {
$mapobj->updateSequenceOfAttribute($attributeGroupId, $attribute_id, $attribute_sort_order, $attribute_code, $attribute_group_id);
} else {
$setup->addAttributeToGroup('catalog_product', $attributeSetId, $attributeGroupId, $attribute_id, $attribute_sort_order);
}
}
}
}
开发者ID:tboulogne,项目名称:Magento-Catalog-Import,代码行数:20,代码来源:Customimport.php
示例18: Mage_Eav_Model_Entity_Setup
<?php
/**
* Created by PhpStorm.
* User: Евгений
* Date: 27.01.2016
* Time: 21:18
*/
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('order', 'ref', array('position' => 1, 'input' => 'text', 'type' => 'varchar', 'label' => 'ref number', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'global' => 1, 'visible_on_front' => 0));
$installer->endSetup();
开发者ID:evgenbel,项目名称:magento,代码行数:13,代码来源:install-0.1.5.php
示例19: Mage_Eav_Model_Entity_Setup
* This package designed for Magento enterprise edition
* aheadWorks does not guarantee correct work of this extension
* on any other Magento edition except Magento enterprise edition.
* aheadWorks does not provide extension support in case of
* incorrect edition usage.
* =================================================================
*
* @category AW
* @package AW_Onsale
* @version 2.4.0
* @copyright Copyright (c) 2010-2012 aheadWorks Co. (http://www.aheadworks.com)
* @license http://ecommerce.aheadworks.com/AW-LICENSE.txt
*/
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->removeAttribute('catalog_product', 'aw_os_product_display');
$setup->removeAttribute('catalog_product', 'aw_os_product_position');
$setup->removeAttribute('catalog_product', 'aw_os_product_image');
$setup->removeAttribute('catalog_product', 'aw_os_product_text');
$setup->removeAttribute('catalog_product', 'aw_os_category_display');
$setup->removeAttribute('catalog_product', 'aw_os_category_position');
$setup->removeAttribute('catalog_product', 'aw_os_category_image');
$setup->removeAttribute('catalog_product', 'aw_os_category_text');
$setup->addAttribute('catalog_product', 'aw_os_product_display', array('backend' => 'onsale/entity_attribute_backend_boolean_config', 'source' => 'onsale/entity_attribute_source_boolean_config', 'label' => 'Display', 'group' => 'Product Label', 'input' => 'select', 'class' => 'validate-digit', 'global' => true, 'visible' => true, 'required' => true, 'user_defined' => false, 'default' => '0', 'visible_on_front' => false));
$setup->addAttribute('catalog_product', 'aw_os_product_position', array('backend' => 'onsale/entity_attribute_backend_position', 'source' => 'onsale/entity_attribute_source_position', 'label' => 'Position', 'group' => 'Product Label', 'input' => 'select', 'class' => 'validate-digit', 'global' => true, 'visible' => true, 'required' => true, 'user_defined' => false, 'default' => 'BR', 'visible_on_front' => false));
$setup->addAttribute('catalog_product', 'aw_os_product_image', array('backend' => 'onsale/entity_attribute_backend_image', 'label' => 'Image', 'group' => 'Product Label', 'input' => 'image', 'class' => 'validate-digit', 'global' => true, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => '', 'visible_on_front' => false));
$setup->addAttribute('catalog_product', 'aw_os_product_text', array('source' => 'onsale/entity_attribute_source_text', 'group' => 'Product Label', 'label' => 'Text', 'note' => 'You can use predefined values in this field. Please refer to extension manual.', 'input' => 'text', 'class' => '', 'global' => true, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => 'CUSTOM', 'visible_on_front' => false));
$setup->addAttribute('catalog_product', 'aw_os_category_display', array('backend' => 'onsale/entity_attribute_backend_boolean_config', 'source' => 'onsale/entity_attribute_source_boolean_config', 'label' => 'Display', 'group' => 'Category Label', 'input' => 'select', 'class' => 'validate-digit', 'global' => true, 'visible' => true, 'required' => true, 'user_defined' => false, 'default' => '0', 'visible_on_front' => false));
$setup->addAttribute('catalog_product', 'aw_os_category_position', array('backend' => 'onsale/entity_attribute_backend_position', 'source' => 'onsale/entity_attribute_source_position', 'label' => 'Position', 'group' => 'Category Label', 'input' => 'select', 'class' => 'validate-digit', 'global' => true, 'visible' => true, 'required' => true, 'user_defined' => false, 'default' => 'BR', 'visible_on_front' => false));
$setup->addAttribute('catalog_product', 'aw_os_category_image', array('backend' => 'onsale/entity_attribute_backend_image', 'label' => 'Image', 'group' => 'Category Label', 'input' => 'image', 'class' => 'validate-digit', 'global' => true, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => '', 'visible_on_front' => false));
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:31,代码来源:mysql4-upgrade-1.0.3-2.0.php
示例20: Mage_Eav_Model_Entity_Setup
<?php
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('customer');
$attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
$installer->addAttribute("customer", "complete_sf_form", array("
|
请发表评论