Create intellisuggest templates
You will need to create a template for each intellisuggest tracking snippet. From within the CommerceV3 admin, click on Design >> Template Library. From here, click on New Template.
For each template, choose a descriptive common name and set the template type to Smarty Template (.tpl)
Be sure to remove any includes or snippets that are automatically included on the new template.
Replace YOUR_SITE_ID in each code snippet with your Searchspring Site ID. This ID can be found in the Searchspring Management Console under My Account.
Product Page Template
Template Name: product_intellisuggest
<script type="text/javascript" src="//cdn.searchspring.net/intellisuggest/is.min.js"></script>
<script type="text/javascript">
{literal}try{{/literal}
var product_code = "{$product.sku}";
IntelliSuggest.init({literal}{{/literal}siteId:'YOUR_SITE_ID', context:'Product/' + product_code, seed:product_code{literal}}{/literal});
IntelliSuggest.viewItem({literal}{{/literal}sku:product_code{literal}}{/literal});
{literal}} catch(err) {}{/literal}
</script>
Basket Page Template
Template Name: basket_intellisuggest
<script type="text/javascript" src="//cdn.searchspring.net/intellisuggest/is.min.js"></script>
<script type="text/javascript">
{literal}try{{/literal}
IntelliSuggest.init({literal}{{/literal}siteId:'YOUR_SITE_ID', context:'Basket', seed:'{foreach from=$cart key=key item=pr}{$pr.sku} {/foreach}'{literal}}{/literal});
{foreach from=$cart key=key item=pr}
IntelliSuggest.haveItem({literal}{{/literal}sku:"{$pr.sku}", qty:"{$pr.qty}", price:"{$pr.price}"{literal}}{/literal});
{/foreach}
IntelliSuggest.inBasket();
{literal}} catch(err) {}{/literal}
</script>
Confirmation Page Template
Template Name: confirmation_intellisuggest
<script type="text/javascript" src="//cdn.searchspring.net/intellisuggest/is.min.js"></script>
<script type="text/javascript">
{literal}try{{/literal}
IntelliSuggest.init({literal}{{/literal}siteId:"YOUR_SITE_ID"{literal}}{/literal});
{foreach from=$placed.cart key=key item=pr}
IntelliSuggest.haveItem({literal}{{/literal}sku:"{$pr.sku}", qty:"{$pr.qty}", price:"{$pr.price}"{literal}}{/literal});
{/foreach}
{if isset($placed.info)}
{literal}IntelliSuggest.inSale({{/literal}
orderId:"{$placed.info.order_id}",
total:"{$placed.totals.grandtotal}",
city:"{$placed.info.billing.billing_city}",
state:"{$placed.info.billing.billing_state}",
country:"{$placed.info.billing.billing_country}"
{literal}}{/literal});
{/if}
{literal}} catch (e) {}{/literal}
</script>
Including the templates on the page
Place the include tag for each template on its respective template page.
default_products.tpl
{include file="product_intellisuggest.tpl"}
viewcart.tpl
{include file="basket_intellisuggest.tpl"}
checkout_thanks.tpl
{include file="confirmation_intellisuggest.tpl"}
Comments
0 comments
Please sign in to leave a comment.