我想允许在产品的描述字段中添加Catalog Product Link小部件(因此我可以轻松链接到描述中的其他产品).我已经通过创建如下文件扩展了Mage_Catalog_Model_Product:
class mymodule_Catalog_Model_Product extends Mage_Catalog_Model_Product
{
/**
* Add getDescription function that interprets widget or static blocks
* within product descriptions
*/
public function getDescription() {
$processor = Mage::getModel('widget/template_filter');
$html = $processor->filter($this->getData('description'));
return $html;
}
}
Run Code Online (Sandbox Code Playgroud)
如果我键入类似的东西,现在它工作正常
{{widget type="catalog/product_widget_link" anchor_text="my text" template="catalog/product/widget/link/link_inline.phtml" id_path="product/1234"}}
进入描述字段 - 它创建一个指向产品Id 1234的链接.
但我想在WYSIWYG编辑器中添加实际的Catalog Product Link小部件按钮来编辑产品.该按钮已经在CMS编辑器中,但我遗漏了我需要修改的内容,以便将此小部件添加到Admin界面以编辑产品.有人可以帮我吗?