Magento:使用magento之外的设置模型 [英] Magento: Use setup-model out of magento
本文介绍了Magento:使用magento之外的设置模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用Magento中的 Mage_Catalog_Model_Resource_Eav_Mysql4_Setup
?
It is possible to use the Mage_Catalog_Model_Resource_Eav_Mysql4_Setup
out of Magento?
require_once "app/Mage.php";
Mage::app();
//Use the setup model
我想使用属性功能(addAttribute()等).
I want to use the attribute functionality (addAttribute(), etc).
推荐答案
是的,就像您在Magento中那样:
Yes, just like you would do so in Magento:
require_once 'app/Mage.php';
Mage::init();
$setup = Mage::getResourceModel('catalog/setup', 'core_setup');
$setup->addAttribute(...);
这篇关于Magento:使用magento之外的设置模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文