From 1b1e0c658d38295fbb32aae139f32d9ffbbb81aa Mon Sep 17 00:00:00 2001 From: Sergey Tolkachyov Date: Tue, 31 May 2022 23:01:00 +0400 Subject: [PATCH] Add files via upload --- fields/plugininfo.php | 104 +++++++++++ ...stem_wt_modules_in_jshopping_positions.ini | 19 ++ ..._wt_modules_in_jshopping_positions.sys.ini | 7 + language/en-GB/index.html | 1 + language/index.html | 1 + ...stem_wt_modules_in_jshopping_positions.ini | 19 ++ ..._wt_modules_in_jshopping_positions.sys.ini | 7 + script.php | 152 +++++++++++++++ subform/category.xml | 53 ++++++ subform/product.xml | 40 ++++ wt_modules_in_jshopping_positions.php | 175 ++++++++++++++++++ wt_modules_in_jshopping_positions.xml | 64 +++++++ 12 files changed, 642 insertions(+) create mode 100644 fields/plugininfo.php create mode 100644 language/en-GB/en-GB.plg_system_wt_modules_in_jshopping_positions.ini create mode 100644 language/en-GB/en-GB.plg_system_wt_modules_in_jshopping_positions.sys.ini create mode 100644 language/en-GB/index.html create mode 100644 language/index.html create mode 100644 language/ru-RU/ru-RU.plg_system_wt_modules_in_jshopping_positions.ini create mode 100644 language/ru-RU/ru-RU.plg_system_wt_modules_in_jshopping_positions.sys.ini create mode 100644 script.php create mode 100644 subform/category.xml create mode 100644 subform/product.xml create mode 100644 wt_modules_in_jshopping_positions.php create mode 100644 wt_modules_in_jshopping_positions.xml diff --git a/fields/plugininfo.php b/fields/plugininfo.php new file mode 100644 index 0000000..df300be --- /dev/null +++ b/fields/plugininfo.php @@ -0,0 +1,104 @@ +form->getData(); + $element = $data->get('element'); + $folder = $data->get('folder'); + + + $doc = Factory::getDocument(); + $doc->addStyleDeclaration(" + .plugin-info-img-svg:hover * { + cursor:pointer; + } + "); + + $wt_plugin_info = simplexml_load_file(JPATH_SITE."/plugins/".$folder."/".$element."/".$element.".xml"); + + + + ?> + +
+ +
+ v.version; ?> + +
+
+getLabel(); + } + +} +?> \ No newline at end of file diff --git a/language/en-GB/en-GB.plg_system_wt_modules_in_jshopping_positions.ini b/language/en-GB/en-GB.plg_system_wt_modules_in_jshopping_positions.ini new file mode 100644 index 0000000..6366906 --- /dev/null +++ b/language/en-GB/en-GB.plg_system_wt_modules_in_jshopping_positions.ini @@ -0,0 +1,19 @@ +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS="System - WT Modules in JShopping positions" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_DESC="The plugin allows you to display Joomla modules in positions on JoomShopping pages" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_PRODUCT_LIST_TMP_VAR_LABEL="Position in the product block in the list of products (type of category)" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_PRODUCT_LIST_TMP_VAR_DESC="You can display the module in front of the card, before or after the image, in three special positions for buttons, etc." + +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_PRODUCT_TMP_VAR_LABEL="Position in the product" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_PRODUCT_TMP_VAR_DESC="You can display the button before or after the product information, before or after the main image or thumbnails, before videos, product files, attributes or characteristics, etc." +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_PRODUCT_VIEW="

Product

" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_PRODUCT_LIST_VIEW="

Product list (category)

" +COM_MODULES_FIELD_POSITION_LABEL="Modules positions" +COM_MODULES_NONE = "- No -" + +COM_PLUGINS_WT_MODULES_IN_JSHOPPING_POSITIONS_PRODUCT_FIELDSET_LABEL="JoomShopping product" +COM_PLUGINS_WT_MODULES_IN_JSHOPPING_POSITIONS_CATEGORY_FIELDSET_LABEL="JoomShopping category" +PLG_WT_MODULES_IN_JSHOPPING_CATEGORY_CATEGORY_OR_PRODUCT="Modules position in..." +PLG_WT_MODULES_IN_JSHOPPING_CATEGORY_CATEGORY_OR_PRODUCT_PRODUCT="product" +PLG_WT_MODULES_IN_JSHOPPING_CATEGORY_CATEGORY_OR_PRODUCT_CATEGORY="category" +PLG_WT_MODULES_IN_JSHOPPING_CATEGORY_CUSTOM_POSITION_CATEGORY="Custom position in JoomShopping category" +PLG_WT_MODULES_IN_JSHOPPING_CATEGORY_CUSTOM_POSITION_PRODUCT="Custom position in products of JoomShopping category" \ No newline at end of file diff --git a/language/en-GB/en-GB.plg_system_wt_modules_in_jshopping_positions.sys.ini b/language/en-GB/en-GB.plg_system_wt_modules_in_jshopping_positions.sys.ini new file mode 100644 index 0000000..fbd3a24 --- /dev/null +++ b/language/en-GB/en-GB.plg_system_wt_modules_in_jshopping_positions.sys.ini @@ -0,0 +1,7 @@ +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS="System - WT Modules in JShopping positions" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_DESC="The plugin allows you to display Joomla modules in positions on JoomShopping pages" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_AFTER_INSTALL = "Thank you for intalling extension" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_AFTER_DISCOVER_INSTALL = "Thank you for intalling extension" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_AFTER_UPDATE = "Thank you for updating extension" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_MAYBE_INTERESTING="

It might be interesting

" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_WHATS_NEW="

v.1.0.0 What's new?

First extension version

" \ No newline at end of file diff --git a/language/en-GB/index.html b/language/en-GB/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/language/en-GB/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/language/index.html b/language/index.html new file mode 100644 index 0000000..fa6d84e --- /dev/null +++ b/language/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/language/ru-RU/ru-RU.plg_system_wt_modules_in_jshopping_positions.ini b/language/ru-RU/ru-RU.plg_system_wt_modules_in_jshopping_positions.ini new file mode 100644 index 0000000..9ff7d32 --- /dev/null +++ b/language/ru-RU/ru-RU.plg_system_wt_modules_in_jshopping_positions.ini @@ -0,0 +1,19 @@ +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS="System - WT Modules in JShopping positions" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_DESC="Плагин позволяет выводить модули Joomla в позициях на страницах JoomShopping" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_PRODUCT_LIST_TMP_VAR_LABEL="Позиция в блоке товара в списке товаров (вид категории)" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_PRODUCT_LIST_TMP_VAR_DESC="Вы можете вывести модуль перед карточкой, перед или после изображения, в трех специальных позициях для кнопок и т.д." + +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_PRODUCT_TMP_VAR_LABEL="Позиция в карточке товара" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_PRODUCT_TMP_VAR_DESC="Вы можете вывести кнопку перед или после информации о товаре, перед или после основного изображения или миниатюр, перед видео, файлами товара, атрибутами или характеристиками и т.д." +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_PRODUCT_VIEW="

Карточка товара

" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_PRODUCT_LIST_VIEW="

Список товаров (категория)

" +COM_MODULES_FIELD_POSITION_LABEL="Позиция модулей" +COM_MODULES_NONE = "- Нет -" + +COM_PLUGINS_WT_MODULES_IN_JSHOPPING_POSITIONS_PRODUCT_FIELDSET_LABEL="Товар JoomShopping" +COM_PLUGINS_WT_MODULES_IN_JSHOPPING_POSITIONS_CATEGORY_FIELDSET_LABEL="Категория JoomShopping" +PLG_WT_MODULES_IN_JSHOPPING_CATEGORY_CATEGORY_OR_PRODUCT="Позиция модуля в..." +PLG_WT_MODULES_IN_JSHOPPING_CATEGORY_CATEGORY_OR_PRODUCT_PRODUCT="товаре" +PLG_WT_MODULES_IN_JSHOPPING_CATEGORY_CATEGORY_OR_PRODUCT_CATEGORY="категории" +PLG_WT_MODULES_IN_JSHOPPING_CATEGORY_CUSTOM_POSITION_CATEGORY="Пользовательская позиция в категории JoomShopping" +PLG_WT_MODULES_IN_JSHOPPING_CATEGORY_CUSTOM_POSITION_PRODUCT="Пользовательская позиция в товаре категории JoomShopping" \ No newline at end of file diff --git a/language/ru-RU/ru-RU.plg_system_wt_modules_in_jshopping_positions.sys.ini b/language/ru-RU/ru-RU.plg_system_wt_modules_in_jshopping_positions.sys.ini new file mode 100644 index 0000000..39455a8 --- /dev/null +++ b/language/ru-RU/ru-RU.plg_system_wt_modules_in_jshopping_positions.sys.ini @@ -0,0 +1,7 @@ +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS="System - WT Modules in JShopping positions" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_DESC="Плагин позволяет выводить модули Joomla в позициях на страницах JoomShopping" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_AFTER_INSTALL = "Спасибо за установку расширения" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_AFTER_DISCOVER_INSTALL = "Спасибо за установку расширения" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_AFTER_UPDATE = "Спасибо за обновление расширения" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_MAYBE_INTERESTING="

Может быть интересно

" +PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_WHATS_NEW="

v.1.0.0 Что нового?

Первая версия расширения

" \ No newline at end of file diff --git a/script.php b/script.php new file mode 100644 index 0000000..48d2c78 --- /dev/null +++ b/script.php @@ -0,0 +1,152 @@ +script.php + * + * @package Joomla.Administrator + * @subpackage com_helloworld + * + * @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ +class plgSystemWt_modules_in_jshopping_positionsInstallerScript +{ + /** + * This method is called after a component is installed. + * + * @param \stdClass $parent - Parent object calling this method. + * + * @return void + */ + public function install($parent) + { + + } + + /** + * This method is called after a component is uninstalled. + * + * @param \stdClass $parent - Parent object calling this method. + * + * @return void + */ + public function uninstall($parent) + { + + + } + + /** + * This method is called after a component is updated. + * + * @param \stdClass $parent - Parent object calling object. + * + * @return void + */ + public function update($parent) + { + + } + + /** + * Runs just before any installation action is performed on the component. + * Verifications and pre-requisites should run in this function. + * + * @param string $type - Type of PreFlight action. Possible values are: + * - * install + * - * update + * - * discover_install + * @param \stdClass $parent - Parent object calling object. + * + * @return void + */ + public function preflight($type, $parent) + { + + } + + + + /** + * Runs right after any installation action is performed on the component. + * + * @param string $type - Type of PostFlight action. Possible values are: + * - * install + * - * update + * - * discover_install + * @param \stdClass $parent - Parent object calling object. + * + * @return void + */ + function postflight($type, $installer) + { + + + $jversion = new Version(); + + // only for Joomla 3.x + + if (version_compare($jversion->getShortVersion(), '4.0', '<')) { + + $element = strtoupper($installer->get("element")); // ex. "$parent" + $class = 'span'; + $web_tolk_site_icon = ""; + + } else { + + $element = strtoupper($installer->getElement()); + $class = 'col-'; + $web_tolk_site_icon = ''; + } + + $smile = ''; + if($type != 'uninstall'){ + $smiles = ['☺','😀','😉','😍','😎','😊','🙏']; + $smile_key = array_rand($smiles, 1); + $smile = $smiles[$smile_key]; + } + + echo " +
+
+

".$smile.Text::_("PLG_".$element."_AFTER_".strtoupper($type))."
".Text::_("PLG_".$element)."

+ ".Text::_("PLG_".$element."_DESC"); + + + echo Text::_("PLG_".$element."_WHATS_NEW"); + + echo "
+
+ +

Joomla Extensions

+

+ ".$web_tolk_site_icon." https://web-tolk.ru + info@web-tolk.ru +

+

Joomla Russian Community in Telegram

+ ".Text::_("PLG_".$element."_MAYBE_INTERESTING")." +
+ + + "; + + } +} \ No newline at end of file diff --git a/subform/category.xml b/subform/category.xml new file mode 100644 index 0000000..4723a9b --- /dev/null +++ b/subform/category.xml @@ -0,0 +1,53 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/subform/product.xml b/subform/product.xml new file mode 100644 index 0000000..fcda183 --- /dev/null +++ b/subform/product.xml @@ -0,0 +1,40 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wt_modules_in_jshopping_positions.php b/wt_modules_in_jshopping_positions.php new file mode 100644 index 0000000..1a52c68 --- /dev/null +++ b/wt_modules_in_jshopping_positions.php @@ -0,0 +1,175 @@ +display() + * + * @param $view JoomShopping Product view object + * + * + * @since 1.0.0 + */ + public function onBeforeDisplayProductView(&$view) + { + + + $product_modules = $this->params->get('product_modules'); + + foreach ($product_modules as $product_module) + { + $product_tmp_var = $product_module->product_tmp_var; + if ($product_tmp_var == 'custom_position') + { + $product_tmp_var = $product_module->custom_position; + } + $modules = ModuleHelper::getModules($product_module->position); + foreach ($modules as $module) + { + $view->$product_tmp_var .= ModuleHelper::renderModule($module); + } + } + + + } + + public function onBeforeDisplaywtjshoppingfavoritesView(&$view) + { + + } + + /** + * Вызывается перед $view->display. Изменение $productlist ничего не даёт. + * + * @param $view JoomShopping category view + * @param $productlist List of products + * + * @see \Joomla\Component\Jshopping\Site\Controller\ProductsController::display + * @see \Joomla\Component\Jshopping\Site\Controller\ManufacturerController::view + * @see \Joomla\Component\Jshopping\Site\Controller\CategoryController::view + * @see \Joomla\Component\Jshopping\Site\Controller\VendorController::products + * @since 1.0.0 + */ + public function onBeforeDisplayProductListView($view, &$productlist) + { + $category_modules = $this->params->get('category_modules'); + + foreach ($category_modules as $category_module) + { + if ($category_module->category_or_product == 'category') + { + + $product_list_tmp_var_category = $category_module->product_list_tmp_var_category; + if ($product_list_tmp_var_category == 'custom_position') + { + $product_list_tmp_var_category = $category_module->custom_position_category; + } + $modules = ModuleHelper::getModules($category_module->position); + foreach ($modules as $module) + { + $view->$product_list_tmp_var_category .= ModuleHelper::renderModule($module); + } + } + elseif ($category_module->category_or_product == 'product') + { + if (count((array) $view->rows) > 0) + { + $product_list_tmp_var_product = $category_module->product_list_tmp_var_product; + if ($product_list_tmp_var_product == 'custom_position') + { + $product_list_tmp_var_product = $category_module->custom_position_product; + } + + foreach ($view->rows as $product) + { + $modules = ModuleHelper::getModules($category_module->position); + foreach ($modules as $module) + { + $product->$product_list_tmp_var_product .= ModuleHelper::renderModule($module); + + } + } + } + } + } + } + + /** + * Вызывается перед $view->display. Изменение $productlist ничего не даёт. + * + * @param $view JoomShopping category view + * + * @see \Joomla\Component\Jshopping\Site\Controller\CategoryController::display + * @since 1.0.0 + */ + public function onBeforeDisplayCategoryView($view) + { + $category_modules = $this->params->get('category_modules'); + + foreach ($category_modules as $category_module) + { + if ($category_module->category_or_product == 'category') + { + + $product_list_tmp_var_category = $category_module->product_list_tmp_var_category; + if ($product_list_tmp_var_category == 'custom_position') + { + $product_list_tmp_var_category = $category_module->custom_position_category; + } + $modules = ModuleHelper::getModules($category_module->position); + foreach ($modules as $module) + { + $view->$product_list_tmp_var_category .= ModuleHelper::renderModule($module); + } + } + elseif ($category_module->category_or_product == 'product') + { + if (count((array) $view->rows) > 0) + { + $product_list_tmp_var_product = $category_module->product_list_tmp_var_product; + if ($product_list_tmp_var_product == 'custom_position') + { + $product_list_tmp_var_product = $category_module->custom_position_product; + } + + foreach ($view->rows as $product) + { + $modules = ModuleHelper::getModules($category_module->position); + foreach ($modules as $module) + { + $product->$product_list_tmp_var_product .= ModuleHelper::renderModule($module); + + } + } + } + } + } + } + +} diff --git a/wt_modules_in_jshopping_positions.xml b/wt_modules_in_jshopping_positions.xml new file mode 100644 index 0000000..e01aa90 --- /dev/null +++ b/wt_modules_in_jshopping_positions.xml @@ -0,0 +1,64 @@ + + + System - WT Modules in JShopping positions + Sergey Tolkachyov + info@web-tolk.ru + https://web-tolk.ru/ + 31/05/2022 + Sergey Tolkachyov + GNU GPL 3.0 + 1.0.0 + PLG_WT_MODULES_IN_JSHOPPING_POSITIONS_DESC + script.php + + wt_modules_in_jshopping_positions.php + language + fields + subform + + + language/en-GB/en-GB.plg_system_wt_modules_in_jshopping_positions.ini + + language/en-GB/en-GB.plg_system_wt_modules_in_jshopping_positions.sys.ini + + language/ru-RU/ru-RU.plg_system_wt_modules_in_jshopping_positions.ini + + language/ru-RU/ru-RU.plg_system_wt_modules_in_jshopping_positions.sys.ini + + + + +
+ +
+
+ + + + +
+
+ + + +
+
+
+ + + https://web-tolk.ru/component/swjprojects/jupdate.html?element=wt_modules_in_jshopping_positions + +
\ No newline at end of file