OrderBy Parameter Ignored?

Greg Laycock asked on February 20, 2017 21:07

I have a number of products divided into categories by node. I'm trying to loop through all the products and list them in the same order as they are shown in the CMS, but nothing I've tried works. The CMS lists the products as follows:

-- Category 1
    -- Product 1
    -- Product 2
-- Category 2
    -- Product 3
    -- Product 4
-- Category 3
    -- Product 5
    -- Product 6

If the OrderBy parameter for the repeater is "NodeLevel, NodeOrder," I get the following output:

-- Product 1
-- Product 3
-- Product 5
-- Product 6
-- Product 4
-- Product 2

No value that I pass for the order seems to change anything. (The delayed loading is so that I can dynamically pass a path, and this works fine.) What am I missing?

<cms:CMSRepeater runat="server" ID="ProductsByCategory" ClassNames="Custom.Product" 
    TransformationName="Custom.Product.ProductGrid_WithCategory" DelayedLoading="true"
    WhereCondition="IsKit=0" OrderBy="NodeOrder, NodeLevel">
</cms:CMSRepeater>

Correct Answer

Trevor Fayas answered on February 20, 2017 22:17

You will probably need to use a Uni-viewer instead of a Repeater then, a UniViewer handles Hierarchy and thus will better render the above. You will probalby need to include the custom page type, and make an empty transformation for it that only contains the Placeholder control for child items.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Trevor Fayas answered on February 20, 2017 21:23

NodeLevel, NodeOrder

Just had them flipped around.

0 votesVote for this answer Mark as a Correct answer

Greg Laycock answered on February 20, 2017 21:25

Neither one works. It simply ignores the parameter.

0 votesVote for this answer Mark as a Correct answer

Greg Laycock answered on February 20, 2017 21:32

Could it have something to do with the parent (Category) pages being a custom page type as well? I've tried hard-coding a path in the repeater and removing the DelayedLoading, and that still makes no difference. No matter what I've tried, the OrderBy parameter is ignored.

0 votesVote for this answer Mark as a Correct answer

Greg Laycock answered on February 20, 2017 21:42

Okay, if I print out the NodeLevel and NodeOrder, respectively, I get the following:

-- Product 1 (4, 1)
-- Product 3 (4, 1)
-- Product 5 (4, 1)
-- Product 6 (4, 2)
-- Product 4 (4, 2)
-- Product 2 (4, 3)

So how would this ever work?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on February 20, 2017 21:48

What version are you using? Are you also using Content Staging as well? What I'd do to resolve the issue would be manually reorder them within the content tree and see if this resolves the issue you are having. Also make sure if you are specifying the columns (for performance) you include the NodeLevel, NodeOrder fields.

0 votesVote for this answer Mark as a Correct answer

Greg Laycock answered on February 20, 2017 21:56

Version 10, Brenden, ASPX + Portal. Reordering the product nodes changes the output, but it doesn't get the output any closer to matching the CMS order. I wasn't specifying columns yet at this point.

0 votesVote for this answer Mark as a Correct answer

Greg Laycock answered on February 20, 2017 22:31

You're right, a hierarchical transformation with a UniViewer did the trick. Thanks much!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.