prestashop back office custom module template for listing OR override by module -
due ps documentation rather bare, 'd know if solve probelm @ subj.
have last stable ps. 1.6.1.7 done many modules ...
needs (custom table [created]: ok, custom listing [ordering, filtering]: ok): when click on row (subq: when add "addrowaction()" produce same ...), want see controllers edit/update page - escpecially: controller = adminproduct & updateproduct ... id_product given, dunno how pass:.
specially: listing of ordered products (own modul, own list) want ovveride link it's automatically provide. i'm sure simple, found solution yet ...
the question is: how override (must copy module structure?) list helper, other helpers ... or need write full .tpl got function(s) above ...
well, implemented ugly solution q. ( codes :) ):
part of _construct()...:
$this->fields_list = array(); $this->fields_list['id_order'] = array( 'title' => $this->l('order id'), 'align' => 'center', 'class' => 'fixed-width-xs', 'type' => 'int' ); $this->fields_list['product_reference'] = array( 'title' => $this->l('product reference'), 'filter_key' => 'product_reference', ); $this->fields_list['product_name'] = array( 'title' => $this->l('name'), 'filter_key' => 'product_name' ); $this->fields_list['product_quantity'] = array( 'title' => $this->l('pices'), 'filter_key' => 'product_quantity' ); $this->fields_list['total_price_tax_incl'] = array( 'title' => $this->l('full price incl. tax.'), 'filter_key' => 'total_price_tax_incl', 'type' => 'int' ); $this->_join .= ' left join `' . _db_prefix_ . 'orders` b on ( a.`id_order` = b.`id_order` )'; $this->_select .= ' b.`date_add`,'; $this->fields_list['date_add'] = array( 'title' => $this->l('added'), 'filter_key' => 'b!date_add', ); $this->_join .= ' left join `' . _db_prefix_ . 'vatera_kl_order` c on (c.`id_order` = b.`id_order` )'; $this->_select .= ' c.`status` vstatus, '; $this->fields_list['vstatus'] = array( 'title' => $this->l('vatera status'), 'filter_key' => 'c!status' ); $this->_group .= 'group `id_order`'; $this->_orderby = 'id_order'; $this->_orderway = 'desc'; parent::__construct();//ddd($this);
one private function, id_product (product_id in order_details), , overrided initcontent() ugly redirect ...:
private function getpidfromodid($odid) { $q = 'select `product_id` `' . _db_prefix_ . 'order_detail` `id_order_detail` = ' . $odid; $result = db::getinstance(_ps_use_sql_slave_)->executes( $q ); return $result[0]['product_id']; } public function initcontent() { if ($this->display == 'edit') { $admin = explode(directory_separator,_ps_admin_dir_); $admin_folder = array_pop((array_slice($admin, -1))); tools::redirect( _ps_base_url_ . '/' . $admin_folder . '/' . $this->context->link->getadminlink('adminproducts') . '&id_product=' . (int)$this->getpidfromodid(tools::getvalue('id_order_detail')) . '&updateproduct'); } else parent::initcontent(); }
so, original question till question ... nice method, override list behaviour ...
Comments
Post a Comment