Sorting Options and Attributes in 2.3.1

Yesterday, a new client approached me to ask if I could provide a way (in 2.3.1) to sort Product Options, and the Attributes of those Options. Well, it’s not rocket science to do this, so came up with a solution.

Needed;

1. An easy way to sort Product Options
2. An easy way to sort the Attributes of those Options
3. An easy way to set an Pre-Selected Attribute.

How it works right now;

In standard 2.3.1 the Options are listed in alphabetical order, so in the example below, Memory comes above Model;

Then the attributes are listed with the lowest cost first, in the image below, you can plainly see that -$10 comes before $0 (blank). The already selected attribute is always the lowest cost (which may be undesirable);

Changes made

1. Recode the admin/product_attributes screen to allow the shop owner to give a Sort Order to the Options;

2. Further recode the admin/product_attributes screen to allow the shop owner to give a Sort Order to the Attributes of each Option, per product (basically the same idea as the previous image, but for Attributes).

3. Recode the product_info.php to ensure that both the Options and their Attributes are sorted by the relevant sort_orders. Also make it so that any sort of zero will be the selected attribute…

Now, the Shop Owner can mix up his options and attributes as he pleases. In the example below, I set 3 versions: VHS (-$10), DVD, Blu Ray (+10). Previously, the -$10 VHS option would have been pre-selected. Now the DVD option is pre-selected, even though it is not first in the dropdown list.

and here is how I set it up in the admin screen;

Once I get this delivered to the client, he might want to contribute it to the osCommerce site, I do not know.

12 Replies to “Sorting Options and Attributes in 2.3.1”

  1. Delivered to client. He has tested and found one bug (typo in the code). Resent an updated file. Will await further testing.

  2. I have the same problem in sorting the product, please could you show me the source code for Sorting Options and Attributes in 2.3.1, many thx

  3. I presume that the client I made this for never contributed it, so if you want to do that, I would need to make it again. Contact me on oscshops@gmail.com if you wish to do that. Obviously there would be a cost attached.

  4. I am running 2.3.1 and it doesn’t automatically put the attribute in alphabetical order or order in which it was added if the cost is set to 0 ? We have ring sizes A-Z then Z+1,Z+2,Z+3,Z+4,Z+5 and Z+6 so 32 attributes, and clearly they HAVE to be in order.

  5. Yes, there never has been a native option for sorting options/attributes. Please see my previous comment.

  6. hoi gary
    i m desperate because i have 2 problem with my oscommerce easypop:

    1 about wrong format downloaded prices (easypop give to me csv where the prices are date.our.format)

    2 about showing (not hide) prices in homepage for the catalogue i charge from csv (for the new products created by admin panel it’s ok)

    can you tell me how post on your site or suggest me solutions ?

    i m from italy

    thanks in advance

    kind regards

  7. I have never used easy populate enough to give advice on it. When I need something to update prices, I write a sql to run direct in phpmyadmin. If my clients need something easier, I can build a .csb price updater. EP is not and never has been a favourite of mine.

  8. Written and paid for by a client means it is up to the client to release it for all to use (or not).

    You want to get something coded and then release it to the community – email me.

Leave a Reply

Your email address will not be published. Required fields are marked *