Jump to content

How to Get Manufacturers List in Alphabetical Order?


Dirty Butter

Recommended Posts

When you choose a Manufacturer while you are creating a new Product the list of Manufacturers is in alphabetical order, which is great! BUT, when you go to create a new manufacturer the list is NOT in alphabetical order. Those I had created previous to the v5 update are in order, but new ones I've added since then are at the bottom of the list. This means it's way too easy to make a duplicate.

If the list can be alphabetized in the code in one place surely it can be done in the other?????

Link to comment
Share on other sites

In /admin/sources/products.manufacturers.inc.php find around line 80:

if (($manufacturers = $GLOBALS['db']->select('CubeCart_manufacturers', array('id','image'), false, false, $per_page, $page)) !== false) {

and change it to:

if (($manufacturers = $GLOBALS['db']->select('CubeCart_manufacturers', array('id','image'), false, "name", $per_page, $page)) !== false) {

Not the most elegant solution since it involves changing source code. In theory it should be possible to sort the manufacturers array in the template using this smarty plugin:

http://smartcoding.wordpress.com/2009/02/24/smarty-sort-array/

but this didn't work for me. I think there are some security settings in the way and I'm not sure how to get around them.

Link to comment
Share on other sites

In /admin/sources/products.manufacturers.inc.php find around line 80:

if (($manufacturers = $GLOBALS['db']->select('CubeCart_manufacturers', array('id','image'), false, false, $per_page, $page)) !== false) {

and change it to:

if (($manufacturers = $GLOBALS['db']->select('CubeCart_manufacturers', array('id','image'), false, "name", $per_page, $page)) !== false) {

Not the most elegant solution since it involves changing source code. In theory it should be possible to sort the manufacturers array in the template using this smarty plugin:

http://smartcoding.wordpress.com/2009/02/24/smarty-sort-array/

but this didn't work for me. I think there are some security settings in the way and I'm not sure how to get around them.

The page was blank when I tried going to Manufacturers. I emptied Cache, but that didn't fix it.

Link to comment
Share on other sites

The page was blank when I tried going to Manufacturers. I emptied Cache, but that didn't fix it.

Odd. I tested it and it worked for me. I've attached my copy of the file - see if that makes any difference.

products.manufacturers.inc.php

And incidentally, I tested this on version 5.0.6

That worked!!

This is very weird. I tried adding your line 80 from your attached file to MY file to see what I had copied wrong, and it STILL didn't work. But when I use YOUR file it does. So something else must be different in my file??? I'm on 5.0.6, too.

I really appreciate all the help you've given me. Would you please suggest this fix for v5.0.7?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...