Thursday, 15 August 2013

Print with PHP into Javascript

Print with PHP into Javascript

Code for the analysis of the payment page but does not write the code in
javascript codes..
For example (HTML Print):



<script>
woopra.track('Odeme Sayfasi', {
urunSayisi: '',
amount: '',
currency: '$'
});
</script>
21234.55



2: 2 pcs products
1234.55: amount
PHP & Javascript codes:
<?php
$mageFilename = '/home4/emre2010/public_html/app/Mage.php';
require_once $mageFilename;
umask(0);
Mage::app();
Mage::getSingleton('core/session', array('name'=>'frontend'));
$session = Mage::getSingleton('checkout/session');
$output = "";
foreach ($session->getQuote()->getAllItems() as $item) { ?>
<script>
woopra.track('Payment Page', {
urunSayisi: '<?php $output .= $item->getQty(); ?>',
amount: '<?php $output .= $item->getBaseCalculationPrice(); ?>',
currency: '$'
});
</script>
<?php } print $output; ?>
Why not write into the javascript code? - Where I make mistake?
P.S: E-commerce script: Magento1

No comments:

Post a Comment