Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

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

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 03-04-2013, 03:34 PM
 
andrewmattress andrewmattress is offline
 

Advanced Member
  
Join Date: Feb 2013
Posts: 39
 

Default 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>
__________________
JK
X-Cart version 4.7
We have about lots of add-on modules.
Reply With Quote
  #12  
Old 03-04-2013, 05:19 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default 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

---

---
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #13  
Old 03-04-2013, 05:42 PM
 
andrewmattress andrewmattress is offline
 

Advanced Member
  
Join Date: Feb 2013
Posts: 39
 

Default 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!
__________________
JK
X-Cart version 4.7
We have about lots of add-on modules.
Reply With Quote
  #14  
Old 03-04-2013, 05:54 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default 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.

---
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote

The following user thanks gb2world for this useful post:
andrewmattress (03-05-2013)
  #15  
Old 03-05-2013, 05:51 AM
 
andrewmattress andrewmattress is offline
 

Advanced Member
  
Join Date: Feb 2013
Posts: 39
 

Default 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.)
__________________
JK
X-Cart version 4.7
We have about lots of add-on modules.
Reply With Quote
  #16  
Old 03-05-2013, 06:14 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default 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.
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #17  
Old 03-05-2013, 06:19 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default 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
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote

The following user thanks carpeperdiem for this useful post:
andrewmattress (03-05-2013)
  #18  
Old 03-05-2013, 06:40 AM
 
andrewmattress andrewmattress is offline
 

Advanced Member
  
Join Date: Feb 2013
Posts: 39
 

Default 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.
__________________
JK
X-Cart version 4.7
We have about lots of add-on modules.
Reply With Quote
  #19  
Old 03-05-2013, 06:49 AM
 
andrewmattress andrewmattress is offline
 

Advanced Member
  
Join Date: Feb 2013
Posts: 39
 

Default 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 -->
__________________
JK
X-Cart version 4.7
We have about lots of add-on modules.
Reply With Quote
  #20  
Old 03-05-2013, 06:50 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default 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.
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote

The following user thanks carpeperdiem for this useful post:
andrewmattress (03-05-2013)
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:23 PM.

   

 
X-Cart forums © 2001-2020