I have a development system, here is everything working as expected. And I have a staging system, here the attribute is not loaded. It feels like, the sytem don't know, that the attribute doesn't exist in the store/attribute_set/…?
I have an attribute artist_id
and this attribute is not loaded.
The collections are initialized with the attribute:
if (!is_null($this->_productCollection)) {
return $this->_productCollection;
}
$collection = parent::_getProductCollection();
$collection->addAttributeToSelect('artist_id');
I checked wether the attribute is in the collection and it is:
[_selectAttributes:protected] => Array
(
[name] => 71
[short_description] => 73
[price] => 75
[special_price] => 76
[special_from_date] => 77
[special_to_date] => 78
[small_image] => 86
[thumbnail] => 87
[news_from_date] => 93
[news_to_date] => 94
[status] => 96
[url_key] => 97
[required_options] => 110
[image_label] => 112
[small_image_label] => 113
[thumbnail_label] => 114
[msrp_enabled] => 118
[msrp_display_actual_price_type] => 119
[msrp] => 120
[tax_class_id] => 122
[price_type] => 124
[weight_type] => 126
[price_view] => 127
[shipment_type] => 128
[links_purchased_separately] => 129
[links_exist] => 132
[artist_id] => 146
)
But when I try to get $_product->getArtistId()
there is no id.
Debugging on this system is really hard. I tried to find the part where the query is built but didn't find it yet.
UPDATE: Flat tables are OFF.
And now the bad part:
A little
<?php $_product->load($_product->getId()); ?>
in the foreach
of the product/list.phtml
fixes the problem 😉
To be honest: I think I broke something in the database while changing settings directy in the tables.
Is there any connection between attributes and stores?
Any ideas on this problem?
Best Answer
Take a look at attribute settings, make sure that 'Visible on Product View Page on Front-end' is yes and 'Use In Layered Navigation' is yes too (only if attribute is dropdown)
UPDATE:
Another thing you can try is adding:
In config.xml of a module, in the <frontend> section.