Prema Posted August 12, 2010 Share Posted August 12, 2010 Hi,I am developing shopping cart website using prestashop integration. now i want to list out products in catalog like default it should display only active products. it means enabled products not disabled one. (right now displaying both types of products . i don't want to display like that. i want to display only active products first)for that i have tried to add condition in AdminTab.phpfunction name is getList()here i have checked this query$sql = ($this->_tmpTableFilter ? 'SELECT * FROM (' : '').' SELECT '.($this->lang ? 'b.*, ' : '').'a.*'.(isset($this->_select) ? ', '.$this->_select.' ' : '').' FROM `'._DB_PREFIX_.$sqlTable.'` a '.($this->lang ? 'LEFT JOIN `'._DB_PREFIX_.$this->table.'_lang` b ON (b.`'.$this->identifier.'` = a.`'.$this->identifier.'` AND b.`id_lang` = '.intval($id_lang).')' : '').' '.(isset($this->_join) ? $this->_join.' ' : '').' WHERE 1 '.(isset($this->_where) ? $this->_where.' ' : '').($this->deleted ? 'AND a.`deleted` = 0 ' : '').$this->_filter.' '.(isset($this->_group) ? $this->_group.' ' : '').' ORDER BY '.(($orderBy == $this->identifier) ? 'a.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay). ($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : '').' LIMIT '.intval($start).','.intval($limit); $this->_list = Db::getInstance()->ExecuteS($sql);for add condition i can use the variable $_where . where can i add and check condition for this variable ? please if any one know help me asapThanksPrema Link to comment Share on other sites More sharing options...
rocky Posted August 12, 2010 Share Posted August 12, 2010 You should use WHERE `active` = 1 to get the enabled products only. Link to comment Share on other sites More sharing options...
Prema Posted August 13, 2010 Author Share Posted August 13, 2010 Thats fine. my doubt is where have to add that condition? i want to display active , non active and damaged products.any have i got it where have to add. in products class. i have added condition like $_where ="AND active =1" like thisis it will make problem in future ? Link to comment Share on other sites More sharing options...
rocky Posted August 13, 2010 Share Posted August 13, 2010 Yes, it may cause a problem if a table without an 'active' field is loaded. You'd be better of modifying a specific tab like admin/tabs/AdminProducts.php instead of classes/AdminTab.php, which is inherited by all tabs. For example, you could change line 53 of admin/tabs/AdminProducts.php from: $this->_filter = 'AND cp.`id_category` = '.intval($this->_category->id); to: $this->_filter = 'AND cp.`id_category` = '.intval($this->_category->id).' AND a.`active` = 1'; This will hide disabled products on the Catalog tab. 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