Magento Forum

   
Page 1 of 2
Blank Attributes Show “No” on Frontend.  -->They should not show at all. How to turn them off? 
 
webscot
Sr. Member
 
Total Posts:  192
Joined:  2009-05-12
 

Since the original post on this topic in Technical has been sitting for a month now with no solutions, maybe it will find better results here. Please help.

We are getting a weird result in 1.4.0.1.

In most, but not all of our products including any newly added products since moving to 1.4.0.1, the attributes of a given attribute set are showing on the product front end with a result of “No” even when there is nothing selected in the drop-down for that given attribute.

When we were running 1.3.2.2, no attributes showed unless there was a selection made for the given attribute in the set.

For example:
Let’s say I was selling shirts and the attribute set contained attributes titled “size” and “color.” If I only select the color blue, the following are the results we would get:
Size: No
Color: Blue

Now being that our attribute sets don’t always use every attribute associated with the set, it looks very stupid having a list of attributes with the word “No” as the result.

Anybody else have this happen and find a solution?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tamburra
Member
 
Total Posts:  46
Joined:  2009-12-02
 

I am also having this problem and am looking for a solution.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Cubix Web Solutions
Guru
 
Avatar
Total Posts:  318
Joined:  2009-07-01
LondON, United Kingdom
 

I think it’s just a templating issue.. You can simply add a one-line if condition to check if the attribute value is blank or not..

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tamburra
Member
 
Total Posts:  46
Joined:  2009-12-02
 

Thanks for the reply Cubix Web Solutions.  I am still a little rusty with the file structure of magento.  Do you have an instructions on what I should exactly change and where? Thank again.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tamburra
Member
 
Total Posts:  46
Joined:  2009-12-02
 

I have imported a product with empty dropdown attributes and everything displays fine on the front end.  It is only when you go into the backend and update your product information that your dropdown attributes for that product show up as NO on the frontend.  It seems that in the admin it is entering NO as an option into the database for that attribute field.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tamburra
Member
 
Total Posts:  46
Joined:  2009-12-02
 

I have sent in a ticket for this bug here:

http://www.magentocommerce.com/bug-tracking/issue?issue=9227

 
Magento Community Magento Community
Magento Community
Magento Community
 
Cubix Web Solutions
Guru
 
Avatar
Total Posts:  318
Joined:  2009-07-01
LondON, United Kingdom
 

To be honest, the file to modify would completely depend on how your template is built. Most likely the file you will need to modify would be located in the folder app/design/frontend/[YOUR INTERFACE]/[YOUR THEME]/template/catalog/product

 
Magento Community Magento Community
Magento Community
Magento Community
 
RickyFk
Sr. Member
 
Avatar
Total Posts:  165
Joined:  2009-03-26
 

I am also getting the same issue on both 1.4.0.1 and 1.4.1.0 even tho the team have reported that this was fixed in the most recent update.

Any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Paaaaa
Member
 
Total Posts:  50
Joined:  2008-10-30
 

Any news on this one?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Paaaaa
Member
 
Total Posts:  50
Joined:  2008-10-30
 

Temporary fix:
File: your theme/template/catalog/product/view/attributes.phtml

Find:

<?php foreach ($_additional as $_data): ?>
            
<tr>
                <
th class=\"label\"><?php echo $this->htmlEscape($this->__($_data[\'label\'])) ?></th>
                <
td class=\"data\"><?php echo $_helper->productAttribute($_product$_data[\'value\']$_data[\'code\']?></td>
            </
tr>
        
<?php endforeach; ?>

replace by this:

<?php foreach ($_additional as $_data): ?>
        <?php 
if($_helper->productAttribute($_product$_data[\'value\']$_data[\'code\'])==\"No\" || $_helper->productAttribute($_product$_data[\'value\']$_data[\'code\']) ==\"Ei\" $_helper->productAttribute($_product$_data[\'value\']$_data[\'code\'])==\"Нет\"): ?>
        <?php 
else: ?> 
            
<tr>
                <
th class=\"label\"><?php echo $this->htmlEscape($this->__($_data[\'label\'])) ?></th>
                <
td class=\"data\"><?php echo $_helper->productAttribute($_product$_data[\'value\']$_data[\'code\']?></td>
            </
tr>
        
<?php endif; ?>
        <?php 
endforeach; ?>

 
Magento Community Magento Community
Magento Community
Magento Community
 
RickyFk
Sr. Member
 
Avatar
Total Posts:  165
Joined:  2009-03-26
 

Brilliant thanks, your patch worked a treat.

If anyone is using the easytabs extension, you will need to overwrite the attributes.phtml file in theme/template/easytabs/attributes.pthml

 
Magento Community Magento Community
Magento Community
Magento Community
 
tvshow
Jr. Member
 
Total Posts:  9
Joined:  2010-06-07
 

Thank You!!! This worked like a charm.

I previously filed a bug report, and the response I got was that this is what is supposed to happen.

This chunk of code worked for me after a I took out some of the back slashes.  Here is what worked for me:

<?php foreach ($_additional as $_data): ?>
        <?php 
if($_helper->productAttribute($_product$_data['value']$_data['code'])=="No" || $_helper->productAttribute($_product$_data['value']$_data['code']) =="Ei" $_helper->
        
productAttribute($_product$_data['value']$_data['code'])=="???"): ?>
        <?php 
else: ?> 
            
<tr>
                <
th class=\"label"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></th>
                <
td class=\"data"><?php echo $_helper->productAttribute($_product$_data['value']$_data['code']?></td>
            </
tr>
        
<?php endif; ?>
        <?php 
endforeach; ?>

 
Magento Community Magento Community
Magento Community
Magento Community
 
MichalL
Jr. Member
 
Total Posts:  14
Joined:  2008-03-02
Kraków
 

Changing theme/template/catalog/product/view/attributes.phtml removes all “no” values. Also when you need it and intentionally set some attributes to “no”.

Method given by icecactus in issue report works well.

Look for file Mage_Eav_Model_Entity_Abstract and copy it to your /local directory

On line 866 you should see

if (!empty($selects)) {
Add

foreach($selects as $query)
{
$query
->where('`value` IS NOT NULL');
}

right below it.

Issue http://www.magentocommerce.com/bug-tracking/issue?issue=9227 is closed, but the bug is still in 1.4.1.1.

 
Magento Community Magento Community
Magento Community
Magento Community
 
pacmanfan
Jr. Member
 
Total Posts:  17
Joined:  2010-05-16
 

MichalL, this solved my problem. It’s excellent, thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
corradomatt
Sr. Member
 
Total Posts:  161
Joined:  2008-09-01
San Diego, CA
 
MichalL - 07 September 2010 12:17 PM

Changing theme/template/catalog/product/view/attributes.phtml removes all “no” values. Also when you need it and intentionally set some attributes to “no”.

Method given by icecactus in issue report works well.

Look for file Mage_Eav_Model_Entity_Abstract and copy it to your /local directory

On line 866 you should see

if (!empty($selects)) {
Add

foreach($selects as $query)
{
$query
->where('`value` IS NOT NULL');
}

right below it.

Issue http://www.magentocommerce.com/bug-tracking/issue?issue=9227 is closed, but the bug is still in 1.4.1.1.

Ok, so if I follow the above post, here is what I do......

Create a folder structure and file under the local directory like this......

app/code/local/Mage/EAV/Model/Entity/Abstract.php

I use the abstract.php from the app/code/core/Mage/EAV/Model/Entity/Abstract.php and then I change....

(around line 866 for 1.4.1.0)

if (!empty($selects)) {
            $values 
$this->_getReadAdapter()->fetchAll(implode(' UNION '$selects));
            foreach (
$values as $valueRow{
                $this
->_setAttribteValue($object$valueRow);
            
}
        }

to this.....

if (!empty($selects)) {
            
foreach($selects as $query)
              
{
              $query
->where('`value` IS NOT NULL');
              

            $values 
$this->_getReadAdapter()->fetchAll(implode(' UNION '$selects));
            foreach (
$values as $valueRow{
                $this
->_setAttribteValue($object$valueRow);
            
}
        }

For some reason it doesn’t work. Is my directory structure wrong? Or am I missing something else?

 
Magento Community Magento Community
Magento Community
Magento Community
 
dbabaev
Sr. Member
 
Total Posts:  83
Joined:  2008-03-29
 

I just upgraded to 1.4.2.0 from 1.4.1.1 and the blank attributes appear as “No” for some reason. I’ve never had that problems before :(

I tried all of the suggestions in this and other threads but nothing worked. Please can someone point me in the right direction?

Thanks in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 2