Post by rickmase » Mon Jul 04, 2011 11:55 am

HI everyone, I am minimal at best to writing and using php. I have had some success with modifying code to take care of simple things and I can usually follow instructions although my understanding of advanced terminology is nil. I came across this thread because I too want to add a like button and I thought when I read the instructions at the beginning of the thread that it should not be too hard. WRONG! The piece of code to look for in the first step does not exist in my product.tpl. I am using version 1.5.0.5. So now what do I do?


Edit the file: catalog/view/theme/default/template/product/product.tpl

Find this piece of code:

Code: Select all

</table>
            <br />
            <?php if ($display_price) { ?>
Replace the <br /> with the following:

Code: Select all

<div style="width: 100%; padding-top:10px;">
            <table>
               <tr>
              <td><iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id='.$this->request->get['product_id']); ?>&layout=standard&show_faces=false&width=280&action=like&colorscheme=light&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:270px; height:35px;" allowTransparency="true"></iframe>
              </td>
              </tr>
            </table>
            </div>
I have tested this on OpenCart 1.4.8b in IE6, IE7, IE8, FF 3.6.6

Let me know if you find any problems :)[/quote]

New member

Posts

Joined
Tue Jun 21, 2011 5:41 am

Post by opencart-templates » Fri Jul 15, 2011 12:06 am

I have updated this to use the vQmod. So there are no core files that need to be edited.
  1. All you need to do is upload the .xml below

Attachments

Update USER_ID


Advanced Professional Email Template
Customers Pre-Sale. Inc abandoned cart email
Order Follow-Up Email. Inc request review
Email Validation with ZeroBounce


User avatar
Active Member

Posts

Joined
Mon May 16, 2011 7:24 pm
Location - UK

Post by hbg » Wed Jul 20, 2011 4:08 pm

Hi, I have uploaded the oc_facebook.xml file, but I haven't seen any sign of the facebook like icon. I did generate the like button, but I am unsure where to place it.

Opencart Version 1.5.1.3
https://www.opencart.homebrewinn.com.au/shop/


User avatar
hbg
Active Member

Posts

Joined
Wed Apr 13, 2011 8:52 am
Location - Newcastle NSW Australia

Post by unknownmale1 » Sat Jul 23, 2011 5:15 am

[quote][/quote]

Active Member

Posts

Joined
Sat Aug 28, 2010 6:46 pm

Post by opencart-templates » Tue Aug 09, 2011 12:24 am

hbg wrote:Hi, I have uploaded the oc_facebook.xml file, but I haven't seen any sign of the facebook like icon. I did generate the like button, but I am unsure where to place it.
The oc_facebook add background data to the page that facebook can easily read. This is called open graph data more info: http://developers.facebook.com/docs/opengraph/

Advanced Professional Email Template
Customers Pre-Sale. Inc abandoned cart email
Order Follow-Up Email. Inc request review
Email Validation with ZeroBounce


User avatar
Active Member

Posts

Joined
Mon May 16, 2011 7:24 pm
Location - UK

Post by Brook » Tue Aug 09, 2011 8:46 pm

Can someone please help with integrate the oc_facebook.xml file into my website?

Not sure that I understand what modifications need to be made to the oc_facebook.xml file?

Instructions say...
"Update the 'USER_ID' in the .xml to your facebook ID."
1) Where do I get my Facebook ID?
2) Is my Facebook ID my email address that I use for my Facebook Account?
3) Do I just replace the literal USER_ID in the xml file with my email address?

Thank you for your help.

Active Member

Posts

Joined
Wed Feb 24, 2010 12:15 am

Post by tokorakyat » Fri Aug 12, 2011 9:00 am

Thanks for the best trick..

I Very like this post...


Successfull at My Online Shop

Image


Newbie

Posts

Joined
Mon May 02, 2011 3:16 am

Post by hbg » Fri Aug 12, 2011 3:32 pm

Hi, VQMod wasn't properly installed. I have installed the latest version, but had an error come up at the top of the page. Notice: Undefined index: image in /home/homebrew/public_html/opencart/shop/vqmod/vqcache/vq-catalog_controller_product_product.php on line 359 is the error I have been receiving

Opencart Version 1.5.1.3
https://www.opencart.homebrewinn.com.au/shop/


User avatar
hbg
Active Member

Posts

Joined
Wed Apr 13, 2011 8:52 am
Location - Newcastle NSW Australia

Post by shawtham » Mon Aug 22, 2011 11:30 pm

HI, I am using OpenCart v1.5.0.5, and have installed the vQmod xml file. And I can't see the "Like" button.

My questions:
1. What is the procedure to turn on the "Like" button?
2. I have enable the Use SEO URL's: and it advices me to rename the htaccess.txt to .htaccess. which I did and caused internal server problem 500. (and I managed to switch it back)

Appreciate if anyone could give me right direction

Thanks

Newbie

Posts

Joined
Fri Jul 22, 2011 10:29 pm

Post by shawtham » Tue Aug 23, 2011 6:14 pm

Hi, I am using this one from facebook.

http://developers.facebook.com/docs/ref ... gins/like/#

Cut and paste the code to heading.tpl and product.tpl in catalog/view/template/my template/etc....

I hope it is useful to you guys !

Shaw

Newbie

Posts

Joined
Fri Jul 22, 2011 10:29 pm

Post by asphole » Sat Aug 27, 2011 12:25 am

There seems to be quite a bit of confusion over using this on v1.5.1 so I will copy my files here and add instructions to setting this up. My method improves on the vqmod kindly provided earlier by opencart-templates.

1)

create an xml file and paste the following code into it:
<modification>
<id>Facebook Meta</id>
<version>1.0.0</version>
<vqmver>1.0.8</vqmver>
<date>14/07/2011</date>
<author>Opencart-templates.co.uk</author>

<file name="catalog/view/theme/YOUR_TEMPLATE/template/common/header.tpl">
<operation>
<search position="before">
<![CDATA[</head>]]></search>
<add><![CDATA[
<fb:share-button class="meta">
<meta name="medium" content="mult"/>
<?php foreach ($this->document->getFBMeta() as $fbMeta) { ?>
<meta property="<?php echo $fbMeta['property'] ?>" content="<?php echo $fbMeta['content']; ?>" />
<?php } ?>
</fb:share-button>
]]></add>
</operation>
</file>

<file name="catalog/controller/product/product.php">
<operation>
<search position="before">
<![CDATA[if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/product.tpl')) {]]></search>
<add><![CDATA[
$this->document->addFBMeta('og:title', $this->data['heading_title']);
$this->document->addFBMeta('og:url',$this->url->link('product/product', 'product_id=' . $this->request->get['product_id']));
$this->document->addFBMeta('og:type', 'product');
$this->document->addFBMeta('og:image', $this->data['thumb'] );
$this->document->addFBMeta('og:image', $this->model_tool_image->resize($result['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height')) );
$this->document->addFBMeta('og:site_name', $this->config->get('config_name'));
$this->document->addFBMeta('og:admins','xxxxxxxxxxxxxxx');
$this->document->addFBMeta('fb:admins','xxxxxxxxxxxxxxx');
if($this->config->get('config_address')){$this->document->addFBMeta('og:street-address',$this->config->get('config_address'));}
if($this->config->get('config_email')){$this->document->addFBMeta('og:email',$this->config->get('config_email'));}
if($this->config->get('config_telephone')){$this->document->addFBMeta('og:phone_number',$this->config->get('config_telephone'));}
if($this->config->get('config_fax')){$this->document->addFBMeta('og:fax_number',$this->config->get('config_fax'));}
]]></add>
</operation>
</file>

<file name="system/library/document.php">
<operation>
<search position="after">
<![CDATA[private $scripts = array();]]></search>
<add><![CDATA[public $fbMeta = array();]]></add>
</operation>
<operation>
<search position="before">
<![CDATA[public function getStyles() {]]></search>
<add><![CDATA[
public function addFBMeta($property , $content ) {
$this->fbMeta[] = array(
'property' => $property,
'content' => $content
);
}
public function getFBMeta () {
return $this->fbMeta;
}
]]></add>
</operation>
</file>


<file name="catalog/view/theme/YOUR_TEMPLATE/template/product/product.tpl">
<operation>
<search position="after">
<![CDATA[<div id="tab-description" class="tab-content"><?php echo $description; ?></div>]]></search>
<add><![CDATA[
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.j ... t><fb:like href="" send="true" width="450" show_faces="true" action="like" font=""></fb:like>
]]></add>
</operation>

</file>

</modification>


The vqmod file above now contains a missing item that was causing errors once connected to FB. It also modifies the product.tpl using vqmod to actually show the button. You will need to search and replace the following items in the above code:

FIND:
'YOUR_TEMPLATE'
Change this to the name of your template (default etc)

FIND:
$this->document->addFBMeta('og:admins','xxxxxxxxxxxxxxx');
$this->document->addFBMeta('fb:admins','xxxxxxxxxxxxxxx');
Change xxxxxxxxxxxxxxx to match your Facebook User ID.
(To find yourfacebook user id, log into facebook and hover your mouse over your profile page. In the status bar at the bottom you will see a link that contains your NUMERICAL facebook user id. Enter this into the lines above.)

Upload the xml file to the vqmod>xml folder and then open your site in your browser. (the file currently puts the fb like buttons at the bottom of the product description but you can change this to any location you prefer.)

At this stage you will see the 'fb like' image but will get an error when trying to use it. To get rid of this error do the following:

Log into your facebook account and go to: http://developers.facebook.com/setup/

You will be presented with 3 fields to complete:

Site name: Put your site name here
Site URL: Put your domain name here in the following format: http://domain.co.uk/
Locale:Select your locale.

Click create app button and get Access Token.

Log back out of facebook and then try your new button.

Follow the steps above and this will work.

PS: You can check for errors on your product page by visiting the following url and entering the url for the product you are testing. http://developers.facebook.com/tools/debug

Enjoy.

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by asphole » Sat Aug 27, 2011 12:32 am

I also believe this wont work on facebook fan pages. The facebook user id must be from a personal facebook profile.

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by asphole » Sat Aug 27, 2011 3:01 am

Ooops slight error with positioning of the fb button in the above example.

Find:

Code: Select all

<file name="catalog/view/theme/YOUR_TEMPLATE/template/product/product.tpl">
<operation>
<search position="after">
<![CDATA[<div id="tab-description" class="tab-content"><?php echo $description; ?></div>]]></search>
<add><![CDATA[
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="" send="true" width="450" show_faces="true" action="like" font=""></fb:like>
]]></add>
</operation>

</file>
and replace with:

Code: Select all

	<file name="catalog/view/theme/YOUR_TEMPLATE/template/product/product.tpl">
        <operation>
		
            <search position="replace">			
            <![CDATA[<?php echo $content_bottom; ?></div>]]>
			</search>
			
            <add>
			<![CDATA[
			  <?php echo $content_bottom; ?><br /><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="" send="true" width="450" show_faces="true" action="like" font=""></fb:like></div>
			]]>
			</add>
			
        </operation>
    </file>

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by asphole » Sat Aug 27, 2011 3:41 am

The original xml file adds a FB Button and 'Share' link at the top left of the page which I didn't want in my template so to remove it:

Find:

Code: Select all

<file name="catalog/view/theme/YOUR_TEMPLATE/template/common/header.tpl">
<operation>
<search position="before">
<![CDATA[</head>]]></search>
<add><![CDATA[
<fb:share-button class="meta">
<meta name="medium" content="mult"/>
<?php foreach ($this->document->getFBMeta() as $fbMeta) { ?>
<meta property="<?php echo $fbMeta['property'] ?>" content="<?php echo $fbMeta['content']; ?>" />
<?php } ?>
</fb:share-button>
]]></add>
</operation>
</file>
and replace with:

Code: Select all

<file name="catalog/view/theme/YOUR_TEMPLATE/template/common/header.tpl">
<operation>
<search position="before">
<![CDATA[</head>]]></search>
<add><![CDATA[

<meta name="medium" content="mult"/>
<?php foreach ($this->document->getFBMeta() as $fbMeta) { ?>
<meta property="<?php echo $fbMeta['property'] ?>" content="<?php echo $fbMeta['content']; ?>" />
<?php } ?>

]]></add>
</operation>
</file>

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by labeshops » Fri Sep 09, 2011 2:21 am

I get "Warning: VQMod XML syntax does not appear to be valid!" when I try to use this.

Running Opencart v2.2 with multi-stores from http://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by asphole » Fri Sep 09, 2011 2:50 am

Sounds like a typo somewhere.

Try this:

Code: Select all

<modification>
<id>Facebook Meta</id>
<version>1.0.0</version>
<vqmver>1.0.8</vqmver>
<date>14/07/2011</date>
<author>Opencart-templates.co.uk</author>

	<file name="catalog/controller/product/product.php">
        <operation>
            <search position="before">
            <![CDATA[if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/product.tpl')) {]]></search>
            <add><![CDATA[
			$this->document->addFBMeta('og:title', $this->data['heading_title']);
			$this->document->addFBMeta('og:url',$this->url->link('product/product', 'product_id=' . $this->request->get['product_id']));
			$this->document->addFBMeta('og:type', 'product');
			$this->document->addFBMeta('og:image', $this->data['thumb'] );
			$this->document->addFBMeta('og:image', $this->model_tool_image->resize($result['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height')) );
			$this->document->addFBMeta('og:site_name', $this->config->get('config_name'));
			$this->document->addFBMeta('og:admins','xxxxxxxxxxxxxxx');
			$this->document->addFBMeta('fb:admins','xxxxxxxxxxxxxxx');
			if($this->config->get('config_address')){$this->document->addFBMeta('og:street-address',$this->config->get('config_address'));}
			if($this->config->get('config_email')){$this->document->addFBMeta('og:email',$this->config->get('config_email'));}
			if($this->config->get('config_telephone')){$this->document->addFBMeta('og:phone_number',$this->config->get('config_telephone'));}
			if($this->config->get('config_fax')){$this->document->addFBMeta('og:fax_number',$this->config->get('config_fax'));}
			]]></add>
        </operation>
	</file>

	<file name="system/library/document.php">
        <operation>
            <search position="after">
            <![CDATA[private $scripts = array();]]></search>
            <add><![CDATA[public $fbMeta = array();]]></add>
        </operation>
        <operation>
            <search position="before">
            <![CDATA[public function getStyles() {]]></search>
            <add><![CDATA[
			public function addFBMeta($property , $content ) {
				$this->fbMeta[] = array(
					'property'   => $property,
					'content' => $content
				);			
			}
			public function getFBMeta () {
				return $this->fbMeta;
			}
			]]></add>
        </operation>
	</file>

	<file name="catalog/view/theme/default/template/common/header.tpl">
        <operation>
            <search position="before">
            <![CDATA[</head>]]></search>
            <add><![CDATA[

			<meta name="medium" content="mult"/>
			<?php foreach ($this->document->getFBMeta() as $fbMeta) { ?>
			<meta property="<?php echo $fbMeta['property'] ?>" content="<?php echo $fbMeta['content']; ?>" />
			<?php } ?>

			]]></add>
        </operation>
	</file>
	
		<file name="catalog/view/theme/default/template/product/product.tpl">
        <operation>
		
            <search position="replace">			
            <![CDATA[<?php echo $content_bottom; ?></div>]]>
			</search>
			
            <add>
			<![CDATA[
			  <?php echo $content_bottom; ?><br /><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="" send="true" width="450" show_faces="true" action="like" font=""></fb:like></div>
			]]>
			</add>
			
        </operation>
    </file>
	
</modification>

Active Member

Posts

Joined
Mon Mar 14, 2011 9:33 am

Post by Joxe » Sun Oct 23, 2011 4:03 am

Hi guys,

I had installed this mod on my v.1.4.7 website but now, after upgrading to 1.4.9.6 the button is missing.
Can some one pass me the eact code I have to add (and where) for the v.1.4.9.6?

Many thanks!

v. 1.4.9.6 & v. 2.0.2.0


Active Member

Posts

Joined
Wed Apr 28, 2010 6:12 am

Post by kathatp » Thu Nov 03, 2011 10:48 am

Hey try out the new HTML5 code. It seems to be working.

https://developers.facebook.com/docs/re ... gins/like/

Newbie

Posts

Joined
Mon Jul 25, 2011 11:12 am

Post by Melanie » Fri Dec 30, 2011 12:00 am

Has anyone got a way to get this working for 1.5.1.3


Thanks a lot.

New member

Posts

Joined
Tue Mar 30, 2010 9:39 am

Post by jimmyharwood » Sat Jan 07, 2012 2:15 am

i would also like to get this to work with 1.5.1.3

I am getting the following error

Notice: Undefined index: image in /vqmod/vqcache/vq2-catalog_controller_product_product.php on line 357

The button does appear at the bottom of the page.

New member

Posts

Joined
Thu Dec 29, 2011 12:55 am
Who is online

Users browsing this forum: No registered users and 5 guests