I have a little knowledge of HTML and recently had a store built with PHP for our website. It works great but was expensive and have no money to pay for a little customization regarding a little issue I am experiencing so I am trying to fix it my self.
We want to share a product on Facebook but when we do it displays the page title and not the product or its description. I have looked around the internet for the issue and thought this was the way forward:
I got this working, so I tried to customize the code from that page to display the information I need from the PHP tags used on the page but as you can tell, I got nowhere.
<?php
$title=urlencode('<?php echo $value['product_name']; ?>');
$url=urlencode('http://mydomain.com');
$summary=urlencode('<?php echo $value['product_description']; ?>');
$image=urlencode('<?php if (is_null($value['product_image'])): ?>');
?>
The cart template is all .tpl so I have tried to put this in the header.tpl.
I have been working on this for a while and got nowhere fast so I started to mess around with the link instead I got it working apart from the description has
in it how do I remove that tag? < p >
<a onClick="window.open('http://www.facebook.com/sharer.php?s=100&p[title]=<?php echo $value['product_name']; ?> - only <?php echo price($value['product_price']); ?>!&p[summary]=<?php echo $value['product_description']; ?>&p[url]=http://www.mydomain.com/store&p[images][0]=<?php echo config_item('cart', 'site_url'); ?>uploads/images/<?php echo $value['product_image']; ?>','sharer','toolbar=0,status=0,width=548,height=325');" href="javascript: void(0)">Insert text or an image here.</a>
Before adding the link, try this:
<?php
$tags = array('<p>','</p>');
$cleanDescription = str_replace($tags,'',$value['product_description']);
?>
It will remove any
tags from description. After that, in your link use $cleanDescription
instead of $value['product_description']