我需要在prestashop 1.7.5中创建一个新的管理员列表页面。在此,我需要显示所有组合明智的产品,并需要更新相关行本身对产品单个组合的价格影响,例如内联编辑。我已经创建了新标签,但不知道显示列表的正确方法。我已经使用下面的代码显示列表,但是此列表仅显示在产品列表中,我需要执行以下mysql查询并需要显示返回结果数据。 我的SQL查询是
SELECT pa.*, ag.id_attribute_group, ag.is_color_group, agl.name AS group_name, al.name AS attribute_name, a.id_attribute, pa.unit_price_impact
FROM ps_product_attribute pa
LEFT JOIN ps_product_attribute_combination pac ON pac.id_product_attribute = pa.id_product_attribute
LEFT JOIN ps_attribute a ON a.id_attribute = pac.id_attribute
LEFT JOIN ps_attribute_group ag ON ag.id_attribute_group = a.id_attribute_group
LEFT JOIN ps_attribute_lang al ON (a.id_attribute = al.id_attribute AND al.id_lang = 1)
LEFT JOIN ps_attribute_group_lang agl ON (ag.id_attribute_group = agl.id_attribute_group AND agl.id_lang = 1)
WHERE pa.id_product = 113
ORDER BY pa.id_product_attribute
public function __construct()
{
$this->bootstrap = true;
$this->table = 'product';
$this->className = 'Product';
$this->list_id = 'details';
parent::__construct();
$this->fields_list = array('name' => array('title' => $this->trans('Product', array(), 'Admin.Global'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'price' => array('title' => $this->trans('Price', array(), 'Admin.Global')),'active' => array( 'title' => $this->trans('Status', array(), 'Admin.Global')));
}
public function initProcess()
{
if (Tools::getIsset('details'.$this->table)) {
$this->list_id = 'details';
if (isset($_POST['submitReset'.$this->list_id])) {
$this->processResetFilters();
}
} else {
$this->list_id = 'details';
}
return parent::initProcess();
}
public function renderDetails()
{
if (($id = Tools::getValue('id_tab'))) {
$this->lang = false;
$this->list_id = 'details';
$this->addRowAction('edit');
$this->addRowAction('details');
//$this->addRowAction('delete');
$this->toolbar_btn = array();
/** @var Tab $tab */
$tab = $this->loadObject($id);
$this->toolbar_title = $tab->name[$this->context->employee->id_lang];
$this->_use_found_rows = false;
self::$currentIndex = self::$currentIndex.'&details'.$this->table;
$this->processFilter();
return parent::renderList();
}
}
我还需要对价格列进行内联编辑以更新费率。