1

I have ~24.000 products, each of them have a custom product attribute called item_size.

How do I make sure the item_size attribute show's up on every page where products are shown? When you search for products or view all products in a certain category for example.

Here's an example:

enter image description here

The product on the left is what I would like it to look like. The product on the right is what it currently looks like. I'm using the default Magento 1.9 theme.

Any ideas?

1 Answer 1

2

Step 1: To access the Product Attribute you can use below code.

$_product->getData('attributeCode');

Please note that the product has to be lowercase.

Step 2: This is Listing page so. you have theme folder template/catalog/product/list.phtml file.

Step 3: search below code.

<?php echo $this->getPriceHtml($_product, true) ?>

Step 4: create span tag near and give class and based on that set the CSS.

Note: If you can display data on site and share the link then I can help to what exactly CSS used/

Let me know if any comments.

6
  • Using <?php echo $_Product->getData('item_size'); ?> doesn't work. It deletes all product from the page, except the first one. Any ideas?
    – narzero
    Sep 18, 2014 at 17:28
  • 1
    @narzero try $_product->... (lowercase) Sep 18, 2014 at 17:56
  • U welcome..... 😃
    – Keyul Shah
    Sep 18, 2014 at 18:11
  • @KeyulShah How do I wrap the item_size attribute inside a <span> or <div>? It's inserted as plain text right now..
    – narzero
    Sep 18, 2014 at 18:13
  • 1
    Put get data code in 'div' tsg simple
    – Keyul Shah
    Sep 18, 2014 at 18:14

Your Answer

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

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