Jump to content
Latest News: (loading..)
tgely

sort_order has no function in configuration table

Recommended Posts

Hi all,

 

sort_order field has no functionality in configuration table. We dont need it..

 

Many of installation process and addons use it for nothing. Only one place used in admin/configuration.php sql query code without any results.

 

Change

DROP TABLE IF EXISTS configuration;
CREATE TABLE configuration (
  configuration_id int NOT NULL auto_increment,
  configuration_title varchar(255) NOT NULL,
  configuration_key varchar(255) NOT NULL,
  configuration_value text NOT NULL,
  configuration_description varchar(255) NOT NULL,
  configuration_group_id int NOT NULL,
  sort_order int(5) NULL,
  last_modified datetime NULL,
  date_added datetime NOT NULL,
  use_function varchar(255) NULL,
  set_function varchar(255) NULL,
  PRIMARY KEY (configuration_id)
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

to:

DROP TABLE IF EXISTS configuration;
CREATE TABLE configuration (
  configuration_id int NOT NULL auto_increment,
  configuration_title varchar(255) NOT NULL,
  configuration_key varchar(255) NOT NULL,
  configuration_value text NOT NULL,
  configuration_description varchar(255) NOT NULL,
  configuration_group_id int NOT NULL,
  last_modified datetime NULL,
  date_added datetime NOT NULL,
  use_function varchar(255) NULL,
  set_function varchar(255) NULL,
  PRIMARY KEY (configuration_id)
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

This code change require a lot of modification in oscommerce.sql and thousands of modules.

 

Any thoughts and feedback would be appreciated.

Edited by Gergely

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

The sort order is used to sort the display of entries per page in the admin > configuration box


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 current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

How do you think it? The installation code gives the real order and never the sort_order field.

If installed 1, 2 and 3 you can not insert between 2 and 3.

sort_order int(5)

so the 2.5 or 2,5 are not allowed.


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

10,20,30

 

There is no need to use 1,2,3 - I dont know why this was done historically


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 current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

No need sort_order if the sql install code sequence define step by step the order. Moreover alphabetic order would be more wanted.


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

I think I dont agree (maybe, maybe not)...

 

We need the sort order, it is used a lot, especially in the new content module system to allow the shopowner to change the layout of (eg) the login page, and ordering the box modules in the side columns and so on.  In the bootstrap version, we use the sort order a lot more, to create the design (eg, the footer modules).

Edited by burt

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 current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

The short_order field is not the same as sort order record. Are we talking the same?

 

The "Sort order of display" record get the value from configuration_value field

but the sort order field get the value from sort_order field

 

INSERT INTO configuration 
(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) 
values 
('Sort Order', 'MODULE_BOXES_MANUFACTURER_INFO_SORT_ORDER', '5010', 'Sort order of display. Lowest is displayed first.', '6', '0', now());
as you see '0' value used everywhere for sort_order field. Edited by Gergely

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Ah, I see.  The sort_order is used to display the lists of info as I pointed out in the http://forums.oscommerce.com/topic/399461-sort-order-has-no-function-in-configuration-table/?p=1712051


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 current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

Gigant code change without any results :-) (faster and smaller code)

 

https://github.com/tgely/oscommerce2-1/commit/b3de578d7b194804287376ab4dc08298e0e7f17d

 

and if you have time for testing download the branch:

https://github.com/tgely/oscommerce2-1/archive/configuration_sort_order_field.zip

 

thanks


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

This basically knocks out all the addons that have a sort_order piece of code ??  That's surely undesirable ?

 

Whats the fascination with the sort_order anyway?  It hurts nothing to leave it as it is.


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 current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

sort_order has deprecated for a while so why is it in the codebase?

Not knock out addons if you dont do this:

ALTER TABLE `configuration_group` DROP `sort_order`;
ALTER TABLE `configuration` DROP `sort_order`;

or ignore the table structure modification.


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Yep, that's what I'm meaning - if we nuke this from the DB all the addons that use it would have to be recoded - which means more posts in the forum.  I don't see a reason to remove it...when removing it means a load more questions in the forum, people trying to install things that simply wont install anymore and so on...


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 current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

v3 does separation in osc_modules table.

 

For keep backward compatibility I supposed to use the following mod in install: COMMENT 'deprecated from v2.4'

DROP TABLE IF EXISTS configuration;
CREATE TABLE configuration (
  configuration_id int NOT NULL auto_increment,
  configuration_title varchar(255) NOT NULL,
  configuration_key varchar(255) NOT NULL,
  configuration_value text NOT NULL,
  configuration_description varchar(255) NOT NULL,
  configuration_group_id int NOT NULL,
  sort_order int(5) NULL COMMENT 'deprecated from v2.4',
  last_modified datetime NULL,
  date_added datetime NOT NULL,
  use_function varchar(255) NULL,
  set_function varchar(255) NULL,
  PRIMARY KEY (configuration_id)
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

DROP TABLE IF EXISTS configuration_group;
CREATE TABLE configuration_group (
  configuration_group_id int NOT NULL auto_increment,
  configuration_group_title varchar(64) NOT NULL,
  configuration_group_description varchar(255) NOT NULL,
  sort_order int(5) NULL COMMENT 'deprecated from v2.4',
  visible int(1) DEFAULT '1' NULL,
  PRIMARY KEY (configuration_group_id)
) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Edited by Gergely

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Perhaps the whole configuration handler should be putted under a microscope.

Where in the future we only load the required data per page load, instead of the whole configuration table.

But then we'd have to have some way of deciding what data was required. So we'd need an extra level of database relations that represented whether page A requires a particular piece of configuration. Then we'd need to load both global configuration (required on every page) and page configuration (required for the current page) plus functional configuration (required for whatever we're doing at the time). And of course, we'd sometimes get it wrong.

 

Plus, there are some pieces of configuration that one store uses only on a few pages while another store might use on every catalog page. Case in point: an add-on that shows shipping fees in the cart info box. That makes shipping configuration required on every catalog page. Yet the vanilla sites only require shipping configuration during the checkout process. So that add-on would have to alter a piece of configuration from being checkout specific to being globally available (at least in catalog). That change would need to persist through a site update.

 

The big advantage of the current system is that it is very simple. Load everything all the time. We never have to worry about missing configuration unless it is actually missing from the database. If we change that, we make it harder for most add-on developers, as configuration that used to be globally available now has to be loaded specially.


Always backup before making changes.

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

×