egohermansyah Posted April 21, 2015 Share Posted April 21, 2015 (edited) Hai guys i have an function like this in the class public static function getProductName($supply_order_reference){ $id_supply_order = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(" select id_supply_order from gzr_supply_order where reference = '".$supply_order_reference."' "); $data = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(" select sod.id_supply_order_detail as id_supply_order_detail, pl.name as name from gzr_supply_order_detail sod, gzr_product_lang pl where sod.id_product = pl.id_product and pl.id_lang = 1 and sod.id_supply_order = '".$id_supply_order[0]['id_supply_order']."' "); return $data; } and this function in my admin controller public function renderForm(){ if (Tools::isSubmit('addsupply_product_order')){ if (Tools::isSubmit('addsupply_product_order')){ $this->toolbar_title = $this->l('Supply product into customer orders'); $update = false; } $product_list = array_unique(SupplyProductOrder::getProductName('Tokosatu-0000000002'), SORT_REGULAR); $this->fields_form = array( 'legend' => array( 'title' => $this->l('Supply product into customer orders'), 'icon' => 'icon-pencil' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Id order'), 'name' => 'id_order', 'required' => true, 'hint' => $this->l('Id order to be in supply.'), ), array( 'type' => 'text', 'label' => $this->l('Supply order reference'), 'name' => 'supply_order_reference', 'required' => true, 'hint' => $this->l('Supply order reference.'), ), array( 'type' => 'select', 'label' => $this->l('Product name'), 'name' => 'id_supply_order_detail', 'required' => true, 'options' => array( 'query' => $product_list, 'id' => 'id_supply_order_detail', 'name' => 'name' ), 'hint' => array( $this->l('Select the supplier you\'ll be purchasing from.'), $this->l('Warning: All products already added to the order will be removed.') ) ), array( 'type' => 'text', 'label' => $this->l('Quantity'), 'name' => 'quantity', 'required' => true, 'hint' => $this->l('Quantity of product.'), ) ), 'submit' => (!$update ? array('title' => $this->l('Save supply product order')) : array()), 'buttons' => (!$update ? array( 'save-and-stay' => array( 'title' => $this->l('Save supply product order and stay'), 'name' => 'submitAddsupply_product_orderAndStay', 'type' => 'submit', 'class' => 'btn btn-default pull-right', 'icon' => 'process-icon-save' ) ) : array()) ); } return parent::renderForm(); } And my question, how to this $product_list = array_unique(SupplyProductOrder::getProductName('Tokosatu-0000000002'), SORT_REGULAR); is execute when this 'type' => 'text', 'label' => $this->l('Supply order reference'), 'name' => 'supply_order_reference', 'required' => true, 'hint' => $this->l('Supply order reference.'), is change the value Than's guys Edited April 21, 2015 by egohermansyah (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now