![]() |
Use Smarty variable in product_details.tpl
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" /> |
Re: Use Smarty variable in product_details.tpl
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 |
Re: Use Smarty variable in product_details.tpl
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!
|
Re: Use Smarty variable in product_details.tpl
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} |
Re: Use Smarty variable in product_details.tpl
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:
|
Re: Use Smarty variable in product_details.tpl
This worked great! Thanks again for your help!
|
All times are GMT -8. The time now is 07:27 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.