Osclass forums

Support forums => Installation / Update help => Topic started by: Abdurauf on December 05, 2011, 03:59:55 pm

Title: [ SOLVED ] One ad shows a double
Post by: Abdurauf on December 05, 2011, 03:59:55 pm
One ad shows a double
What problem?
(http://forums.osclass.org/index.php?action=dlattach;topic=5287.0;attach=2241)
Title: Re: One ad shows a double
Post by: _CONEJO on December 05, 2011, 05:48:03 pm
Hi, which version of OSClass are you using ?
Title: Re: One ad shows a double
Post by: Abdurauf on December 05, 2011, 07:38:07 pm
Hi, which version of OSClass are you using ?
Hi. Last version. OsClass 2.3.1
Title: Re: One ad shows a double
Post by: bilekas on December 06, 2011, 05:48:05 pm
You have not closed the php correctly for the if premium..

Close this if statement before the even is ++ ! This is what i would suspect!
Title: Re: One ad shows a double
Post by: akapar on December 08, 2011, 11:48:59 am
I also have same issue. All ads on main page appear twice. I think this should be related to some issues with main.php. I would appreciate urgent help on this. Check 05suq.com (http://05suq.com) to see the issue.

Regards, akapar...
Title: Re: One ad shows a double
Post by: _CONEJO on December 09, 2011, 11:01:52 am
I could only see Arabic, but ... do you have any other language installed ? Even if it's disable , we're trying to reproduce this issue
Title: Re: One ad shows a double
Post by: akapar on December 09, 2011, 11:53:25 am
website is only Arabic, i have both English and Arabic enabled at Admin panel. I tried also making admin panel only Arabic but it doesn't solve the issue. Attached is my main.php file, same as latest version except a small modification to hide sub-categories which was suggested by Juan Ramon at http://forums.osclass.org/index.php/topic,574.0.html (http://forums.osclass.org/index.php/topic,574.0.html)

Title: Re: One ad shows a double
Post by: Juan Ramón on December 09, 2011, 06:58:31 pm
@akapar: If you give me access to your DB and FTP via PM I can try to figure out what's happening.
Title: Re: One ad shows a double
Post by: arabasatis on December 09, 2011, 10:09:49 pm
I have the same issue.

When I tried whats happening behind scenes I figured that :

in /oc-includes/osclass/model/Search.php, around line 660 , there is a query like that :

Code: [Select]
$this->sql = sprintf("SELECT  %st_item.*, %st_item_location.*, cd.s_name as s_category_name %s FROM %st_item, %st_item_location, %st_category, %st_category_description .....
which returns items as multiplied by language count:  eg. one description from english, one from german.

I will try to solve in time but just wanted give a hint.
Title: Re: One ad shows a double
Post by: akapar on December 10, 2011, 06:06:55 pm
Hi arabasatis,

I think you are on the right track. My website has category descriptions maintained both in English and Arabic. Please let us know if you find a solution for the issue.

Regards.

05suq.com (http://05suq.com)
Title: Re: One ad shows a double
Post by: Abdurauf on December 11, 2011, 02:10:39 pm
osc_count_latest_items() value gives twice as much.
Cod
(http://forums.osclass.org/index.php?action=dlattach;topic=5287.0;attach=2317;image)
Site
(http://forums.osclass.org/index.php?action=dlattach;topic=5287.0;attach=2319;image)


Title: Re: One ad shows a double
Post by: arabasatis on December 11, 2011, 08:35:45 pm
Here is my solution:

in /oc-includes/osclass/model/Search.php, around line 660 (the line that I mentioned in my previous post)

change the query lline as below:
Code: [Select]
$this->sql = sprintf("SELECT  %st_item.*, %st_item_location.*, cd.s_name as s_category_name %s FROM %st_item, %st_item_location, %st_category, %st_category_description as cd WHERE %st_item_location.fk_i_item_id = %st_item.pk_i_id %s AND %st_item.fk_i_category_id = cd.fk_i_category_id and cd.fk_c_locale_code = '%s' ORDER BY %s %s LIMIT %d, %d", DB_TABLE_PREFIX, DB_TABLE_PREFIX, $extraFields,DB_TABLE_PREFIX, DB_TABLE_PREFIX, DB_TABLE_PREFIX ,DB_TABLE_PREFIX, DB_TABLE_PREFIX, DB_TABLE_PREFIX, $conditionsSQL, DB_TABLE_PREFIX, osc_language(), $this->order_column, $this->order_direction, $this->limit_init, $this->results_per_page);

here, we are just adding a "AND cd.fk_c_locale_code = '%s'" condition just before "ORDER BY" and we are giving osc_language() as sprintf format parameter.
Title: Re: One ad shows a double
Post by: _CONEJO on December 12, 2011, 07:55:44 am
Try using this file instead of oc-includes/osclass/model/Search.php
Download from here --> https://raw.github.com/osclass/OSClass/develop/oc-includes/osclass/model/Search.php
Title: Re: One ad shows a double
Post by: akapar on December 12, 2011, 08:19:54 am
Conejo, arabasatis,

Unfortunately both of the recommendations do not solve the issue, my website still shows double ads on main page.
Title: Re: One ad shows a double
Post by: trains58554 on December 12, 2011, 08:26:58 am
Hi akapar,

Are the ads that are showing more than once marked as premium?

Jay
Title: Re: One ad shows a double
Post by: akapar on December 12, 2011, 08:29:11 am
Apologies for my mistake, arasatis's code solved the issue. Sorry for the mistake in my previous post.

Regards,

akapar
Title: Re: One ad shows a double
Post by: trains58554 on December 12, 2011, 08:30:53 am
That is great news.

Jay
Title: Re: One ad shows a double
Post by: Juan Ramón on December 13, 2011, 03:01:59 pm
Moreover, it's fixed in 2.3.2 too. Sorry for the problems.
Title: Re: [ SOLVED ] One ad shows a double
Post by: Alexandr on December 13, 2011, 03:38:17 pm
Hi. If the ad is doing paid it appears 2 times. So should it be?

PS Why does not see the admin IP, and can not hang a ban (blocking)
Title: Re: [ SOLVED ] One ad shows a double
Post by: Juan Ramón on December 13, 2011, 05:21:43 pm
This is the normal behavior of the premium and organics ads. If you have only a few ads, you may get the same premium ad in the organic results.