Osclass Support Forums

Osclass theme support => Ideas, improvements and tips => Topic started by: quickregister on December 03, 2019, 10:17:44 PM

Title: Increasing the number of Premium ads showing on the home page and category page
Post by: quickregister on December 03, 2019, 10:17:44 PM
Hi,

I found this solution off the old osclass.org forum using the Way Back Machine. It helped me so I though I would post it here for my own future reference as well as others.

Here is what I did to change the number of Premium ads showing on the home page of my site:


##display show 6 premium ads##

1. On main.php beneath this code:

<?php osc_current_web_theme_path('header.php') ; ?>

insert this code:

<?php
$i = 0;
osc_get_premiums(6);
if(osc_count_premiums() > 0) {
echo '<h5>'.__('premium','bender').'</h5>';
View::newInstance()->_exportVariableToView("listType", 'premiums');
View::newInstance()->_exportVariableToView("listClass",$listClass.' premium-list');
osc_current_web_theme_path('loop.php');
echo '<div style="clear:both;"></div><br/>';
}
?>

Where it says  osc_get_premiums(6);
Put the number of Premium ads you want to display.
If you want to display 9 Premium ads change this code to:
osc_get_premiums(9);

2.  loop.php

find code

elseif($type == 'premiums'){
while ( osc_has_premiums() ) {
$class = '';
if($i%3 == 0){
$class = 'first';
}
bender_draw_item($class,false,true);
$i++;
if($i == 3){
break;
}

change >>>>>if($i == 3) to>>>  if($i == 9)
or to whatever number of ads you want to appear.


To change the number of Premium ads showing in the specific categories I did this:

In search.php
Located in /oc-content/bender/search.php

I found where it said:

osc_get_premiums();

and put

osc_get_premiums(9);

So that 9 premium ads were displayed above my specific categories.

It seemed to work for me but if somebody who knows more wants to clarify
that would be fine.

Thank you for keeping this forum up.

Title: Re: Increasing the number of Premium ads showing on the home page and category page
Post by: Anthony Marshall on February 14, 2021, 12:21:22 AM
Thank you!



Hi,

I found this solution off the old osclass.org forum using the Way Back Machine. It helped me so I though I would post it here for my own future reference as well as others.

Here is what I did to change the number of Premium ads showing on the home page of my site:


##display show 6 premium ads##

1. On main.php beneath this code:

<?php osc_current_web_theme_path('header.php') ; ?>

insert this code:

<?php
$i = 0;
osc_get_premiums(6);
if(osc_count_premiums() > 0) {
echo '<h5>'.__('premium','bender').'</h5>';
View::newInstance()->_exportVariableToView("listType", 'premiums');
View::newInstance()->_exportVariableToView("listClass",$listClass.' premium-list');
osc_current_web_theme_path('loop.php');
echo '<div style="clear:both;"></div><br/>';
}
?>

Where it says  osc_get_premiums(6);
Put the number of Premium ads you want to display.
If you want to display 9 Premium ads change this code to:
osc_get_premiums(9);

2.  loop.php

find code

elseif($type == 'premiums'){
while ( osc_has_premiums() ) {
$class = '';
if($i%3 == 0){
$class = 'first';
}
bender_draw_item($class,false,true);
$i++;
if($i == 3){
break;
}

change >>>>>if($i == 3) to>>>  if($i == 9)
or to whatever number of ads you want to appear.


To change the number of Premium ads showing in the specific categories I did this:

In search.php
Located in /oc-content/bender/search.php

I found where it said:

osc_get_premiums();

and put

osc_get_premiums(9);

So that 9 premium ads were displayed above my specific categories.

It seemed to work for me but if somebody who knows more wants to clarify
that would be fine.

Thank you for keeping this forum up.