@@ -12,20 +12,14 @@ $enabled = Mage::getStoreConfig('advanced/modules_disable_output/' . $moduleName
1212 document.write(unescape("%3Cscript src='" + cvtJsHost
1313 + "client/setup.js' type='text/javascript'%3E%3C/script%3E"));
1414 </script>
15- <script type="text/javascript">
16- window.convert = new Convert("<?php echo $ merchantID ; ?> ");
17- convert.init();
18- </script>
19- <!--End Script tag for setup.js-->
20- <!--Tagging Your Cart for Items-->
21- <?php if (count ($ this ->getCartItems ()) > 0 ): ?>
15+ <?php $ cartItems = $ this ->getCartItems (); ?>
16+ <?php if (count ($ cartItems ) > 0 ): ?>
2217 <script type="text/javascript">
2318 if (!window.convert_cart) {
2419 window.convert_cart = {};
2520 convert_cart.shoppingCartItems = new Array();
2621 }
27- <?php $ products = $ this ->getCartItems ();
28- foreach ($ products as $ items ) { ?>
22+ <?php foreach ($ products as $ items ) { ?>
2923 var convert_item = {};
3024 convert_item.sku = "<?php echo $ items ['sku ' ]; ?> ";
3125 convert_item.category = "<?php echo $ items ['category ' ]; ?> ";
@@ -36,12 +30,18 @@ $enabled = Mage::getStoreConfig('advanced/modules_disable_output/' . $moduleName
3630 </script>
3731 <?php endif ; ?>
3832 <!--End Tagging Your Cart for Items-->
39- <!--Shopping Cart Tagging-->
40- <?php
41- $ orderdetails = $ this ->getOrderDetails ();
42- if ($ orderdetails ['quote_id ' ] > 0 or $ orderdetails ['quote_id ' ] == 'successpage ' ):
43- ?>
44- <!--order tagging code-->
33+
34+ <?php $ orderdetails = $ this ->getOrderDetails (); ?>
35+
36+ <?php // if this quote_id is successpage then there was a transaction. ?>
37+ <?php if ($ orderdetails ['quote_id ' ] == 'successpage ' ): ?>
38+ <script type="text/javascript">
39+ convert_cart.isPurchased = true;
40+ </script>
41+ <?php endif ; ?>
42+
43+ <?php if ($ orderdetails ['quote_id ' ] > 0 or $ orderdetails ['quote_id ' ] == 'successpage ' ): ?>
44+ <?php //order tagging code // ?>
4545 <script type="text/javascript">
4646 if (!window.convert_cart) {
4747 window.convert_cart = {};
@@ -63,39 +63,25 @@ $enabled = Mage::getStoreConfig('advanced/modules_disable_output/' . $moduleName
6363 <?php endif ; ?>
6464 </script>
6565 <!--order tagging code-->
66- <?php
67- endif ;
68-
69- if ($ orderdetails ['quote_id ' ] == 'successpage ' ):
70- ?>
71- <!--End Shopping Cart Tagging-->
72- <!--Order confirmation tagging-->
73- <script type="text/javascript">
74- convert_cart.isPurchased = true;
75- </script>
76- <!--End Order confirmation tagging-->
7766 <?php endif ; ?>
78- <!--Visitor Profile Tagging-->
7967
80- <?php
81- $ customerDet = $ this ->getCustomerDetails ();
68+ <?php //Visitor Profile Tagging ?>
8269
83- if ($ customerDet ):
84- $ group_name = Mage::getModel ('customer/group ' )->load ($ customerDet ['group_id ' ])->getCode ();
85- $ group_name =
86- ($ group_name == 'NOT LOGGED IN ' AND $ customerDet ['group_id ' ] == 0 ) ? 'Guest '
87- : $ group_name ;
88- ?>
70+ <?php $ customerDet = $ this ->getCustomerDetails (); ?>
71+
72+ <? if ($ customerDet ):?>
8973 <script type="text/javascript">
9074 if (!window.convert_profile) {
9175 window.convert_profile = {};
9276 }
9377 convert_profile.firstName = "<?php echo $ customerDet ['firstname ' ]; ?> ";
9478 convert_profile.lastName = "<?php echo $ customerDet ['lastname ' ]; ?> ";
9579 convert_profile.email = "<?php echo $ customerDet ['email ' ]; ?> ";
96- convert_profile.login = "<?php echo $ customerDet ['email ' ]; ?> ";
97- convert_profile.customertype = "<?php echo $ group_name ; ?> ";
9880 </script>
9981 <!--End Visitor Profile Tagging-->
10082 <?php endif ; ?>
83+ <script type="text/javascript">
84+ window.convert = new Convert("<?php echo $ merchantID ; ?> ");
85+ convert.init();
86+ </script>
10187<?php endif ; ?>
0 commit comments