1

I'm working on a site where I utilise a custom field to store a pipe-delimited list of related entries, in order to sort Playa's reverse related entries. This looks something like this:

{exp:channel:entries
    channel='deals'
    limit='1'
}
<h1>{title}</h1>
<ul>
    {exp:playa:parents
        channel='products'
        var_prefix='parent'
        fixed_order='{deal_text_product_order}'
    }
        <li>{parent:title}</li>
    {/exp:playa:parents}
</ul>
{/exp:channel:entries}

Now this works fine, my client can order their products (I'm doing this in Safecracker, with jQuery UI Sortable) "and all was well with the world". However, if they add a product after the order's been set, the product isn't shown because it's not in the list in the fixed_order parameter. Ideally I'd want any products not in the pipe-delimited list to be shown after the products that were in the list... Is there any way to achieve that?

So for example my client sorts the products as 3|1|4|2, and then publishes new products with ID 5 and 6, I'd like them to be appended after products 3, 1, 4 and 2, displaying the products in the order 3 1 4 2 5 6. Does that make sense?

Thanks!

2

Low Reorder has this exact functionality you describe. New entries are added to either the beginning or end of a manually ordered list. But this only works thru the control panel.

http://gotolow.com/addons/low-reorder

You could possibly write a custom SQL query to update the Low Reorder tables with the External Entries add-on. Low Reorder uses a table called "exp_low_reorder_orders" thats just a list of entry ids. External Entries can be called from any EE template:

Put the plugin in its own EE template, call the template with jQuery’s .load() and .live() functions for AJAXy goodness, and your web site is now a web app!

http://engaging.net/products/external-entries

2
  • As you can see I'm using Playa and it's {exp:playa:parents} tag, and the sheer amount of content doesn't lend itself to use Low Reorder (right now: 4000+ products spanning 200 deals) – Steven Mar 5 '13 at 10:19
  • You could use {exp:playa:parents fixed_order="{exp:low_reorder:entry_ids set="1" separator="|"}"} to support Playa. Not sure how the "sheer amount of content" plays into the equation, I mean you might have to do some data mapping to get your relationships initially into reorder I suppose? I think this is a good answer. – spacesuitdiver Mar 10 '13 at 12:30
1

You could do this super inefficiently without reorder.

Basically call {exp:playa:parents} twice, fixed_order="" once for your ordered set, then entry_id="" once for the rest WITHOUT the ordered set. Something like:

...
{exp:playa:parents
    channel='products'
    var_prefix='parent'
    fixed_order='{deal_text_product_order}'
}
    <li>{parent:title}</li>
{/exp:playa:parents}

{exp:playa:parents
    channel='products'
    var_prefix='parent'
    entry_id='not {deal_text_product_order}'
}
    <li>{parent:title}</li>
{/exp:playa:parents}
...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.