Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Pinterest

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 03-13-2012, 08:23 AM
 
cedaly1968 cedaly1968 is offline
 

eXpert
  
Join Date: May 2011
Posts: 225
 

Default 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 -->
__________________
4.4.3
Reply With Quote
  #12  
Old 03-17-2012, 03:11 PM
 
MSfan MSfan is offline
 

Advanced Member
  
Join Date: Nov 2011
Posts: 56
 

Default 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?
__________________
v4.4.4 Pro
Reply With Quote
  #13  
Old 03-22-2012, 11:50 AM
  eknee's Avatar 
eknee eknee is offline
 

Advanced Member
  
Join Date: Oct 2003
Location: Fort Wayne, IN
Posts: 86
 

Default 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
__________________
30 X-Cart sites and growing.
versions 4.0.11 - 4.4.1
Reply With Quote
  #14  
Old 03-22-2012, 12:08 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default 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>
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote

The following user thanks balinor for this useful post:
eknee (03-22-2012)
  #15  
Old 03-22-2012, 12:17 PM
  eknee's Avatar 
eknee eknee is offline
 

Advanced Member
  
Join Date: Oct 2003
Location: Fort Wayne, IN
Posts: 86
 

Default Re: Pinterest

Yep, that did it. Thanks very much.
__________________
30 X-Cart sites and growing.
versions 4.0.11 - 4.4.1
Reply With Quote
  #16  
Old 04-10-2012, 01:31 PM
 
Sara Sara is offline
 

Advanced Member
  
Join Date: Mar 2010
Posts: 75
 

Default 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.
__________________
www.foxvalleyviews.com
X-Cart 4.5.4
www.expressionsunglasses.com
X-Cart 4.5.4
hosted by handsonwebhosting.com (and I LOVE them!)
Reply With Quote
  #17  
Old 04-12-2012, 03:34 PM
 
spiredem spiredem is offline
 

Advanced Member
  
Join Date: Oct 2008
Posts: 87
 

Default 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?
__________________
X-Cart Gold 4.1.10
Add-on: X-AOM (Advanced Order Management)
Reply With Quote
  #18  
Old 04-12-2012, 03:52 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: Pinterest

product.tpl
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #19  
Old 04-12-2012, 03:58 PM
 
spiredem spiredem is offline
 

Advanced Member
  
Join Date: Oct 2008
Posts: 87
 

Default Re: Pinterest

I pasted it into my product.tpl and it does grab the product name, but not the image.
__________________
X-Cart Gold 4.1.10
Add-on: X-AOM (Advanced Order Management)
Reply With Quote
  #20  
Old 04-12-2012, 04:14 PM
 
spiredem spiredem is offline
 

Advanced Member
  
Join Date: Oct 2008
Posts: 87
 

Default Re: Pinterest

I see! My image is

$product.tmbn_url_P
not
$product.image_url

got it!
__________________
X-Cart Gold 4.1.10
Add-on: X-AOM (Advanced Order Management)
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:07 AM.

   

 
X-Cart forums © 2001-2020