Skip to content

Commit

Permalink
v.1.1.0
Browse files Browse the repository at this point in the history
Joomla 4 and JoomShopping 5 support added
  • Loading branch information
sergeytolkachyov authored Mar 14, 2022
1 parent 0c23b5d commit 1312da1
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 30 deletions.
7 changes: 7 additions & 0 deletions fields/jshoppingextrafields.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<?php
/**
* @package WT JoomShopping Schema.org
* @author Sergey Tolkachyov info@web-tolk.ru https://web-tolk.ru
* @copyright Copyright (C) 2021 Sergey Tolkachyov. All rights reserved.
* @license GNU General Public License version 3 or later
* @version 1.0.1
*/
defined('_JEXEC') or die;

use Joomla\CMS\Form\FormHelper;
Expand Down
13 changes: 6 additions & 7 deletions fields/plugininfo.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?php
/**
* @package WebTolk plugin info field
* @version 1.0.0
* @Author Sergey Tolkachyov, https://web-tolk.ru
* @copyright Copyright (C) 2020 Sergey Tolkachyov
* @license GNU/GPL http://www.gnu.org/licenses/gpl-2.0.html
* @since 1.0.0
* @package WT JoomShopping Schema.org
* @author Sergey Tolkachyov info@web-tolk.ru https://web-tolk.ru
* @copyright Copyright (C) 2021 Sergey Tolkachyov. All rights reserved.
* @license GNU General Public License version 3 or later
* @version 1.0.1
*/

defined('_JEXEC') or die;
Expand Down Expand Up @@ -76,7 +75,7 @@ protected function getLabel()
</a>
</div>
<div style="padding: 0px 15px;">
<span class="label label-success">v.<?php echo $wt_plugin_info->version; ?></span>
<span class="badge badge-success bg-success">v.<?php echo $wt_plugin_info->version; ?></span>
<?php echo Text::_("PLG_WT_JSHOPPING_SCHEMA_ORG_DESC"); ?>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PLG_WT_JSHOPPING_SCHEMA_ORG="Jshoppingproducts - WT JoomShopping Schema.org"
PLG_WT_JSHOPPING_SCHEMA_ORG_DESC="<p><span class="badge badge-important">JoomShopping minimal version</span><span class="badge badge-success">4.18.x</span></p><p>The plugin adds micro markup to the product pages, manufacturer list and product categories Schema.org for JoomShopping product categories and products in ld+json format.</p>"
PLG_WT_JSHOPPING_SCHEMA_ORG_DESC="<p><span class=\"badge badge-important bg-danger\">JoomShopping minimal version</span><span class=\"badge badge-success bg-success\">4.18.x</span></p><p>The plugin adds micro markup to the product pages, manufacturer list and product categories Schema.org for JoomShopping product categories and products in ld+json format.</p>"
PLG_WT_JSHOPPING_SCHEMA_ORG_INFO_LABEL="Micro-markup Schema.org"
PLG_WT_JSHOPPING_SCHEMA_ORG_INFO_DESC="<p><code>Schema.org</code> — this is a standard for semantic markup of data on the web, announced by the search engines Google, Bing and Yahoo! in the summer of 2011.</p><p>The purpose of semantic markup is to make the Internet more understandable, structured and make it easier for search engines and special programs to extract and process information for convenient presentation in search results. <strong>In practice, this means that search engines better understand what is being discussed on the site page and make snippets in search results more logical, "beautiful", which in turn affects their CTR-clickability - and can increase the number of clicks to the site.</strong></p><p>Markup occurs directly in the HTML code of pages using special attributes and does not require the creation of separate export files.</p><p>You can check the page's micro-markup using the services: <a href=\"https://webmaster.yandex.com\" target=\"_blank\">Yandex.Webmaster</a>, <a href=\"https://search.google.com/test/rich-results\" target=\"_blank\">Google micro-markup validator</a>, <a href=\"https://validator.schema.org/\" target=\"_blank\">micro-markup validator Schema.org<a/>.</p>"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PLG_WT_JSHOPPING_SCHEMA_ORG="Jshoppingproducts - WT JoomShopping Schema.org"
PLG_WT_JSHOPPING_SCHEMA_ORG_DESC="<p><span class=\"label label-important\">JoomShopping minimal version</span><span class=\"label label-success\">4.18.x</span></p><p>The plugin adds micro markup to the product pages and product categories Schema.org for JoomShopping product categories and products in ld+json format.</p>"
PLG_WT_JSHOPPING_SCHEMA_ORG_DESC="<p><span class=\"badge badge-important bg-danger\">JoomShopping minimal version</span><span class=\"badge badge-success bg-success\">4.18.x</span></p><p>The plugin adds micro markup to the product pages, manufacturer list and product categories Schema.org for JoomShopping product categories and products in ld+json format.</p>"
PLG_WT_JSHOPPING_SCHEMA_ORG_AFTER_INSTALL = "Thank you for intalling extension"
PLG_WT_JSHOPPING_SCHEMA_ORG_AFTER_DISCOVER_INSTALL = "Thank you for intalling extension"
PLG_WT_JSHOPPING_SCHEMA_ORG_AFTER_UPDATE = "Thank you for updating extension"
PLG_WT_JSHOPPING_SCHEMA_ORG_MAYBE_INTERESTING="<h4>It might be interesting</h4><ul class=\"nav nav-tabs nav-stacked\"><li><a href=\"https://web-tolk.ru/dev/joomshopping/joomshopping-russian-post-shipping-method-api.html\" target=\"_blank\" title=\"Go to https://web-tolk.ru\">JoomShopping Russian Post Shipping method (via API)</a></li><li><a href=\"https://web-tolk.ru/en/dev/joomla-plugins/wt-joomshopping-bitrix24-pro.html\" target=\"_blank\" title=\"Go to https://web-tolk.ru\">WT JoomShopping Bitrix24 PRO, two-way integration plugin for JoomShopping online store and Bitrix24 CRM.</a></li></ul>"
PLG_WT_JSHOPPING_SCHEMA_ORG_WHATS_NEW="<h3>v.1.0.1 What's new?</h3><p>Fixed a Google warning about an incorrect price format. The price was with the currency, and this is not possible.</p>"
PLG_WT_JSHOPPING_SCHEMA_ORG_MAYBE_INTERESTING="<h4>It might be interesting</h4><ul class=\"nav nav-tabs nav-stacked list-group\"><li class="list-group-item"><a href=\"https://web-tolk.ru/en/dev/joomla-plugins/jlsitemap-phoca-gallery.html\" target=\"_blank\" title=\"Go to https://web-tolk.ru\">JLSitemap - Phoca Gallery plugin for XML sitemap</a></li><li class="list-group-item"><a href=\"https://web-tolk.ru/dev/joomla-plugins/wt-on-fly-image-handler.html\" target=\"_blank\" title=\"Go to https://web-tolk.ru\">WT On fly image handler for JoomShopping.</a></li><li class="list-group-item"><a href=\"https://web-tolk.ru/en/dev/joomshopping/action-log-joomshopping.html\" target=\"_blank\" title=\"Go to https://web-tolk.ru\">Action log - JoomShopping. Free plugin for Joomla core action logs.</a></li><li class="list-group-item"><a href=\"https://web-tolk.ru/en/dev/joomshopping/shablon-joomshopping-na-bootstrap-4-6.html\" target=\"_blank\" title=\"Go to https://web-tolk.ru\">JoomShopping Bootstrap 4.6 free template.</a></li></ul>"
PLG_WT_JSHOPPING_SCHEMA_ORG_WHATS_NEW="<h3>v.1.1.0 What's new?</h3><p>Joomla 4 and JoomShopping 5 support added.</p>"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PLG_WT_JSHOPPING_SCHEMA_ORG="Jshoppingproducts - WT JoomShopping Schema.org"
PLG_WT_JSHOPPING_SCHEMA_ORG_DESC="<p><span class="badge badge-important">Минимальная версия JoomShopping</span><span class="badge badge-success">4.18.x</span></p><p>Плагин добавляет на страницы товара и категории товара микроразметку Schema.org для категорий товаров, производителей и товаров JoomShopping в формате ld+json</p>"
PLG_WT_JSHOPPING_SCHEMA_ORG_DESC="<p><span class=\"badge badge-important bg-danger\">Минимальная версия JoomShopping</span><span class=\"badge badge-success bg-success\">4.18.x</span></p><p>Плагин добавляет на страницы товара и категории товара микроразметку Schema.org для категорий товаров, производителей и товаров JoomShopping в формате ld+json</p>"
PLG_WT_JSHOPPING_SCHEMA_ORG_INFO_LABEL="Микроразметка Schema.org"
PLG_WT_JSHOPPING_SCHEMA_ORG_INFO_DESC="<p><code>Schema.org</code> — это стандарт семантической разметки данных в сети, объявленный поисковыми системами Google, Bing и Yahoo! летом 2011 года.</p><p>Цель семантической разметки – сделать интернет более понятным, структурированным и облегчить поисковым системам и специальным программам извлечение и обработку информации для удобного её представления в результатах поиска. <strong>На практике это означает, что поисковые системы лучше понимают о чём идет речь на странице сайта и делают сниппеты в поисковой выдаче более логичными, \"красивыми\", что в свою очередь влияет на их CTR - кликабельность - и может увеличить количество переходов на сайт.</strong></p><p>Разметка происходит непосредственно в HTML-коде страниц с помощью специальных атрибутов и не требует создания отдельных экспортных файлов.</p><p>Проверить микроразметку страницы можно с помощью сервисов <a href=\"https://webmaster.yandex.ru\" target=\"_blank\">Яндекс.Вебмастер</a>, <a href=\"https://search.google.com/test/rich-results\" target=\"_blank\">валидатор микроразметки Google</a>, <a href=\"https://validator.schema.org/\" target=\"_blank\">валидатор микроразметки Schema.org</a>.</p>"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PLG_WT_JSHOPPING_SCHEMA_ORG="Jshoppingproducts - WT JoomShopping Schema.org"
PLG_WT_JSHOPPING_SCHEMA_ORG_DESC="<p><span class=\"label label-important\">Минимальная версия JoomShopping</span><span class=\"label label-success\">4.18.x</span></p><p>Плагин добавляет на страницы товара и категории товара микроразметку Schema.org для категорий товаров и товаров JoomShopping в формате ld+json</p>"
PLG_WT_JSHOPPING_SCHEMA_ORG_DESC="<p><span class=\"badge badge-important bg-danger\">Минимальная версия JoomShopping</span><span class=\"badge badge-success bg-success\">4.18.x</span></p><p>Плагин добавляет на страницы товара и категории товара микроразметку Schema.org для категорий товаров и товаров JoomShopping в формате ld+json</p>"
PLG_WT_JSHOPPING_SCHEMA_ORG_AFTER_INSTALL = "Спасибо за установку расширения"
PLG_WT_JSHOPPING_SCHEMA_ORG_AFTER_DISCOVER_INSTALL = "Спасибо за установку расширения"
PLG_WT_JSHOPPING_SCHEMA_ORG_AFTER_UPDATE = "Спасибо за обновление расширения"
PLG_WT_JSHOPPING_SCHEMA_ORG_MAYBE_INTERESTING="<h4>Может быть интересно</h4><ul class=\"nav nav-tabs nav-stacked\"><li><a href=\"https://web-tolk.ru/dev/joomshopping/wt-sm-otpravka-pochta-ru.html\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">Интеграция JoomShopping с Почтой России для Бизнеса</a></li><li><a href=\"https://web-tolk.ru/dev/joomshopping/wt-joomshopping-favorite.html\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">WT JoomShopping Favorites, альтернативный список пожеланий (wishlist) для JoomShopping.</a></li><li><a href=\"https://web-tolk.ru/dev/joomla-plugins/wt-joomshopping-bitrix24-pro.html\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">WT JoomShopping Bitrix24 PRO, плагин двухсторонней интеграции интернет-магазина JoomShopping и CRM Битрикс24.</a></li></ul>"
PLG_WT_JSHOPPING_SCHEMA_ORG_WHATS_NEW="<h3>v.1.0.1 Что нового?</h3><p>Исправлено предупреждение Google о неверном формате цены. Цена была с валютой, а так нельзя.</p>"
PLG_WT_JSHOPPING_SCHEMA_ORG_MAYBE_INTERESTING="<h4>Может быть интересно</h4><ul class=\"nav nav-tabs nav-stacked list-group\"><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/joomshopping/wt-sm-otpravka-pochta-ru.html\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">Интеграция JoomShopping с Почтой России для Бизнеса</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/joomshopping/wt-joomshopping-favorite.html\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">WT JoomShopping Favorites, альтернативный список пожеланий (wishlist) для JoomShopping.</a></li><li class=\"list-group-item\"><a href=\"https://web-tolk.ru/dev/joomla-plugins/wt-joomshopping-bitrix24-pro.html\" target=\"_blank\" title=\"Перейти на https://web-tolk.ru\">WT JoomShopping Bitrix24 PRO, плагин двухсторонней интеграции интернет-магазина JoomShopping и CRM Битрикс24.</a></li></ul>"
PLG_WT_JSHOPPING_SCHEMA_ORG_WHATS_NEW="<h3>v.1.1.0 Что нового?</h3><p>Добавлена поддержка Joomla 4 и JoomShopping 5.</p>"
63 changes: 51 additions & 12 deletions wt_jshopping_schema_org.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
* @author Sergey Tolkachyov info@web-tolk.ru https://web-tolk.ru
* @copyright Copyright (C) 2021 Sergey Tolkachyov. All rights reserved.
* @license GNU General Public License version 3 or later
* @version 1.0.1
* @version 1.1.0
*/

defined('_JEXEC') or die;

use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;

use Joomla\CMS\Version;

class PlgJshoppingproductsWt_jshopping_schema_org extends CMSPlugin
{
Expand Down Expand Up @@ -42,7 +42,20 @@ public function onBeforeDisplayProductView(&$view)
{
$jshopConfig = $view->config;
$product = $view->product;
$shop_item_id = getShopMainPageItemid();

// For Joomla 3.x

if (version_compare(JVERSION, '4', '<')) {

$shop_item_id = getShopMainPageItemid();

} else {
// For Joomla 4.x
$shop_item_id = \JSHelper::getShopMainPageItemid();

}


$link = Route::_("index.php?option=com_jshopping&controller=product&task=view&category_id=" . $product->category_id . "&product_id=" . $product->product_id . "&Itemid=" . $shop_item_id, '', '', true);
$product_info = array(
'@context' => 'https://schema.org',
Expand Down Expand Up @@ -147,7 +160,20 @@ public function onBeforeDisplayProductView(&$view)
*/
public function onBeforeDisplayProductListView($view, &$productlist)
{
$jshopConfig = JSFactory::getConfig();


// For Joomla 3.x

if (version_compare(JVERSION, '4', '<')) {

$jshopConfig = JSFactory::getConfig();

} else {
// For Joomla 4.x
$jshopConfig = \JSFactory::getConfig();

}

$category_description = $this->params->get('category_desc_is', 'short_description');
$schema_org_list = array(
'@context' => 'https://schema.org',
Expand Down Expand Up @@ -293,15 +319,17 @@ public function onBeforeDisplayProductListView($view, &$productlist)

}


// Свойство position для элемента списка.
for($i = 0; $i<count($schema_org_list['itemListElement']); $i++)
{
$schema_org_list['itemListElement'][$i]['position'] = $i+1;
}
//Количество элементов списка
$schema_org_list['numberOfItems'] = count($schema_org_list['itemListElement']);

}

// Свойство position для элемента списка.
for($i = 0; $i<count($schema_org_list['itemListElement']); $i++)
{
$schema_org_list['itemListElement'][$i]['position'] = $i+1;
}
//Количество элементов списка
$schema_org_list['numberOfItems'] = count($schema_org_list['itemListElement']);

$doc = Factory::getDocument();
$doc->addScriptDeclaration(json_encode($schema_org_list), 'application/ld+json');
Expand All @@ -317,7 +345,18 @@ public function onBeforeDisplayProductListView($view, &$productlist)
* @since 1.0.0
*/
public function onBeforeDisplayCategoryView($view){
$jshopConfig = JSFactory::getConfig();

// For Joomla 3.x

if (version_compare(JVERSION, '4', '<')) {

$jshopConfig = JSFactory::getConfig();

} else {
// For Joomla 4.x
$jshopConfig = \JSFactory::getConfig();

}
$category_description = $this->params->get('category_desc_is', 'short_description');
$schema_org_list = array(
'@context' => 'https://schema.org',
Expand Down
6 changes: 3 additions & 3 deletions wt_jshopping_schema_org.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<extension version="3.10" type="plugin" group="jshoppingproducts" method="upgrade">
<name>PLG_WT_JSHOPPING_SCHEMA_ORG</name>
<author>Sergey Tolkachyov</author>
<creationDate>03/09/2021</creationDate>
<copyright>(c) 2021 Sergey Tolkachyov</copyright>
<creationDate>09/03/2022</creationDate>
<copyright>(c) 2022 Sergey Tolkachyov</copyright>
<license>GNU General Public License version 3 or later</license>
<authorEmail>info@web-tolk.ru</authorEmail>
<authorUrl>https://web-tolk.ru</authorUrl>
<version>1.0.1</version>
<version>1.1.0</version>
<description>PLG_WT_JSHOPPING_SCHEMA_ORG_DESC</description>
<scriptfile>script.php</scriptfile>
<files>
Expand Down

0 comments on commit 1312da1

Please sign in to comment.