Просмотр исходного кода

Ticket #4148 - Build-in API support: Ads.

AntonLV 2 лет назад
Родитель
Сommit
fc62cfe3a6

+ 1 - 1
modules/boonex/ads/classes/BxAdsFormEntry.php

@@ -24,7 +24,7 @@ class BxAdsFormEntry extends BxBaseModTextFormEntry
 
         $CNF = &$this->_oModule->_oConfig->CNF;
 
-        $this->_initCategoryFields();
+        $this->_initCategoryFields((int)BxDolSession::getInstance()->getValue($this->aParams['display'] . '_category'));
 
         if(isset($this->aInputs[$CNF['FIELD_TITLE']], $this->aInputs[$CNF['FIELD_NAME']])) {
             $sJsObject = $this->_oModule->_oConfig->getJsObject('form');

+ 6 - 5
modules/boonex/ads/classes/BxAdsModule.php

@@ -416,16 +416,17 @@ class BxAdsModule extends BxBaseModTextModule
 
     public function serviceEntityCreate ($sParams = false)
     {
-        if(($sDisplay = $this->getCategoryDisplay('add')) !== false) {
+        $iCategory = is_numeric($sParams) ? (int)$sParams : 0;
+
+        if(($sDisplay = $this->getCategoryDisplay('add', $iCategory)) !== false) {
             if(empty($sParams) || !is_array($sParams))
                 $sParams = array();
 
             $sParams['display'] = $sDisplay;
         }
-        
-        if (is_int($sParams)){
-            $_GET['category'] = $sParams;
-        }
+
+        if($iCategory)
+            BxDolSession::getInstance()->setValue($sDisplay . '_category', $iCategory);
 
         return parent::serviceEntityCreate($sParams);
     }