On 8 April 2016 at 13:21, Sam W <demon....@gmail.com> wrote:

> So I end up doing a lot of weird stuff with Cartridge, but something a bit
> more normal has been plaguing me recently; user-defined sort orders for
> products in Cartridge's categories.
>
> Basically, clients' sales staff want to be able to manually drag and drop
> products in categories to change their initial order when the page loads.
> At the moment, they're doing all sorts of stuff to achieve this, including
> unloading and reloading products so that "recently added" does what they
> want. D:
>
> Obviously this is not a normal feature in Cartridge for a bunch of
> reasons, but I was wondering if anyone else had run into this before, and
> if so how you worked around it.
>
> As I'm already customising cartridge, that's the approach I'll likely end
> up taking. It seems like the ideal way to do it is to make products
> orderable with respect to categories and then find a way to add a
> product-order widget to the category page in the admin that will update the
> category-respective order of products when edited. The latter part is the
> most difficult part of the implementation for me, as adding custom widgets
> to the grappelli is not exactly my strong suite. Does anyone have any
> advice on that subject?
>
>
I've customised cartridge as well, and one of the things I did was add an
'ordering' field to the model (I did at first try subclassing Orderable but
it wasn't successful). Then in the Products Admin, I've allowed the
ordering field to be visible/editable so an admin can numerically change
the order of the products. This isn't per category, it's overall, but it's
enough for me.

In the category template, I've removed the sort dropdown, so the only order
that products appear in is the default (which I've set to be based on
'ordering') and that way the products appear in the order I want them.

It's a simple and crude solution, but it's enough for me.

I think if you want drag-and-drop ordering you may want to *start* by
making the Product class subclass Orderable, but to provide that drag-drop
feature, you'll have to adapt the TabularDynamicInline javascript behaviour
to apply to a top level model (rather than an inline). I could never get
the drag/drop ordering to work on any top-level model, so I just gave up
and decided to use numeric ordering as it was simpler for me.

Seeya. Danny.

-- 
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.

Reply via email to