OpenCart City 0 Posted April 6, 2020 Posted April 6, 2020 Hello, I want to develop a simple module in which I've created few tables and configuration page. Now I want to display the data from these tables along with some default PS tables like customer etc. So how can I do that. I'm new to prestashop and tried many solutions and table is displaying but no proper layout. So please share one complete example. Thanks! Share this post Link to post Share on other sites
Chill_user 14 Posted April 6, 2020 Posted April 6, 2020 (edited) If I understood correctly, you need to just show some variables from db? In your controller/module/some php file: public static function getAddressCustom($id_customer){ $result = Db::getInstance()->getRow(' SELECT * FROM `'._DB_PREFIX_.'address` sample WHERE sample.`id_customer` = '.(int)$id_customer ); } Before to send the variables to the smarty, I recommend you to make all manipulations in php file, and after sent the proper data.Assign variable to the .tpl file, where 'customer_current_address' is your variable name in smarty $this->context->smarty->assign('customer_current_address', $result); P.S. check SQL queries here P.S2: You have power of "$this", for example : //get customer cart id $this->context->cart->id //or changing delivery option to some custom id (dont run it like this) $this->context->cart->setDeliveryOption(array($this->context->cart->id_address_delivery => $delivery_option)); $this->context->cart->save(); Edited April 6, 2020 by Amantha Bill (see edit history) Share this post Link to post Share on other sites
OpenCart City 0 Posted April 7, 2020 Posted April 7, 2020 Hello, Thank you for your comment but our file is located under modules/test/controllers/admin/some.php. So, 1. Is the path correct? 2. We are able to get the data but main issue is while trying to display this data using table, it is not displaying in proper format. No bootstrap, css is applied. So please share one example for this. Thanks! Share this post Link to post Share on other sites
Chill_user 14 Posted April 7, 2020 Posted April 7, 2020 1. No, you should place it in /test/controllers/front/some.php 2. I don't really know how to do this exactly, try to check this: https://www.siteground.com/tutorials/php-mysql/display-table-data/ Share this post Link to post Share on other sites
OpenCart City 0 Posted April 7, 2020 Posted April 7, 2020 (edited) 1. Why it should be in front? We are creating back end controller. 2. We have checked the link but we are not looking for this. We want to display like customer list in prestashop. The main problem is in format. Edited April 7, 2020 by OpenCart City Added point 2 (see edit history) Share this post Link to post Share on other sites
OpenCart City 0 Posted April 9, 2020 Posted April 9, 2020 Can anyone answer this please? Share this post Link to post Share on other sites
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