m33ts4k0z Posted February 25, 2013 Share Posted February 25, 2013 (edited) Hello all, I'm trying to create a new admin page. I've managed, using the tutorials, to make it display a list of the products and generally it does what I want. The problem is that I don't seem to find a proper way to add a button at the bottom of the table where it shows my products. It only shows at the header I have implemented a boolean with a save button as you will see on my code but I don't know how to use it to call a function that I'm about to write. Is there any other way or can I use my existing code to call a function on button click and also do things with the products that are chosen by the delete multi selection? Thanks in advance <?php include_once( PS_ADMIN_DIR.'/../classes/AdminTab.php'); class AdminTest extends AdminTab { public function __construct() { $sql= 'TRUNCATE TABLE '._DB_PREFIX_.'fyndiq'; $sql2= 'INSERT IGNORE INTO '._DB_PREFIX_.'fyndiq (product_id,product_name,product_price)SELECT '._DB_PREFIX_.'product_lang.id_product,name,price FROM '._DB_PREFIX_.'product_lang, '._DB_PREFIX_.'product WHERE '._DB_PREFIX_.'product_lang.id_product = '._DB_PREFIX_.'product.id_product'; if (!Db::getInstance()->Execute($sql)) die('Error etc.'); if (!Db::getInstance()->Execute($sql2)) die('Error etc.'); $this->table = 'fyndiq'; $this->className = 'fyndiq'; $this->lang = false; $this->edit = false; $this->delete = true; $this->fieldsDisplay = array( 'product_id' => array( 'title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'product_name' => array( 'title' => $this->l('Name'), 'width' => 200), 'product_price' => array( 'title' => $this->l('Price'), 'align' => 'center', 'width' => 6) ); $this->_fieldsOptions =array('active' => array('title' => $this->l('Importera alla valda produkter till Fyndiq.se?'), 'width' => 25, 'align' => 'center', 'active' => 'true', 'type' => 'bool', 'orderby' => true)); $this->identifier = 'product_id'; parent::__construct(); } } ?> Edited February 26, 2013 by m33ts4k0z (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