add shop group, improve inactive categories export

This commit is contained in:
Daniel Seifert 2021-04-28 13:39:03 +02:00
parent 400554ea9c
commit 5b8867b1e8
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
5 changed files with 48 additions and 21 deletions

View File

@ -16,6 +16,7 @@ declare(strict_types=1);
namespace D3\DataWizard\Application\Model;
use D3\DataWizard\Application\Model\Exports\InactiveCategories;
use D3\DataWizard\Application\Model\Exports\KeyFigures;
use OxidEsales\Eshop\Core\Registry;
class Configuration

View File

@ -28,6 +28,14 @@ use OxidEsales\Eshop\Core\Registry;
abstract class ExportBase implements QueryBase
{
/**
* @return string
*/
public function getDescription() : string
{
return '';
}
/**
* @param string $format
*

View File

@ -16,6 +16,9 @@
namespace D3\DataWizard\Application\Model\Exports;
use D3\DataWizard\Application\Model\ExportBase;
use OxidEsales\Eshop\Application\Model\Article;
use OxidEsales\Eshop\Application\Model\Category;
use OxidEsales\Eshop\Application\Model\Object2Category;
use OxidEsales\Eshop\Core\Registry;
class InactiveCategories extends ExportBase
@ -32,37 +35,43 @@ class InactiveCategories extends ExportBase
return Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES');
}
/**
* @return string
*/
public function getDescription() : string
{
return '';
}
/**
* @return array
*/
public function getQuery() : array
{
$categoryTableName = oxNew(Category::class)->getCoreTableName();
$object2categoryTableName = oxNew(Object2Category::class)->getCoreTableName();
$articleTableName = oxNew(Article::class)->getCoreTableName();
$treeTitle = Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_TREE');
$titleTitle = Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_TITLE');
$countTitle = Registry::getLang()->translateString('D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_COUNT');
return [
"SELECT
oc.OXID,
oc.OXSHOPID,
oc.oxtitle as 'Titel',
oc.oxtitle as :titleTitle,
(
SELECT GROUP_CONCAT(oxtitle ORDER BY oxleft ASC SEPARATOR ' > ')
from oxcategories
from ".$categoryTableName."
WHERE OXLEFT < oc.oxleft AND OXRIGHT > oc.oxright AND OXROOTID = oc.OXROOTID AND OXSHOPID = oc.OXSHOPID
) as 'Baum',
COUNT(oa.oxid) as 'Anzahl'
FROM oxcategories oc
LEFT JOIN oxobject2category o2c ON oc.OXID = o2c.OXCATNID
LEFT JOIN oxarticles oa ON o2c.OXOBJECTID = oa.OXID
WHERE oc.OXACTIVE = ? AND oa.OXACTIVE = ?
) as :treeTitle,
COUNT(oa.oxid) as :countTitle
FROM ".$categoryTableName." oc
LEFT JOIN ".$object2categoryTableName." o2c ON oc.OXID = o2c.OXCATNID
LEFT JOIN ".$articleTableName." oa ON o2c.OXOBJECTID = oa.OXID
WHERE oc.OXACTIVE = :categoryActive AND oa.OXACTIVE = :articleActive
GROUP BY oc.oxid
ORDER BY oc.oxleft ASC",
[0, 1]
[
'categoryActive' => 0,
'articleActive' => 1,
'titleTitle' => $titleTitle,
'treeTitle' => $treeTitle,
'countTitle' => $countTitle
]
];
}
}

View File

@ -30,9 +30,10 @@ $aLang = array(
'D3_DATAWIZARD_GROUP_ARTICLES' => 'Artikel',
'D3_DATAWIZARD_GROUP_CATEGORIES' => 'Kategorien',
'D3_DATAWIZARD_GROUP_REMARKS' => 'Bewertungen',
'D3_DATAWIZARD_GROUP_USERS' => 'Benutzer',
'D3_DATAWIZARD_GROUP_ORDERS' => 'Bestellungen',
'D3_DATAWIZARD_GROUP_REMARKS' => 'Bewertungen',
'D3_DATAWIZARD_GROUP_SHOP' => 'Shop',
'D3_DATAWIZARD_GROUP_USERS' => 'Benutzer',
'D3_DATAWIZARD_EXPORT_SUBMIT' => 'Export starten',
'D3_DATAWIZARD_EXPORT_FORMAT_CSV' => 'CSV-Format',
@ -45,7 +46,15 @@ $aLang = array(
'D3_DATAWIZARD_ERR_NOEXPORTCONTENT' => 'Export ist leer, kein Inhalt zum Download verfügbar',
'D3_DATAWIZARD_ERR_NOSUITABLERENDERER' => 'kein Renderer für Format "%1$s" registriert',
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES' => 'deaktivierte Kategorien, mit aktiven Artikel'
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES' => 'deaktivierte Kategorien, mit aktiven Artikel',
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_TREE' => 'Baum',
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_TITLE' => 'Titel',
'D3_DATAWIZARD_EXPORTS_INACTIVECATEGORIES_COUNT' => 'Anzahl',
'D3_DATAWIZARD_EXPORTS_KEYFIGURES' => 'Bestellungskennzahlen nach Monat',
'D3_DATAWIZARD_EXPORTS_KEYFIGURES_ORDERSPERMONTH' => 'Bestellungen pro Monat',
'D3_DATAWIZARD_EXPORTS_KEYFIGURES_BASKETSIZE' => 'Warenkorbhöhe',
'D3_DATAWIZARD_EXPORTS_KEYFIGURES_MONTH' => 'Monat',
// Abracadata
// Harry Potter

View File

@ -26,7 +26,7 @@ $logo = '<img src="https://logos.oxidmodule.com/d3logo.svg" alt="(D3)" style="he
*/
$aModule = [
'id' => $sModuleId,
'title' => $logo.' Data Wizard framework',
'title' => $logo.' Data Wizard',
'description' => [
'de' => '',
'en' => '',