I have a third party service that needs customer info to manage advertisement. I have this code for the successpage of Magento:

<script type="text/javascript"> window.sovIframes = window.sovIframes || []; window.sovIframes.push({ 

trafficSourceNumber : '3637',
trafficMediumNumber : '2',
sessionId : 'Session-ID',
timestamp : 'Timestamp',
orderId : 'Order-ID',
orderValue : 'Bestelwaarde',
orderCurrency : 'Bestelvaluta',
usedCouponCode : 'Gebruikte kortingscode',
iframeContainerId : 'sovendus-container-1' }); 

The values between the brackets must be the values of Magento. How do I get these values? Are they loaded on the successpage automatically?

  • are you need login customer data or order data? – Abdul Mar 21 '18 at 13:32
  • Actually I need both: order data and customer data – Marcel Mar 21 '18 at 13:49

Try this:

<?php $customer = Mage::getSingleton('customer/session')->getCustomer(); ?>
<?php $order = Mage::getModel('sales/order')->load($this->getOrderId());?>

<?php if($order && $order->getId()):?>
<script type="text/javascript">

window.sovIframes = window.sovIframes || []; window.sovIframes.push({ 

orderId : '<?php echo $order->getIncrementId();?>',
orderValue : '<?php echo number_format($order->getGrandTotal(), 2)?>',
orderCurrency : '<?php echo $order->getBaseCurrencyCode();?>',

<?php endif;?>

Note: I have added order data in above code. You are used same way customer data. for eg. sessionId : '<?php echo $customer->getEmail();?>'

  • Thanks, The if-statement prevents the javascript from being executed. can there be a problem in that? <?php if($order && $order->getId()):?> – Marcel Mar 23 '18 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.