saman0 / flexicontent

Automatically exported from code.google.com/p/flexicontent
0 stars 0 forks source link

SEF creating code adds id and cid segments always, even when a menu item exists #334

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Normally if menu item exists that points to a FLEXIcontent item or category, 
then SEF link should not include segments with category and/or item ids

Original issue reported on code.google.com by ggp...@gmail.com on 14 Jan 2012 at 7:55

GoogleCodeExporter commented 9 years ago
There is a bug in components/com_flexicontetn/router.php which is responsible 
for this behaviour.
The Itemid in the menu is called just id and thus doesn't match the field 
query['Itemid']. The parameters Itemid and option must not be removed from the
$query array.
After i changed line 40 to 61 of the code to the following it worked again :

    // 2. Try to match the variables against the variables of the menuItem
    $menuItem_matches = true;
    foreach($query as $index => $value) {
        if($index!='Itemid'){
            if (!isset($menuItem->query[$index])) {
                $menuItem_matches = false;
                break;
            }
            if ($query[$index] != $menuItem->query[$index]) {
                $menuItem_matches = false;
                break;
            }
            $query_backup[$index] = $value;
        }   
    }
    if ($menuItem_matches) {
        foreach($query as $index => $value)
            if($index!='option' && $index!='Itemid'){
                unset($query[$index]);
            }   
        return $segments;  // $segments is empty we will get variables from menuItem (it has them)
    }

Original comment by lis...@hueper.de on 2 Apr 2012 at 5:54

GoogleCodeExporter commented 9 years ago
I just tried that - and it didn't change it still adds the code afterwards. 

I am using Joomla 2.5.3 and the newest flexicontent. What could it be? 

Original comment by he...@iamrobert.com on 3 Apr 2012 at 11:51

Attachments:

GoogleCodeExporter commented 9 years ago
Actually - it works for menu items only - however when you choose flexicontent 
items 
(even those that are on the menu) - it adds the itemid...

Original comment by he...@iamrobert.com on 5 Apr 2012 at 5:01

GoogleCodeExporter commented 9 years ago
Fixed the matching of menu item in r1307

but please note that if you have an joomla menu item pointing to a FLEXIcontent 
Item, the menu item will match only if the link to the item is through the SAME 
FLEXIcontent category as the menu item.

The issue is remains open because more work needs to be done, on partial 
matches, e.g. a links to category views with extra variables in the URL

Original comment by ggp...@gmail.com on 15 May 2012 at 8:31