We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Ordering oddity- selected items??

Development and Programming

jtnt's avatar
jtnt
137 posts
17 years ago
jtnt's avatar jtnt

I was having an issue where using a “display_order” field, with values of 100, 200, 300, etc. weren’t ordering properly.

I had entries with values 200 - 700. I then added a new entry and gave it a display_order value of 100, which should have made it show up first. It always showed up last. orderby=”display_order” sort=”asc” was the code.

I tried everything, deleting and re-entering the new entry, double-checking template code, I couldn’t get it to not show up last. I was also writing out the value of the field in the template as an HTML comment to check. Sure enough, 200-700 were first, then 100 came last. ??

I then gave up and used the great SelectedItems module/extension. This solved the above problem, as the items were ordered as specified in the module. However, a weird switch behavior came up.

Using {switch="blank|clearer"}, the first 2 entries contained the “blank” switch value, then the rest alternated properly as expected while using the switch variable.

You can see the page in question here: http://www.ser.com/about/management-team

Any ideas?

BTW, this site is running 1.5.2 build 20070122. I cannot undertake upgrading this site at this time.

EDIT:

Here’s my template code for this bit:

<div class="team">
{exp:selecteditems name="mgmt_team"}
{exp:weblog:entries weblog="team" entry_id="{selecteditems_id}" orderby="selecteditems"}
<div class="col">
<a href="http://{title_permalink=">{if team_photo}{team_photo}{if:else}/xres/images/common/no-image.jpg{/if}</a>
<h2><a href="http://{title_permalink=">{team_name}</a></h2>
<h3>{if team_title}{team_title}{/if}</h3>
</div>
<div class="{switch="blank|clearer"}"></div>    
{/exp:weblog:entries}
{/exp:selecteditems}
</div>
       
jtnt's avatar
jtnt
137 posts
17 years ago
jtnt's avatar jtnt

Ok, I think I know what’s going on with the current situation. SelectedItems is re-ordering these after the switch code is written. So, basically, I don’t think you can use switch with that module.

BUT, it still doesn’t explain the first bit about why, when I was using display_order field to order them, the 100 was showing up behind 200-700.

Ideas?

       
Andrew Weaver's avatar
Andrew Weaver
206 posts
17 years ago
Andrew Weaver's avatar Andrew Weaver

To use the switch statement with the SelectedItems extension, you can replace it with {selecteditems_switch="blank|clear"}.

       
jtnt's avatar
jtnt
137 posts
17 years ago
jtnt's avatar jtnt

Sweet! That worked. Don’t know why I didn’t see this option before. RTFM, right?

       
Robin Sowell's avatar
Robin Sowell
13,158 posts
17 years ago
Robin Sowell's avatar Robin Sowell

Thanks for the pointer, Andrew. jtnt, not sure why the order was goofing with 100- it makes no sense. To debug, I’d probably start by running some queries- see what they return. That would help us narrow down the issue. Not sure you’re up for that, but if you are, say the word and we can start hitting it.

       
plebe's avatar
plebe
50 posts
17 years ago
plebe's avatar plebe

I have two usages of Selected Items extension on the same page and one works, but the other one does not. It seems to list entries in the order of the edit tab in back end.

Here is the code (not working) (this page is embedded in a full-page):

<table id="featured" cellspacing="0" cellpadding="0" border="0" width="100%">
    <tr>
        <td align="center" valign="top">
            {exp:selecteditems name="paintings_display_order"}
            {exp:weblog:entries weblog="paintings_weblog" entry_id="{selecteditems_id}" orderby="selecteditems" limit="1" status="open"}
                <div class="featured-painting">{painting-img}</div>
                

                {entry_id}

                {selecteditems_id}
                <div class="featured_stats"><strong>{title}</strong>
                    


                    {painting-medium}  {painting-width} X {painting-height}  {painting-year}
                    


                    {painting-status} {painting-holder}</div>
            {/exp:weblog:entries}
            {/exp:selecteditems}
        </td>
        <td align="center" valign="top" width="200">
            {embed="site/thumbs"} <<<<<-- THIS IS THE PAGE BELOW >>>>
        </td>
    </tr>
</table>

And here is the site/thumbs embedded page within this one highlighted above. The selected items extension ordering here works, but not above! Go figure…scratching my head.

<div id="paintingthumbs">
    {exp:selecteditems name="paintings_display_order"}
    {exp:weblog:entries weblog="paintings_weblog" entry_id="{selecteditems_id}" orderby="selecteditems" dynamic="off" status="open" disable="trackbacks|member_data|pagination"}
        <div class="thethumbs">
        <a href="http://{url_title_path=site/paintings}#{url_title}">{painting-thumb}</a>
        </div>
    {/exp:weblog:entries}
    {/exp:selecteditems}
</div>
       
plebe's avatar
plebe
50 posts
17 years ago
plebe's avatar plebe

Does anyone know if it’s possible to use the selecteditems module twice on one page??

       
plebe's avatar
plebe
50 posts
17 years ago
plebe's avatar plebe

I found why it was not working. Apparently I am not able to use the limit=”” parameter with selected items. When I take it out, it lists the entries in the correct order. When I add, with limit=1, =2 or =20 it does not order correctly (or seems to default to the order in the back end (date).

Anyone else have this problem? I really need some way of ordering entries. I’ve tried reeorder and it’s great, but not going to work for what I need.

       
Robin Sowell's avatar
Robin Sowell
13,158 posts
17 years ago
Robin Sowell's avatar Robin Sowell

I don’t know the selected items plugin/module or what it does- but looks like that’s where the issue comes into play. Might be a better question for the author- or I can move this down to the plugin/module forum?

       
plebe's avatar
plebe
50 posts
17 years ago
plebe's avatar plebe

Thanks Robin,

Move anywhere you feel appropriate. I went back to creating a custom field and type in a number manually, then use that in the templates to custom order.

Thanks, Joel.

       
Robin Sowell's avatar
Robin Sowell
13,158 posts
17 years ago
Robin Sowell's avatar Robin Sowell

I think I’ll shift it to modules and tweak the title- I suspect someone who is up on that module might have an idea of what’s up.

       
Andrew Weaver's avatar
Andrew Weaver
206 posts
17 years ago
Andrew Weaver's avatar Andrew Weaver

Hi Joel,

Due to the way that the SelectedItems module works, you cannot use the limit parameter.

You might be able to limit the entries that show using something like:

{if selecteditems_count < 5} … {/if}

If you try this and it does not work let me know. There was a bug (that has been fixed), but I’m not sure whether it was in the last ‘release’.

Andrew

       
plebe's avatar
plebe
50 posts
17 years ago
plebe's avatar plebe

Hi Andrew,

Thanks. For now I’m just resorting to using a custom field. This seems to work, though as mentioned too many times on these forums, it’s not the best way.

Thanks for your help all the same.

Joel.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.