Advertisement:

Author Topic: Boxer theme similar listings [SOLVED]  (Read 1201 times)

arcsales

  • Full Member
  • ***
  • Posts: 192
Boxer theme similar listings [SOLVED]
« on: September 11, 2016, 05:52:26 pm »
Good day,
I have boxer theme but i want to change the number of similar ads shown at item page.
The standard is 3 similar ads but i want them 4.
I did look at all theme files for related functions and did made some changes without any success. I started wondering if this is a standard osclass feature and i actually need to look at osclass files for that function.

« Last Edit: September 13, 2016, 05:56:12 pm by arcsales »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Boxer theme similar listings
« Reply #1 on: September 11, 2016, 05:59:43 pm »
Hi,

No, it's in functions.php, look for function related_listings() { and change there all the "3".

Regards

arcsales

  • Full Member
  • ***
  • Posts: 192
Re: Boxer theme similar listings
« Reply #2 on: September 11, 2016, 06:04:01 pm »
I did that but nothing changed.
Here is the function code.

Code: [Select]
    if( !function_exists('related_listings') ) {
        function related_listings() {
            View::newInstance()->_exportVariableToView('items', array());

            $mSearch = new Search();
            $mSearch->addCategory(osc_item_category_id());
            $mSearch->addRegion(osc_item_region());
            $mSearch->addItemConditions(sprintf("%st_item.pk_i_id < %s ", DB_TABLE_PREFIX, osc_item_id()));
            $mSearch->limit('0', '4');

            $aItems      = $mSearch->doSearch();
            $iTotalItems = count($aItems);
            if( $iTotalItems == 4 ) {
                View::newInstance()->_exportVariableToView('items', $aItems);
                return $iTotalItems;
            }
            unset($mSearch);

            $mSearch = new Search();
            $mSearch->addCategory(osc_item_category_id());
            $mSearch->addItemConditions(sprintf("%st_item.pk_i_id != %s ", DB_TABLE_PREFIX, osc_item_id()));
            $mSearch->limit('0', '4');

            $aItems = $mSearch->doSearch();
            $iTotalItems = count($aItems);
            if( $iTotalItems > 0 ) {
                View::newInstance()->_exportVariableToView('items', $aItems);
                return $iTotalItems;
            }
            unset($mSearch);

            return 0;
        }
    }

That is why i was thinking that may be there is other function related to this one and is messing the things up.

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Boxer theme similar listings
« Reply #3 on: September 11, 2016, 06:21:19 pm »
Oh, that's because that function only takes care of database queries, the real layout is generated in boxer/related-items.php script. You'd need to make it 4 columns if you want 4 ads or add a new row of ads if you want more.

Regards

arcsales

  • Full Member
  • ***
  • Posts: 192
Re: Boxer theme similar listings
« Reply #4 on: September 11, 2016, 06:38:51 pm »
I am not really sure how to add more columns since i see no columns there. There 3 type of ads posted and forming algorithm.
Here is the full code from related_items.php
Code: [Select]
<?php if( osc_count_items() > ) { ?>
       
<div class="row listing-grid">
<?php
$i 0;

if($type == 'latestItems'){
while ( osc_has_latest_items() ) {
$class '';
if($i%== 0){
$class 'first';
}
boxer_draw_item($class);
$i++;
}
} elseif($type == 'premiums'){
while ( osc_has_premiums() ) {
$class '';
if($i%== 0){
$class 'first';
}
boxer_draw_item($class,false,true);
$i++;
if($i == 4){
break;
}
}
} else {
while(osc_has_items()) {
$i++;
$class false;
if($i%== 0){
$class 'last';
}
$admin false;
if(View::newInstance()->_exists("listAdmin")){
$admin true;
}

boxer_draw_item($class,$admin);
  }
}
?>

</div>             

        <?php ?>

Any ideas?

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Boxer theme similar listings
« Reply #5 on: September 11, 2016, 06:56:39 pm »
Probably you'll need to adjust your styles, look in your style.css for

.listing-grid .item-block {
    width: 25%;
}

(Although at first glance it appears ready to accomodate 4 ads ???)

arcsales

  • Full Member
  • ***
  • Posts: 192
Re: Boxer theme similar listings
« Reply #6 on: September 11, 2016, 07:08:06 pm »
I did try that too...I made it 20% to test if for some reason the 4th ad is not appearing because of the styles. No success.
That is why i started thinking that there is an other function defined which is overwriting the one in theme functions.

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Boxer theme similar listings
« Reply #7 on: September 11, 2016, 07:15:00 pm »
I don't think so... Are we talking about the site pr*****.se? Are these modifications already in place?

arcsales

  • Full Member
  • ***
  • Posts: 192
Re: Boxer theme similar listings
« Reply #8 on: September 11, 2016, 07:22:39 pm »
Yes it is the same website.
The modifications are done except of the 20% width because it reflect the ads appearing on search page too but I can assure you that i did made tests with different width with no different result.

It is very strange.

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Boxer theme similar listings
« Reply #9 on: September 11, 2016, 07:55:41 pm »
Sorry, I don't know what's happening to you, in my Boxer theme just changing the function related_ads (with no modification of related_ads.php), a second row of ads (with the 4th result) appears there... ???

Regards


arcsales

  • Full Member
  • ***
  • Posts: 192
Re: Boxer theme similar listings
« Reply #10 on: September 11, 2016, 08:48:10 pm »
Of course yours will be working and mine not. I did not expect anything else different :D

I have a testing website for theme and there is also working which means there is something else involved that is messing up the count of related listings. What it could be related to that?

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Boxer theme similar listings
« Reply #11 on: September 11, 2016, 09:21:54 pm »
My guess is as good as yours... :D

Use WinMerge to compare Boxer theme in both installations. Whatever difference you find on related scripts or .css might lead you to the solution.

Regards

arcsales

  • Full Member
  • ***
  • Posts: 192
Re: Boxer theme similar listings
« Reply #12 on: September 11, 2016, 09:30:53 pm »
Thanks for the program. So far I was using http://diffchecker.com but this is better.
Will post the solution if i find it... Thanks Teseo

arcsales

  • Full Member
  • ***
  • Posts: 192
Re: Boxer theme similar listings
« Reply #13 on: September 13, 2016, 05:55:48 pm »
My programmer have found the problem.
I am using simple item moderation plugin and at the plugin's index.php there is the same function related_listings that is loading before the one in my functions.php and that is why the related ads count was not changing so after changing the values at plugin index.php it all works perfectly.

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Boxer theme similar listings [SOLVED]
« Reply #14 on: September 13, 2016, 08:41:19 pm »
Custom functions names should have a unique prefix [i.e.  sim_related_ads(), boxer_related_ads()], it's not enough to check for the existence of the function, as you can see in this case.

You should contact both developers and tell them about your issue.

Regards