如何通过ajax在magento管理面板中加载phtml?以下是详细信息。
\ app \ design \ adminhtml \ default \ default \ layout \ layout.xml:
<adminhtml_catalog_product_new>
<reference name="product_tabs">
<action method="addTab">
<name>My_custom_tab</name>
<block>listing/adminhtml_catalog_product_tab</block>
</action>
</reference>
</adminhtml_catalog_product_new>
app \ design \ adminhtml \ default \ default \ template \ mymodule \ catalog \ product \ tab.phtml:
<div id="customer_info_tabs_customer_edit_tab_action_content">
<div class="entry-edit">
<div class="entry-edit-head">
<h4 class="icon-head head-edit-form fieldset-legend">content</h4>
</div>
<div id="group_fields4" class="fieldset fieldset-wide">
<div class="hor-scroll">
content body
</div>
</div>
</div>
</div>
\ app \ code \ local \ Company \ Mymodule \ Block \ Adminhtml \ Catalog \ Product \ Tab.php:
<?php
class Company_Mymodule_Block_Adminhtml_Catalog_Product_Tab extends Mage_Adminhtml_Block_Widget implements Mage_Adminhtml_Block_Widget_Tab_Interface
{
public function _construct()
{
parent::_construct();
$this->setTemplate('Mymodule/catalog/product/tab.phtml');
}
public function canShowTab()
{
$product = Mage::registry('product');
//if on edit mode show the tab
if ($product->getId()) {
return true;
}
$request = Mage::app()->getRequest();
//if creating product with any attributes, show the tab
if ($request->getParam('type')) {
return true;
}
return false;
}
public function getTabLabel()
{
return $this->__('Listing');
}
public function getTabTitle()
{
return $this->__('Listing');
}
public function isHidden()
{
return false;
}
}
我想通过ajax加载内容。我最后通过将此代码添加到Block-&gt; tab.php
来搜索谷歌 public function getTabUrl()
{
return $this->getUrl('*/*/custom', array('_current' => true));
}
public function getTabClass()
{
return 'ajax';
}
如何实现此ajax调用,当触发列表时,内容应该通过ajax加载。 ?请帮助我的朋友们。