shop_default_category_ajax.php

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