本文整理汇总了PHP中Mage_Eav_Model_Entity_Setup::startSetup方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Eav_Model_Entity_Setup::startSetup方法的具体用法?PHP Mage_Eav_Model_Entity_Setup::startSetup怎么用?PHP Mage_Eav_Model_Entity_Setup::startSetup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Eav_Model_Entity_Setup
的用法示例。
在下文中一共展示了Mage_Eav_Model_Entity_Setup::startSetup方法的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();
示例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;
}
示例3:
<?php
require_once "mygassi-config.php";
require_once mageroot;
Mage::app();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->startSetup();
$setup->deleteTableRow('eav/entity_attribute', 'attribute_id', $setup->getAttributeId('catalog_product', 'linientext'), 'attribute_set_id', $setup->getAttributeSetId('catalog_product', 'Default'));
$setup->deleteTableRow('eav/entity_attribute', 'attribute_id', $setup->getAttributeId('catalog_product', 'gruppentext'), 'attribute_set_id', $setup->getAttributeSetId('catalog_product', 'Default'));
$setup->deleteTableRow('eav/entity_attribute', 'attribute_id', $setup->getAttributeId('catalog_product', 'einzeltext'), 'attribute_set_id', $setup->getAttributeSetId('catalog_product', 'Default'));
$setup->deleteTableRow('eav/entity_attribute', 'attribute_id', $setup->getAttributeId('catalog_product', 'add_desc_1'), 'attribute_set_id', $setup->getAttributeSetId('catalog_product', 'Default'));
$setup->deleteTableRow('eav/entity_attribute', 'attribute_id', $setup->getAttributeId('catalog_product', 'add_desc_2'), 'attribute_set_id', $setup->getAttributeSetId('catalog_product', 'Default'));
$setup->deleteTableRow('eav/entity_attribute', 'attribute_id', $setup->getAttributeId('catalog_product', 'add_desc_3'), 'attribute_set_id', $setup->getAttributeSetId('catalog_product', 'Default'));
$setup->endSetup();
exit;
示例4: updatedb23Action
public function updatedb23Action()
{
$installer = new Mage_Core_Model_Resource_Setup();
$installer->startSetup();
$webposHelper = Mage::helper("webpos");
if (!$webposHelper->columnExist($installer->getTable('sales_flat_order'), 'webpos_admin_id')) {
$installer->run("ALTER TABLE {$installer->getTable('sales_flat_order')} ADD COLUMN `webpos_admin_id` int(10) default NULL");
}
if (!$webposHelper->columnExist($installer->getTable('sales_flat_order'), 'webpos_admin_name')) {
$installer->run("ALTER TABLE {$installer->getTable('sales_flat_order')} ADD COLUMN `webpos_admin_name` varchar(255) default NULL");
}
if (!$webposHelper->columnExist($installer->getTable('webpos_user'), 'store_ids')) {
$installer->run("ALTER TABLE {$installer->getTable('webpos_user')} ADD `store_ids` VARCHAR(255) NOT NULL AFTER `user_id`;");
}
if (!$webposHelper->columnExist($installer->getTable('webpos_transaction'), 'user_id')) {
$installer->run("ALTER TABLE {$installer->getTable('webpos_transaction')} ADD `user_id` int(4) unsigned DEFAULT NULL;");
}
if (!$webposHelper->columnExist($installer->getTable('webpos_transaction'), 'till_id')) {
$installer->run("ALTER TABLE {$installer->getTable('webpos_transaction')} ADD `till_id` unsigned NULL DEFAULT 0;");
}
if (!$webposHelper->columnExist($installer->getTable('webpos_transaction'), 'location_id')) {
$installer->run("ALTER TABLE {$installer->getTable('webpos_transaction')} ADD `location_id` unsigned NULL DEFAULT 0;");
}
if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'till_id')) {
$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'");
//.........这里部分代码省略.........