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.