| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Use Smarty variable in product_details.tpl | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() I am trying to edit the skin\customer\main\product_details.tpl to display a button/link. The code I'm trying to implement needs the PRODUCTID to call the appropriate item, but I'm not sure how to call that in HTML. Here's the code snippet I'm trying to put the PRODUCTID in ("SKU" after the UA-XXXX part):
<param name="flashvars" value="video=http://website.com/video/get/UA-XXXX/SKU&backcolor=0x000000&frontcolor=0xCCCCCC & lightcolor=0x557722&allowfullscreen=false& auto-play=false&ShowLogo=1&play_on_click=true" /> |
|||||||
#2
|
|||||||||
|
|||||||||
![]() Hiyah MAPerformance,
Banged out a quick tutorial to show you how to determine all these variables, I've covered it before, but this gave me a chance to record a quick tip on the subject. http://youtu.be/lSb0dBP6I98 Duration: 3:04
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
|
#3
|
|||||||
|
|||||||
![]() You know, I knew all of that but couldn't seem to get it to work. Tried again this morning and it worked fine. Thanks!
|
|||||||
#4
|
|||||||
|
|||||||
![]() OK, here's one for you
![]() I'm doing a similar thing for catching the product bought for conversion tracking. The code is like this: function initTracking () {ldelim} try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.0.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim} {rdelim} As you can see I've already done some work here, and it does work fine as is. My question is how do you work it so multiple items can be tracked this way? The suggestion from the conversion tracking company is to duplicate the "try { Tracking...catch (e) {}" line and filling the SKU/PRODUCTID spot with each different item. What's the cleanest way to have each PRODUCTID populate these based on how many products the customer buys? Is this right to make sure I cover up to 10 items? function initTracking () {ldelim} try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.0.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim} try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.1.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim} try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.2.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim} try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.3.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim} try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.4.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim} try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.5.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim} try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.6.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim} try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.7.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim} try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.8.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim} try {ldelim} Tracking.getProduct('UA-XXXX','{$orders.0.products.9.productid}').logAddTo Cart(); {rdelim} catch (e) {ldelim}{rdelim} {rdelim} |
|||||||
#5
|
|||||||||
|
|||||||||
![]() What you want to do here is run through a foreach loop.
For example (untested): PHP Code:
Just so you understand better how loops work, consider this annotated code: PHP Code:
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey XcartGuru X-cart Tutorials | X-cart 5 Tutorials Check out the responsive template for X-cart. |
|||||||||
|
#6
|
|||||||
|
|||||||
![]() This worked great! Thanks again for your help!
|
|||||||
|
|||
X-Cart forums © 2001-2020
|