Magento Forum

   
Pinterest Button throws error on Internet Explorer
 
baba9
Jr. Member
 
Total Posts:  2
Joined:  2011-07-19
 

I have tried many of the Pinterest extensions on Magento Connect and have tried (to no avail) to install my own button, but basically the url of the page is giving an error on all versions of Internet Explorer, saying that it cannot display the page (it basically crashes).

This is what I’m using:

<a href="http://pinterest.com/pin/create/button/?url=<?php echo urlencode($this->helper('core/url')->getCurrentUrl() ); ?>&media;=<?php echo urlencode($this->helper('catalog/image')->init($_product, 'image')->resize(150) ); ?>&description;=<?php echo urlencode($_product->getName()); ?>" class="pin-it-button" count-layout="horizontal">Pin It</a>

If you take out

url=<?php echo urlencode($this->helper('core/url')->getCurrentUrl() ); ?>
, then it will work in IE.

How can you have Magento encode the url, so that it displays in the format of

<a href="http://pinterest.com/pin/create/button/?url=http&#x3A;&#x2F;&#x2F;www.mysite.com&#x2F;&media;=http" class="pin-it-button" count-layout="horizontal"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
so that IE will accept it?

 
Magento Community Magento Community
Magento Community
Magento Community
 
baba9
Jr. Member
 
Total Posts:  2
Joined:  2011-07-19
 

Update:
The problem only happens on product pages and Category/CMS pages when it has 2 columns plus right column, it doesn’t happen on category/cms pages if there’s only 1 column.

 
Magento Community Magento Community
Magento Community
Magento Community
 
maugan
Member
 
Avatar
Total Posts:  31
Joined:  2008-09-05
London
 

I had the same thing, what worked for me was using the Pinterest asynchronous javascript rather than the basic

http://business.pinterest.com/widget-builder/#do_pin_it_button

<script type="text/javascript">
  (function (
dbuildThese{
    
var homeScriptnewScriptbuildThese.lengthi;
    for (
0n1{
      newScript 
d.createElement('SCRIPT');
      
newScript.type 'text/javascript';
      
newScript.async true;
      
newScript.src buildThese[i];
      
homeScript d.getElementsByTagName('SCRIPT')[0];
      
homeScript.parentNode.insertBefore(newScripthomeScript);
    
}
  }
(document[
    
'//assets.pinterest.com/js/pinit.js'
    
/* load more third-party JavaScript here */
  
])
  );
</script>

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top