Customize <store>/products url ?

72 views
Skip to first unread message

David Unric

unread,
Dec 19, 2012, 6:11:03 PM12/19/12
to spree...@googlegroups.com
Hi,

I'd like to set the default http://<store_site>/products url to my own (localized) version.

I did found it is stored in Spree's products_path attribute.

What is the "proper" way to set its value ? Where has the setting to be done ?

Thanks.

David

Ryan Bigg

unread,
Dec 19, 2012, 10:34:20 PM12/19/12
to spree...@googlegroups.com
You need to set this in your application's routes file using this code:

Spree::Core::Engine.routes.prepend do
  resources :products, :path => "/productos"
end

Note that this will draw two sets of the products routes on Spree::Core::Engine's router, meaning that people will be able to access it by both /products and /productos.

I don't know of a way to "undraw" routes.




David

--
You received this message because you are subscribed to the Google Groups "Spree" group.
To view this discussion on the web visit https://groups.google.com/d/msg/spree-user/-/14UlcqSGN6oJ.
To post to this group, send email to spree...@googlegroups.com.
To unsubscribe from this group, send email to spree-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.

David Unric

unread,
Dec 20, 2012, 4:12:07 AM12/20/12
to spree...@googlegroups.com
Thanks Ryan, your solution does work.
I'm also curious how to replace the path instead of prepending it ?

David Unric

unread,
Dec 20, 2012, 5:25:17 AM12/20/12
to spree...@googlegroups.com
Hi,

now I tried to customize /cart url in the same way but it does not work.
Any idea how to replace cart_path ?

Thx.


On Thursday, December 20, 2012 4:34:20 AM UTC+1, Ryan Bigg wrote:

Ryan Bigg

unread,
Dec 20, 2012, 5:20:53 PM12/20/12
to spree...@googlegroups.com
I don't think you can replace it using Rails. The best you could do is set up a RewriteRule using apache or the equivalent in nginx to redirect people from /products to /productos.


To view this discussion on the web visit https://groups.google.com/d/msg/spree-user/-/O2chI5MNHlQJ.

Nate Lowrie

unread,
Dec 21, 2012, 8:17:06 AM12/21/12
to spree...@googlegroups.com
Could you use the spree_redirects gem for this?

Ryan Bigg

unread,
Jan 3, 2013, 12:52:48 AM1/3/13
to spree...@googlegroups.com
Yeah, I think that'd be a possibility.


To view this discussion on the web visit https://groups.google.com/d/msg/spree-user/-/MMRNJ51sdiIJ.

Nate Lowrie

unread,
Jan 3, 2013, 8:05:49 AM1/3/13
to spree...@googlegroups.com
On second thought, if I was doing this I would just use the rack-rewrite gem and put 301 redirects there...
Reply all
Reply to author
Forward
0 new messages