Sunday, November 3, 2019

Drupal 7 / Ubercart 7 - Stability Theme Change Default Catalog Sort Order

Drupal core 7.67 / Ubercart 7.x-3.13  / Stability Theme 


Following years of frustratingly hard-to-reach, disinterested and/or incompetent and needlessly expensive Drupal developers we have set up an affordable commercial service for Small and Medium sized Enterprise (SME) decision-makers who rely on Drupal to support their business, like us.  So, if you need help with this problem, or any other form of Drupal Wizardry, feel free to contact us via our new division, Drupal Wizard, which provides support for all versions of Drupal.  


We offer the following services to serve the unique and evolving needs of your business:
  • 24/7 Emergency Support
  • Low-Cost Annual Support Packages
  • Drupal Module Integration and Development
  • Linux and Drupal Scheduled Systems Maintenance
Visit www.drupalwizard.com for more information.

Stability Theme Change Default Catalog Sort Order


Currently, the sort order of the catalog in the Stability Theme is by reverse chronological
order, meaning that the most recent items appear at the top.  This makes sense sometimes, but it is a fairly rudimentary way of displaying products.

Some other potential ways of ordering a catalog are:


  • Alphabetic
  • Weight
  • Random
  • Sales
  • Score
  • Popularity / Recently Purchased

At the moment, we prefer to list our products Alphabetically, because our customers find a product line they like, and then buy products within that line.  Controlling the sort order gives us complete control over how our catalog is presented to our customers.

All of this happens in a View, which is the Drupal way of executing a database query.  So, the first we need to figure out is which View we need to change:



Because it has /shop in it, this View is a very likely candidate,  so we are going to take a close look at it:


For reference, this is the Products (Content) View:



Looking at the Shop Full Width aspect, we can see the SORT CRITERIA is
  • Post date (desc)

This would display the products in the reverse order they were entered, which is what we are currently getting. but not what we want.

What we want is to have the SORT CRITERA changed to an alphabetic list in ascending order.  This critiera is:


  • Content: Title (asc)



So, here's what we did to get our catalog to present products in the correct sort order:

In the SORT CRITERIA, click on Add:

Select Content: Title



Accept Sort ascending as the sort order



Click on Apply (all displays).

Next, we need to remove the obsolete Post date (desc) sort order criteria:

Click on Post date (desc).

Click on Remove:



Scroll to the bottom of the page to see if the View is producing the correct results.

Yes, looks great!

So, now that the View is functioning right, save it.

Click Save, which is in the upper right corner of the screen:



Voila, problem solved.

No comments:

Post a Comment