Jump to content
BrockleyJohn

[Addon] Product Sort Within Category

Recommended Posts

This addon has three simple unavoidable changes to core code and an optional simple change to admin categories. Amended code and instructions are provided for 2.3.4BS Edge but with comparable edits it would work on any 2.3+ store.

It provides the means to change the default order of products with a category on index.php and supports the same product having different values in different categories.

A separate admin page allows you to set all the sort orders within a category at once, and also lets you change the sort order of categories.

Upload link coming when available.


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (Phoenix).

here: on the official osc download page

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites

For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (Phoenix).

here: on the official osc download page

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites

Not sure why I can't add this to the Original addon, but just a little adaption for PHP 7.2 and Dutch language files

oscom-product-sort-within-category-bs-php72.zip


Building great webshops for customers with opensource backoffice application for a robotic accounting solution including POS
Migrating osC 2.x webshops to 2.3.4.x
osCommerce dedicated hosting/colocation + turnkey solutions + building addons per request

Share this post


Link to post
Share on other sites

Thanks for the Dutch language files - they'll be incorporated into the next release which is in line with the Edge changes for 7.2 compatibility. I'm looking at an enhancement for the manager page too.


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (Phoenix).

here: on the official osc download page

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites
On 3/6/2018 at 1:25 PM, BrockleyJohn said:

It provides the means to change the default order of products with a category on index.php and supports the same product having different values in different categories.

A separate admin page allows you to set all the sort orders within a category at once, and also lets you change the sort order of categories.

Very nice John...I just installed it on a site running on the GOLD version.  It was a pretty easy install and does exactly what you described above.   It will certainly  bring some organization to those category pages where the products seemed to be listed randomly.   It is definitely a must have add-on and one that I'll be using  on an ongoing basis.  Well done!  :thumbsup:

Dan

Share this post


Link to post
Share on other sites

I've just uploaded Version 1.1 to the Apps area.

This version incorporates the Dutch language files prepared by Domé.

It adds (by request) the option to view the list of products in a category one page at a time instead of all at once. This option is available on the page itself.


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (Phoenix).

here: on the official osc download page

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites

@BrockleyJohn

Is there any possibility that this will be updated for Phoenix as its the only product sort order that I can find.  I have tried to install it but  the difference in code changes is too much for my pay grade to sort. I found similar code in a few files so don't really know what to change. I got all the admin ones changed.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

I added a couple of sort orders in recently, if you search on PRODUCT_LIST_ORDERED that will give you everywhere you need to change to add a new sort;

https://github.com/gburton/CE-Phoenix/search?q=PRODUCT_LIST_ORDERED

 


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

Thanks for that Gary, I will take a look later. I am really after a custom sort order as over the years I have added more and more products  which are the same or similar to other products already stocked and listed and its nice to get them all grouped together in order within the category. Or am I missing something obvious. Its been a long day.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

IIRC (I haven't played in the admin side for a long time) there is a category sort order feature (where you can input numbers).

I think you just need similar for products;

  1. add in another input on the admin/categories.php page for products "sort_order"
    get that working first so you can insert numbers to sort things

Once that is working;

  1. do the changes as above for "PRODUCT_LIST_ORDERED" but call it "PRODUCT_SORT_ORDERED"
  2. in any SQL change sort by sort_order DESC|ASC as appropriate

It should be `fairly` straightforward, and should not take you more than an hour I'd guess if you break it down into small chunks.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

@burt Hi Gary,

I have integrated this Product Sort Within Category successfully with the core sorting functionality.  I even added the "Product Drag and Sort" you coded many years ago to make custom sorting of the products very easy.  However, in <<general.php>> the function tep_create_sort_heading where the sorting table heading is built, it has the following piece of code:

$sort_suffix = (substr($sortby, 0, 1) == $colnum ? (substr($sortby, 1, 1) == 'a' ? LISTING_SORT_DOWN : LISTING_SORT_UP) : LISTING_SORT_UNSELECTED) . '</a>';

If the number of sort filters >9, substr($sortby, 0, 1) will not return the correct $colnum.  Instead substr($sortby, 0, -1) will work.

This is just for your information - I guess 99.99% of shopowners will not have this issue.

Thanks, Eddy

Share this post


Link to post
Share on other sites
3 minutes ago, Moxamint said:

I even added the "Product Drag and Sort" you coded many years ago

Totally forgot about that.  Well remembered!

 


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites
2 minutes ago, burt said:

Totally forgot about that.  Well remembered!

I actually think it should go into the core...

Eddy

Share this post


Link to post
Share on other sites
Posted (edited)
1 hour ago, 14steve14 said:

Is there any possibility that this will be updated for Phoenix as its the only product sort order that I can find.  I have tried to install it but  the difference in code changes is too much for my pay grade to sort. I found similar code in a few files so don't really know what to change. I got all the admin ones changed.

Hi Steve, move the required code changes from index.php to includes\modules\content\index_products\cm_ip_product_listing.php and I think that's it.

Eddy

Edited by Moxamint

Share this post


Link to post
Share on other sites

@Moxamint @burt

Does the 'Product Drag and Sort' code allow the shop owner to also sort the categories (or sub-categories)? Or, only products?

In addition to includes/modules/content/index_products, does the code changes also have to be applied to includes/modules/content/index_nested ?

M

PS: I too think this should be added to the core.

 


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites
33 minutes ago, Moxamint said:

Hi Steve, move the required code changes from index.php to includes\modules\content\index_products\cm_ip_product_listing.php and I think that's it.

Eddy

Sort of tried that but bits have changed and I was unsure on how to modify the old code to match the new. Now I have said that I hope I was looking in the right place.

 


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites
10 minutes ago, ArtcoInc said:

Does the 'Product Drag and Sort' code allow the shop owner to also sort the categories (or sub-categories)? Or, only products?

Products I think.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites
2 hours ago, 14steve14 said:

@BrockleyJohn

Is there any possibility that this will be updated for Phoenix as its the only product sort order that I can find. 

There is every possibility ;)

It's one of the things on the list...


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (Phoenix).

here: on the official osc download page

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites
1 hour ago, burt said:

Products I think.

There is already sort order on the categories as standard unless I am mistaken.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites
1 hour ago, 14steve14 said:

There is already sort order on the categories as standard unless I am mistaken.

Yes, that's core (but not very user-friendly!)

The sort order manager makes changing it a little easier


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (Phoenix).

here: on the official osc download page

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites
 
 
 
1
6 hours ago, ArtcoInc said:

@Moxamint @burt

Does the 'Product Drag and Sort' code allow the shop owner to also sort the categories (or sub-categories)? Or, only products?

In addition to includes/modules/content/index_products, does the code changes also have to be applied to includes/modules/content/index_nested ?

M

PS: I too think this should be added to the core.

 

The Drag n Sort works for the categories, too.  It takes a few code changes for Gary's mod to use the same database fields that Product Sort Within Category uses, but after that, they work harmoniously together. 

Eddy

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×