Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Hide A Div ID if Grand Total Less than Specific Dollar Amount
 
adamchodson
Jr. Member
 
Total Posts:  3
Joined:  2012-09-25
 

I’m trying to hide or display a div based on the cart grand total. For instance, if the cart grand total is less than $79, i’d like to hide the div. I’ve tried using conditional statements but it’s not quite working. I’ve tried using the below code in onepage.phtml, review.phtml (where the div is placed) and in the actual file that holds the div I’d like to hide.

<?php
$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
$subtotal = round($totals["subtotal"]->getValue());
$grandtotal = round($totals["grand_total"]->getValue());
if ($grandtotal <= '79'){ ?>
<script type="text/javascript\">$(’#gifterWrap’).hide()</script>
<?php
}
?>
Any insight would be much appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ryan Sun _Kuafu
Guru
 
Total Posts:  317
Joined:  2008-11-14
FL
 

1, make sure cache is cleared
2, make sure this js is ater the giftwrap div
3, you can get grandtotal from quote directly by $quote->getGrandTotal()
4, you don’t even have to use js, just add class display:none

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top