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


PHP Mage_Eav_Model_Entity_Setup::endSetup方法代码示例

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


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

示例1: array

<?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();
开发者ID:hueyl77,项目名称:fourwindsgear,代码行数:19,代码来源:mysql4-upgrade-0.4.0-0.5.0.php

示例2: createOptions

 public function createOptions($newOptions)
 {
     $cache = Mage::app()->getCache();
     $installer = new Mage_Eav_Model_Entity_Setup('core_setup');
     $attributeApi = Mage::getModel('catalog/product_attribute_api');
     $helperCatalog = Mage::helper('catalog');
     $installer->startSetup();
     $attributesList = array();
     foreach ($newOptions as $attribute_id => $options) {
         $newOption = array();
         $newOption['attribute_id'] = $attribute_id;
         $attributesList[] = $attribute_id;
         $newOption['value'] = array();
         for ($i = 0; $i < sizeof($options); $i++) {
             $label = $helperCatalog->stripTags($options[$i]);
             $cachedValue = $cache->load($attribute_id . '_' . strtolower($label));
             if ($cachedValue != 1) {
                 $newOption['value']['option' . $i][0] = $label;
                 $cache->save("1", $attribute_id . '_' . strtolower($label), array('LINNLIVE_EXTENSION_ATTRIBUTES'), 300);
             }
         }
         if (sizeof($newOption['value'])) {
             $installer->addAttributeOption($newOption);
         }
     }
     $installer->endSetup();
     Mage::app()->cleanCache(array(Mage_Core_Model_Translate::CACHE_TAG));
     $currentOptions = array();
     $attributeApi = Mage::getModel('catalog/product_attribute_api');
     foreach ($attributesList as $attribute_id) {
         $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', $attribute_id);
         foreach ($attribute->getSource()->getAllOptions(true, true) as $option) {
             $label = strtolower($option['label']);
             $optionId = $option['value'];
             if (!isset($currentOptions[$attribute_id][$label])) {
                 $currentOptions[$attribute_id][$label] = $optionId;
             }
             $currentOptionId = $currentOptions[$attribute_id][$label];
             if ($optionId > $currentOptionId) {
                 $attributeApi->removeOption($attribute_id, $optionId);
             }
             if ($currentOptionId > $optionId) {
                 $attributeApi->removeOption($attribute_id, $currentOptionId);
                 $currentOptions[$attribute_id][$label] = $optionId;
             }
         }
     }
     return $currentOptions;
 }
开发者ID:xiaoguizhidao,项目名称:mydigibits,代码行数:49,代码来源:Data.php

示例3:

<?php

$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('customer_address');
$attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
$setup->addAttributeToGroup($entityTypeId, $attributeSetId, $attributeGroupId, 'tax_invoice', '999');
$setup->endSetup();
$installer->endSetup();
开发者ID:bogdy2p,项目名称:apstufgnto,代码行数:11,代码来源:upgrade-0.0.2-0.0.3.php

示例4: updatedb23Action


//.........这里部分代码省略.........
         $installer->run(" ALTER TABLE {$installer->getTable('sales/order')} ADD `till_id` int(11) unsigned NOT NULL DEFAULT 0; ");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'location_id')) {
         $installer->run(" ALTER TABLE {$installer->getTable('sales/order')} ADD `location_id` int(11) unsigned NOT NULL DEFAULT 0; ");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/quote_payment'), 'ccforpos_ref_no')) {
         $installer->run(" ALTER TABLE {$installer->getTable('sales/quote_payment')} ADD `ccforpos_ref_no` VARCHAR( 255 ) NOT NULL; ");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/order_payment'), 'ccforpos_ref_no')) {
         $installer->run(" ALTER TABLE {$installer->getTable('sales/order_payment')} ADD `ccforpos_ref_no` VARCHAR( 255 ) NOT NULL; ");
     }
     if (!$webposHelper->columnExist($installer->getTable('webpos_order'), 'till_id')) {
         $installer->run(" ALTER TABLE {$installer->getTable('webpos_order')} ADD `till_id` int(11) unsigned NOT NULL DEFAULT 0; ");
     }
     if (!$webposHelper->columnExist($installer->getTable('webpos_order'), 'location_id')) {
         $installer->run(" ALTER TABLE {$installer->getTable('webpos_order')} ADD `location_id` int(11) unsigned NOT NULL DEFAULT 0; ");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_cash')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_cash` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_base_cash')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_base_cash` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_cash')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_cash` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_base_cash')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_base_cash` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_ccforpos')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_ccforpos` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_base_ccforpos')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_base_ccforpos` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_ccforpos')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_ccforpos` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_base_ccforpos')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_base_ccforpos` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_cp1forpos')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_cp1forpos` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_base_cp1forpos')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_base_cp1forpos` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_cp1forpos')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_cp1forpos` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_base_cp1forpos')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_base_cp1forpos` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_cp2forpos')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_cp2forpos` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_base_cp2forpos')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_base_cp2forpos` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_cp2forpos')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_cp2forpos` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_base_cp2forpos')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_base_cp2forpos` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_change')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_change` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_base_change')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_base_change` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_change')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_change` decimal(12,4) NOT NULL default '0'");
     }
     if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_base_change')) {
         $installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_base_change` decimal(12,4) NOT NULL default '0'");
     }
     $installer->endSetup();
     $installer = new Mage_Eav_Model_Entity_Setup();
     $installer->startSetup();
     $fieldList = array('tax_class_id');
     foreach ($fieldList as $field) {
         $applyTo = explode(',', $installer->getAttribute(Mage_Catalog_Model_Product::ENTITY, $field, 'apply_to'));
         if (!in_array('customsale', $applyTo)) {
             $applyTo[] = 'customsale';
             $installer->updateAttribute(Mage_Catalog_Model_Product::ENTITY, $field, 'apply_to', implode(',', $applyTo));
         }
     }
     $installer->endSetup();
     $product = Mage::getModel('catalog/product');
     $product->getIdBySku('webpos-customsale');
     if ($product->getId()) {
         try {
             $product->setData('tax_class_id', 0);
             $product->save();
         } catch (Exception $e) {
             Zend_debug::dump($e->getMessage());
         }
     }
 }
开发者ID:javik223,项目名称:Evron-Magento,代码行数:101,代码来源:ProductController.php


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