Guest
17 Jul 2014 11:40

Hi,

i have this url to filter the records by a specific field. ex: filter about city

/site/index.php/list-cobalt?task=records.filter&filter_name[0]=filter_4&filter_val[0]=toronto&section_id=1

This link leads to the all result page with records of toronto.

But i want create a specific url for any city.

ex: /site/index.php/list-cobalt/toronto

How can do this?

Last Modified: 28 Jul 2014


pepperstreet VIP
Total posts: 3,837
17 Jul 2014 13:59

Where do you want to use and display those links? As Joomla menu items? An auto-generated link list in a module or content?


Guest
17 Jul 2014 20:30

Hi,

I want to consider all the possibilities. I want to make this url becouse i want to indexing it on google.

It's possible? Must i create an menu item or modifying the source code?


pepperstreet VIP
Total posts: 3,837
17 Jul 2014 22:38

Guest Must i create an menu item or modifying the source code?

Please, have a look in the respective documentation:

At least, that should be the usual J! way... it also allows to get a pretty SEF URL.


Apart from that... it might be possible to submit and promote such a direct filter link in Google-Webmaster account!? I am no specialist in that topic ;)


Guest
18 Jul 2014 11:28

Hi,

very interesting articles. This guides can help me but i want create a specific url for this field 'city'.

It think that it doesn't create problem for the velocity of site or bad url for Google.

Must i modify the file main_router.php?


pepperstreet VIP
Total posts: 3,837
18 Jul 2014 15:59

Guest Must i modify the file main_router.php?

Actually, no. Only if you are not satisfied with the default SEF version of your link.

Apart from modifying the router file, you may also add a 3rd-party extension like MijoSEF. If performance is not a criteria for your site, an easy way to modify the SEF URL. Headsup: This would add additional database queries.

I think Google & Co doesn't really care about how it looks... it just has to be indexed and avilable. Plus the usual SEO work i.e. content structure, titles, meta-data etc.


Guest
19 Jul 2014 11:33

Hi,

yes i know the seo method to have a good index of site.

But i have post this question becouse when i use this link 'travel/?task=records.filter&filter_name[0]=filter_1&filter_val[0]=toronto&section_id=1' the site go to 'travel/items/ect' and the page show the filter results. But this url 'travel/items/ect' is the same for any city that i choose to filter.

So i can't index it to Google. This is the reason for my question about change the url for any city o another field value.

I don't know the solution to do this.


pepperstreet VIP
Total posts: 3,837
19 Jul 2014 14:57

Ah, now I got your real issue. I was lost in translation, and your last comment clears things up a lot.

  • Did you try to index the none-SEF URL? They are all different. (Sorry, don't know the current Webmaster UI and options)
  • Bummer: The external URL MenuItem type does NOT provide an "URL Alias" parameter! I guess, that is the main problem. In older J!1.5 it was possible to edit the Alias. I have read, in J!3 it is actually stored in the respective DB table, but not editable, nor displayed by this menuItem type.

Some Ideas:

  • Bummer: MenuItems of type "Alias" cannot point to an External-URL menuItem. Causes 404 error.
  • Create another J! article menuItem! Enter YOUR ALIAS URL there... save it. THEN change the MenuItem type to external-URL and Coablt link. Maybe it keeps the Alias for you?!
  • Alternative to previous idea: Edit and change MenuItem ALIAS in database!? (Not sure if this Alias is used. Maybe Cobalt SEF URL has the priority?)

  • Custom Cobalt Router? (maybe @Sergey can give some advice here)

  • Consider to use a 3rd-Party extension to modify SEF URLs to your liking.

Guest
21 Jul 2014 12:50

Hi,

thanks for your ideas.

I think that i try to resolve the problem with an Jarticle. In the article i can link the page of cobalt filter result with 'componentanywhere'. I don't know if it works so i must test it.

Another solution is a modification to the source code of joomla to insert 'alias' to external url menu item, but i don't know if it is possibile. I must do a question to Joomla developers.

If somebody has some idea or solution to the problem please write here.

Thanks luca


Guest
21 Jul 2014 12:52

How can i ask @sergey some instruction to modifying the colbat router for this problem?


Guest
22 Jul 2014 10:23

I try with an 'alias' for a joomla menu item 'external url' don't work, i have an 404 error.

Componentanywhere doesn't work becouse the url result invalid.

If i don't find a solution, i think that Cobalt is not the extension that i search for my project. Sorry.


Sergey
Total posts: 13,748
22 Jul 2014 11:32

You can open com_cobalt/routers/main_riouter.php. Copy it and modify as you want. It is not something we invented. This is standart Joomla router.

http://docs.joomla.org/Supporting_SEF_URLs_in_your_component


Guest
22 Jul 2014 12:31

ok thanks for the guide!

I will study the router od Joomla.

I have seen in main_router on line 355 case JText::_('SEF_ITEMS'): $vars['view'] = 'records'; $vars['section_id'] = '1';

I have insert $vars['filter_1'] = 'TORONTO';

But it doesn't work. Can i find the solution of my problem with similar code of this?


Sergey
Total posts: 13,748
23 Jul 2014 01:43

There is no filter_1 parameter in URL that cobalt may understand. Please read Create pre-filtered links article link provided by papperstreet.

This is main idea. You create URL

/menu-alias-to-cobalt/filter/params

In router now add

case 'filter':
    $vars['task'] = 'records.filter';
    $vars['filter_name'][] = 'sdfsdfsdfsdfsdfsdfsdfsdf';
    $vars['filter_val'][] = end($segment);
break;

Just set filter variables acording to documentation.


Sergey
Total posts: 13,748
23 Jul 2014 12:48

Hi,

i have insert your code in the CobaltBuildRoute function

function CobaltBuildRoute(&$query)
{
// ect

case 'filter':
    $vars['task'] = 'records.filter';
    $vars['filter_name'][] = 'filter_1';
    $vars['filter_val'][] = end($segment);
    // $segments[] = urlencode(JText::_('SEF_FILTER'));
break;

//ect
}

I have set up SEF_FILTER = "filter".

Then in CobaltParseRoute function (line 356) i have insert

switch(urldecode(str_replace(':', '-', $segments[0])))
{
    case JText::_('SEF_FILTER'):
        $vars['view']       = 'records';
        $vars['section_id'] = $filter->clean($segments[1], 'INT');

        $vars['filter_name'][] = 'filter_1';
         $vars['filter_val'][] = 'city';
    break;
}

I have a problem.

My link section-content/?task=records.filter&filter_name[0]=filter_1&filter_val[0]=namecity&section_id=1 go to section-content/items/ID-alias-section, so the filter doesn't go to page section-content/filter/ID-alias-section.

If i write this link manually it works. The next problem is to insert the name of city in the url.

To solve my problem i have think this solution.

I set up all of SEF FILTER PAGES like ex: SEF_FILTER_TORONTO=city-toronto. Then in CobaltParseRoute function i insert.

case JText::_('SEF_FILTER_TORONTO'):
    $vars['view']       = 'records';
    $vars['section_id'] = $filter->clean($segments[1], 'INT');

    $vars['filter_name'][] = 'filter_1';
    $vars['filter_val'][] = 'TORONTO';
break;
}

So i have all links to insert on Google with filter results without use the 'records.filter'.

But i don't know if it is possibile and if it works.

If this last idea is not possibile, where i have wrong in my code?


Sergey
Total posts: 13,748
24 Jul 2014 00:33

My example is for CobaltParseRoute only. You do not need anything for CobaltBuildRoute because you build it manually.


pepperstreet VIP
Total posts: 3,837
24 Jul 2014 02:04

While following this topic... I remembered this extension: Simple Custpm Router Maybe it is of any help (or inspiration).


Guest
24 Jul 2014 09:22

Hi,

i have used this extension. It doesn't work with your extension Cobalt.

I have insert the path of destination of a filter but when i open this page the page is refresh to the default page of Cobalt section.

I don't resolve the problem.


Sergey
Total posts: 13,748
24 Jul 2014 09:36

If it redirects it means it is correct. You need not default section home? Did you add section_id parameter?


Guest
24 Jul 2014 15:24

i have insert the section_id parameter but i want a specific url for any filter.

I don't want the refresh to the general section page becouse it is the same url and i can't index it at Google for any specific filter of city.

So i want that the filter of city toronto goes to 'SECTION-COBALT/filter/toronto' or 'SECTION-COBALT/city/toronto' or another url that it contains the specific value of filter.


Guest
28 Jul 2014 10:13

I find a solution for my problem and i just test it.

I have modify the php file for the list of record of a section to filter the records on the value of a filter.

When i end the file i write my personal solution to solve the problem for 'an url for any value of filter'.

If you have other solution please write in this post and i study it.

Powered by Cobalt