short :
Attribute have many dropdown values - v1,v2,v3,v4
IF all Products are assigned to value "v1" of an attribute , means no products are assigned to "v2,v3.v4" than that Attribute label should not visible under Layered Navigation....
Long :
we wanted to hide one attribute value in layered navigation.
many attribute codes have same attribute value.
ex: "attribute codes "a1", "a2", "a3", "a4" have attribute value "v1"
we are using following code to hide the attribute value "v1" in layered navigation.
but Attribute Label is still displaying in layered navigation.
if for attribute code : "a1" , attribute label is "L1" , values are "v1", "v2","v3"
if all products are assigned to "v1", than along with "v1" , I want to hide "L1" in layered navigation.

<?php
$_helper = $this->helper('catalog/output');
$_product = $this->getProduct();
?>
<?php if($_additional = $this->getAdditionalData()): ?>
<div class="fp1"><?php $Pro_name = $_product->getName();?>
<h2><?php echo $this->__('Specifications Of '."$Pro_name") ?></h2><br/><br/>
<table class="data-table" id="product-attribute-specs-table">
<col width="25%" />
<col />
<tbody>
<?php foreach ($_additional as $_data): ?>
<?php $_attribute = $_product->getResource()->getAttribute($_data['code']);
/* hide abc */
if($_attribute->getFrontend()->getValue($_product) == 'v1') {
continue;
}
/* hide no abc*/
if (!is_null($_product->getData($_attribute->getAttributeCode())) && (trim((string)$_attribute->getFrontend()->getValue($_product)) != ''))
{
if ($_data['code'] == 'gendernew'):
?>
<tr><th colspan="3"><?php echo $this->__('') ?></th></tr>
<th class = "tablehead" colspan="3" > GENERAL </th>
<?php elseif ($_data['code'] == 'productweight'): ?>
<tr><th class = "tablehead" id="prod_dim" colspan="3"><p style="background: rgb(255, 255, 255) none repeat scroll 0% 0% ! important; color: rgb(255, 255, 255); width: 100%; padding-top: 10px; padding-right: 10px; padding-left: 10px; padding-bottom: 0px ! important;" class="Product_dim">Product Dimension</p><?php echo $this->__('PRODUCT DIMENSION') ?></th></tr>
<?php endif; ?>
<tr>
<th class="label"><?php echo $this->escapeHtml($this->__($_data['label'])) ?></th>
<?php
if (($_data['code'] == 'brnad') || ($_data['code'] == 'age')||($_data['code'] == 'mobile_design'))
{ ?>
<td class="data">
<?php
$_ageValues = $_product->getAttributeText($_data['code']);
$count = 1;
?>
<?php if(is_array($_ageValues)): foreach($_ageValues as $_ageValue): ?>
<?php if($count > 1) { echo ","; } ?>
<?php echo $_ageValue; ?>
<?php $count++; ?>
<?php endforeach;
else: echo $_product->getAttributeText($_data['code']);
endif; ?>
</td>
<?php } else { ?>
<td class="data"><?php echo $_helper->productAttribute($_product, $_product->getData($_data['code']), $_data['code']); ?></td>
<?php
}
?>
</tr>
<?php
}
?>
<?php endforeach; ?>
</tbody>
</table>
</div>
<script type="text/javascript">decorateTable('product-attribute-specs-table')</script>
<?php endif;?>
<?php
$attribute_value = 'xyz ';
if (strlen($attribute_value) > 0)
{
// code to display the value
}
?>
As per my understanding, below solution would resolve your issue:-
Please copy app/design/frontend/base/default/template/em_layerednavigation/view.phtml
template file(em_layerednavigation folder) and place it in your theme and append below code after line number 49:-
<?php if($this->__($_filter->getName())=='L1'&& $_filter->getItemsCount()<=1)
continue;?>

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With