Osclass forums

Support forums => General help => 3.6.x => Topic started by: SmaRTeY on August 22, 2016, 12:26:09 am

Title: Possible Footer links URL fix
Post by: SmaRTeY on August 22, 2016, 12:26:09 am
Hi there,

Using Osclass 3.6.1 I found that my footer links on search page (bottom) were showing interesting links which were referring to an url that was just part of the link shown. Some investigation lead to the following fix, works for me so far but nevertheless if you use it for your own system/theme make sure you keep your old code backed up since this is a *core* fix/change that will be overwritten when upgrading Osclass to a new version. That said, here's the change that makes my footerlinks work correctly:

File: oc-includes/osclass/functions.php
Funtion: osc_footer_link_url

Code: [Select]
function osc_footer_link_url($f = null) {
    if($f==null) {
        if(View::newInstance()->_exists('footer_link')) {
            $f = View::newInstance()->_get('footer_link');
        } else {
            return '';
        }
    } else {
        View::newInstance()->_exportVariableToView('footer_link', $f);
    }
    $params = array();
    $tmp = osc_search_category_id();
    //21-08-2016 FIX by SmaRTeY, categories in footer link were missed using "!empty($tmp)"
    if(isset($tmp)) {
        $params['sCategory'] = $f['fk_i_category_id'];
    }

    if( osc_search_region() == '' ) {
        $params['sRegion'] = $f['fk_i_region_id'];
    } else {
        $params['sCity'] = $f['fk_i_city_id'];
    }

    return osc_search_url($params);
}

Hope it helps others, use at own risk and do not forget to keep track of this change with regard to future Osclass updates!


Regards,
Eric
Title: Re: Possible Footer links URL fix
Post by: portatil33 on February 17, 2017, 05:00:03 pm
Great!  Now works !!  ;)
Is not "posible .....  It´s the FIX !!!

 :D

http://www.buscadisimo.com/anuncios (http://www.buscadisimo.com/anuncios)
Title: Re: Possible Footer links URL fix
Post by: SmaRTeY on March 01, 2017, 11:42:20 am
Nice to hear you like the fix :D

Regards,
Eric
Title: Re: Possible Footer links URL fix
Post by: SmaRTeY on June 29, 2017, 01:20:17 am
In addition to this fix I created earlier, those who are using the Teseo category translation fix (https://forums.osclass.org/modern/categories-translation/msg116959/#msg116959) or most likely also Liath fix (https://forums.osclass.org/general-help/category-header-does-not-change-when-translated/msg149606/#msg149606), you need to add another parameter to the footerlinks function for further improvement of this function.

In my fixed function add the following code before the return statement:
Code: [Select]
    $params['locale']= $f['fk_c_country_code'];

Without this parameter the footerlink can be wrong, not Always but I encountered an issue so here's the fix in case you are using the category translation fix as well. I *think* it makes perfect sense to have this parameter added anyways when translation of categories is working in Osclass core. 8)

- EDIT -
I just tested the category translation fix with a bit faster sql code from Liath and it also works with this fix. So in short, adding the parameter will mean your footerlinks will Always show the correct ad(s).