Osclass forums

Development => Plugins => Topic started by: TechGuy23 on June 16, 2013, 05:23:52 pm

Title: Premium Ads Show Duplicate
Post by: TechGuy23 on June 16, 2013, 05:23:52 pm
What a wonderful Premium Ad service. Im using it with my paypal email address only as standard as im not sure how to set the rest up for API. This is not a current issue. The issue is when someone posts a premium Ad it shows Duplicate in Carousel for Osclass. I am not sure where the problem is and i was hoping someone could iddue a quick and easy fix. I know there is a spam plugin but i dont want to use that yet. I would rather get a quick fix issued.

Also the Make Ad Premium button on item.php i believe anyone can make it premium and im not sure how to fix this.

Title: Re: Premium Ads Show Duplicate
Post by: rcraig12 on August 02, 2013, 05:00:56 pm
I had the same problem. A little investigation found that the file search_list.php is the culprit!

Look for the code that reads:

<?php while ( osc_has_items() ) { ?> then directly under it insert the following code : <?php if(!osc_item_is_premium()) { ?>

Farther down the file you will come across:

    <?php } ?>
<?php } ?>

insert another set of tags the same and you will be done! It will look like this :

    <?php } ?>
    <?php } ?>
<?php } ?>

thats all there is to it really. No more duplicate content :)

Title: Re: Premium Ads Show Duplicate
Post by: creat15 on August 29, 2013, 11:25:47 am
I had the same problem. A little investigation found that the file search_list.php is the culprit!

Look for the code that reads:

<?php while ( osc_has_items() ) { ?> then directly under it insert the following code : <?php if(!osc_item_is_premium()) { ?>

Farther down the file you will come across:

    <?php } ?>
<?php } ?>

insert another set of tags the same and you will be done! It will look like this :

    <?php } ?>
    <?php } ?>
<?php } ?>

thats all there is to it really. No more duplicate content :)

hi thank's for tutorial

this is works  ;D
Title: Re: Premium Ads Show Duplicate
Post by: scoodek on December 30, 2013, 12:49:42 am
 :) thanks for this, works a treat!
Title: Re: Premium Ads Show Duplicate
Post by: frosticek on December 30, 2013, 01:04:02 am
@TechisTheme Creations
Actually it is not bug.
Suppose we have following listings:
list 1 - premium
list 2 - regular
list 3 - premium
list 4 - regular

There will be 2 loops using arrays: osc_has_items() and osc_has_premiums()
Means you will have in final list:
loop 1 (premium loop): list 1, list 3
loop 2 (regular loop): list 1, list 2, list 3, list 4

Why?
Because even list 1 and list 3 are premiums, they are still also considered as regular  :)
Title: Re: Premium Ads Show Duplicate
Post by: Adyyda on December 08, 2015, 08:25:47 pm
Because even list 1 and list 3 are premiums, they are still also considered as regular  :)

Hello. Do you know how to hide the standard ads that are marked as premium ads? I do not like duplicated ads. Thanks
Title: Re: Premium Ads Show Duplicate
Post by: teseo on December 08, 2015, 09:20:50 pm
Hi,

Do you mean Premiums that are already being shown in the same page, or it's just that you want to totally exclude any Premium in the "normal" list? ???

Regards
Title: Re: Premium Ads Show Duplicate
Post by: Adyyda on December 08, 2015, 09:28:55 pm
If a ad is marked as premium, do not show it olso as standard in the whole website.
Title: Re: Premium Ads Show Duplicate
Post by: teseo on December 09, 2015, 12:36:31 am
Hm... What I can do is to provide code to hide them only on search lists, they might still appear on Latest Ads and some special modules... ???

Add this at the very bottom of your theme functions.php:
Notes:
1.- Take care not to leave blank lines after this.
2.- If your theme functions.php doesn't end with ?> skip first line of my code.

Code: [Select]
<?php
function cust_exclude_premiums_from_list() {
    
Search::newInstance()->addConditions('b_premium = 0');
}

osc_add_hook('search_conditions''cust_exclude_premiums_from_list');
?>


Regards
Title: Re: Premium Ads Show Duplicate
Post by: WORLDSERVED on October 08, 2018, 05:04:45 pm
hi Teseo any idea to apply the function to latest items. because latest items if the default list on the homepage and it will be nice if we can avoid the repeat as you have done with search pages.
Thank you