Magento sets null value for non-selected attribute value in admin. It affects the frontend display. How to deal with it? -


i've created new attribute (type: dropdown) not required field.

at moment, every product shows in frontend "my attribute: n/a".

after save in product, magento write null value inside catalog_product_entity_int table attribute.

but in frontend attribute appear "my attribute: no" instead of "n/a".

it looks bug, since didn't touch in attribute while editing new product.

is there way deal or apply rule in phtml?

actually not bug. it's feature.
n/a displayed when there no record in table catalog_product_entity_int attribute.
when add attribute there no values attribute product, save product has attribute, null value inserted in table (as stated). no value different null value.
magic happens here mage_catalog_block_product_view_attributes::getadditionaldata().
these lines interest you:

if (!$product->hasdata($attribute->getattributecode())) { // no value in database     $value = mage::helper('catalog')->__('n/a'); } elseif ((string)$value == '') { // empty value in database     $value = mage::helper('catalog')->__('no');   } 

if want change override method.
if change might want take @ mage_catalog_block_product_compare_list::getproductattributevalue().
same system used displaying attribute values in compare products list.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -