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>
```<br />
<br />
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?<br />
<br />
Thank you for any input! <img src="upload://rA9Qa8gnUPZzRZRdI8kt3dpjkrs.png" class="bbc_emoticon" alt=":)"><br />
<br />
-Tim
You can use the {$order_info} variable. For example in this way:
<br />
<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><br />
```<br />
<br />
Hope it will be helpful.<br />
[/quote]<br />
<br />
Thank you eComLabs!<br />
<br />
Unfortunately it does not seem to work. It only passed through the variable but not the actual data.<br />
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.<br />
<br />
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?<br />
<br />
Again thank you very much for the help! <img src="upload://rA9Qa8gnUPZzRZRdI8kt3dpjkrs.png" class="bbc_emoticon" alt=":)">
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…
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?
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!!!
[/quote]
Could you please provide us with the full content of the file?
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).
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).
[/quote]
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
[color=#808080][size=2]part of hungryweb.net[/size][/color]
@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.
#add to file [color=#ff0000]skins/[SKIN_NAME]/customer/addons/my_changes/hooks/checkout/order_confirmation.post.tpl[/color]
<br />
{if $order_info}<br />
<script type="text/javascript"><br />
var sa_values = {$ldelim}<br />
'site': '{$config.http_host}',<br />
'orderid': {$order_info.order_id},<br />
'name': '{$order_info.firstname} {$order_info.lastname}',<br />
'email': '{$order_info.email}'<br />
{$rdelim};<br />
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());<br />
</script><br />
{/if}<br />
```<br />
<br />
# Clear Cache ex: [color=#ff0000][url="http://www.example.com/admin.php?cc"]http://www.example.com/admin.php?cc[/url][/color]<br />
<br />
I hope that helps,<br />
<br />
---<br />
Valentin<br />
[color=#808080][size=2]part of hungryweb.net[/size][/color]<br />
[/quote]<br />
<br />
Hi Valentin,<br />
I attempted to try this but in my store (2.2.5) I do not have this file:<br />
<br />
#add to file [color=#FF0000]skins/[SKIN_NAME]/customer/addons/my_changes/hooks/checkout/order_confirmation.post.tpl[/color]<br />
<br />
The only file I have under the [color=#FF0000]skins/[SKIN_NAME]/customer/addons/my_changes/hooks/checkout/ [/color]is: order_confirmation.override.tpl<br />
This file is just the Google Analytics Code for order tracking.<br />
<br />
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?<br />
<br />
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).<br />
<br />
Thank you to everyone again! <img src="upload://rA9Qa8gnUPZzRZRdI8kt3dpjkrs.png" class="bbc_emoticon" alt=":)"><br />
<br />
<br />
-Tim
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.
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.
[/quote]
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.