Errors of the version 1.36.2

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.

Errors of the version 1.36.2

Postby support » 26 Oct 2022, 12:27

Errors of the version 1.36.2
Last edited by support on 30 Mar 2023, 10:09, edited 1 time in total.
support
Citizen
Citizen
 
Posts: 136
Joined: 28 Dec 2011, 13:14
Reputation point: 0

Re: Errors of the version 1.36.2

Postby Zach2k » 22 Nov 2022, 11:12

Greetings Monoray team,

I would like to report a bug in the advertisement module: (I have purchased a pro license)

if you have 2 or more ads (same position or different) the views counter updates on the latest ad ONLY, so if you have 3 ads on the same page and every-time you refresh only 1 ad will get more views.

I tested this on your demo and the same results, once you add the 2nd add, the 1st one stop updating views.
would you kindly post a fix.

Thank you
Attachments
Screen Shot 2022-11-222 at 2.57.13 AM.jpg
screenshot from your demo
Screen Shot 2022-11-222 at 2.57.13 AM.jpg (137.72 KiB) Viewed 29715 times
Zach2k
Stranger
 
Posts: 18
Joined: 07 Aug 2020, 19:02
Reputation point: 2

Re: Errors of the version 1.36.2

Postby andipas » 06 Feb 2023, 11:12

Zach2k wrote:Greetings Monoray team,

I would like to report a bug in the advertisement module: (I have purchased a pro license)

if you have 2 or more ads (same position or different) the views counter updates on the latest ad ONLY, so if you have 3 ads on the same page and every-time you refresh only 1 ad will get more views.

I tested this on your demo and the same results, once you add the 2nd add, the 1st one stop updating views.
would you kindly post a fix.

Thank you


Hello. Sorry for the long wait for a response. Thanks for finding the error.
To correct the error in the file protected/modules/advertising/models/Advert.php


Code: Select all

        
if ($content && is_array($content)) {
            
$this->publishAssets();

            
$pos1 $pos2 $pos3 $pos4 $pos5 $pos6 = array();
            foreach (
$content as $key => $item) {
                if (
$item['position'] == 'pos1') {
                    
$pos1[] = $item;
                }
                if (
$item['position'] == 'pos2') {
                    
$pos2[] = $item;
                }
                if (
$item['position'] == 'pos3') {
                    
$pos3[] = $item;
                }
                if (
$item['position'] == 'pos4') {
                    
$pos4[] = $item;
                }
                if (
$item['position'] == 'pos5') {
                    
$pos5[] = $item;
                }
                if (
$item['position'] == 'pos6') {
                    
$pos6[] = $item;
                }
            }
            
Yii::app()->controller->advertPos1 $pos1;
            
Yii::app()->controller->advertPos2 $pos2;
            
Yii::app()->controller->advertPos3 $pos3;
            
Yii::app()->controller->advertPos4 $pos4;
            
Yii::app()->controller->advertPos5 $pos5;
            
Yii::app()->controller->advertPos6 $pos6;

            
// set count
            
if ((int)$item['id']) {
                
Advert::model()->updateCounters(
                    array(
'views' => 1), "id = :id", array(':id' => (int)$item['id'])
                );
            }

            unset(
$pos1$pos2$pos3$pos4$pos5$pos6);
 


change to
Code: Select all

            $ids 
= [];
            
$pos1 $pos2 $pos3 $pos4 $pos5 $pos6 = array();
            foreach (
$content as $key => $item) {
                if (
$item['position'] == 'pos1') {
                    
$pos1[] = $item;
                }
                if (
$item['position'] == 'pos2') {
                    
$pos2[] = $item;
                }
                if (
$item['position'] == 'pos3') {
                    
$pos3[] = $item;
                }
                if (
$item['position'] == 'pos4') {
                    
$pos4[] = $item;
                }
                if (
$item['position'] == 'pos5') {
                    
$pos5[] = $item;
                }
                if (
$item['position'] == 'pos6') {
                    
$pos6[] = $item;
                }

                
$ids[] = $item['id'];
            }
            
Yii::app()->controller->advertPos1 $pos1;
            
Yii::app()->controller->advertPos2 $pos2;
            
Yii::app()->controller->advertPos3 $pos3;
            
Yii::app()->controller->advertPos4 $pos4;
            
Yii::app()->controller->advertPos5 $pos5;
            
Yii::app()->controller->advertPos6 $pos6;

            
// set count
            
if ($ids) {
                
$criteria = new CDbCriteria();
                
$criteria->compare('id'$ids);
                
Advert::model()->updateCounters(
                    array(
'views' => 1), $criteria
                
);
            }
 
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 1 guest

cron