0

My success.phtml dir is -> /app/design/frontend/pb/default/template/checkout (my theme's success.phtml)

I've tried to implement this code in to this success page.

    <!-- BEGIN GCR Opt-in Module Code -->
<?php
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
$order = Mage::getModel('sales/order')->load($orderId);
?>
<script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer></script>

<script>
    window.renderOptIn = function() {
        window.gapi.load('surveyoptin', function() {
            window.gapi.surveyoptin.render(
                {
                    "merchant_id": 112592416,
                    "order_id": "<?php echo $order->getIncrementId() ?>",
                    "email": <?php echo $order->getCustomerEmail() ?>,
                    "delivery_country":  "<?php echo $order->getShippingAddress()->getCountryId() ?>",
                    "estimated_delivery_date": "YYYY-MM-DD",

                });
        });
    }
</script>
<!-- END GCR Opt-in Module Code -->

And then I tried. The form is not showed up. I don't know how to configure estimated delivery day but it is usually in 1 day.

I'm stuck at this point and I need a hand :)

Thanks.

0

Try to change this line:

"email": <?php echo $order->getCustomerEmail() ?>,

into

"email": "<?php echo $order->getCustomerEmail() ?>",

or, copy and past (check your Merchant ID):

<script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer></script>
<script>
window.renderOptIn = function(){
    window.gapi.load('surveyoptin', function(){
        window.gapi.surveyoptin.render({
          "merchant_id": 112592416,
          "order_id": "<?php echo $order->getIncrementId(); ?>",
          "email": "<?php echo $order->getCustomerEmail(); ?>",
          "delivery_country": "<?php echo $order->getShippingAddress()->getCountryId(); ?>",
          "estimated_delivery_date": "<?php $date = date('Y-m-d'); $mod_date = strtotime($date.'+ 1 days'); echo date('Y-m-d',$mod_date); ?>"
        });
    });
}
</script>

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.