Last active
August 29, 2015 13:57
-
-
Save rabu81/9363010 to your computer and use it in GitHub Desktop.
How to load the total amount in Magento
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// load the latest order | |
$order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId()); | |
// get the total amount | |
$amount = number_format($order->getGrandTotal(),2); | |
// now you can use the variable $amount in the same page, to print the total amount | |
// important! please add your own error handling to avoid exceptions or errors displayed on the page | |
?> | |
<script type="text/javascript"> | |
var _agTrack = _agTrack || []; | |
// please make sure you set the correct customer code | |
_agTrack.push({cid:"XXXXX"}) | |
// in this example USD is used for the currency code | |
// please set your correct currency code or optionally load it dynamically, if you are handling multiple currencies | |
_agTrack.push({conv:"USD<?php echo $amount;?>"}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment