Hi there,

i have a catalog of products, i am using will paginator for paging the
results. now The user can sor the products by: name, price or
category, and can filter the products by category and ocation. For
doing this i have used link_to hepler like so:

link_to "Name", :action => :index, :orderby => "name"

link_to "Category", :action => :index, :orderby => "category_id"

link_to "Price", :action => :index, :orderby => "price"

for category in @categories
   link_to category.name, :action => :index, :category => category.id
end

for ocation in @ocations
   link_to ocation.name, :action => :index, :ocation => ocation.id
end

So, when the user click in the sort functionality, the URL will be any
of these:

http://www.something.com/gallery/page/4?orderby=name
http://www.something.com/gallery/page/4?orderby=category_id
http://www.something.com/gallery/page/4?orderby=price

And when the user click on the filter funtionality the URl will be
any:

http://www.something.com/gallery/page/4?category=1
http://www.something.com/gallery/page/4?ocation=3

I am having problems because i do not know how to keep both parameters
on the url if the user click on one of the sort links anf one of the
ocation or category links. In this case what i want to have in my URL
will be:

http://www.something.com/gallery/page/4?category=1&orderby=name

Or if nothing has been selected, i wish for example:

http://www.something.com/gallery/page/4?category=&orderby=  (in this
case i set defaults values for each parameter)

Any idea, suggestion?

Regards



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to