X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Pinterest (https://forum.x-cart.com/showthread.php?t=62293)

cedaly1968 03-13-2012 08:23 AM

Re: Pinterest
 
This is what I ended up having for my Pinterest Code... leveraged Cherie's code:

<!-- Pinterest Code -->
<!-- Include ONCE for ALL buttons in the page -->
<script type="text/javascript">
(function() {
window.PinIt = window.PinIt || { loaded:false };
if (window.PinIt.loaded) return;
window.PinIt.loaded = true;
function async_load(){
var s = document.createElement("script");
s.type = "text/javascript";
s.async = true;
if (window.location.protocol == "https:")
s.src = "https://assets.pinterest.com/js/pinit.js";
else
s.src = "http://assets.pinterest.com/js/pinit.js";
var x = document.getElementsByTagName("script")[0];
x.parentNode.insertBefore(s, x);
}
if (window.attachEvent)
window.attachEvent("onload", async_load);
else
window.addEventListener("load", async_load, false);
})();
</script>

{if $main eq "product"}
{assign var=piniturl value="http://`$config.Company.company_website``$smarty.server.R EQUEST_URI`"}
{assign var=pinitmedia value=$product.images.T.url}
{elseif $main eq "catalog" and $current_category.category}
{assign var=piniturl value="http://`$config.Company.company_website``$smarty.server.R EQUEST_URI`"}
{if $current_category.icon_url}
{assign var=pinitmedia value=$current_category.icon_url}
{/if}
{/if}
<a class="addthis_button_pinterest"{if $piniturl} pi:pinit:url="{$piniturl}"{/if}{if $pinitmedia} pi:pinit:media="{$pinitmedia}"{/if} pi:pinit:layout="horizontal"></a>

<a href="http://pinterest.com/pin/create/button/&url={$piniturl}&media={$pinitmedia}" class="pin-it-button" count-layout="horizontal">Pin It</a>
<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>
<br></br>
<!-- End Pinterest Code -->

MSfan 03-17-2012 03:11 PM

Re: Pinterest
 
Quote:

Originally Posted by cedaly1968
This is what I ended up having for my Pinterest Code... leveraged Cherie's code:

<!-- Pinterest Code -->
<!-- Include ONCE for ALL buttons in the page -->
<script type="text/javascript">
(function() {
window.PinIt = window.PinIt || { loaded:false };
if (window.PinIt.loaded) return;
window.PinIt.loaded = true;
function async_load(){
var s = document.createElement("script");
s.type = "text/javascript";
s.async = true;
if (window.location.protocol == "https:")
s.src = "https://assets.pinterest.com/js/pinit.js";
else
s.src = "http://assets.pinterest.com/js/pinit.js";
var x = document.getElementsByTagName("script")[0];
x.parentNode.insertBefore(s, x);
}
if (window.attachEvent)
window.attachEvent("onload", async_load);
else
window.addEventListener("load", async_load, false);
})();
</script>

{if $main eq "product"}
{assign var=piniturl value="http://`$config.Company.company_website``$smarty.server.R EQUEST_URI`"}
{assign var=pinitmedia value=$product.images.T.url}
{elseif $main eq "catalog" and $current_category.category}
{assign var=piniturl value="http://`$config.Company.company_website``$smarty.server.R EQUEST_URI`"}
{if $current_category.icon_url}
{assign var=pinitmedia value=$current_category.icon_url}
{/if}
{/if}
<a class="addthis_button_pinterest"{if $piniturl} pi:pinit:url="{$piniturl}"{/if}{if $pinitmedia} pi:pinit:media="{$pinitmedia}"{/if} pi:pinit:layout="horizontal"></a>

<a href="http://pinterest.com/pin/create/button/&url={$piniturl}&media={$pinitmedia}" class="pin-it-button" count-layout="horizontal">Pin It</a>
<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>
<br></br>
<!-- End Pinterest Code -->


Does it populate the description?

eknee 03-22-2012 11:50 AM

Re: Pinterest
 
Does anyone see a problem with this?
<a href="http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fwww.coffee-authority.com/product.php?productid={$product.productid}&ref=pin terest{$product.productid}&media={$product.image_u rl}&description={$product.product}" class="pin-it-button" count-layout="horizontal"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>

It's for x-cart version 4.1.11

Here's a product page that includes the link. This worked fine for a while, but suddenly stopped. I've no clue why.

http://www.coffee-authority.com/big-train-blended-ice-coffee-java-chip-3.5lb-bulk-bag.html

balinor 03-22-2012 12:08 PM

Re: Pinterest
 
Yea, use what I posted, the second question mark from your url is botching it up, which is why you need to use the urlencode url. Here it is again:

Code:

<a href="http://pinterest.com/pin/create/button/?url={php}echo urlencode('http://www.yoururlhere.com' . $_SERVER['REQUEST_URI']);{/php}&media={$product.image_url}&description={$product.product}" class="pin-it-button" count-layout="horizontal">Pin It</a>
<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>


eknee 03-22-2012 12:17 PM

Re: Pinterest
 
Yep, that did it. Thanks very much.

Sara 04-10-2012 01:31 PM

Re: Pinterest
 
Could something similar be added to the socialize module or is it best to wait until X-Cart officially adds it? I do have an add-this snippet on my site but I would assume adding it with the rest of them is best.

spiredem 04-12-2012 03:34 PM

Re: Pinterest
 
Forgive my ignorance but in what file am I pasting this code in order to make it appear on all product details pages?

cflsystems 04-12-2012 03:52 PM

Re: Pinterest
 
product.tpl

spiredem 04-12-2012 03:58 PM

Re: Pinterest
 
I pasted it into my product.tpl and it does grab the product name, but not the image.

spiredem 04-12-2012 04:14 PM

Re: Pinterest
 
I see! My image is

$product.tmbn_url_P
not
$product.image_url

got it!


All times are GMT -8. The time now is 11:15 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.