【发布时间】:2017-02-13 10:22:52
【问题描述】:
我一直在尝试为自定义属性制作升级脚本。但是,升级脚本似乎不起作用。它不会更新站点或 mysql 数据库。
只需将组从“General”切换到“Prijzen”即可。
每次我尝试升级模块时,版本号都不会改变,组也不会改变。似乎找不到我走错路了。
MySQL 数据库core_resources:
topperquotation_setup | 0.1.0 | 0.1.0
模块config.xml:
<config>
<modules>
<Topper_Quotation>
<version>1.0.0</version>
</Topper_Quotation>
</modules>
<global>
<resources>
<topperquotation_setup>
<setup>
<module>Topper_Quotation</module>
<class>Mage_Catalog_Model_Resource_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</topperquotation_setup>
</resources>
<template>
<email>
<topp...........
原install-0.1.0.php:
<?php
/** @var Mage_Catalog_Model_Resource_Setup $installer */
$installer = $this;
$installer->startSetup();
$installer->addAttribute('catalog_product', 'is_quotable', array(
'group' => 'General',
'type' => 'int',
'backend' => '',
'frontend' => '',
'label' => 'Offerteaanvraag',
'input' => 'select',
'class' => '',
'source' => 'eav/entity_attribute_source_boolean',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => '0',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'unique' => false,
'apply_to' => 'simple,virtual,bundle',
'is_configurable' => false,
));
$installer->endSetup();
当前upgrade-0.1.0-1.0.0.php:
<?php
/** @var Mage_Catalog_Model_Resource_Setup $installer */
$installer = $this;
$installer->startSetup();
$installer->updateAttribute('catalog_product', 'is_quotable', 'group', 'Prijzen');
$installer->endSetup();
【问题讨论】:
-
简单的事情第一 - 你是否关闭了缓存,并清除了
var/cache? -
哦,我觉得自己好笨哈哈!我清理缓存很多次,只是当我不认为缓存发生这种情况时。感谢您的提醒;)
标签: php mysql magento attributes