Sort Promotions

How do I sort promotions?

I have tried to set priority (0, 1, 2, 3 etc.) in the admin Promotions screen, but it has no effect on the front of the site. All I want to do is have a certain promotion listed at the top, when I want too.

can you elaborate clearly. where u want to show? which page?

I want to sort the order of the promotions on the Promotions page on the front of the website.

When i sort them in the admin side of the site, it has no affect on the front side of the site.


I solved this problem in v3 by editing /core/fn.promotions.php

Staring at Line 62, change this:

if (empty($params['sort_by']) || empty($sortings[$params['sort_by']])) {
$params['sort_by'] = 'name';

Change to this:

if (empty($params['sort_by']) || empty($sortings[$params['sort_by']])) {
$params['sort_by'] = 'priority';

You don't have to clear the cache to see a change in the PHP, so you should instantly see your Promotions sorted by the Priority you assign them. The default sort order is descending, so the lower priority numbers will show up first. You could also edit the sort order to 'asc' while you are changing the script if you want to, but keep in mind that the “priority” of a promotion is used when more than one promotion can be applied and you have selected “stop other rules” for a promotion - only the highest priority value (lowest number) will prevail.

Thanks @magpie Don.

The person like you keeps the community live.

I have been spending some time to figure it out glad you came out first :)

Keep up the good work .