![]() |
Help Please!
Need to add external java script to individual product pages. This is the script:
<script src="http://www.yakkingheads.com/sample.js"> </script> The script is for a talking pop-up spokesperson. I need it to open up on each product page. I got it to work home the home page on xcart by placing it in the customer/home.tpl head section. But cannot figure it out how to get it to work on individual product pages. Please help. |
Re: Help Please!
Do you need this script on product pages only?
Try Code:
{if $main eq "product"}<script src="http://www.yakkingheads.com/sample.js"> </script>{/if} |
Re: Help Please!
Yes that code works, but I need to have a different script open for different products. Any help would be great. Thanks
|
Re: Help Please!
The simplest solution is
Code:
{if $main eq "product"}<script src="http://www.yakkingheads.com/sampleFor more flexibility you will need an extra field |
Re: Help Please!
How would I put the product id in the above script? Also what is the product id? The sku? or the product name? Thanks
|
Re: Help Please!
productid is an numeric internal xcart value. It is used in database as a primary key so it is unique. If you browse to any product you will see URL like this
http://yourstore/product.php?productid=14334 14334 is a productid you can also use SKU: Code:
{if $main eq "product"}<script src="http://www.yakkingheads.com/sampleor even product title: Code:
{if $main eq "product"}<script src="http://www.yakkingheads.com/samplebut in last two cases you can get an invalid URL for your script as either title or SKU may contains characters that are not allowed to use in URI |
Re: Help Please!
Thanks, but It still opens on every product page? I m having a brain fart today. Can you give me the code for it to work if my product id is: 16199
Thanks for all your help. |
Re: Help Please!
{if $product.productid eq 123456}
insert your product id |
Re: Help Please!
This is the code I used:
{if $main eq "product"}<script src="http://www.yakkingheads.com/sample {$product.16199}.js"> </script>{/if} It works, but it opens up on every product page. I need it to only open on the product page that has the product id of 16199 Anymore help would be great. Thanks. |
Re: Help Please!
{if $product.productid eq 16199}<script src="http://www.yakkingheads.com/sample
.js"> </script>{/if} |
| All times are GMT -8. The time now is 08:42 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.