Skip to content

Commit

Permalink
v.1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeytolkachyov authored Dec 25, 2021
1 parent caa4af4 commit 17ef2a4
Show file tree
Hide file tree
Showing 8 changed files with 670 additions and 0 deletions.
100 changes: 100 additions & 0 deletions fields/plugininfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?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
*/

defined('_JEXEC') or die;

use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Language\Text;
use \Joomla\CMS\Factory;
FormHelper::loadFieldClass('spacer');

class JFormFieldPlugininfo extends JFormFieldSpacer
{

protected $type = 'plugininfo';

/**
* Method to get the field input markup for a spacer.
* The spacer does not have accept input.
*
* @return string The field input markup.
*
* @since 1.7.0
*/
protected function getInput()
{
return ' ';
}

/**
* @return string The field label markup.
*
* @since 1.7.0
*/
protected function getLabel()
{
$doc = Factory::getDocument();
$doc->addStyleDeclaration("
.wt-b24-plugin-info{
box-shadow: 0 .5rem 1rem rgba(0,0,0,.15);
padding:1rem;
margin-bottom: 2rem;
display:flex;
}
.plugin-info-img{
margin-right:auto;
max-width: 100%;
}
.plugin-info-img svg:hover * {
cursor:pointer;
}
");

$wt_plugin_info = simplexml_load_file(JPATH_SITE."/plugins/jshoppingproducts/wt_add_products_info_to_joomla_script_options/wt_add_products_info_to_joomla_script_options.xml");

?>
<div class="wt-b24-plugin-info">
<div class="plugin-info-img span2">
<a href="https://web-tolk.ru" target="_blank">
<svg width="200" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Go to https://web-tolk.ru</title>
<text font-weight="bold" xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="32" id="svg_3" y="36.085949" x="8.152073" stroke-opacity="null" stroke-width="0" stroke="#000" fill="#0fa2e6">Web</text>
<text font-weight="bold" xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="32" id="svg_4" y="36.081862" x="74.239105" stroke-opacity="null" stroke-width="0" stroke="#000" fill="#384148">Tolk</text>
</g>
</svg>
</a>
</div>
<div style="padding: 0px 15px;" class="span10">
<span class="label label-success">v.<?php echo $wt_plugin_info->version; ?></span>
<?php echo Text::_("PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_DESC"); ?>
</div>
</div>
<?php

}

/**
* Method to get the field title.
*
* @return string The field title.
*
* @since 1.7.0
*/
protected function getTitle()
{
return $this->getLabel();
}

}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS="Jshoppingproducts - WT Add products info to Joomla script options"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_XML_DESCRIPTION="<p>Adds JoomShopping product info to Joomla script options. You can access it from javascript via Joomla.getOptions('jshop_products_details').</p>"
; Product view
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW="<h3>Product view</h3>"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_NAME="Product name"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_IMAGE="Product image URL"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_EAN="EAN"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_MANUFACTURER_CODE="Manufacturer code"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_QUANTITY="Product quantity"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_PRICE="Product price"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_ZERO_PRICE="Show if product price is <span class='label label-important'>0</span>?"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_OLD_PRICE="Old price"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_MIN_PRICE="Min price (price from)"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_DELIVERY_TIME="Delivery time"
; Category view
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW="<h3>Product on category view</h3>"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_NAME="Product name"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_IMAGE="Product image URL"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_EAN="EAN"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_MANUFACTURER_CODE="Manufacturer code"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_QUANTITY="Product quantity"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_PRICE="Product price"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_ZERO_PRICE="Show if product price is <span class='label label-important'>0</span>?"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_OLD_PRICE="Old price"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_MIN_PRICE="Min price (price from)"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_DELIVERY_TIME="Delivery time"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS="Jshoppingproducts - WT Add products info to Joomla script options"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_DESC="<p>Adds JoomShopping product info to Joomla script options. You can access it from javascript via Joomla.getOptions('jshop_products_details').</p>"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_AFTER_INSTALL = "Thank you for intalling extension"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_AFTER_DISCOVER_INSTALL = "Thank you for intalling extension"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_AFTER_UPDATE = "Thank you for updating extension"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_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_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_WHATS_NEW="<h3>v.1.1.0 What's new?</h3><p>Added <a href=\"https://web-tolk.ru/en/dev/joomshopping/wt-joomshopping-favorite.html\" target=\"_blank\">WT JoomShopping Favorites</a> products list support.</p><div class=\"alert alert-info\"><p style=\"text-align:center;\" class=\"alert-link\">This plugin is intended for developers. This solution is not in \"1 click\".</p></div><h2>What is it and why?</h2><h3>What is it?</h3><p>To create feedback forms in the online store on Joomla JoomShopping, such as:</p><ul><li>quick order of goods</li><li>ask a question about the product</li><li>request for a discount on an ite</li><li>wholesale price request</li></ul><p>And so on - <strong>for all Joomla feedback forms, where you need to specify information about the product.</strong></p><p>This plugin is necessary for those who use the <a class=\"text-info\" href=\"https://extensions.joomla.org/extension/radicalform/\">professional plugin feedback form - Radical Form</a> - in their work. I wrote <a class=\"text-info\" href=\"blog/integratsiya-form-obratnoj-svyazi-i-bitriks24-na-sajte-joomla.html\" target=\"_blank\">more about how to use Radical Form (in Russian)</a> in my blog.</p><h3>Why it?</h3><p>In order to make a beautiful and informative lead magnet, a feedback form that specifies the specific product in question.</p><p><span style=\"background-color: inherit; color: inherit; font-family: inherit; font-size: 1rem; caret-color: auto;\">Webmasters often get data for forms directly from the HTML layout of the site. In the case of a design change, it is easy to damage the structure on which the JS script relies and the feedback form will stop receiving data about the product.</span></p><p>This data should not depend on the design of the site. In Joomla there is a great native way to transfer data from PHP to JavaScript using a JSON object and receive it.</p><h2>Getting data about JoomShopping products for the feedback form</h2><div style=\"margin-top:15px; margin-bottom:15px; padding:10px; text-align:center;\"><code style=\"font-weight:bold\">Joomla.getOptions('your_json_object_with_data_from_php_here');</code></div><p>This way, you can get data from a JSON object. The <code>product_id</code> variable is read in advance from the button that the site visitor clicks on.</p><p><code>let jshop_products_details=Joomla.getOptions('jshop_products_details');&gt;</code><br/><code>let product_name=jshop_products_details[product_id]['product_name'];</code><br/><code>let product_price=jshop_products_details[product_id]['price'];</code><br/><code>let product_image_url=jshop_products_details[product_id]['product_image_url'];</code><br/><code>let product_ean=jshop_products_details[product_id]['ean'];</code></p><p>The plugin works in the product category, the list of products of the manufacturer, the favorite products list <a href=\"https://web-tolk.ru/en/dev/joomshopping/wt-joomshopping-favorite.html\" target=\"_blank\">WT JoomShopping Favorites</a> the single product view. The structure of the json array is the same everywhere - you don't have to write different code for different pages.</p>"
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS="Jshoppingproducts - WT Add products info to Joomla script options"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_XML_DESCRIPTION="<p>Плагин добавляет на страницы товара и категории товара js-массив с данными товара для использования через JavaScript. Обратиться можно через javascript - Joomla.getOptions('jshop_products_details')</p>"
; Карточка товара
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW="<h3>Страница товара</h3>"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_NAME="Название товара"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_IMAGE="URL основного изображения товара"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_EAN="Код товара (EAN)"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_MANUFACTURER_CODE="Артикул (manufacturer code)"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_QUANTITY="Количество товара"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_PRICE="Цена товара"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_ZERO_PRICE="Показать, если цена <span class='label label-important'>0</span>?"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_OLD_PRICE="Старая цена"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_MIN_PRICE="Минимальная цена (если есть зависимые атрибуты)"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_PRODUCT_VIEW_SHOW_PRODUCT_DELIVERY_TIME="Сроки поставки"
; Вид категории
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW="<h3>Товар на странице категории</h3>"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_NAME="Название товара"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_IMAGE="URL основного изображения товара"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_EAN="Код товара (EAN)"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_MANUFACTURER_CODE="Артикул (manufacturer code)"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_QUANTITY="Количество товара"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_PRICE="Цена товара"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_ZERO_PRICE="Показать, если цена <span class='label label-important'>0</span>?"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_OLD_PRICE="Старая цена"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_MIN_PRICE="Минимальная цена (если есть зависимые атрибуты)"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_CATEGORY_VIEW_SHOW_PRODUCT_DELIVERY_TIME="Сроки поставки"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS="Jshoppingproducts - WT Add products info to Joomla script options"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_DESC="<p>Плагин добавляет на страницы товара и категории товара js-массив с данными товара для использования через JavaScript. Обратиться можно через javascript - Joomla.getOptions('jshop_products_details')</p>"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_AFTER_INSTALL = "Спасибо за установку расширения"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_AFTER_DISCOVER_INSTALL = "Спасибо за установку расширения"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_AFTER_UPDATE = "Спасибо за обновление расширения"
PLG_WT_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_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_ADD_PRODUCTS_INFO_TO_JOOMLA_SCRIPT_OPTIONS_WHATS_NEW="<h3>v.1.1.0 Что нового?</h3><p>Добавлена поддержка списка избранных товаров <a href=\"https://web-tolk.ru/dev/joomshopping/wt-joomshopping-favorite.html\" target=\"_blank\">WT JoomShopping Favorites</a></p><div class=\"alert alert-info\"><p class=\"text-center font-weight-bold\">Данный плагин предназначен для разработчиков. Это решение не в \"1 клик\".</p></div><h2>Что это и зачем?</h2><h3>Что это?</h3><p>Для создания форм обратной связи в <strong>интернет-магазине на Joomla JoomShopping</strong>, таких как:</p><ul><li>быстрый заказ товара</li><li>задать вопрос по товару</li><li>запрос скидки на товар</li><li>запрос оптовой цены</li></ul><p>И так далее - <strong>для всех форм обратной связи Joomla, где нужно указать информацию о товаре.</strong>&nbsp;</p><p>Данный плагин нужен для тех, кто использует в работе профессиональный <a href=\"https://hika.su/rasshireniya/radical-form\" target=\"_blank\" rel=\"noopener\">плагин формы обратной связи Radical Form</a>. Подробнее о том, <a href=\"https://web-tolk.ru/blog/integratsiya-form-obratnoj-svyazi-i-bitriks24-na-sajte-joomla.html\" target=\"_blank\">как использовать Radical Form</a> писал в блоге.</p><h3>Зачем это?</h3><p>Для того, чтобы сделать красивый и информативный лид-магнит, форму обратной связи, в которой указывается конкретный товар, о котором идет речь.&nbsp;</p><p>Нередко вебмастера получают данные для форм напрямую из HTML-верстки сайта. В случае смены дизайна легко повредить структуру, на которую опирается JS-скрипт и форма обратной связи перестанет получать данные о товаре.&nbsp;</p><p>Эти данные не должны зависеть от дизайна сайта. В Joomla \"из коробки\" есть прекрасный способ передавать данные из PHP в JavaScript с помощью JSON-объекта и получать его нативным способом.&nbsp;</p><h2>Получение данных о товарах JoomShopping для формы обратной связи</h2><div style=\"margin-top:15px; margin-bottom:15px; padding:10px; text-align:center;\"><code style=\"font-weight:bold;\">Joomla.getOptions('your_json_object_with_data_from_php_here');</code></div><p>Таким образом можно получить данные из JSON-объекта. Переменную <code>product_id</code> заранее считываем с кнопки, по которой кликает посетитель сайта.</p><p><code>let jshop_products_details=Joomla.getOptions('jshop_products_details');&gt;</code><br/><code>let product_name=jshop_products_details[product_id]['product_name'];</code><br/><code>let product_price=jshop_products_details[product_id]['price'];</code></p><p>Плагин работает в категории товаров, списке товаров производителя, списке избранных товаров <a href=\"https://web-tolk.ru/dev/joomshopping/wt-joomshopping-favorite.html\" target=\"_blank\">WT JoomShopping Favorites</a>, карточка товара. Структура json-массива везде одинакова - Вам не придется писать разный код для разных страниц.</p>"
Loading

0 comments on commit 17ef2a4

Please sign in to comment.