Magento - set custom sort by and order direction with Layout Updates for just one category

Magento - set custom sort by and order direction with Layout Updates for just one category

August 8, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - set custom sort by and order direction with Layout Updates for just one category

Magento - Setting Custom Sort By and Order Direction via Layout Updates for a Single Category

Dear reader,

I understand your frustration—attempting to set custom sort by and order direction using layout updates in Magento can be challenging if you don’t nail the syntax precisely. You’re on the right track, though! Let me guide you through this seemingly elusive task.

The Problem: Layout Updates Aren’t Applying

You’ve tried setting the default sort order via your category’s custom layout update XML:

<reference name="product_list_toolbar">
    <action method="setDefaultOrder"><string>created_at</string></action>
    <action method="setDefaultDirection"><string>desc</string></action>
</reference>

However, this setup isn’t working in your custom theme or even the default RWD theme. It seems the action methods aren’t being called.

The Solution: A Carefully Crafted Layout Update

The issue lies not in your approach but rather in the specific layout handle you’re targeting—product_list_toolbar. This handle corresponds to the product list toolbar in a category, which doesn’t have built-in actions for setting default order and direction.

Instead, we need to target the catalog_product_list block directly. Here’s how:

<reference name="catalog_product_list">
    <action method="setDefaultOrder"><string>created_at</string></action>
    <action method="setDefaultDirection"><string>desc</string></action>
</reference>

Understanding the Layout Handle

The catalog_product_list is the main block responsible for rendering products in a category. By targeting this handle, we’re ensuring our sort settings apply directly to the product listing.

Remember, layout updates are processed based on their priority and the specific layout handles they target. If you want your updates to take precedence over Magento’s core behavior, ensure your priority is set appropriately.

Testing Your Changes

After updating your category with this new layout XML, save it and refresh your storefront. Navigate to the relevant category page where you applied these changes. You should now see that the products are sorted by created_at in descending order.

If everything works as expected, consider exploring more Magento layout handles for fine-grained control over your store’s appearance and behavior.

Conclusion

Setting custom sort parameters via layout updates is indeed possible—once you understand the specific layout handle that needs to be targeted. By carefully crafting your XML as shown above, you can achieve granular control over how products are sorted within a single category in your Magento store.

Remember, Magento offers numerous customization options, including product listing changes, for enhancing the user experience and driving conversions on your e-commerce platform.

Let me know if you have any further questions or need assistance with other Magento development tasks!

Catalog Themes Configuration Orders

Our network