<ol class="product-grid">
<?php foreach ($products as $product): ?>
<li class="product-grid_item product-tile">
<a class="product-image" href="<?php echo $product->getProductUrl(); ?>">
<div class="quickview"><button class="button button--s button--inverted">Quick View</button></div>
<picture class="pimg1">
<source srcset="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize(290, 290); ?>" media="(min-width: 400px)">
<img srcset="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize(130, 130); ?>" alt="<?php echo $this->escapeHtml($this->getImageLabel($product, 'small_image')); ?>">
</picture>
<picture class="pimg2">
<source srcset="<?php echo $this->helper('catalog/image')->init($product, 'thumbnail')->resize(290, 290); ?>" media="(min-width: 400px)">
<img srcset="<?php echo $this->helper('catalog/image')->init($product, 'thumbnail')->resize(130, 130); ?>" alt="<?php echo $this->escapeHtml($this->getImageLabel($product, 'thumbnail')); ?>">
</picture>
<?php
// GravDept:
// Check if product is new.
$isNewProduct = Mage::helper('magefrontend')->isNewProduct($product);
?>
<?php if ($isNewProduct): ?>
<ul class="badge-list">
<li class="badge-list_item badge-list_item--new">
<?php echo $this->__('New'); ?>
</li>
</ul>
<?php endif; ?>
</a>
<div class="product-banner-box">
<span class="plussize-banner">now in plus sizes</span>
</div>
-
I want to display last div only if size of the product is also XXL – onlyfordigitalworld Jun 23 '17 at 11:00
-
are you using custom options or configurable products? – Jaimin Sutariya Jun 23 '17 at 11:12
-
Yes, My size attribute is custom ,and itis for all type of products – onlyfordigitalworld Jun 23 '17 at 11:14
Add a comment
|
Try replacing below code
<div class="product-banner-box">
<span class="plussize-banner">now in plus sizes</span>
</div>
With
<?php
$showMessage = false;
$tmpProduct = Mage::getModel("catalog/product")->load($product->getId());
foreach ($tmpProduct->getOptions() as $o) {
if($o->getTitle() == 'Size'){ // Use Your Size Option Title
$values = $o->getValues();
foreach ($values as $v){
if($v->getTitle() == 'XXL'){ // Use your option text to match
$showMessage = true;
break;
}
}
}
}
?>
<?php if($showMessage): ?>
<div class="product-banner-box">
<span class="plussize-banner">now in plus sizes</span>
</div>
<?php endif; ?>
-
-
-
Uncaught Error: Call to undefined method Mage_Catalog_Model_Resource_Product_Collection::getId() in – onlyfordigitalworld Jun 23 '17 at 12:10
-
1This solution should work, but it's better not to use
$product = Mage::getModel("catalog/product")->load($_product->getId());
in a product grid, because then the entire product info will be loaded, for each product in the grid. Better make sure the value is present in the collection. – Niels Jun 23 '17 at 12:10 -