0

I have just created a custom attribute for categories through Attribute Manager, with attribute code category_view_img.

Now I can only put one image into a category, and use this image for both the banner and category-view-image on the home page. I want to use this custom attribute image on the home page as category view image. How can I get this image on front-end?

I am new to Magento and I don't have ideas how to do this, please assist. I am using Magento 1.9.2.3.

Glorfindel
3661 gold badge8 silver badges14 bronze badges
asked May 7, 2016 at 11:34

2 Answers 2

0

Use below code:

<?php $category = Mage::getModel('catalog/category')->load('category-id'); ?>
<img src="<?php echo $category->getCategoryViewImg(); ?> />
answered May 7, 2016 at 11:44
1
  • Thanx For Your Reply @Prashant, I have tried this, But its not working. Maybe there is any other way to getData from Catergory Attributes. Commented May 9, 2016 at 6:53
0

After spinning my head regularly throughout all over Internet, I finally found a solution for this issue:

var $image= trim(Mage::getBaseUrl('media').'catalog/category/'.$_category->getData('category_view_img'));
<img src="<?php echo $image;?>"/>

I hope this helps someone.

Glorfindel
3661 gold badge8 silver badges14 bronze badges
answered May 12, 2016 at 9:13

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.