Jump to content

How to Hide some data sheet tabs on some features.


Recommended Posts

Hi everyone, a need some help please. 

I made some features wich serve only to make some difference between products in a particular subcategory, but I do not want them to show up on the more info data tabs. BUT I do NOT want to remove all feature displays, only those few that serve as filters for me. Example for better understanding: I have a subcategory called "adult incontinency", which cannot be further divided in more subcategories, but it contains different products, like "diapers for incontinence" and "pads for incontinence".

Hence I made two features to be able to filter them separately with layered navigationmodule, but stay in the same category. All good now, but I just dont want for these features to show up on the More info tabs Data sheet, its just a useless info on the screen. But I have other features that I have to show on other products. So how do I filter which feature to show on screen and which not? 

post-759375-0-32655800-1414157418_thumb.jpg

post-759375-0-01566600-1414157410_thumb.jpg

 

The above is copied from an old topic which has not been closed, I put my problem there but I get no answer, so I feel forced to open a new topic - apologize for this, but I need the answer. Old topic was this:

http://www.prestashop.com/forums/topic/282397-how-to-hide-on-feature-in-the-data-sheet/

 Vekia offered a solution with an {if} condition in the product.tpl file, but it does not work for me at all. Maybe just a syntax error or logical error, I dunno. Please help :)

Link to comment
Share on other sites

hello,

 

if you don't want some feature in the product page, you can create an override of the product page controller in order to have features in array with their id as key :

$features_by_key = array();

   $features = $this->product->getFrontFeatures($this->context->language->id);
      foreach ($features as $key=>$value) {
        $features_by_key[$value['id_feature']]['name'] = $value['name'];
        $features_by_key[$value['id_feature']]['value'] = $value['value'];
      }
$feature_to_exclude = array(2,3...);
assign those arrays ($features_by_key) to smarty


 
 
 
 
 
 
PHP
1
2
3
4
5
6
7
8
9
10
$this->context->smarty->assign(array(
'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'),
'customizationFields' => ($this->product->customizable) ? $this->product->getCustomizationFields($this->context->language->id) : false,
'accessories' => $this->product->getAccessories($this->context->language->id),
'return_link' => $return_link,
'product' => $this->product,
'product_manufacturer' => $product_manufacturer,
'token' => Tools::getToken(false),
'features' => $features,
        'features_by_key' => $features_by_key,
 

In your product page :
replace :

{foreach from=$features item=feature}
<tr class="{cycle values="odd,even"}">
{if isset($feature.value)}
<td>{$feature.name|escape:'html':'UTF-8'}</td>
<td>{$feature.value|escape:'html':'UTF-8'}</td>
{/if}
</tr>
{/foreach}

by


{foreach from=$features_by_key key=key item=feature}
<tr class="{cycle values="odd,even"}">
{if !array_key_exists($key,$feature_to_exclude)}
<td>{$feature.$key.name|escape:'html':'UTF-8'}</td>
<td>{$feature.$key.value|escape:'html':'UTF-8'}</td>
{/if}
</tr>
{/foreach}

I wrote a post about this but it s in french : http://www.prestarocket.com/blog/prestashop-tut-feature-produit/

  • Like 1
Link to comment
Share on other sites

Oui, oui, monsieur, merci beaucoup, but there are multiple problems with this: 1.) I dont speak french, which is bad, but even worse is that 2.) I dont speak php. I hardly speak html and smarty, but no php at all. So i try avoiding fiddling with controllers and such.But I wont give up. Please gimme some time to understand what you just said above, I will come with a feedback shortly. I get the logic of it, I just cant put it into code... sorry, you are not talking to a programmer here, I`m just an ordinary mortal. So i`ll be back soon...
(went off digging into php comprehending)

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...