Jump to content
thirty bees forum

How to show product visibility in product list


zimmer-media

Recommended Posts

Expand the product list with the product visibility column. Either: Controller / Admin / AdminProductsController.php or override override / controllers / admin / AdminProductsController.php.

Find the following codes and replace them.

Step 1 original $this->_select .= $aliasImage.'.`id_image` AS `id_image`, cl.`name` AS `name_category`, '.$alias.'.`price`, 0 AS `price_final`, a.`is_virtual`, pd.`nb_downloadable`, sav.`quantity` AS `sav_quantity`, '.$alias.'.`active`, IF(sav.`quantity`<=0, 1, 0) AS `badge_danger`'; change to $this->_select .= $aliasImage.'.`id_image` AS `id_image`, cl.`name` AS `name_category`, '.$alias.'.`price`, 0 AS `price_final`, a.`is_virtual`, pd.`nb_downloadable`, sav.`quantity` AS `sav_quantity`, '.$alias.'.`active`, '.$alias.'.`visibility` AS `my_visibility`, IF(sav.`quantity`<=0, 1, 0) AS `badge_danger`';

step 2 before if ($joinCategory && (int) $this->id_current_category) { $this->fields_list['position'] = [ 'title' => $this->l('Position'), 'filter_key' => 'cp!position', 'align' => 'center', 'position' => 'position', ]; add this $this->fields_list['my_visibility'] = [ 'title' => $this->l('Visibility'), 'align' => 'left', 'class' => 'fixed-width-xs', 'align' => center, 'havingFilter' => true, 'filter_key' => 'my_visibility', ];

If the text should be translated use this code $this->fields_list['my_visibility'] = [ 'title' => $this->l('Visibility'), 'align' => 'left', 'class' => 'fixed-width-xs', 'align' => center, 'havingFilter' => true, 'filter_key' => 'my_visibility', 'callback' => 'my_visibility_function', ]; step 3

after if ($joinCategory && (int) $this->id_current_category) { $this->fields_list['position'] = [ 'title' => $this->l('Position'), 'filter_key' => 'cp!position', 'align' => 'center', 'position' => 'position', ]; } } add with your languages between ...... or change the style public static function my_visibility_function($my_visibility_function) { if ($my_visibility_function == 'both') return '<span style="background-color : #0b9819; color : #ffffff; border-radius : 2px/2px"> Sichtbar </span>'; elseif ($my_visibility_function == 'catalog') return '<span style="background-color : #009adf; color : #ffffff; border-radius : 2px/2px"> Katalog </span>'; elseif ($my_visibility_function == 'search') return '<span style="background-color : #0020df; color : #ffffff; border-radius : 2px/2px"> Suche </span>'; else return '<span style="background-color : #6c6c6c; color : #ffffff; border-radius : 2px/2px"> Nein </span>'; }

Note, if a different language is used, the filter only works with the English terms. both - catalog - search - none

images only german - sorry 0_1518458322937_a10.png

0_1518458339454_a11.png

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...