Search code examples
phpmagentomagento-1.5magento-1.6

View images with product attributes in Magento


I am developing a store with magento ... I need to create some "stamps" to the Lodge as:

  • New Product
  • Only Today
  • Free Shipping

The easiest would be using attributes right? How do I attribute to use Yes / No and when set to Yes, display the image, and when set to No, the image does not appear.

Does anyone know the best way to do this?

Thank you,


Solution

  • You can also do it with categories - have a new product, only today, free shipping category and move the products in and out of the categories as need be. The 'stamp' can then be floated over the product image as an additional div in the product grids and or detail pages.

    Will also allow for easier display of these products as a group if required. For example:

    $categoryIds = $_product->getCategoryIds();
    if ( in_array('123',$categoryIds))
        echo '<div class="badge-a">&nbsp;</div>';               
    elseif ( in_array('456',$categoryIds)) 
        echo '<div class="badge-b">&nbsp;</div>';