php - Magento's getAttributeText is inconsistent -


I am trying to write some custom arguments for browsing and searching in Magento stores.

I thought I would overwrite on GetProductCollection for both Mage_Catalog_Model_Layer and Mage_CatalogSearch_Model_Layer.

I am trying to make decisions based on the value of certain features for some of the products in the collection, but I can not seem to get the text value of all the attributes.

I have overwritten the function as:

  public function getProductCollection () {if (isset ($ this->; _productCollections [$ this- & gt; getCurrentCategory () - & gt; getId ()]) {$ collection = $ this-> gtproductcollections [$ this-> mengageant category () -> getId ()];} and ($ collection = $ it - & gt; MillenContract Category () -> GetProductCollection (); $ this-> readyProductCollection ($ Collection); $ This-> _productCollections [$ this- & gt; MillenContract Category () - & gt; GetId ()] = $ collection;} // $ ben- collection-> add-attit toe seal ('parent_scu'); $ COLLECTION- & gt; addAttributeToSelect ('door_color '); Foreign currency ($ product as $ $ collection) {Echo "\ n SKU:". $ Product-> getSku (). "\ N"; $ Product_data = $ Product-> getData ( ); If (isset ($ product_data ['parent_sku']) & amp; amp; ($ product_data ['parent_sku']! = '')) {Echo "gateadata parent:" $ Product_data ['parent_sku']. N ";} If ($ product-> getAttributeText ('parent_sku')! = '') {Echo "ATTR text parent:" $ Product- & gt; GetAttributeText ('parent_sku'). "\ N"; } If ($ product-> getAttributeText ('door_color')! = '') {Echo "ATTR text color:". $ Product- & gt; GetAttributeText ('door_color'). "\ N"; }} // and Ben Returns $ collection; }   

This produces production:

SKU: TEST_SKU_1
GateData Parent: TEST_SKU_2
ATTR Text Color: Black

Notice:
I add both 'parent_sku' and 'door_color' as the attributes to choose from.
I $ product-> I can use the door using getAttributeText () - $ $ PRODUCT- & gt; Can not access parent_sku using getAttributeText ()
I $ product-> I can use parent_sku through getData ()

; At any time, I have $ PRODUCT- & gt; Calling a matching object ('parent_sku'), it returns incorrectly.

I think it was a caching problem, but I flushed the cache and did not think so.

Does anyone have a clue why I can not use the value of 'parent_sku' through getAttributeText?)

Are parents implemented as a dropdown box? I understand that GetAttributeText has loaded the dropdown option and maps them and reads the ID for you.

Comments