shop_default_category.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00003 $aColumns = array( 'container1' => array(    // field , table,         visible, multilanguage, ident
00004                                         array( 'oxtitle',  'oxcategories', 1, 1, 0 ),
00005                                         array( 'oxdesc',   'oxcategories', 1, 1, 0 ),
00006                                         array( 'oxid',     'oxcategories', 0, 0, 0 ),
00007                                         array( 'oxid',     'oxcategories', 0, 0, 1 )
00008                                         )
00009                     );
00013 class ajaxComponent extends ajaxListComponent
00014 {
00020     protected function _getQuery()
00021     {
00022         $oCat = oxNew('oxcategory');
00023         $oCat->setLanguage( oxConfig::getParameter('editlanguage') );
00024 
00025         $sCategoriesTable = $oCat->getViewName();
00026         return " from $sCategoriesTable where ".$oCat->getSqlActiveSnippet();
00027     }
00028 
00034     public function unassignCat()
00035     {
00036         $sShopId = oxConfig::getParameter( 'oxid');
00037         $oShop = oxNew('oxshop');
00038         if ($oShop->load($sShopId)) {
00039             $oShop->oxshops__oxdefcat = new oxField('');
00040             $oShop->save();
00041         }
00042     }
00043 
00049     public function assignCat()
00050     {
00051         $sChosenCat = oxConfig::getParameter( 'oxcatid' );
00052         $sShopId    = oxConfig::getParameter( 'oxid');
00053         $oShop = oxNew('oxshop');
00054         if ($oShop->load($sShopId)) {
00055             $oShop->oxshops__oxdefcat = new oxField($sChosenCat);
00056             $oShop->save();
00057         }
00058     }
00059 }