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);
                 }
             }
         }
     }
 }
示例#2
0
 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);
 }
示例#3
0
 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";
 }
示例#4
0
 /**
  * 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();
 }
示例#5
0
 /**
  * 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;
 }
示例#6
0
 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);
 }
示例#7
0
 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;
 }
示例#8
0
 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;
 }
示例#9
0
 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();
 }
示例#10
0
 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;
 }
示例#11
0
 /**
  * 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();
 }
示例#12
0
 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;
 }
示例#13
0
 public function addAttribute($entityTypeId, $code, array $attr)
 {
     if (isset($this->_flatEntityTables[$entityTypeId]) && $this->_flatTableExist($this->_flatEntityTables[$entityTypeId])) {
         $this->_addFlatAttribute($this->_flatEntityTables[$entityTypeId], $code, $attr);
     } else {
         parent::addAttribute($entityTypeId, $code, $attr);
     }
     return $this;
 }
 /**
  * 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();
 }
示例#15
0
 /**
  * @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));
             }
         }
     }
 }
 public function installEntities($entities = null)
 {
     parent::installEntities($entities);
     foreach ($this->getEntityExtensions() as $entityName => $entity) {
         $frontendPrefix = isset($entity['frontend_prefix']) ? $entity['frontend_prefix'] : '';
         $backendPrefix = isset($entity['backend_prefix']) ? $entity['backend_prefix'] : '';
         $sourcePrefix = isset($entity['source_prefix']) ? $entity['source_prefix'] : '';
         foreach ($entity['attributes'] as $attrCode => $attr) {
             if (!empty($attr['backend'])) {
                 if ('_' === $attr['backend']) {
                     $attr['backend'] = $backendPrefix;
                 } elseif ('_' === $attr['backend'][0]) {
                     $attr['backend'] = $backendPrefix . $attr['backend'];
                 } else {
                     $attr['backend'] = $attr['backend'];
                 }
             }
             if (!empty($attr['frontend'])) {
                 if ('_' === $attr['frontend']) {
                     $attr['frontend'] = $frontendPrefix;
                 } elseif ('_' === $attr['frontend'][0]) {
                     $attr['frontend'] = $frontendPrefix . $attr['frontend'];
                 } else {
                     $attr['frontend'] = $attr['frontend'];
                 }
             }
             if (!empty($attr['source'])) {
                 if ('_' === $attr['source']) {
                     $attr['source'] = $sourcePrefix;
                 } elseif ('_' === $attr['source'][0]) {
                     $attr['source'] = $sourcePrefix . $attr['source'];
                 } else {
                     $attr['source'] = $attr['source'];
                 }
             }
             $this->addAttribute($entityName, $attrCode, $attr);
         }
     }
     return $this;
 }
 * 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 license@magentocommerce.com so we can send you a copy immediately.
 *
 * @category  Itabs
 * @package   Itabs_Debit
 * @author    ITABS GmbH <*****@*****.**>
 * @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();
 * @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();
}
 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);
             }
         }
     }
 }
示例#20
0
<?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();
 * 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));
<?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("type" => "int", "backend" => "", "label" => "Completed SalesForce Form", "input" => "select", "source" => "eav/entity_attribute_source_boolean", "visible" => 1, "required" => 0, "default" => "0", "user_defined" => 1));
$attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "complete_sf_form");
$setup->addAttributeToGroup($entityTypeId, $attributeSetId, $attributeGroupId, 'complete_sf_form', '999');
$used_in_forms = array();
$used_in_forms[] = "adminhtml_customer";
$attribute->setData("used_in_forms", $used_in_forms)->setData("is_used_for_customer_segment", true)->setData("is_system", 0)->setData("is_user_defined", 1)->setData("is_visible", 1)->setData("sort_order", 100);
$attribute->save();
$installer->endSetup();
示例#23
0
<?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();
<?php

$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
$setup = $this;
$fieldList = array('is_reservation', 'tax_class_id', 'payperrentals_quantity', 'payperrentals_min_number', 'payperrentals_min_type', 'payperrentals_max_number', 'payperrentals_max_type', 'payperrentals_avail_number', 'payperrentals_avail_type', 'payperrentals_avail_numberb', 'payperrentals_avail_typeb', 'payperrentals_deposit', 'payperrentals_has_shipping', 'payperrentals_has_multiply', 'payperrentals_pricingtype', 'payperrentals_use_serials', 'payperrentals_use_send_return', 'payperrentals_use_times', 'res_excluded_dates', 'res_prices', 'payperrentals_padding_days', 'res_serialnumbers', 'disabled_with_message', 'res_excluded_daysweek', 'allow_overbooking', 'global_min_period', 'global_max_period', 'global_turnover_after', 'global_turnover_before', 'global_excludedays');
foreach ($fieldList as $field) {
    $applyTo = explode(',', $installer->getAttribute('catalog_product', $field, 'apply_to'));
    if (!in_array('bundle', $applyTo)) {
        $applyTo[] = 'bundle';
    }
    $installer->updateAttribute('catalog_product', $field, 'apply_to', implode(',', $applyTo));
}
try {
    $setup->removeAttribute('catalog_product', 'bundle_pricingtype');
} catch (Exception $E) {
}
$setup->addAttribute('catalog_product', 'bundle_pricingtype', array('backend' => '', 'source' => 'payperrentals/product_bundlepricingtype', 'group' => 'Payperrentals', 'label' => 'Bundle Pricing Type', 'input' => 'select', 'type' => 'int', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 'visible' => true, 'default' => 0, 'required' => false, 'user_defined' => false, 'apply_to' => 'bundle', 'visible_on_front' => false, 'position' => 10));
$installer->endSetup();
示例#25
0
<?php

/**
 * Pan_JewelryDesigner Extension
 *
 * @category  Pan
 * @package   Pan_JewelryDesigner
 * @copyright Copyright (c) 2014 August Ash, Inc. (http://www.augustash.com)
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 * @author    August Ash Team <*****@*****.**>
 */
$installer = new Mage_Eav_Model_Entity_Setup();
// start transaction
$installer->startSetup();
/**
 * Is Dangle Charm (is_dangle_charm)
 *
 * Helps identify beads that are "danglers" b/c their
 * registration point should be closer to the top than
 * the center of the image
 */
$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'is_dangle_charm', array('group' => 'Jewelry Designer', 'input' => 'boolean', 'label' => 'Is Dangle Charm?', 'visible' => true, 'required' => false, 'visible_on_front' => false, 'user_defined' => true, 'default_value' => false, 'used_in_product_listing' => true, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
/**
 * Bracelet has spots for clips? (bracelet_has_clip_spots)
 *
 * Helps identify bracelets that may not have spots for clips
 * and therefore do not have exclusion zones
 */
$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'bracelet_has_clip_spots', array('group' => 'Jewelry Designer', 'input' => 'boolean', 'label' => 'Bracelet has spots for clips?', 'visible' => true, 'required' => false, 'visible_on_front' => false, 'user_defined' => true, 'default_value' => true, 'used_in_product_listing' => true, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL));
// end transaction
$installer->endSetup();
 function updateSourceModel(Mage_Eav_Model_Entity_Setup $setup, $entityTypeId, $code, $key, $value)
 {
     $id = $setup->getAttribute($entityTypeId, $code, 'attribute_id');
     $setup->updateAttribute($entityTypeId, $id, $key, $value);
 }
示例#27
0
 /**
  * Setup setup class and connection
  */
 public function __construct()
 {
     $this->_setup = Mage::getModel('eav/entity_setup', 'core_setup');
     $this->_connection = $this->_setup->getConnection();
 }
 * @copyright 2008-2013 ITABS GmbH / Rouven Alexander Rieker (http://www.itabs.de)
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 * @version   1.0.2
 * @link      http://www.magentocommerce.com/magento-connect/debitpayment.html
 */
// load id for customer entity
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
$eid = $read->fetchRow("select entity_type_id from {$this->getTable('eav_entity_type')} where entity_type_code = 'customer'");
$customerTypeId = $eid['entity_type_id'];
$attrDate = array('type' => 'datetime', 'input' => 'label', 'label' => 'Account update date', 'global' => 1, 'required' => 0, 'default' => '', 'position' => '100');
$attrName = array('type' => 'varchar', 'input' => 'text', 'label' => 'Account Name', 'global' => 1, 'required' => 0, 'default' => '', 'position' => '100');
$attrNumber = array('type' => 'varchar', 'input' => 'text', 'label' => 'Account number', 'backend' => 'debit/entity_customer_attribute_backend_encrypted', 'global' => 1, 'required' => 0, 'default' => '', 'position' => '100');
$attrBlz = array('type' => 'varchar', 'input' => 'text', 'label' => 'Bank code', 'backend' => 'debit/entity_customer_attribute_backend_encrypted', 'global' => 1, 'required' => 0, 'default' => '', 'position' => '100');
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute($customerTypeId, 'debit_payment_acount_update', $attrDate);
$setup->addAttribute($customerTypeId, 'debit_payment_acount_name', $attrName);
$setup->addAttribute($customerTypeId, 'debit_payment_acount_number', $attrNumber);
$setup->addAttribute($customerTypeId, 'debit_payment_acount_blz', $attrBlz);
// Since 1.4.2.0 this is necessary!
$eavConfig = Mage::getSingleton('eav/config');
$attribute = $eavConfig->getAttribute($customerTypeId, 'debit_payment_acount_update');
$attribute->setData('used_in_forms', array('customer_account_edit', 'customer_account_create', 'adminhtml_customer'));
$attribute->save();
$attribute = $eavConfig->getAttribute($customerTypeId, 'debit_payment_acount_name');
$attribute->setData('used_in_forms', array('customer_account_edit', 'customer_account_create', 'adminhtml_customer'));
$attribute->save();
$attribute = $eavConfig->getAttribute($customerTypeId, 'debit_payment_acount_number');
$attribute->setData('used_in_forms', array('customer_account_edit', 'customer_account_create', 'adminhtml_customer'));
$attribute->save();
                 } else {
                     // se il prodotto ha più colori, salverò nell'attributo filtraggio_colore tutti i colori presenti (se non esiste già)
                     $filtraggio_colori = explode("/", $stringaIdAttributo);
                     $filtraggio_coloriName = explode("/", $stringaValoreAttributo);
                     for ($u = 0; $u < count($filtraggio_colori); $u++) {
                         $stringQuery = "select id_magento from " . $resource->getTableName('wsca_filtraggio_colore') . " where id_ws='" . $filtraggio_colori[$u] . "'";
                         $id_filtraggioColoreMage = $readConnection->fetchOne($stringQuery);
                         if ($id_filtraggioColoreMage == null) {
                             // Colori misti non esiste
                             $attribute_model = Mage::getModel('eav/entity_attribute');
                             $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table');
                             $attribute_code = $attribute_model->getIdByCode('catalog_product', 'ca_filtraggio_colore');
                             $attribute = $attribute_model->load($attribute_code);
                             $attribute->setData('option', array('value' => array('option' => array($filtraggio_coloriName[$u], $filtraggio_coloriName[$u]))));
                             $attribute->save();
                             $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
                             $optionTable = $setup->getTable('eav/attribute_option');
                             $id_filtraggioColoreMage = getLastInsertId($optionTable, 'option_id');
                             $query = "insert into " . $resource->getTableName('wsca_filtraggio_colore') . " (id_magento,id_ws) values('" . $id_filtraggioColoreMage . "','" . $filtraggio_colori[$u] . "')";
                             $writeConnection->query($query);
                         }
                     }
                 }
             }
         }
     }
 }
 // recupero varianti
 foreach ($varianti as $key => $value) {
     $scalare = $key;
     $misura = $value;
<?php

$installer = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
/**
 * Fixes all indexes
 */
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationorders'), 'IDX_start_end', array('start_date', 'end_date'));
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationorders'), 'IDX_send_return_id', 'sendreturn_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationorders'), 'IDX_turnover_start_end', array('start_turnover_before', 'end_turnover_after'));
$installer->getConnection()->dropKey($installer->getTable('payperrentals/reservationprices'), 'entity_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationprices'), 'IDX_entity_id', 'entity_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationprices'), 'IDX_store_id', 'store_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationprices'), 'IDX_date_from_to', array('date_from', 'date_to'));
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationprices'), 'IDX_ptype', 'ptype');
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationprices'), 'IDX_numberof', 'numberof');
$installer->getConnection()->dropKey($installer->getTable('payperrentals/sendreturn'), 'order_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/sendreturn'), 'IDX_order_id', 'order_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/sendreturn'), 'IDX_order_id', 'order_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/sendreturn'), 'IDX_res_start_end', array('res_startdate', 'res_enddate'));
$installer->getConnection()->addKey($installer->getTable('payperrentals/sendreturn'), 'IDX_send_return', array('send_date', 'return_date'));
$installer->getConnection()->dropKey($installer->getTable('payperrentals/serialnumbers'), 'entity_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/serialnumbers'), 'IDX_entity_id', 'entity_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/serialnumbers'), 'IDX_status', 'status');
$installer->getConnection()->addKey($installer->getTable('payperrentals/ordertodates'), 'IDX_event_date', 'event_date');
$installer->getConnection()->addKey($installer->getTable('payperrentals/rentalqueue'), 'IDX_customer_id', 'customer_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/rentalqueue'), 'IDX_sendreturn_id', 'sendreturn_id');
$installer->getConnection()->dropKey($installer->getTable('payperrentals/rentalqueue'), 'product_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/rentalqueue'), 'IDX_product_id', 'product_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationquotes'), 'IDX_quote_item_id', 'quote_item_id');
$installer->getConnection()->addKey($installer->getTable('payperrentals/reservationquotes'), 'IDX_quote_id', 'quote_id');