CSS not showing for “NEW” or “SALE” label












3















So I followed this tutorial to add "NEW" or "SALE" label for this site: http://www.ubertheme.com/docs/add-product-labels/. The label does show up on the product icon but for some reason the CSS isn't showing.



Current code for the appdesignfrontenddefault{theme}templatecatalogproductlist.phtml



<?php

?>
<?php

?>
<?php
$_productCollection=$this->getLoadedProductCollection();
$_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>



<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<?php $i=1; ?>

<!--label-->
<?php $i=0; foreach ($_productCollection as $_product): ?>

<?php

$_product = Mage::getModel('catalog/product')->load($_product->getId());

$attribute = $_product->getResource()->getAttribute('label');

if(is_object($attribute)) {

$attdefaultvalue = $attribute->getDefaultValue();

$attributeValue = Mage::getModel('catalog/product')->load($_product->getId())->getlabel();

$attributeValueName = Mage::getModel('catalog/product')->load($_product->getId())->getAttributeText('label');

if(strlen($attributeValue) && ($attdefaultvalue !== $attributeValue)) {

$labeltype = $attributeValueName;

}

else {

$labeltype = "";

}

}

?>

<?php if ($labeltype): ?>

<span class="<?php echo $labeltype; ?>-label"><?php echo $labeltype; ?></span>

<?php endif; ?>

<!--end label-->

<div class="product_top_box_container">
<div class="product_top_box_image"> <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image'); ?>" width="162" height="162" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a> </div>
<div class="product_top_box_name" style=" height:80px;"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></div>
<div class="sep2" style="float:left;"></div>
<div class="product_box_read_more"><a href="<?php echo $_product->getProductUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/product_read_more.png', array('_secure' => true)) ?>" alt="" /></a></div>
<div class="flaot_clear"></div>
</div>
<? if( $i%5 == 0)

{ ?>
<?php }
else {
?>
<div class="product_seperater"></div>
<?php
}


?>
<?php $i++ ; endforeach ; ?>
<div class="flaot_clear"></div>
</div>
</div>
</div>
<?php endif; ?>


And my CSS: skinfrontenddefault{theme}css.style
has this code in it



/*Product Label*/
.products-grid .NEW-label {
background: #15ae75;
padding: 2px 5px;
position: absolute;
right: -5px;
top: -5px;
color: #fff;
text-transform: uppercase;
font-size: 92%;
border-radius: 3px;
}
.products-grid .DISCONTINUED-label {
background: #ef4135;
padding: 2px 5px;
position: fixed;
position: absolute;
right: -5px;
top: -5px;
color: #fff;
text-transform: uppercase;
font-size: 92%;
border-radius: 3px;
}









share|improve this question
















bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • The label attribute backend: i.stack.imgur.com/WbBnU.jpg and i.stack.imgur.com/5CfbJ.jpg What the frontend looks like: i.stack.imgur.com/scVcc.jpg

    – Annie
    Oct 27 '15 at 18:45













  • add css .product_top_box_container{position: relative;}

    – Prashant Valanda
    Oct 27 '15 at 19:23











  • no luck..... :(

    – Annie
    Oct 27 '15 at 19:55
















3















So I followed this tutorial to add "NEW" or "SALE" label for this site: http://www.ubertheme.com/docs/add-product-labels/. The label does show up on the product icon but for some reason the CSS isn't showing.



Current code for the appdesignfrontenddefault{theme}templatecatalogproductlist.phtml



<?php

?>
<?php

?>
<?php
$_productCollection=$this->getLoadedProductCollection();
$_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>



<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<?php $i=1; ?>

<!--label-->
<?php $i=0; foreach ($_productCollection as $_product): ?>

<?php

$_product = Mage::getModel('catalog/product')->load($_product->getId());

$attribute = $_product->getResource()->getAttribute('label');

if(is_object($attribute)) {

$attdefaultvalue = $attribute->getDefaultValue();

$attributeValue = Mage::getModel('catalog/product')->load($_product->getId())->getlabel();

$attributeValueName = Mage::getModel('catalog/product')->load($_product->getId())->getAttributeText('label');

if(strlen($attributeValue) && ($attdefaultvalue !== $attributeValue)) {

$labeltype = $attributeValueName;

}

else {

$labeltype = "";

}

}

?>

<?php if ($labeltype): ?>

<span class="<?php echo $labeltype; ?>-label"><?php echo $labeltype; ?></span>

<?php endif; ?>

<!--end label-->

<div class="product_top_box_container">
<div class="product_top_box_image"> <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image'); ?>" width="162" height="162" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a> </div>
<div class="product_top_box_name" style=" height:80px;"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></div>
<div class="sep2" style="float:left;"></div>
<div class="product_box_read_more"><a href="<?php echo $_product->getProductUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/product_read_more.png', array('_secure' => true)) ?>" alt="" /></a></div>
<div class="flaot_clear"></div>
</div>
<? if( $i%5 == 0)

{ ?>
<?php }
else {
?>
<div class="product_seperater"></div>
<?php
}


?>
<?php $i++ ; endforeach ; ?>
<div class="flaot_clear"></div>
</div>
</div>
</div>
<?php endif; ?>


And my CSS: skinfrontenddefault{theme}css.style
has this code in it



/*Product Label*/
.products-grid .NEW-label {
background: #15ae75;
padding: 2px 5px;
position: absolute;
right: -5px;
top: -5px;
color: #fff;
text-transform: uppercase;
font-size: 92%;
border-radius: 3px;
}
.products-grid .DISCONTINUED-label {
background: #ef4135;
padding: 2px 5px;
position: fixed;
position: absolute;
right: -5px;
top: -5px;
color: #fff;
text-transform: uppercase;
font-size: 92%;
border-radius: 3px;
}









share|improve this question
















bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • The label attribute backend: i.stack.imgur.com/WbBnU.jpg and i.stack.imgur.com/5CfbJ.jpg What the frontend looks like: i.stack.imgur.com/scVcc.jpg

    – Annie
    Oct 27 '15 at 18:45













  • add css .product_top_box_container{position: relative;}

    – Prashant Valanda
    Oct 27 '15 at 19:23











  • no luck..... :(

    – Annie
    Oct 27 '15 at 19:55














3












3








3








So I followed this tutorial to add "NEW" or "SALE" label for this site: http://www.ubertheme.com/docs/add-product-labels/. The label does show up on the product icon but for some reason the CSS isn't showing.



Current code for the appdesignfrontenddefault{theme}templatecatalogproductlist.phtml



<?php

?>
<?php

?>
<?php
$_productCollection=$this->getLoadedProductCollection();
$_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>



<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<?php $i=1; ?>

<!--label-->
<?php $i=0; foreach ($_productCollection as $_product): ?>

<?php

$_product = Mage::getModel('catalog/product')->load($_product->getId());

$attribute = $_product->getResource()->getAttribute('label');

if(is_object($attribute)) {

$attdefaultvalue = $attribute->getDefaultValue();

$attributeValue = Mage::getModel('catalog/product')->load($_product->getId())->getlabel();

$attributeValueName = Mage::getModel('catalog/product')->load($_product->getId())->getAttributeText('label');

if(strlen($attributeValue) && ($attdefaultvalue !== $attributeValue)) {

$labeltype = $attributeValueName;

}

else {

$labeltype = "";

}

}

?>

<?php if ($labeltype): ?>

<span class="<?php echo $labeltype; ?>-label"><?php echo $labeltype; ?></span>

<?php endif; ?>

<!--end label-->

<div class="product_top_box_container">
<div class="product_top_box_image"> <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image'); ?>" width="162" height="162" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a> </div>
<div class="product_top_box_name" style=" height:80px;"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></div>
<div class="sep2" style="float:left;"></div>
<div class="product_box_read_more"><a href="<?php echo $_product->getProductUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/product_read_more.png', array('_secure' => true)) ?>" alt="" /></a></div>
<div class="flaot_clear"></div>
</div>
<? if( $i%5 == 0)

{ ?>
<?php }
else {
?>
<div class="product_seperater"></div>
<?php
}


?>
<?php $i++ ; endforeach ; ?>
<div class="flaot_clear"></div>
</div>
</div>
</div>
<?php endif; ?>


And my CSS: skinfrontenddefault{theme}css.style
has this code in it



/*Product Label*/
.products-grid .NEW-label {
background: #15ae75;
padding: 2px 5px;
position: absolute;
right: -5px;
top: -5px;
color: #fff;
text-transform: uppercase;
font-size: 92%;
border-radius: 3px;
}
.products-grid .DISCONTINUED-label {
background: #ef4135;
padding: 2px 5px;
position: fixed;
position: absolute;
right: -5px;
top: -5px;
color: #fff;
text-transform: uppercase;
font-size: 92%;
border-radius: 3px;
}









share|improve this question
















So I followed this tutorial to add "NEW" or "SALE" label for this site: http://www.ubertheme.com/docs/add-product-labels/. The label does show up on the product icon but for some reason the CSS isn't showing.



Current code for the appdesignfrontenddefault{theme}templatecatalogproductlist.phtml



<?php

?>
<?php

?>
<?php
$_productCollection=$this->getLoadedProductCollection();
$_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>



<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<?php $i=1; ?>

<!--label-->
<?php $i=0; foreach ($_productCollection as $_product): ?>

<?php

$_product = Mage::getModel('catalog/product')->load($_product->getId());

$attribute = $_product->getResource()->getAttribute('label');

if(is_object($attribute)) {

$attdefaultvalue = $attribute->getDefaultValue();

$attributeValue = Mage::getModel('catalog/product')->load($_product->getId())->getlabel();

$attributeValueName = Mage::getModel('catalog/product')->load($_product->getId())->getAttributeText('label');

if(strlen($attributeValue) && ($attdefaultvalue !== $attributeValue)) {

$labeltype = $attributeValueName;

}

else {

$labeltype = "";

}

}

?>

<?php if ($labeltype): ?>

<span class="<?php echo $labeltype; ?>-label"><?php echo $labeltype; ?></span>

<?php endif; ?>

<!--end label-->

<div class="product_top_box_container">
<div class="product_top_box_image"> <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image'); ?>" width="162" height="162" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a> </div>
<div class="product_top_box_name" style=" height:80px;"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></div>
<div class="sep2" style="float:left;"></div>
<div class="product_box_read_more"><a href="<?php echo $_product->getProductUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/product_read_more.png', array('_secure' => true)) ?>" alt="" /></a></div>
<div class="flaot_clear"></div>
</div>
<? if( $i%5 == 0)

{ ?>
<?php }
else {
?>
<div class="product_seperater"></div>
<?php
}


?>
<?php $i++ ; endforeach ; ?>
<div class="flaot_clear"></div>
</div>
</div>
</div>
<?php endif; ?>


And my CSS: skinfrontenddefault{theme}css.style
has this code in it



/*Product Label*/
.products-grid .NEW-label {
background: #15ae75;
padding: 2px 5px;
position: absolute;
right: -5px;
top: -5px;
color: #fff;
text-transform: uppercase;
font-size: 92%;
border-radius: 3px;
}
.products-grid .DISCONTINUED-label {
background: #ef4135;
padding: 2px 5px;
position: fixed;
position: absolute;
right: -5px;
top: -5px;
color: #fff;
text-transform: uppercase;
font-size: 92%;
border-radius: 3px;
}






magento-1 theme css design labels






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 12 '17 at 12:44









Siarhey Uchukhlebau

9,43692757




9,43692757










asked Oct 27 '15 at 18:45









AnnieAnnie

284




284





bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • The label attribute backend: i.stack.imgur.com/WbBnU.jpg and i.stack.imgur.com/5CfbJ.jpg What the frontend looks like: i.stack.imgur.com/scVcc.jpg

    – Annie
    Oct 27 '15 at 18:45













  • add css .product_top_box_container{position: relative;}

    – Prashant Valanda
    Oct 27 '15 at 19:23











  • no luck..... :(

    – Annie
    Oct 27 '15 at 19:55



















  • The label attribute backend: i.stack.imgur.com/WbBnU.jpg and i.stack.imgur.com/5CfbJ.jpg What the frontend looks like: i.stack.imgur.com/scVcc.jpg

    – Annie
    Oct 27 '15 at 18:45













  • add css .product_top_box_container{position: relative;}

    – Prashant Valanda
    Oct 27 '15 at 19:23











  • no luck..... :(

    – Annie
    Oct 27 '15 at 19:55

















The label attribute backend: i.stack.imgur.com/WbBnU.jpg and i.stack.imgur.com/5CfbJ.jpg What the frontend looks like: i.stack.imgur.com/scVcc.jpg

– Annie
Oct 27 '15 at 18:45







The label attribute backend: i.stack.imgur.com/WbBnU.jpg and i.stack.imgur.com/5CfbJ.jpg What the frontend looks like: i.stack.imgur.com/scVcc.jpg

– Annie
Oct 27 '15 at 18:45















add css .product_top_box_container{position: relative;}

– Prashant Valanda
Oct 27 '15 at 19:23





add css .product_top_box_container{position: relative;}

– Prashant Valanda
Oct 27 '15 at 19:23













no luck..... :(

– Annie
Oct 27 '15 at 19:55





no luck..... :(

– Annie
Oct 27 '15 at 19:55










1 Answer
1






active

oldest

votes


















0














don't use the span because you can not use css position on span and apply width css element on that. so use div element



change



<span class="<?php echo $labeltype; ?>-label"><?php echo $labeltype; ?></span>


to



<div class="<?php echo $labeltype; ?>-label"><?php echo $labeltype; ?></div>





share|improve this answer
























  • still no luck... the css is still not showing.

    – Annie
    Oct 28 '15 at 18:44











  • Remove the product-grid in class write direct class

    – Qaisar Satti
    Oct 28 '15 at 18:51











  • no change... still looks the same.

    – Annie
    Oct 28 '15 at 22:19











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f87881%2fcss-not-showing-for-new-or-sale-label%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














don't use the span because you can not use css position on span and apply width css element on that. so use div element



change



<span class="<?php echo $labeltype; ?>-label"><?php echo $labeltype; ?></span>


to



<div class="<?php echo $labeltype; ?>-label"><?php echo $labeltype; ?></div>





share|improve this answer
























  • still no luck... the css is still not showing.

    – Annie
    Oct 28 '15 at 18:44











  • Remove the product-grid in class write direct class

    – Qaisar Satti
    Oct 28 '15 at 18:51











  • no change... still looks the same.

    – Annie
    Oct 28 '15 at 22:19
















0














don't use the span because you can not use css position on span and apply width css element on that. so use div element



change



<span class="<?php echo $labeltype; ?>-label"><?php echo $labeltype; ?></span>


to



<div class="<?php echo $labeltype; ?>-label"><?php echo $labeltype; ?></div>





share|improve this answer
























  • still no luck... the css is still not showing.

    – Annie
    Oct 28 '15 at 18:44











  • Remove the product-grid in class write direct class

    – Qaisar Satti
    Oct 28 '15 at 18:51











  • no change... still looks the same.

    – Annie
    Oct 28 '15 at 22:19














0












0








0







don't use the span because you can not use css position on span and apply width css element on that. so use div element



change



<span class="<?php echo $labeltype; ?>-label"><?php echo $labeltype; ?></span>


to



<div class="<?php echo $labeltype; ?>-label"><?php echo $labeltype; ?></div>





share|improve this answer













don't use the span because you can not use css position on span and apply width css element on that. so use div element



change



<span class="<?php echo $labeltype; ?>-label"><?php echo $labeltype; ?></span>


to



<div class="<?php echo $labeltype; ?>-label"><?php echo $labeltype; ?></div>






share|improve this answer












share|improve this answer



share|improve this answer










answered Oct 28 '15 at 4:57









Qaisar SattiQaisar Satti

26.4k1255106




26.4k1255106













  • still no luck... the css is still not showing.

    – Annie
    Oct 28 '15 at 18:44











  • Remove the product-grid in class write direct class

    – Qaisar Satti
    Oct 28 '15 at 18:51











  • no change... still looks the same.

    – Annie
    Oct 28 '15 at 22:19



















  • still no luck... the css is still not showing.

    – Annie
    Oct 28 '15 at 18:44











  • Remove the product-grid in class write direct class

    – Qaisar Satti
    Oct 28 '15 at 18:51











  • no change... still looks the same.

    – Annie
    Oct 28 '15 at 22:19

















still no luck... the css is still not showing.

– Annie
Oct 28 '15 at 18:44





still no luck... the css is still not showing.

– Annie
Oct 28 '15 at 18:44













Remove the product-grid in class write direct class

– Qaisar Satti
Oct 28 '15 at 18:51





Remove the product-grid in class write direct class

– Qaisar Satti
Oct 28 '15 at 18:51













no change... still looks the same.

– Annie
Oct 28 '15 at 22:19





no change... still looks the same.

– Annie
Oct 28 '15 at 22:19


















draft saved

draft discarded




















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f87881%2fcss-not-showing-for-new-or-sale-label%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

What other Star Trek series did the main TNG cast show up in?

Berlina muro

Berlina aerponto