0

I am calling a block

 $this->getLayout()->createBlock('Amasty_Shopby_Block_List')

that has this in its default method

 $attribute  = Mage::getModel('catalog/resource_eav_attribute')
            ->loadByCode($entityTypeId, $this->getAttributeCode());

I need to set the block so that getAttributeCode returns 'manufacturer' adding

->setAttribute('manufacturer')

is not working any ideas?

2 Answers 2

1

Instead of ->setAttribute('manufacturer') use ->setAttributeCode('manufacturer')
Just make sure the method getAttributeCode does not exist.

5
  • i tried that too it does not work Commented May 23, 2016 at 14:18
  • what does it mean to make sure getAttributeCode doesnt exsist? Commented May 23, 2016 at 14:20
  • If a method does not exist, then it will be transformed automatically to getData('attribute_code'). Commented May 23, 2016 at 14:28
  • i am trying $this->getLayout()->createBlock('Amasty_Shopby_Block_List')->setData('attribute_code', 'manufacturer'); and it still is not working? Commented May 23, 2016 at 14:35
  • why does the attribute code not get set? $this->getLayout()->createBlock('Amasty_Shopby_Block_List')->setAttributeCode('manufacturer') Commented May 23, 2016 at 14:57
0

I found a similar post where setData does not work. Here is the link:-ref link.

May be this can help you as you have mentioned in comment that below code is not working. $this->getLayout()->createBlock('Amasty_Shopby_Block_List')->setData('attribute‌​_code', 'manufacturer');

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.