Advertisement:

Author Topic: Possible Footer links URL fix  (Read 1737 times)

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Possible Footer links URL fix
« 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
« Last Edit: August 29, 2016, 01:47:54 am by SmaRTeY »

portatil33

  • Newbie
  • *
  • Posts: 12
Re: Possible Footer links URL fix
« Reply #1 on: February 17, 2017, 05:00:03 pm »
Great!  Now works !!  ;)
Is not "posible .....  It´s the FIX !!!

 :D

http://www.buscadisimo.com/anuncios

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: Possible Footer links URL fix
« Reply #2 on: March 01, 2017, 11:42:20 am »
Nice to hear you like the fix :D

Regards,
Eric

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: Possible Footer links URL fix
« Reply #3 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 or most likely also Liath fix, 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).

« Last Edit: June 29, 2017, 02:00:45 am by SmaRTeY »