15 array(
'oxtitle',
'oxcategories', 1, 1, 0),
16 array(
'oxdesc',
'oxcategories', 1, 1, 0),
17 array(
'oxid',
'oxcategories', 0, 0, 0),
18 array(
'oxid',
'oxcategories', 0, 0, 1)
20 'container2' => array(
21 array(
'oxtitle',
'oxcategories', 1, 1, 0),
22 array(
'oxdesc',
'oxcategories', 1, 1, 0),
23 array(
'oxid',
'oxcategories', 0, 0, 0),
24 array(
'oxid',
'oxobject2discount', 0, 0, 1),
25 array(
'oxid',
'oxcategories', 0, 0, 1)
38 $sId = $oConfig->getRequestParameter(
'oxid');
39 $sSynchId = $oConfig->getRequestParameter(
'synchoxid');
45 $sQAdd =
" from {$sCategoryTable}";
47 $sQAdd =
" from oxobject2discount, {$sCategoryTable} " .
48 "where {$sCategoryTable}.oxid=oxobject2discount.oxobjectid " .
49 " and oxobject2discount.oxdiscountid = " . $oDb->quote($sId) .
50 " and oxobject2discount.oxtype = 'oxcategories' ";
53 if ($sSynchId && $sSynchId != $sId) {
55 $sSubSelect =
" select {$sCategoryTable}.oxid from oxobject2discount, {$sCategoryTable} " .
56 "where {$sCategoryTable}.oxid=oxobject2discount.oxobjectid " .
57 " and oxobject2discount.oxdiscountid = " . $oDb->quote($sSynchId) .
58 " and oxobject2discount.oxtype = 'oxcategories' ";
59 if (stristr($sQAdd,
'where') ===
false) {
64 $sQAdd .=
" {$sCategoryTable}.oxid not in ( $sSubSelect ) ";
79 if ($oConfig->getRequestParameter(
'all')) {
84 } elseif (is_array($aChosenCat)) {
86 $sQ =
"delete from oxobject2discount where oxobject2discount.oxid in (" . $sChosenCategories .
") ";
98 $soxId = $oConfig->getRequestParameter(
'synchoxid');
101 if ($oConfig->getRequestParameter(
'all')) {
105 if ($soxId && $soxId !=
"-1" && is_array($aChosenCat)) {
106 foreach ($aChosenCat as $sChosenCat) {
107 $oObject2Discount =
oxNew(
"oxbase");
108 $oObject2Discount->init(
'oxobject2discount');
109 $oObject2Discount->oxobject2discount__oxdiscountid =
new oxField($soxId);
110 $oObject2Discount->oxobject2discount__oxobjectid =
new oxField($sChosenCat);
111 $oObject2Discount->oxobject2discount__oxtype =
new oxField(
"oxcategories");
112 $oObject2Discount->save();