Move Fave button

Get more information about the integration of social media platforms like Facebook, Twitter, GooglePlus etc. with your online store.

Move Fave button

Postby Shapes » Thu Jan 09, 2014 10:44 am

Hello,

I would like to know how to move the fave button, I would like to have it right next my "add to cart" button.
I made some tries in xml and phtml files but can't get it done.
Could you please help me a bit here ?

Hoping for answers,
Best regards,
David
Shapes
 
Posts: 3
Joined: Thu Jan 09, 2014 10:41 am

Re: Move Fave button

Postby AlexMalex » Mon Jan 13, 2014 5:31 am

Hello Shapes,

By defaul code at this file:
/app/design/frontend/your_theme/default/template/catalog/product/view.phtml


If the "Add to Cart" block in the same file you need to move this code:

<?php if ($faveModuleEnabled) { ?>
<?php
$productUrl = Mage::helper('fave')->getObjUrl($_product, 'product', Mage::getStoreConfig('urlmanager/open/link'));
$buttonData = array(
'url' => $productUrl,
'objTypeName' => 'product',
);

?>
<table width="280">
<tr>
<td rowspan="2">
<?php
if ($faveButton = $this->getLayout()->createBlock('fave/buttons_button'))
echo $faveButton
->setButton('fave_button')
->setData(array(
'obj' => $_product,
'url' => $productUrl,
'objTypeName' => 'product',
'template' => 'fave/bigheart.phtml',
))
->toHtml();
?>
</td>
<td><?php $this->getLayout()->createBlock('fave/buttons_button')->setButton('fb_like')->setData($buttonData)->toHtml(); ?></td>
<td><?php $this->getLayout()->createBlock('fave/buttons_button')->setButton('google_plus_button')->setData($buttonData)->toHtml(); ?></td>
</tr>
<tr>
<td><?php $this->getLayout()->createBlock('fave/buttons_button')->setButton('tweet_button')->setData($buttonData)->toHtml(); ?></td>
<td><?php
$productMediaConfig = Mage::getModel('catalog/product_media_config');
$baseImageUrl = $productMediaConfig->getMediaUrl($_product->getImage());
$this->getLayout()->createBlock('fave/buttons_button')->setButton('pin_it_button', $productUrl )->setData($buttonData)->addData(array('media' => $baseImageUrl, 'description' => $_product->getName()))->toHtml();
?></td>
</tr>
</table>
<?php } ?>


to "Add to cart" block.


====

If "Add to Cart" block NOT in the same file, you need to copy this code

<?php 

$faveButtonsHeader = $this->getLayout()->createBlock('fave/buttons_head');
if ($faveModuleEnabled = !empty($faveButtonsHeader))
{
$faveButtonsHeader
->setPageType('product')
->addButton('google_plus_button')
->addButton('tweet_button')
->addButton('fb_like')
->addButton('pin_it_button')
->toHtml();
}
?>


to top of "Add to Cart" template file and code mentioned before.


Hope it is clear and work for you.
Regards,
Alex
User avatar
AlexMalex
Site Admin
 
Posts: 39
Joined: Mon Jul 15, 2013 5:30 am

Re: Move Fave button

Postby Shapes » Mon Jan 13, 2014 10:54 am

Hi,

Thanks for the answer, it worked.. almost.
I did the second trick, adding both code blocks to addtocart file.

The facebook, twitter, google+ and pinterest buttons showed up but not the favorite button.
So I changed :
'template' => 'fave/bigheart.phtml',
to
'template' => 'fave/favebutton.phtml',
because i could not manage to find "bigheart.phtml".

The header still showed with the buttons, so I had them twice on page.
I fixed this by erasing the code in "template/fave/buttons.phtml"
Hope it's OK.. ?

By the way, could you please send me "bigheart.phtml", it looks nice on your website screenshots ! ;)

Best regards,
David
Shapes
 
Posts: 3
Joined: Thu Jan 09, 2014 10:41 am

Re: Move Fave button

Postby AlexMalex » Mon Jan 13, 2014 12:18 pm

Hello David,

The header still showed with the buttons, so I had them twice on page.
I fixed this by erasing the code in "template/fave/buttons.phtml"
Hope it's OK.. ?


Is not good. Make this one:

Open and edit file:

app/design/frontend/your_theme/default/layout/fave.xml


comment nodes:

catalog_category_default
catalog_category_layered
catalog_product_view


save and clean magento cache.

By the way, could you please send me "bigheart.phtml", it looks nice on your website screenshots !


Sorry we cannot. It is a part of Private Sales Red Fashion Theme (https://store.plumrocket.com/magento-themes/private-sales-fashion-red-magento-theme.html).

Regards,
Alex
User avatar
AlexMalex
Site Admin
 
Posts: 39
Joined: Mon Jul 15, 2013 5:30 am

Re: Move Fave button

Postby Shapes » Mon Jan 13, 2014 12:38 pm

OK, thanks a lot again.

I restored buttons.phtml, and commented the nodes you told me in fave.xml, seems OK.

No problem for the template, I already managed to display the button like the graphic designer wanted. ;)

Best regards,
David
Shapes
 
Posts: 3
Joined: Thu Jan 09, 2014 10:41 am


Return to Faves

Who is online

Users browsing this forum: No registered users and 1 guest

cron