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
  #21  
Old 03-05-2013, 06:59 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 the same post,

I tried this (which I know is putting PHP inside of Javascript, but I'm unsure what else to do here...):

<!-- SpringMetrics Conversion Code for mattressinsider -->
<script type="text/javascript">
_springMetq.push(["setdata", {literal}{revenue: "{/literal}if (<? echo $order.total ?>) {<? echo $order.total ?>;}{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 -->

Which output this:
<!-- SpringMetrics Conversion Code for mattressinsider --> <script type="text/javascript"> _springMetq.push(["setdata", {revenue: "if (<? echo $order.total ?>) "}]); _springMetq.push(["setdata", { "orderId": "" }]); _springMetq.push(["setdata", { "email": "" }]); _springMetq.push(["setdata", { "promoCode": "" }]); _springMetq.push(["convert", "sale" ]); </script> <!-- SpringMetrics Conversion Code for mattressinsider -->



I also tried this:

<!-- SpringMetrics Conversion Code for mattressinsider -->
<script type="text/javascript">
_springMetq.push(["setdata", {literal}{revenue: "{/literal}{<? echo $order.total ?>;}{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 -->

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
  #22  
Old 03-05-2013, 07:09 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?

Quote:
Originally Posted by carpeperdiem
Don't "try" - go get the actual variable. I gave you the link.

Where is the debug console? I changed smarty.php, and turned on Webmaster mode...
__________________
JK
X-Cart version 4.7
We have about lots of add-on modules.
Reply With Quote
  #23  
Old 03-05-2013, 07:17 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?

I switched the code in smarty.php, but it's still showing templates, not variables, in the popup.
__________________
JK
X-Cart version 4.7
We have about lots of add-on modules.
Reply With Quote
  #24  
Old 03-05-2013, 07:27 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?

General settings.

http://help.x-cart.com/index.php?title=X-Cart:Editing_Skin_Files#Using_Debugging_Console

You have to search the docs. 99% of the time, it's there for you!
__________________
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)
  #25  
Old 03-05-2013, 07:50 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?

Okay... that was a stretch for me, but based on all the help offered in this post, as well as here:
http://forum.x-cart.com/showthread.php?t=44543

I was able to get the variables to display in debug mode.

Here are the relevant variables:

{$orderids}"12817"{$orders}Array (1)
0 => Array (4)
order => Array (77)
orderid => "12817"
login => "anonymous-13353"
membership => ""
total => "329.00"
giftcert_discount => "0.00"
giftcert_ids => ""
subtotal => "329.00"
discount => "0.00"
coupon => ""
coupon_discount => "0.00"
shippingid => "0"
tracking => ""
shipping_cost => "0.00"
tax => "0.00"
taxes_applied => "N;"
date => "1362493877"
status => "Q"
payment_method => "Phone Ordering"
email => "123testing@readingrainbow.com"

So I put in this code:

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

Which gives this output:

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

Finally the Order ID works. So I assume I'm close now.

How do I get the rest of the fields to work? The email field is at the same level in the tree as the other fields.

Thank-you!
__________________
JK
X-Cart version 4.7
We have about lots of add-on modules.
Reply With Quote
  #26  
Old 03-05-2013, 07:56 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?

Shoot. The tree structure went away. Please see screenshot.
Attached Thumbnails
Click image for larger version

Name:	2013-03-05-order_message-variable-structure2.png
Views:	93
Size:	12.9 KB
ID:	3399  
__________________
JK
X-Cart version 4.7
We have about lots of add-on modules.
Reply With Quote
  #27  
Old 03-05-2013, 08:57 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?

Solved!

YAY!!!

Thank-you SO much for your help.

Was a much longer process than anticipated, but good to go now!

Here is the XCart code for making Spring Metrics work with the version of XCart we are using.

<!-- SpringMetrics Conversion Code for mattressinsider -->
<script type="text/javascript">
_springMetq.push(["setdata", {literal}{revenue: "{/literal}{$orders.0.order.total}{literal}"}]);
_springMetq.push(["setdata", { "orderId": "{/literal}{$orderids}{literal}" }]);
_springMetq.push(["setdata", { "email": "{/literal}{$orders.0.order.email}{literal}" }]);
_springMetq.push(["setdata", { "promoCode": "{/literal}{$orders.0.order.coupon}{literal}" }{/literal}]);
_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
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 02:08 AM.

   

 
X-Cart forums © 2001-2020