PinIt Pinterest Button Does not Show Image - magento

I have a Magento store at http://www.harmonics.co.uk and I have PinIt buttons on products.
The problem is when you click it, it does not pick up the image from the media attribute in the query string, even though the URL is correct.
I'm using the following code to generate my image and the PinIt button on product pages:
<?php
$_helper = $this->helper('catalog/output');
$_product = $this->getProduct();
$image = $this->helper('catalog/image')->init($_product, $_product->getImageUrl(), 'image')->resize(150, 150);
?>
// PinIt Anchor
<a class="pinterest" href="http://pinterest.com/pin/create/button/?url=<?php echo $_product->getProductUrl(); ?>&media=<?php echo $image; ?>&description=<?php echo $_product->getName(); ?>" title="Share on Pinterest"> </a>
It used to work but I think Pinterest have changed the way their buttons work but I can't see how. The generated code looks almost the same, except that generated URL's replace : with %3A and / with %2F.
I've tried doing a string replace but this doesn't work either. Any ideas folks. Cheers.

try replacing
<a class="pinterest" href="http://pinterest.com/pin/create/button/?url=<?php echo $_product->getProductUrl(); ?>&media=<?php echo $image; ?>&description=<?php echo $_product->getName(); ?>" title="Share on Pinterest"> </a>
with
<a class="pinterest" href="http://pinterest.com/pin/create/button/?url=<?php echo urlencode($_product->getProductUrl()); ?>&media=<?php echo urlencode($image); ?>&description=<?php echo urlencode($_product->getName()); ?>" title="Share on Pinterest"> </a>

Related

Joomla/Jomsocial PinMe template I want to replace the PinMe Avatar with JomSocial's Profile image

Hi I am using TemPlaza's PinMe template with the Jomsocial community component in Joomla! 3.0.3 Stable [ Ember ]
What I am looking for a very simple solution to having the Jomsocial avatar (Profile Image) replace the PinMe image on the Pins which
uses joomla core for image and profile
Jomsocial offers this:
Use JomSocial Avatars
To acquire a path to a JomSocial Avatar, you can simply request a cUser object and call a simple getThumbAvatar function to retrieve the avatar url.
include_once JPATH_ROOT.'/components/com_community/libraries/core.php';
// Get CUser object
$user = CFactory::getUser($userid);
$avatarUrl = $user->getThumbAvatar();
echo '<img src="'.$avatarUrl.'">';
The PinMe template is coded as such:
<?php if(isset($this->s_user) && $this->s_user==1){ ?>
<div class="TzAuthor">
<?php if(isset($Pins->user_img) && !empty($Pins->user_img)){ ?>
<img class="tz_pin_img_user" src="<?php echo JUri::root().'/'.$Pins->user_img; ?>">
<?php }else{ ?>
<img class="tz_pin_img_user" src="<?php echo JUri::root().'/components /com_tz_pinboard/images/avata.jpg'?>">
<?php }?>
<div class="TzAuthorInfo">
<a class="tz_pin_name_user"
href="<?php echo Route::_(TZ_PinboardHelperRoute::getPinboardManageruserRoute($Pins->id_user)); ?>" rel="nofollow">
<?php echo $Pins->user_name; ?>
<?php if(isset($Pins->name_user_repin) && !empty($Pins->name_user_repin)){
?>
<strong class="tz_by">
<?php echo JText::_('COM_TZ_PINBOARD_MANAGERUSER_REPIN_BY'); ?>
</strong>
<?php
echo $Pins->name_user_repin;
}
?>
</a>
spoke with the PinMe people and the cost for custom code isnt worth it and the sites on my local not live
to reiterate
all I am looking for a very simple solution to having the Jomsocial avatar (Profile Image) replace the PinMe profile image on the Pins
how do i make this happen

Linking intro image in Joomla 3.3.1

I would like to turn all intro images on the blog layout to links to the articles just as read more does.
Found this post here:
Joomla 3.1 intro image as read more link
The solution here is to replace the code in default_item.php from this:
<img
<?php if ($images->image_intro_caption):
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
endif; ?>
src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/>
To this:
<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>"><img
<?php if ($images->image_intro_caption):
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
endif; ?>
src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/> </a>
Followed the instructions, added an override folder in my template, copied default_item.php to it and made the change to the code. Nothing happened. I then tried to change the same lines in the component folder just to see if the problem was with the template override, nothing.
Is there another way of doing this?
Thanks in advance,
Guy.
default_item.php is only used as part of the featured articles view. If you are using the blog view, then the files appear under com_content/views/category/
The image itself is generated under com_content/views/category/blog_item.php on line 35
<?php echo JLayoutHelper::render('joomla.content.intro_image', $this->item); ?>
Change this to (via your template override)
<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>">
<?php echo JLayoutHelper::render('joomla.content.intro_image', $this->item); ?>
</a>

related products in joomla

How to display only thumbnails of products in related products area, my current code is showing the link too i.e image tag with href title of product name. I just want to show the thumbnails
<?php
foreach($this->product->customfieldsRelatedProducts as $field) {
echo $field->display;
}
?>
I think code will help you.
<?php
$image_dir = JURI::root()."images/";
foreach($this->product->customfieldsRelatedProducts as $field) {
echo $field->display;
?>
<img src="<?php echo $image_dir.$field->image; ?>" alt="<?php echo $field->title ?>" />
<?php
}
?>

Magento display multiple product images on details page

I am uploading 2 images for each product. Only 2 no more, no less.
1st image is product base image and will be displayed on product details page.
I am using following line to display this image:
$_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(180, 300).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
echo $_helper->productAttribute($_product, $_img, 'image');
I am able to display the above image correctly.
Second image will be displayed in a pop up when a particular link is clicked. I do not want to display a gallery. Just want to display each image separately.
I think I found a way to retrieve array of images uploaded:
$productData = $_product->getData();
$secondImage = $productData['media_gallery']['images'][1];
Now, I am not sure how to display this image. I mean how to use helper, like I used for first image to make is display second image.
I've option to hardcode the complete path of image and use:
$secondImage['file'];
to display the image etc, but, I want to know if there is way, I can do it magento way ?
<?php foreach ($this->getGalleryImages() as $_image): ?>
<li>
<a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_image) ?>', 'gallery', 'scrollbars=yes,width=200,height=200,resizable=yes');return false;">
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(68,68); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"/>
</a>
</li>
<?php endforeach; ?>
Code lifted from:
http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/catalog/adding_lightbox_to_magento_v2
Note exactly the answer but obviously you can remove the foreach and simply supply the array's index if you know your only going to have one file.

Category url goes to 404 page in magento

I'm new to magento when i list categories in sidebar. when i click the category name means it will go to 404 error page. If you have any idea Please tell me as soon as possible..
and my code is
<?php
$_categories = Mage::getModel('catalog/category')->load(3)->getChildrenCategories();
if($_categories->count()):
$categorycount = 0;
foreach ($_categories as $_category):
if($_category->getIsActive()):
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
?>
<li><a href="<?php echo $_category->getURL() ?>" title="<?php echo
$this->htmlEscape($_category->getName()) ?>"><span class="categoriesHead"><?php
echo $this->htmlEscape($_category->getName()) ?></span>
</a>
</li>
<?php
endif;
endforeach;
endif;
?>
I had the same issue in 1.5.1 and in my case it was the category url suffix which was expecting a .html suffix but the links were giving me blank. I changed Admin>>System>>Configuration>>Catalog>>Search Engine Optimisations>>category suffix from ".html" to "" (blank) and it's working fine now.
I spend so much time on this problem.... You might have made your categories root categories and not subcategories. Simply drag and drop them into the default category and see if that gives you a better url.
You can see if you are getting a bad url by just appending index.php/name of category in small case/ to the base url
Try this:
Go in admin>>System>>Configuration>>Catalog and under Category permissions select No at Enable option.
Then click Save config and clear Magento cache.

Resources