Marius05 Posted March 3, 2017 Share Posted March 3, 2017 (edited) Hi! I want to add new column admin product listing to display or not product in website. 1. I have create an override for classes/Product.php in controllers/AdminProductsController.php and add new column in database tables (product, product_shop) . Column name is hideproduct In Product.php i have: class Product extends ProductCore { public $hideproduct = false; public function toggleHideProduct() { $this->setFieldsToUpdate(array('hideproduct' => true)); $this->hideproduct = !(int)$this->hideproduct; return $this->update(false); } public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null) { self::$definition['fields']['hideproduct'] = array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'); parent::__construct($id_product, $full, $id_lang, $id_shop, $context); } } In AdminProductsController.php i have: class AdminProductsController extends AdminProductsControllerCore { public function initProcess() { parent::initProcess(); if ((isset($_GET['hideproduct'.$this->table]) || isset($_GET['hideproduct'])) && Tools::getValue($this->identifier)) { if ($this->tabAccess['edit'] === '1') $this->action = 'hideproduct'; else $this->errors[] = Tools::displayError('You do not have permission to edit this.'); } } public function __construct() { parent::__construct(); $this->fields_list['hideproduct'] = array( 'title' => $this->l('Hide product'), 'active' => 'hide', 'filter_key' => 'sa!hideproduct', 'type' => 'bool', 'class' => 'fixed-width-sm', 'orderby' => false ); } public function processhideproduct() { if (Validate::isLoadedObject($object = $this->loadObject())) { $object->toggleHideProduct(); $this->confirmations[] = $this->l('Actiune efectuata cu succes'); } return $object; } } In attach is images with database column structure and admin new column. Everything seems fine but when I want to change their status to product not working.Can anyone tell me what is the cause? Thank you! Marius Edited March 3, 2017 by Marius05 (see edit history) Link to comment Share on other sites More sharing options...
Marius05 Posted March 4, 2017 Author Share Posted March 4, 2017 Nobody ? Link to comment Share on other sites More sharing options...
Marius05 Posted March 8, 2017 Author Share Posted March 8, 2017 Although no one knows where the problem is, or at least a version that works? Link to comment Share on other sites More sharing options...
Marius05 Posted March 13, 2017 Author Share Posted March 13, 2017 I` can not believe. Nobody? Link to comment Share on other sites More sharing options...
Marius05 Posted March 15, 2017 Author Share Posted March 15, 2017 Bump Link to comment Share on other sites More sharing options...
eleazar Posted March 17, 2017 Share Posted March 17, 2017 If you want a product not to be displayed in the shop front, change the status active to NO. In the BO's product list it's just called Status (stare). Link to comment Share on other sites More sharing options...
Marius05 Posted March 17, 2017 Author Share Posted March 17, 2017 Hi! I want product link and product info to be listed, if i use Status i have product link but all the info disapear. Therefore I tried to create my new method of hidding product Another option is to use Visibility. But how ken I use and display Vsibility in admin product listing column ? Link to comment Share on other sites More sharing options...
Marius05 Posted March 28, 2017 Author Share Posted March 28, 2017 Nobody! 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