From 1a40b54beffe3597ec64b131eff44b58f044568c Mon Sep 17 00:00:00 2001 From: darkWolf-PR Date: Mon, 12 Apr 2021 19:28:01 +0200 Subject: [PATCH 1/4] Detail cover image and default index image Updated cover image url for product detail tags. Repaired index image not showing for other pages when only image for index is uploaded(was showing shop logo instead). --- classes/TagsRetriever.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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; } } From f9083d67f479062f550ffc15754c168003aaf7db Mon Sep 17 00:00:00 2001 From: darkWolf-PR Date: Mon, 12 Apr 2021 19:31:12 +0200 Subject: [PATCH 2/4] Shop url moved to tagsRetriever Adding shop url in template duplicated image url in product detail. --- views/templates/hook/opengraph.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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} From 1b058f93da1045e92f790e8ae21230f2f789228c Mon Sep 17 00:00:00 2001 From: darkWolf-PR Date: Mon, 12 Apr 2021 19:34:35 +0200 Subject: [PATCH 3/4] Config tips in readme Added info about setting up images for FB and possibly duplicated OG tags in product detail. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) 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) From 6cf911ac4f724a8ccf5716280f23d6b69b4b9951 Mon Sep 17 00:00:00 2001 From: darkWolf-PR Date: Mon, 27 Jan 2025 13:45:10 +0100 Subject: [PATCH 4/4] Deprecated hook fix Deprecated hook "Header" changed to "displayHeader" --- jk_opengraph.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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()