X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   XCart removing code from script. How to get code on page? (https://forum.x-cart.com/showthread.php?t=66240)

andrewmattress 03-04-2013 03:34 PM

Re: XCart removing code from script. How to get code on page?
 
Here's the code I get on the confirmation page.

<script type="text/javascript">
_springMetq.push(["setdata", {revenue: ""}]);
_springMetq.push(["setdata", { "orderId": "" }]);
_springMetq.push(["setdata", { "email": "" }]);
_springMetq.push(["setdata", { "promoCode": "" }]);
_springMetq.push(["convert", "sale" ]);
</script>

gb2world 03-04-2013 05:19 PM

Re: XCart removing code from script. How to get code on page?
 
Have you used webmaster mode to ensure that the smarty variables you are using are available and correct for whatever page this is on?

You can also use ldelim if you find it easier: http://www.smarty.net/docsv2/en/language.function.ldelim.tpl

---

---

andrewmattress 03-04-2013 05:42 PM

Re: XCart removing code from script. How to get code on page?
 
Quote:

Originally Posted by gb2world
Have you used webmaster mode to ensure that the smarty variables you are using are available and correct for whatever page this is on?

You can also use ldelim if you find it easier: http://www.smarty.net/docsv2/en/language.function.ldelim.tpl

---

---


I'm not sure what this means - as far as testing it.

I've just now seen Webmaster Mode for the first time, so will check that shortly.

This is on /customer/main/order_message.tpl because it's tracking the conversion of the sale.

Is there somewhere else I would put it to make it work better?

How would I know what the correct smarty variables would be?

Thanks for your help!

gb2world 03-04-2013 05:54 PM

Re: XCart removing code from script. How to get code on page?
 
Webmaster mode tells you all the smarty variables available on whichever page you need the code to be. You can look at the X-Cart documentation for Webmastermode, or you might find the tutorials that Totaltec has created useful. Just search for him on the the forum and follow the links in his signature.

---

andrewmattress 03-05-2013 05:51 AM

Re: XCart removing code from script. How to get code on page?
 
Webmaster Mode doesn't give me a list of variables.

It just gives me a list of templates referenced for the page I'm on.

modules/Fast_Lane_Checkout/home.tpl skin1.conf [] global meta.tpl presets_js.tpl main/include_js.tpl rectangle_top.tpl head.tpl


etc. (X-cart.com doesn't let me post the full list, but it's just a list of templates.)

carpeperdiem 03-05-2013 06:14 AM

Re: XCart removing code from script. How to get code on page?
 
Quote:

Originally Posted by andrewmattress
Webmaster Mode doesn't give me a list of variables.

It just gives me a list of templates referenced for the page I'm on.


Click on "Show Variables" in the debug console.

carpeperdiem 03-05-2013 06:19 AM

Re: XCart removing code from script. How to get code on page?
 
Ah -- you are in version 4.1.x, yes? There's a slightly different way to do it.

See this thread:
http://forum.x-cart.com/viewtopic.php?t=17601

andrewmattress 03-05-2013 06:40 AM

Re: XCart removing code from script. How to get code on page?
 
Here's the code that seems to work to do everthing correctly, except put the variables in.

Here's what's in order_message.tpl:

<!-- SpringMetrics Conversion Code for mattressinsider -->
<script type="text/javascript">
_springMetq.push(["setdata", {literal}{revenue: "{/literal}{$order.order.subtotal}{literal}"}]);
_springMetq.push(["setdata", { "orderId": "{/literal}{$order.orderid}{literal}" }]);
_springMetq.push(["setdata", { "email": "{/literal}{$order.email}{literal}" }]);
_springMetq.push(["setdata", { "promoCode": "{/literal}{$order.coupon}{literal}" }{/literal}]);
_springMetq.push(["convert", "sale" ]);
</script>
<!-- SpringMetrics Conversion Code for mattressinsider -->


Here's what's output on https://www.mattressinsider.com/cart.php?mode=order_message&orderids=12816&keep_ht tps=yes

<!-- SpringMetrics Conversion Code for mattressinsider --> <script type="text/javascript"> _springMetq.push(["setdata", {revenue: ""}]); _springMetq.push(["setdata", { "orderId": "" }]); _springMetq.push(["setdata", { "email": "" }]); _springMetq.push(["setdata", { "promoCode": "" }]); _springMetq.push(["convert", "sale" ]); </script> <!-- SpringMetrics Conversion Code for mattressinsider -->

Except it's spaced properly when I view the code:
<!-- SpringMetrics Conversion Code for mattressinsider -->
<script type="text/javascript">
_springMetq.push(["setdata", {revenue: ""}]);
_springMetq.push(["setdata", { "orderId": "" }]);
_springMetq.push(["setdata", { "email": "" }]);
_springMetq.push(["setdata", { "promoCode": "" }]);
_springMetq.push(["convert", "sale" ]);
</script>
<!-- SpringMetrics Conversion Code for mattressinsider -->



Here are the variables I have tried in revenue:
{$order.total}
{$order.order.subtotal}

What other variables might work there to put in the revenue?

Is there a guide or list of variables somewhere?

Thank-you so much for helping with this.

andrewmattress 03-05-2013 06:49 AM

Re: XCart removing code from script. How to get code on page?
 
Based on this post:
http://forum.x-cart.com/showthread.php?t=62458

I also just tried:

{foreach from=$orders item=order}
... {$order.total} ...
{/foreach}

Which output this:



<!-- SpringMetrics Conversion Code for mattressinsider -->
<script type="text/javascript">
_springMetq.push(["setdata", {revenue: "... ...
"}]);
_springMetq.push(["setdata", { "orderId": "" }]);
_springMetq.push(["setdata", { "email": "" }]);
_springMetq.push(["setdata", { "promoCode": "" }]);
_springMetq.push(["convert", "sale" ]);
</script>
<!-- SpringMetrics Conversion Code for mattressinsider -->

I also just tried it without the ...,
which output this:

<!-- SpringMetrics Conversion Code for mattressinsider -->
<script type="text/javascript">
_springMetq.push(["setdata", {revenue: "... ...
"}]);
_springMetq.push(["setdata", { "orderId": "" }]);
_springMetq.push(["setdata", { "email": "" }]);
_springMetq.push(["setdata", { "promoCode": "" }]);
_springMetq.push(["convert", "sale" ]);
</script>
<!-- SpringMetrics Conversion Code for mattressinsider -->

carpeperdiem 03-05-2013 06:50 AM

Re: XCart removing code from script. How to get code on page?
 
Don't "try" - go get the actual variable. I gave you the link.


All times are GMT -8. The time now is 06:08 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.