2

I have created an product attribute. initially its property "Used in Product Listing" was "No". So when i try to fetch its value in listing page it was returning an empty value. Therefore i changed its value to "Yes" then reIndexed all the Index from admin panel. But still no value is returning in the listing page. However i'm able to get its value in Product details page.

Am i missing something. ?

Please help.!

EDIT Adding code :

private function findPointsPercentage(){

        $attribute = $this->role."_fbp";

        /*
         * Get master Product using the productcode
         */

        $product =  $this->product;
        $isMasterProduct = (int)$product->getIsMasterRecord();
        if(!$isMasterProduct){
            $masterPdtCollection = Mage::getModel('catalog/product')->getCollection()
                                            ->addAttributeToFilter('is_master_record',1)
                                            ->addAttributeToFilter('productcode',$product->getProductcode());
            if($masterPdtCollection instanceof Varien_Data_Collection && $masterPdtCollection->getSize()){
                $product = $masterPdtCollection->getFirstItem();
            }

        }
        $percentage = $product->getData($attribute);
}

The variable $this->role will be based on user. In my case role is general. So value of $attribute will be 'general_fbp'.

I'm using the same function in the details page where i'm able to pull the value for general_fbp

More Details :

This function is defined in a model. And the value of the is $this->product is value from the forloop in list.phtml i.e

<?php $_i = 0; foreach ($_productCollection as $_product): ?>
  • please provide your attribute code and the fetching code you are using – Murtuza Zabuawala Jan 20 '17 at 7:23
1

To show an attribute in product listing page. The following two conditions must be fulfill.

  1. The Attribute Frontend property "Used in Product Listing" to Yes.
  2. The Attribute should be assigned to the "attribute set" that is used during product creation.

1st point you have done . Please also fulfill the 2nd point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.