我正在創建一個模塊以在我的商店中插入新屬性和新類型的產品。作爲模板,我使用虛擬產品類型的相同註冊屏幕,並僅包含此類產品的新選項。 對於這一點,在我的config.xml中,我用:需要在新類型的產品中創建新屬性
<catalog>
<product>
<type>
<incomm_virtual translate="label" module="incomm">
<label>Incomm Virtual</label>
<model>incomm/product_type</model>
<price_model>incomm/product_price</price_model>
<is_qty>1</is_qty>
<composite>0</composite>
<can_use_qty_decimals>0</can_use_qty_decimals>
</incomm_virtual>
</type>
</product>
</catalog>
,並配置在同一config.xml中的SQL的安裝:
<resources>
<abc_incommproduct_setup>
<setup>
<module>ABC_Incomm</module>
<class>Mage_Catalog_Model_Resource_Setup</class>
</setup>
</abc_incommproduct_setup>
</resources>
使用的下一個文件mymodule中/模型/含產物/ type.php:
class ABC_Incomm_Model_Product_Type
extends Mage_Catalog_Model_Product_Type_Virtual
{
const TYPE_INCOMM = 'incomm';
const XML_PATH_AUTHENTICATION = 'catalog/incomm/authentication';
protected function _prepareProduct(Varien_Object $buyRequest, $product, $processMode)
{
if ($this->_isStrictProcessMode($processMode)) {
return Mage::helper('ABC_Incomm_Helper_Data')->__(
'Incomm product %s cannot be added to cart. ' .
' On the product detail page click the "Go to parent site"'.
' button to access the product.',
$product->getName()
);
}
return parent::_prepareProduct($buyRequest, $product, $processMode);
}
}
在相同的文件夾中,virtual.php:
class ABC_Incomm_Model_Product_Virtual extends Mage_Catalog_Model_Product_Type_Virtual {
}
最後,在SQL文件夾中的SQL安裝文件/ abc_incommproduct_setup/MySQL的安裝,4-0.1.0.php:
$this->startSetup();
$this->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'terms_of_use', array(
'group' => 'General',
'input' => 'textarea',
'type' => 'text',
'sort_order' => 4,
'label' => 'Terms of use',
'backend' => '',
'visible' => true,
'required' => true,
'wysiwyg_enabled' => true,
'visible_on_front' => true,
'apply_to' => 'incomm', //only in this type of product
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));
$this->endSetup();
我的問題是這樣的,禁止在Magento緩存後,明確緩存幷包含新類型的產品,在Product Types列表中出現我的NEW類型的產品,但選項不會加載通過sql插入的新屬性,發生了什麼?我的sqlinstall.php沒有運行?