Unable to get product custom attribute value on product page

11,593

You should be able to

$_product->getPrdHelpTab();

Try adding to the product collection when it's gathered

$_productCollection->addAttributeToSelect("prd_help_tab");

Make sure the attribute in the admin is included in flat tables by setting it to "Used in Product Listing" and then reindexing

include attribute in product flat

Share:
11,593
Imran Zahoor
Author by

Imran Zahoor

BY DAY: Application developer by profession, so that's what I do on daily basis playing with programming problems and helping my team to move forward. BY NIGHT: Listening to news, watch cricket or play some Computer or Mobile game. FOR FUN: Love traveling and spending time with my family. "Always enjoy learning new technologies especially related to programming and data."

Updated on June 04, 2022

Comments

  • Imran Zahoor
    Imran Zahoor almost 2 years

    I introduced an attribute for products from admin, and assigned a value to it for a specific product to get it's value. But the value is not showing up on frontend, I tried all recommended methods but was unable to get it. Then I moved on it's debugging with print_r($_product->debug()). And this debug showed me the following behavior:

    Array
    (
        [store_id] => 1
        [entity_id] => 339
    
        [_cache_instance_products] => Array
        (
            [0 (Mage_Catalog_Model_Product)] => Array
            .
            .
            .
            [419 (Mage_Catalog_Model_Product)] => Array
            (
                [entity_id] => 1210
            [entity_type_id] => 4
                [prd_help_tab] => This is testing help for "Mobster US e-liquid"
            )
        )
    )
    

    The attribute name is "prd_help_tab" and it's value is there, but it's inside _cache_instance_products => 419 (Mage_Catalog_Model_Product) => prd_help_tab

    My question is how to get this value in template file? As the value is only in hierarchy which mentioned above.

    After further investigations, I came to know that this problem raises up in "Configurable Products".