Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Getting Order Id # On Order Landing Page? Rate Topic   - - - - -

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11998 posts

Posted 05 May 2014 - 08:17 PM #21

When an override is encountered, any existing .post content is thrown away. However, I do believe that if the override contains the same hook that they will be reprocessed (but I'm not sure). But generally, ovrerrides should not be used.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Tim Hensel
  • Junior Member
  • Members
  • Join Date: 01-Mar 11
  • 237 posts

Posted 06 May 2014 - 12:47 AM #22

shouldn't use an 'override' for any of the order_confirmation hooks. You should never use an override hook unless you absolutely need to replace the existing content and are willing to throw away an other addon pre or post templates.


Hi Tbirnseth,
This is how I started using the override file for the Google Analytics Code.
It works great for the tracking with Google on the order confirmation...but this should have been done differently since it will interfere with trying to use this file 'order_confirmation.post.tpl' in the same directory? :-(

-Tim
- CS-Cart 2.2.5 Pro Store -

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11998 posts

Posted 06 May 2014 - 05:00 AM #23

Tim, just change it to a post and you'll have fewer issues in the end. You can always add to the hook foot your needs. Not a requirement (especially for this hook), more about best practices.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Tim Hensel
  • Junior Member
  • Members
  • Join Date: 01-Mar 11
  • 237 posts

Posted 07 May 2014 - 01:42 AM #24

Would it be possible to safely combine the Google Tracking with the Shopper Approved code in the same post file? Then once that post file exists then just remove the original override file.

Creating the post file: skins/[SKIN_NAME]/customer/addons/my_changes/hooks/checkout/order_confirmation.post.tpl

And placing both javascripts into the single post file?


<!-- Shopper Approved Successful Order Code -->
{if $order_info}
<script type="text/javascript">
var sa_values = {$ldelim}
		  'site': '{$config.http_host}',
		  'orderid': {$order_info.order_id},
		  'name': '{$order_info.firstname} {$order_info.lastname}',
		  'email': '{$order_info.email}'
				{$rdelim};
function saLoadScript(src) {$ldelim} var js = window.document.createElement('script'); js.src = src; js.type = 'text/javascript'; document.getElementsByTagName("head")[0].appendChild(js); {$rdelim} var d = new Date(); if (d.getTime() - 172800000 > 1398344779000) saLoadScript('//www.shopperapproved.com/thankyou/rate/xxxx.js'); else saLoadScript('//direct.shopperapproved.com/thankyou/rate/xxxx.js?d=' + d.getTime());
</script>
{/if}

<!-- Google Code for Sales Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 123456789;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "HOHFCKboxQQQxMSL_gM";
var google_conversion_value = 0;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/123456789/?value=0&amp;label=HOHFCKboxQQQxMSL_gM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>


Thanks!
- CS-Cart 2.2.5 Pro Store -

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21562 posts

Posted 07 May 2014 - 07:11 AM #25

Would it be possible to safely combine the Google Tracking with the Shopper Approved code in the same post file? Then once that post file exists then just remove the original override file.

Creating the post file: skins/[SKIN_NAME]/customer/addons/my_changes/hooks/checkout/order_confirmation.post.tpl

And placing both javascripts into the single post file?


<!-- Shopper Approved Successful Order Code -->
{if $order_info}
<script type="text/javascript">
var sa_values = {$ldelim}
		  'site': '{$config.http_host}',
		  'orderid': {$order_info.order_id},
		  'name': '{$order_info.firstname} {$order_info.lastname}',
		  'email': '{$order_info.email}'
				{$rdelim};
function saLoadScript(src) {$ldelim} var js = window.document.createElement('script'); js.src = src; js.type = 'text/javascript'; document.getElementsByTagName("head")[0].appendChild(js); {$rdelim} var d = new Date(); if (d.getTime() - 172800000 > 1398344779000) saLoadScript('//www.shopperapproved.com/thankyou/rate/xxxx.js'); else saLoadScript('//direct.shopperapproved.com/thankyou/rate/xxxx.js?d=' + d.getTime());
</script>
{/if}

<!-- Google Code for Sales Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 123456789;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "HOHFCKboxQQQxMSL_gM";
var google_conversion_value = 0;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/123456789/?value=0&amp;label=HOHFCKboxQQQxMSL_gM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>


Thanks!


You can add unlimited amout of scripts to the .post tpl file. The override is not necessary in this case.
GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11998 posts

Posted 07 May 2014 - 08:02 PM #26

Best to also do two things....
1. Use the 'async' attribute to the script tag like:
<script async>
2. Put all scripts within a single
<script async>
$.document.ready(function () {$ldelim}
 your JS scripts here
{$rdelim});
</script>

This should ensure that the scripts do NOT execute until after the page fully loads and that they will complete even if the user quickly leaves the page. You can probably get by without the async but it won't hurt anything.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.