Skip to content

Commit

Permalink
Merge pull request #6 from netfeld/netfeld
Browse files Browse the repository at this point in the history
Netfeld
  • Loading branch information
kingschnulli authored Sep 1, 2020
2 parents b0f8894 + 8fb0053 commit 22e09f9
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 19 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ Free OXID eShop module for GDRP compliance.
- See module settings
- Activate "Lern-Modus" and make an test order, after this deacticate "Lern-Modus"
- Change cookie settings in general shop data --> cookies
- add `[{include file="widget/cookieinfos.tpl"}]` to `oxsecurityinfo` cms-page
- Add `[{include file="widget/cookieinfos.tpl"}]` to `oxsecurityinfo` cms-page
- "Lern-Modus" will handle the oxid standard cookies (ESSENTIAL, Google Analytics)
- Add extra cookies in the backend module
- Customize the including of the extra cookies in templates by using `[{if $oViewConf->isCookieCategoryEnabled('MARKETING') == 1}][{/if}]`
- Possible cats are ESSENTIAL,PERSONALIZATION,ANALYTICS,MARKETING,UNCATEGORIZED

## Notice
- Template compatibility only for wave theme, feel free to contribute for other themes ;-)
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function loadAllCookies()
$sTable = getViewName('compliancecookies');
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

$sQ = "SELECT $sFields FROM $sTable WHERE $sTable.oxactive = 1 AND $sTable.oxshopid = $sShopId";
$sQ = "SELECT $sFields FROM $sTable WHERE $sTable.oxactive = 1 AND $sTable.oxshopid = $sShopId ORDER BY OXCATEGORY DESC, OXCOOKIE ASC ";
$this->selectString($sQ);
}

Expand All @@ -30,7 +30,7 @@ public function loadCategoryCookies($sCategory)
$sTable = getViewName('compliancecookies');
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

$sQ = "SELECT $sFields FROM $sTable WHERE $sTable.oxshopid = $sShopId AND $sTable.oxcategory = " . $db->quote($sCategory);
$sQ = "SELECT $sFields FROM $sTable WHERE $sTable.oxshopid = $sShopId AND $sTable.oxcategory = " . $db->quote($sCategory).' ORDER BY OXCOOKIE ASC';
$this->selectString($sQ);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
[{assign var=cookies value=$oViewConf->getComplianceCookies()}]
<div class="table-responsive">
<table class="table table-striped">
<thead>
[{assign var=cookies_by_cat value=$oViewConf->getComplianceCookiesByCategory()}]

<div class="cc-cookie-infos">
[{foreach from=$cookies_by_cat key=cat item=cookies}]
<h3>[{oxmultilang ident="COOKIE_COMPLIANCE_CATEGORY_"|cat:$cat}]</h3>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<td>[{oxmultilang ident="COOKIE_COMPLIANCE_LIST_NAME"}]</td>
<td>[{oxmultilang ident="COOKIE_COMPLIANCE_LIST_SOURCE"}]</td>
<td>[{oxmultilang ident="COOKIE_COMPLIANCE_LIST_PURPOSE"}]</td>
<td>[{oxmultilang ident="COOKIE_COMPLIANCE_LIST_RETENTION"}]</td>
</tr>
</thead>
<tbody>
</thead>
<tbody>
[{foreach from=$cookies item=cookie}]
<tr>
<td>[{$cookie->compliancecookies__oxcookie->value}]</td>
<td>[{$cookie->compliancecookies__oxservice->value}]</td>
<td>[{$cookie->compliancecookies__oxdescription->value}]</td>
<td>[{$cookie->compliancecookies__oxretention->value}]</td>
</tr>
[{/foreach}]
</tbody>
</table>
</div>
<tr>
<td>[{$cookie->compliancecookies__oxcookie->value}]</td>
<td>[{$cookie->compliancecookies__oxcookie->value}]</td>
<td>[{$cookie->compliancecookies__oxservice->value}]</td>
<td>[{$cookie->compliancecookies__oxdescription->value}]</td>
<td>[{$cookie->compliancecookies__oxretention->value}]</td>
</tr>
[{/foreach}]
</tbody>
</table>
</div>
[{/foreach}]
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,21 @@ public function getComplianceCookies () {
return $list;
}

public function getComplianceCookiesByCategory () {
$list = oxNew('compliancecookielist');
$list->loadAllCookies();

$types=[];

foreach ($list as $item){
$cat=$item->compliancecookies__oxcategory->value;
if($cat){
if(!$types[$cat]) $types[$cat]=[];
$types[$cat][]=$item;
}
}

return $types;
}

}

0 comments on commit 22e09f9

Please sign in to comment.