diff --git a/README.md b/README.md index b3cc37f..2bf8463 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,9 @@ Adds the open graph meta tags to your Prestashop site. Open graph meta tags allo 3. Rename folder to jk_opengraph. 4. ZIP jk_opengraph folder. 5. Install it through prestashop back office. + +# Configuration + +1. Upload image at least for Index page - if no other provided, image will be used for other pages but product detail(product cover image is used here) +2. If no image is uploaded, module uses eshop logo as default image +3. Use "turn off tags" for product tags if your template has default OG tags on product detail page(classic theme has them now, not sure from which version) diff --git a/classes/TagsRetriever.php b/classes/TagsRetriever.php index 5e6c31c..0fe5191 100644 --- a/classes/TagsRetriever.php +++ b/classes/TagsRetriever.php @@ -100,7 +100,7 @@ private function addAdditionalTags($tags) $product = new Product($id_product, true); if ($this->page->type == OpengraphPage::TYPE_META_TAGS) { $id_cover = Product::getCover($id_product); - $id_cover['id_image'] ? $tags['image'] = Context::getContext()->link->getImageLink($id_product, $id_cover['id_image']) : ''; + $id_cover['id_image'] ? $tags['image'] = Context::getContext()->link->getImageLink($product->link_rewrite[Context::getContext()->language->id], $id_cover['id_image'], ImageType::getFormatedName('large')) : ''; } $tags['product'] = array( 'brand' => Manufacturer::getNameById((int)$product->id_manufacturer), @@ -122,15 +122,17 @@ private function addAdditionalTags($tags) public function getImageUrl() { $index = new OpenGraphPage(1); - - if ($this->page->type == OpengraphPage::TYPE_INDEX_TAGS && $index->image != '') { - $url = Media::getMediaPath(_PS_MODULE_DIR_ . 'jk_opengraph/views/img/' . $index->image); //index image - } elseif ($this->page->image != '') { + + if ($this->page->image != '') { $url = Media::getMediaPath(_PS_MODULE_DIR_ . 'jk_opengraph/views/img/' . $this->page->image); //individual image + } elseif ($index->image) { + $url = Media::getMediaPath(_PS_MODULE_DIR_ . 'jk_opengraph/views/img/' . $index->image); //index image } else { $url = _PS_IMG_ . Configuration::get('PS_LOGO'); // shop logo } + $url = _PS_BASE_URL_ . $url; //add base url + return $url; } } diff --git a/jk_opengraph.php b/jk_opengraph.php index 5aa2ff3..8a2dffa 100644 --- a/jk_opengraph.php +++ b/jk_opengraph.php @@ -52,7 +52,7 @@ public function __construct() { $this->name = 'jk_opengraph'; $this->tab = 'front_office_features'; - $this->version = '1.3.2'; + $this->version = '1.3.3'; $this->author = 'yusttas.github.io'; $this->need_instance = 0; $this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_); @@ -76,7 +76,7 @@ public function install() } if (!parent::install() //Check that the module parent class is installed. - || !$this->registerHook('header') + || !$this->registerHook('displayHeader') || !$this->installTables() || !$this->installPages() || !$this->installConfig() diff --git a/views/templates/hook/opengraph.tpl b/views/templates/hook/opengraph.tpl index 57c24fa..277af67 100644 --- a/views/templates/hook/opengraph.tpl +++ b/views/templates/hook/opengraph.tpl @@ -7,7 +7,7 @@ - + {if $tags.site_type=='product'} {if $tags.product.brand}