Jump to content

Open Graph protocol - adding tags useful?


Mister Denial

Recommended Posts

I think that those tag will be good just for social media, like if you have a like button in product page, by adding the og tags you can determine which name,description,image, url etc.... will be passed on to share in facebook, same thing for gplus, twittwe ....

Link to comment
Share on other sites

In my opinion social networks are important thing in e-commerce today, so i can go ahead and say that OG tags are necessary ;)

event if you don't want to integrate your shop with facebook ... Why? Because when someone will add and url to your shop to own timeline, without OG tags it may looks weirdy....

Link to comment
Share on other sites

  • 6 months later...

Put the microformats as well, they are basically two different kinds of tags used for two different purposes. OG tags are generally for social type sites like FB, reddit, Stumble upon. While the microformats describe data being sent to search engines to make your site "richer" for the search engines. 

Link to comment
Share on other sites

  • 3 months later...

Hi Dh42, i'm trying to follow your guide to add the OpenGraph to my website.

I done the second part (adding the code to the header) without any problem but i don't understand what to do with the first part.

I din't understand where to place this code:

public function preProcess()
    {
 
        $product = new Product($_GET['id_product'], false, intval($cookie->id_lang));
    if (Validate::isLoadedObject($product))
        self::$smarty->assign('product', $product);
 
    $images = $product->getImages(intval($cookie->id_lang));
    foreach ($images AS $k => $image)
        if ($image['cover'])
        {
            $cover = $image;
            $cover['id_image'] = intval($product->id).'-'.$cover['id_image'];
            $cover['id_image_only'] = intval($image['id_image']);
        }
        if (!isset($cover))
        $cover = array('id_image' => Language::getIsoById($cookie->id_lang).'-default', 'legend' => 'No picture', 'title' => 'No picture');
    self::$smarty->assign('cover', $cover);
    }

So I tried downloading your file and placed in override/classes but when i put it my shop stop working.

 

 

I'm using prestashop 1.4.9.

Link to comment
Share on other sites

The problem is that i don't understand where they must be placed.

I try to look in the folder override/classes and i see there's a file named "_FrontController.php", that to enable it you should remove the _. I try to remove it but i broke my website, if there's that file my website doesn't works.

Link to comment
Share on other sites

In your shop, open you classes/frontcontroller.php and look for this 

public function preProcess()
    {
}

Paste this code between the two brackets

 $product = new Product($_GET['id_product'], false, intval($cookie->id_lang));
    if (Validate::isLoadedObject($product))
        self::$smarty->assign('product', $product);
 
    $images = $product->getImages(intval($cookie->id_lang));
    foreach ($images AS $k => $image)
        if ($image['cover'])
        {
            $cover = $image;
            $cover['id_image'] = intval($product->id).'-'.$cover['id_image'];
            $cover['id_image_only'] = intval($image['id_image']);
        }
        if (!isset($cover))
        $cover = array('id_image' => Language::getIsoById($cookie->id_lang).'-default', 'legend' => 'No picture', 'title' => 'No picture');
    self::$smarty->assign('cover', $cover);

So that it looks like the code above. You are looking at around line 443. 

Link to comment
Share on other sites

Sorry for the delay but i haven't seen the notify of reply.

 

The url is strange, but oddly enough it works, have you checked with the facebook linter?

I don't find a way to test on facebook, i notice the problem because some user told me, but i'm not very pratical with facebook and i don't know where to go to see if image it's correct when i add the like... Google plus button seem to be ok, because it open a frame with the correct image. If you want to try facebook it's the website in signature.

 

What are you using in the template? just the variable?

 

I don't know, i think it's the same as prestashop base 1.4.9 theme... Where i can see that?

Link to comment
Share on other sites

  • 9 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...