Jump to content

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

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

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

Posted 24 April 2014 - 01:19 PM #1

Hello.
On my order landing page (CS-Cart 2.2.5), I am using Shopper Approved Ratings code which just puts a popup on the thank you for your order and just asks to rate their experience shopping. There is now an option with the Shopper Approved code that I can automatically pass some information to the rating such as Order #, Name, and email.

Here is the sample Shopper Approved code:
<script type="text/javascript"> var sa_values = { 'site':xxxx, 'orderid':'ORDER123', 'name':'John Doe', 'email':'john.doe@gmail.com' }; function saLoadScript(src) { var js = window.document.createElement('script'); js.src = src; js.type = 'text/javascript'; document.getElementsByTagName("head")[0].appendChild(js); } var d = new Date(); if (d.getTime() - 172800000 > 1398344779000) saLoadScript('//www.shopperapproved.com/thankyou/rate/2592.js'); else saLoadScript('//direct.shopperapproved.com/thankyou/rate/xxxx.js?d=' + d.getTime()); </script>

On the order landing page, do these variables exist already or would it require extra programming to do something like look at the last order just successfully placed and pull that information from the database?

Thank you for any input! :)

-Tim
- CS-Cart 2.2.5 Pro Store -

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

Posted 24 April 2014 - 02:55 PM #2

Hello Tim Hensel,

You can use the {$order_info} variable. For example in this way:

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

Hope it will be helpful.
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)

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

Posted 24 April 2014 - 03:59 PM #3

Hello Tim Hensel,

You can use the {$order_info} variable. For example in this way:

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

Hope it will be helpful.


Thank you eComLabs!

Unfortunately it does not seem to work. It only passed through the variable but not the actual data.
So looking at the feedback left in the Shopper Approved system, the Order ID was transferred as '{$order_info.order_id}'....and the same with the name and email.

Could it be being 2.25 CS-Cart that there are no variables once the order is completed and the customer goes to the thank you/order landing page?

Again thank you very much for the help! :)
- CS-Cart 2.2.5 Pro Store -

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

Posted 24 April 2014 - 08:58 PM #4

You probably have the JS enclosed in '{literal}' tags that is preventing the smarty engine from expanding the variable. Alternatively you can replace '{' characters with '{ldelim}' and '}' characters with {rdelim} or reposition your '{literal}' tags..

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.


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

Posted 25 April 2014 - 07:04 AM #5

@Tim Hensel,

tbirnseth is right. Try to add the following code:
<script type="text/javascript"> var sa_values = {{/literal} 'site':xxxx, 'orderid':'{$order_info.order_id}', 'name':'{$order_info.firstname} {$order_info.lastname}', 'email':'{$order_info.email}' {literal}}; function saLoadScript(src) { var js = window.document.createElement('script'); js.src = src; js.type = 'text/javascript'; document.getElementsByTagName("head")[0].appendChild(js); } var d = new Date(); if (d.getTime() - 172800000 > 1398344779000) saLoadScript('//www.shopperapproved.com/thankyou/rate/2592.js'); else saLoadScript('//direct.shopperapproved.com/thankyou/rate/xxxx.js?d=' + d.getTime()); </script>


Thanks.
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)

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

Posted 26 April 2014 - 12:42 PM #6

Thank you for the help! :)

tbirnseth - I tried using the {ldelim} and {ldelim} smarty tags as you suggested but it still would just transfer $order_info.order_id instead of the actual order ID #. :(

eComLabs - I tried this too as you have shown with the literal tags moved but this time the Shopper Approved popup never appeared. :(

For the actual Shopper Approved code/script, I just have this code in its own HTML BLOCK on the order landing page. Could this be why none of the suggestions are working? Should I try pasting the code somewhere else like maybe in the language file?

Thanks guys!!!
- CS-Cart 2.2.5 Pro Store -

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

Posted 28 April 2014 - 07:10 AM #7

Thank you for the help! :)

tbirnseth - I tried using the {ldelim} and {ldelim} smarty tags as you suggested but it still would just transfer $order_info.order_id instead of the actual order ID #. :(

eComLabs - I tried this too as you have shown with the literal tags moved but this time the Shopper Approved popup never appeared. :(

For the actual Shopper Approved code/script, I just have this code in its own HTML BLOCK on the order landing page. Could this be why none of the suggestions are working? Should I try pasting the code somewhere else like maybe in the language file?

Thanks guys!!!


Could you please provide us with the full content of the file?
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)

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

Posted 28 April 2014 - 01:50 PM #8

Hi,
It is just a single line for code:
<script type="text/javascript"> var sa_values = { 'site':xxxx, 'orderid':'ORDER123', 'name':'John Doe', 'email':'john.doe@gmail.com' }; function saLoadScript(src) { var js = window.document.createElement('script'); js.src = src; js.type = 'text/javascript'; document.getElementsByTagName("head")[0].appendChild(js); } 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>

On my successful order landing page (CS-Cart 2.2.5), the script is placed in its own HTML BLOCK.
The code above is the same as what I am actually using, less the orderid, name, and email variables as I cannot seem to retrieve that data.
- CS-Cart 2.2.5 Pro Store -

 
  • mink
  • Developer
  • Authorized Reseller
  • Join Date: 03-Oct 12
  • 27 posts

Posted 28 April 2014 - 02:26 PM #9

Hi Tim,

On my successful order landing page (CS-Cart 2.2.5), the script is placed in its own HTML BLOCK.
The code above is the same as what I am actually using, less the orderid, name, and email variables as I cannot seem to retrieve that data.


You can use the following trick:
1. In the "skins/[SKIN]/customer/views/checkout/complete.tpl" file or its hooks you can add 3 (or more) necessary HTML inputs:
<input type="hidden" value="{$order_info.order_id}" id="secret_order_id" />
<input type="hidden" value="{$order_info.email}" id="secret_order_email" />
NOTE: On this step it is necessary to create HTML input per every parameter passed to JS.
2. The JS code of your block you should wrap in:
$(document).ready(function(){
});
3. Now in your script you may get necessary attributes by one of the following commands:
document.getelementbyid("secret_order_id").value;
$("#secret_order_id").val();

I hope it helps.

Best regards, Sergei
Simtech Development | sales@simtechdev.com | www.simtechdev.com
CERTIFIED CS-CART PARTNER
LICENSES | DEVELOPMENT | ADD-ONS | DESIGNS | UPGRADES

 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1269 posts

Posted 28 April 2014 - 02:50 PM #10

Hi Tim,

This is what you need on order confirmation page ? :D

Posted Image

#add to file skins/[SKIN_NAME]/customer/addons/my_changes/hooks/checkout/order_confirmation.post.tpl
{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/2592.js'); else saLoadScript('//direct.shopperapproved.com/thankyou/rate/xxxx.js?d=' + d.getTime());
</script>
{/if}

# Clear Cache ex: http://www.example.com/admin.php?cc

I hope that helps,

---
Valentin
part of hungryweb.net

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

Posted 28 April 2014 - 09:56 PM #11

You neglected to state that you were trying to use your code in an html block. Template variables are not available in html blocks. You need to use an html block with "smarty support" if you want to include it in a block. Be much easier to just use the hook as described above (but I wouldn't use the input fields, I'd just use the template variables as we described).

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.


 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1269 posts

Posted 29 April 2014 - 03:10 AM #12

You neglected to state that you were trying to use your code in an html block. Template variables are not available in html blocks. You need to use an html block with "smarty support" if you want to include it in a block. Be much easier to just use the hook as described above (but I wouldn't use the input fields, I'd just use the template variables as we described).


Hi tbirnseth, I know this was the original desire but does not need to be inserted into an html block and create everything complicated
If is any reason why this should be into an html block please Tim let me know

Regards,

---
Valentin
part of hungryweb.net

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

Posted 02 May 2014 - 01:14 PM #13

Hi All!
Thank you very much for some much help with my problem! :grin:
This weekend I will have a chance try this and I will post back again with the results.

-Tim
- CS-Cart 2.2.5 Pro Store -

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

Posted 03 May 2014 - 07:48 AM #14

@Vali - I wasn't suggesting that he put it in an html block but identifying that the reason the template variables were not being expanded was because he was using an html block.

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.


 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1269 posts

Posted 03 May 2014 - 08:40 AM #15

Yes, @tbirnseth you are right

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

Posted 05 May 2014 - 03:37 AM #16

Hi Tim,

This is what you need on order confirmation page ? :D

Posted Image

#add to file skins/[SKIN_NAME]/customer/addons/my_changes/hooks/checkout/order_confirmation.post.tpl

{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/2592.js'); else saLoadScript('//direct.shopperapproved.com/thankyou/rate/xxxx.js?d=' + d.getTime());
</script>
{/if}

# Clear Cache ex: http://www.example.com/admin.php?cc

I hope that helps,

---
Valentin
part of hungryweb.net


Hi Valentin,
I attempted to try this but in my store (2.2.5) I do not have this file:

#add to file skins/[SKIN_NAME]/customer/addons/my_changes/hooks/checkout/order_confirmation.post.tpl

The only file I have under the skins/[SKIN_NAME]/customer/addons/my_changes/hooks/checkout/ is: order_confirmation.override.tpl
This file is just the Google Analytics Code for order tracking.

Could I just add the order_confirmation.post.tpl file in this directory with the Shopper Approved code ... or would the order_confirmation.override.tpl file 'override' anything else in this directory?

Originally I just had the basic code in an HTML BLOCK, but it just provides limited or no information about the customer that left the review. And it was very easy to do with placing right into an HTML BLOCK directly through CS-Cart (this is the only reason why I placed the code here). But I did not know the limitations of the HTML BLOCK and not being able to see the variables. This is why I am hoping to be able to use the extra features like automatically adding on the order # to the review to better handle them (if any action is required).

Thank you to everyone again! :)


-Tim
- CS-Cart 2.2.5 Pro Store -

 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1269 posts

Posted 05 May 2014 - 03:43 AM #17

Hi Tom,
You need to:
#create directory structure (if not exists)
skins/[SKIN_NAME]/customer/addons/my_changes/hooks/checkout/
#create the file
order_confirmation.post.tpl

Regards,

---
Valentin
part of hungryweb.net

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

Posted 05 May 2014 - 05:17 AM #18

Hi Tom,
You need to:
#create directory structure (if not exists)

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

Regards,

---
Valentin
part of hungryweb.net


Are you sure that the .post file will correctly work with the .override one?
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 05 May 2014 - 06:11 AM #19

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.

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.


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

Posted 05 May 2014 - 06:22 AM #20

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.


We are totally agree with. And I am not sure, but as I remember if .post and .override files are used, the first one will be ignored.
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)