shop_default_category_ajax.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class shop_default_category_ajax extends ajaxListComponent
00007 {
00008 
00014     protected $_aColumns = array('container1' => array( // field , table,         visible, multilanguage, ident
00015         array('oxtitle', 'oxcategories', 1, 1, 0),
00016         array('oxdesc', 'oxcategories', 1, 1, 0),
00017         array('oxid', 'oxcategories', 0, 0, 0),
00018         array('oxid', 'oxcategories', 0, 0, 1)
00019     )
00020     );
00021 
00027     protected function _getQuery()
00028     {
00029         $oCat = oxNew('oxcategory');
00030         $oCat->setLanguage(oxRegistry::getConfig()->getRequestParameter('editlanguage'));
00031 
00032         $sCategoriesTable = $oCat->getViewName();
00033 
00034         return " from $sCategoriesTable where " . $oCat->getSqlActiveSnippet();
00035     }
00036 
00040     public function unassignCat()
00041     {
00042         $sShopId = oxRegistry::getConfig()->getRequestParameter('oxid');
00043         $oShop = oxNew('oxshop');
00044         if ($oShop->load($sShopId)) {
00045             $oShop->oxshops__oxdefcat = new oxField('');
00046             $oShop->save();
00047         }
00048     }
00049 
00053     public function assignCat()
00054     {
00055         $sChosenCat = oxRegistry::getConfig()->getRequestParameter('oxcatid');
00056         $sShopId = oxRegistry::getConfig()->getRequestParameter('oxid');
00057         $oShop = oxNew('oxshop');
00058         if ($oShop->load($sShopId)) {
00059             $oShop->oxshops__oxdefcat = new oxField($sChosenCat);
00060             $oShop->save();
00061         }
00062     }
00063 }