[ic] more-list by criteria aka Group By

Kevin Walsh kevin at cursor.biz
Sun Jul 22 18:18:03 EDT 2007


"Paul Jordan" <paul at gishnetwork.com> wrote:
> I am wondering if it's possible to alter the more-list internals to account
> for results based on criteria and yes - I know this sounds like a house of
> cards.
> 
> Basically, I am using [prefix onchange] to reduce the actual amount of
> products displayed in the resultset, so the more-list might say "results
> 1-7 of 52" but there may only be 3 items showing. I was hoping it would not
> be too much a hit to have an addition where you could set a more-lists
> pseudo "group by" setting ala:
> 
> ml=12
> more=1
> more_unique=sku
> 
> Yes, I know I can use sql to narrow down my results in a better fashion,
> however that is not what I am doing. I use a custom OnFly system that
> allows me to create one product sku, that is linked to an infinite ways to
> sell it. Sort of like "options" however these options are similar across
> many products, so I can control a way to sell 1000 items, by changing one
> row. For example, I sell an image, and it is available as a low rez
> download, high rez download, 24x36 poster, 18x24 poster, etc. My options
> don't change item by item, but rather by large sets of items.
> 
> Till now, I have not needed to display the items in this way (I usually
> handle it on a flypage). I wish to show a list of items with all their ways
> they can be purchased. 
> 
> This is all easily solved using (ultimately) many queries on the page, but
> I am accomplishing this all in one joined query, and want to exhaust this
> attempt first.
> 
I think that what you need is a new search parameter that works along
the lines of the existing mv_more_alpha:

    http://www.interchange.rtfm.info/icdocs/Search_parameters.html#mv_more_alpha_ma

A new mv_more_unique (boolean) parameter could be created that, when
paired with mv_sort_field, would treat all non-unique values as a single
result as far as the pagination is concerned.

Loops would continue to loop through all rows, as usual, but the number
of results per page could vary, depending upon the uniqueness of the
first mv_sort_field column in each row.

I imagine that a facility such as this would be reasonably easy to
create, but it would require a core change and a lot of regression
testing, of course.  I haven't looked at the code involved recently,
so I can't say for sure just how easy it'll be. :-)

Mv_more_alpha overrides the page numbers (creating page letters instead),
so a wholesale copy/paste/tweak of the mv_more_alpha code couldn't be
used here (or perhaps it could - I haven't looked, as I said).  Also,
I imagine also that people might want to combine a new mv_more_unique
with the existing mv_more_alpha, which could complicate matters a little.

I like this idea.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin at cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/


More information about the interchange-users mailing list