Commit 93d261f1 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

V1.0: First working version of the plugin for public consumption

parent f553c8c1
BASE=vmAutoParentCategories
PLUGINTYPE=system
VERSION=0.1
VERSION=1.0
PLUGINFILES=$(BASE).php $(BASE).xml index.html
# TRANSDIR=../../../administrator/language/
......
......@@ -3,7 +3,7 @@
; @Website : http://kainhofer.com
; @license - http://www.gnu.org/licenses/gpl.html GNU/GPL
VMAUTOCATEGORIES_DESCRIPTION="<h2>Virtuemart 2 automatische Produktkategorien Plugin</h2><p style='font-weight: normal'>Dieses Plugin kann den VirtueMart Produkten automatische alle übergeordneten Kategorien des Produkts zuweisen, oder all übergeordneten Kategorien entfernen. Ebenso können bei Produktvarianten die Kategorien des übergeordneten Produkts zugeordnet, oder alle Kategorien entfernt werden.</p><p style='font-weight: normal'>Um das Plugin manuell auszuführen, <a href="_QQ_"?vmAutoParentCategories=run"_QQ_">klicken Sie hier</a>.</p>"
VMAUTOCATEGORIES_DESCRIPTION="<h2>Virtuemart 2 automatische Produktkategorien Plugin</h2><p style='font-weight: normal'>Dieses Plugin kann den VirtueMart Produkten automatische alle übergeordneten Kategorien des Produkts zuweisen, oder all übergeordneten Kategorien entfernen. Ebenso können bei Produktvarianten die Kategorien des übergeordneten Produkts zugeordnet, oder alle Kategorien entfernt werden.</p><p style='font-weight: normal'>Um das Plugin manuell auszuführen, <a href="_QQ_"?vmAutoParentCategories=run"_QQ_">klicken Sie hier</a> (dazu muss das Plugin aber auch aktiviert sein!).</p>"
VMAUTOCATEGORIES_RUN="Führe Plugin aus:"
VMAUTOCATEGORIES_RUN_DESC="Wählen Sie aus, wann das Plugin ausgeführt wird und die Kategorien der VirtueMart Produkte modifiziert."
......
......@@ -3,7 +3,7 @@
; @Website : http://kainhofer.com
; @license - http://www.gnu.org/licenses/gpl.html GNU/GPL
VMAUTOCATEGORIES_DESCRIPTION="<h2>Virtuemart 2 Auto Product Categories plugin</h2><p style='font-weight: normal'>Automatically add VirtueMart products to all parent categories of the categories assigned to it, or remove all parent categories. Additionally, child products can also be adjusted with their parents' categories, or removed from all categories.</p><p style='font-weight: normal'>To call the plugin explicitly, <a href="_QQ_"?vmAutoParentCategories=run"_QQ_">click here</a>.</p>"
VMAUTOCATEGORIES_DESCRIPTION="<h2>Virtuemart 2 Auto Product Categories plugin</h2><p style='font-weight: normal'>Automatically add VirtueMart products to all parent categories of the categories assigned to it, or remove all parent categories. Additionally, child products can also be adjusted with their parents' categories, or removed from all categories.</p><p style='font-weight: normal'>To call the plugin explicitly, <a href="_QQ_"?vmAutoParentCategories=run"_QQ_">click here</a> (will only work if the plugin is enabled!).</p>"
VMAUTOCATEGORIES_RUN="Run plugin on:"
VMAUTOCATEGORIES_RUN_DESC="Select when the plugin shall be run and automatically modify the VirtueMart categories of your products."
......
<?php
/**
* @plugin VMAutoParentCategories
* Version 1.0, 2012-12-18
* @copyright Copyright (C) 2012 Reinhold Kainhofer - All rights reserved.
* @Website : http://www.kainhofer.com
* @license - http://www.gnu.org/licenses/gpl.html GNU/GPL
......@@ -88,7 +89,7 @@ class plgSystemVMAutoParentCategories extends JPlugin {
}
function getCategoriesAllParents($categories, $catparents) {
$newcats=[];
$newcats=array();
foreach ($categories as $c) {
$newcats[$c]=1;
$c1=$c;
......@@ -221,7 +222,7 @@ class plgSystemVMAutoParentCategories extends JPlugin {
}
if ($modified>0) {
$this->progressMessage(JText::sprintf('VMAUTOCATEGORIES_PROGRESS_ARTICLES_MODIFIED', $modified));
} elseif (in_array ($this->_dbg, ['report_always', 'report_no_change', 'debug', 'debug_no_changes'])) {
} elseif (in_array ($this->_dbg, array('report_always', 'report_no_change', 'debug', 'debug_no_changes'))) {
$this->progressMessage(JText::sprintf('VMAUTOCATEGORIES_PROGRESS_ARTICLES_NO_MODIFICATIONS'));
}
......@@ -238,7 +239,7 @@ class plgSystemVMAutoParentCategories extends JPlugin {
case 'add_two_leaves': $newcats = $this->getCategoriesOneParent($cats, $catparents); break;
case 'remove_except_leaf': $newcats = $this->getCategoriesOnlyLeaf($cats, $catparents); break;
case 'copy_parent': $newcats = $this->getProductCategories($topparent->virtuemart_product_id); break;
case 'remove_all': $newcats = []; break;
case 'remove_all': $newcats = array(); break;
}
$added=array_diff($newcats,$cats);
$removed=array_diff($cats,$newcats);
......@@ -258,7 +259,7 @@ class plgSystemVMAutoParentCategories extends JPlugin {
}
if ($childrenmodified>0) {
$this->progressMessage(JText::sprintf('VMAUTOCATEGORIES_PROGRESS_CHILDREN_MODIFIED', $childrenmodified));
} elseif (in_array ($this->_dbg, ['report_always', 'report_no_change', 'debug', 'debug_no_changes'])) {
} elseif (in_array ($this->_dbg, array('report_always', 'report_no_change', 'debug', 'debug_no_changes'))) {
$this->progressMessage(JText::sprintf('VMAUTOCATEGORIES_PROGRESS_CHILDREN_NO_MODIFICATIONS'));
}
}
......
......@@ -7,7 +7,7 @@
<license>http://www.gnu.org/licenses/gpl.html GNU/GPL v3+</license>
<authorEmail>reinhold@kainhofer.com/</authorEmail>
<authorUrl>http://kainhofer.com</authorUrl>
<version>0.0.2</version>
<version>1.0.0</version>
<description>VMAUTOCATEGORIES_DESCRIPTION</description>
<files>
......@@ -15,8 +15,8 @@
<filename plugin="vmAutoParentCategories">index.html</filename>
</files>
<languages>
<language tag="en-GB">en-GB.plg_system_vmAutoParentCategories.ini</language>
<language tag="de-DE">de-DE.plg_system_vmAutoParentCategories.ini</language>
<language tag="en-GB">en-GB.plg_system_vmAutoParentCategories.sys.ini</language>
<language tag="de-DE">de-DE.plg_system_vmAutoParentCategories.sys.ini</language>
</languages>
<config>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment