how to solve empty ads issue

Write about issues that you have found.

Moderators: Koduc, Xpycm

Forum rules
Pay attention! Forum is not a means for guaranteed support of clients and users. An answer as well as a quick answer is not supposed on the forum. We post messages as soon as possible.

The message limit on the forum is 3 messages per day.
If you want to say "thank you" then use the function "Give good reputation point", which is a green icon "plus" under the nickname of the person, who answered the message.

how to solve empty ads issue

Postby andipas » 20 Nov 2014, 14:30

Change in the file Apartment.php (protected/modules/apartments/models/Apartment.php) the method "beforeSave" for the following code

Code: Select all

    
public function beforeSave()
    {
        if (!
$this->square) {
            
$this->square 0;
        }

        if (!
$this->land_square) {
            
$this->land_square 0;
        }

        
$userInfo User::model()->findByPk($this->owner_id, array('select' => 'isAdmin'));

        if (
$this->isNewRecord) {
            
$this->owner_id $this->owner_id $this->owner_id Yii::app()->user->id;

            if (
$userInfo && $userInfo->isAdmin == 1) {
                
$this->owner_active self::STATUS_ACTIVE;
            }

            
$maxSorter Yii::app()->db->createCommand()
                ->
select('MAX(sorter) as maxSorter')
                ->
from($this->tableName())
                ->
queryScalar();
            
$this->sorter $maxSorter 1;

            if (
$this->obj_type_id == 0) {
                
$this->obj_type_id Yii::app()->db->createCommand('SELECT MIN(id) FROM {{apartment_obj_type}}')->queryScalar();
            }
        }

        if (!
isFree()) {
            
$defaultCurrencyCharCode Currency::getDefaultCurrencyModel()->char_code;

            if (
$defaultCurrencyCharCode != $this->in_currency) {

                
$this->price = (int)Currency::convert($this->price$this->in_currency$defaultCurrencyCharCode);

                if (isset(
$this->price_to) && $this->price_to) {
                    
$this->price_to = (int)Currency::convert($this->price_to$this->in_currency$defaultCurrencyCharCode);
                }
            }
        }

        switch (
$this->type) {
            case 
self::TYPE_SALE:
                
$this->price_type self::PRICE_SALE;
                break;

            case 
self::TYPE_BUY:
                
$this->price_type self::PRICE_BUY;
                break;

            case 
self::TYPE_RENTING:
                
$this->price_type self::PRICE_RENTING;
                break;

            case 
self::TYPE_CHANGE:
                
$this->price_type self::PRICE_CHANGE;
                break;
        }

        if (isset(
$_POST['set_period_activity']) && $_POST['set_period_activity'] == && $this->period_activity) {
            
$list self::getPeriodActivityList();
            if (isset(
$list[$this->period_activity])) {
                if (
$this->period_activity == 'always') {
                    
$this->activity_always 1;
                } else {
                    
$this->date_end_activity date('Y-m-d'strtotime($this->period_activitytime()));
                    
$this->activity_always 0;
                }
            }
        }

        return 
parent::beforeSave();
    }
 
andipas
Web Developer
Web Developer
 
Posts: 156
Joined: 28 Dec 2011, 22:37
Reputation point: 1

Return to Issues

Who is online

Users browsing this forum: No registered users and 15 guests

cron