Re: [mezzanine-users] Re: Design to extend cartridge with global location selection
Hi Stephen and Mathias, Thanks for your reply and that's really good suggestion. Currently I think customizing @processor_for(Category) is better for my current scenario. Use Category as location is higher level controller I think very useful when all products are involved in just on Category(also in the top navigation bar). Currently I have several categories fixed in the top menu and all linked to special type of products. So, it's better for me now to use @processor_for to filter products when every category on the top menu is clicked. :-) Thank you guys. Wesley Yeah, great idea hiding the menu items. Then all you'd need is a couple of small view functions, like the one that sets the session variable, and one that does the redirect to the relevant location category by looking at the session variable - that might end up having a Link page in your menu called Products that just links to the redirector. On Fri, May 29, 2015 at 11:39 PM, Mathias Ettinger mathias@gmail.com javascript: wrote: Indeed, Category can be the (already existing and SQL cheaper version of the) ManyToMany field I was referring to. You can use the PAGE_MENU_TEMPLATES checkboxes to make sure they don't appear in the menu if you don't want them to. Le samedi 30 mai 2015 08:17:57 UTC+2, Stephen McDonald a écrit : Might even be able to do something simple using locations as categories. On Fri, May 29, 2015 at 11:12 PM, Mathias Ettinger mathias@gmail.com wrote: Hi, I’d rather not use a variation option to store the location: - it can be costly to retrieve every one of them when filtering products for a given category; - it will display on the product page and can be redundant if you have a dropdown elsewhere. Instead, I’d rather use EXTRA_MODEL_FIELDS to inject a CharField (or better, a ForeignKey or a ManyToMany, depending on your needs, to a custom model storing locations and may be other metadata) into cartridge.shop.models.Product You can then write a custom @processor_for(Category) to filter the products according to your needs. Check out https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/page_processors.py for an example of how to achieve that. Le jeudi 28 mai 2015 10:55:55 UTC+2, Wesley a écrit : Hi guys, This is not an problem but just here to consult with you guys. When coding these days, I happen to think about that how to add a functionality that dynamic display products by user's location selection. That is, on my homepage, there is one location select, e.g. New York, Boston .etc When users select New York, all product list related shows only products that are availabe for New York. So, if I code, I will: 1. Add one product option to Product, maybe named as location, and values are those city names, e.g. New York, Boston .etc 2. Add the selected location variable to request.session 3. Within those product list templates or view functions returning queryset to product list pages, filter products Is above idea correct? or do you guys has some better suggestions? Wesley -- You received this message because you are subscribed to the Google Groups Mezzanine Users group. To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Stephen McDonald http://jupo.org -- You received this message because you are subscribed to the Google Groups Mezzanine Users group. To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- Stephen McDonald http://jupo.org -- You received this message because you are subscribed to the Google Groups Mezzanine Users group. To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[mezzanine-users] Re: Design to extend cartridge with global location selection
Hi, I’d rather not use a variation option to store the location: - it can be costly to retrieve every one of them when filtering products for a given category; - it will display on the product page and can be redundant if you have a dropdown elsewhere. Instead, I’d rather use EXTRA_MODEL_FIELDS to inject a CharField (or better, a ForeignKey or a ManyToMany, depending on your needs, to a custom model storing locations and may be other metadata) into cartridge.shop.models.Product You can then write a custom @processor_for(Category) to filter the products according to your needs. Check out https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/page_processors.py for an example of how to achieve that. Le jeudi 28 mai 2015 10:55:55 UTC+2, Wesley a écrit : Hi guys, This is not an problem but just here to consult with you guys. When coding these days, I happen to think about that how to add a functionality that dynamic display products by user's location selection. That is, on my homepage, there is one location select, e.g. New York, Boston .etc When users select New York, all product list related shows only products that are availabe for New York. So, if I code, I will: 1. Add one product option to Product, maybe named as location, and values are those city names, e.g. New York, Boston .etc 2. Add the selected location variable to request.session 3. Within those product list templates or view functions returning queryset to product list pages, filter products Is above idea correct? or do you guys has some better suggestions? Wesley -- You received this message because you are subscribed to the Google Groups Mezzanine Users group. To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [mezzanine-users] Re: Design to extend cartridge with global location selection
Might even be able to do something simple using locations as categories. On Fri, May 29, 2015 at 11:12 PM, Mathias Ettinger mathias.ettin...@gmail.com wrote: Hi, I’d rather not use a variation option to store the location: - it can be costly to retrieve every one of them when filtering products for a given category; - it will display on the product page and can be redundant if you have a dropdown elsewhere. Instead, I’d rather use EXTRA_MODEL_FIELDS to inject a CharField (or better, a ForeignKey or a ManyToMany, depending on your needs, to a custom model storing locations and may be other metadata) into cartridge.shop.models.Product You can then write a custom @processor_for(Category) to filter the products according to your needs. Check out https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/page_processors.py for an example of how to achieve that. Le jeudi 28 mai 2015 10:55:55 UTC+2, Wesley a écrit : Hi guys, This is not an problem but just here to consult with you guys. When coding these days, I happen to think about that how to add a functionality that dynamic display products by user's location selection. That is, on my homepage, there is one location select, e.g. New York, Boston .etc When users select New York, all product list related shows only products that are availabe for New York. So, if I code, I will: 1. Add one product option to Product, maybe named as location, and values are those city names, e.g. New York, Boston .etc 2. Add the selected location variable to request.session 3. Within those product list templates or view functions returning queryset to product list pages, filter products Is above idea correct? or do you guys has some better suggestions? Wesley -- You received this message because you are subscribed to the Google Groups Mezzanine Users group. To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Stephen McDonald http://jupo.org -- You received this message because you are subscribed to the Google Groups Mezzanine Users group. To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [mezzanine-users] Re: Design to extend cartridge with global location selection
Indeed, Category can be the (already existing and SQL cheaper version of the) ManyToMany field I was referring to. You can use the PAGE_MENU_TEMPLATES checkboxes to make sure they don't appear in the menu if you don't want them to. Le samedi 30 mai 2015 08:17:57 UTC+2, Stephen McDonald a écrit : Might even be able to do something simple using locations as categories. On Fri, May 29, 2015 at 11:12 PM, Mathias Ettinger mathias@gmail.com javascript: wrote: Hi, I’d rather not use a variation option to store the location: - it can be costly to retrieve every one of them when filtering products for a given category; - it will display on the product page and can be redundant if you have a dropdown elsewhere. Instead, I’d rather use EXTRA_MODEL_FIELDS to inject a CharField (or better, a ForeignKey or a ManyToMany, depending on your needs, to a custom model storing locations and may be other metadata) into cartridge.shop.models.Product You can then write a custom @processor_for(Category) to filter the products according to your needs. Check out https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/page_processors.py for an example of how to achieve that. Le jeudi 28 mai 2015 10:55:55 UTC+2, Wesley a écrit : Hi guys, This is not an problem but just here to consult with you guys. When coding these days, I happen to think about that how to add a functionality that dynamic display products by user's location selection. That is, on my homepage, there is one location select, e.g. New York, Boston .etc When users select New York, all product list related shows only products that are availabe for New York. So, if I code, I will: 1. Add one product option to Product, maybe named as location, and values are those city names, e.g. New York, Boston .etc 2. Add the selected location variable to request.session 3. Within those product list templates or view functions returning queryset to product list pages, filter products Is above idea correct? or do you guys has some better suggestions? Wesley -- You received this message because you are subscribed to the Google Groups Mezzanine Users group. To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- Stephen McDonald http://jupo.org -- You received this message because you are subscribed to the Google Groups Mezzanine Users group. To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.