Add new ordering to Characteristics popup

  • Posts: 180
  • Thank you received: 13
12 years 6 months ago #50040

Currently there are 2 options for sorting of the product Characteristics, which determines the order they appear in the popup displayed in the front-end. This is set by the option "Characteristics values ordering" under "System->Configuration->DIsplay".

This does not cater the ordering in certain situations. e.g. We start with "Sizes" Small, Medium, Large. Ordering by ID caters for this scenario OK at this point. But later we add X-Small and X-Large.

The correct ordering should be "X-Small, Small, Medium, Large, X-Large" ...
... but with ID sorting we have "Small, Medium, Large, X-Small, X-Large" ...
... and with name ordering we have "Large, Medium, Small, X-Large, X-Small".

I am looking to add my own ordering column, but I can not see where the ordering is use for the front end. I found code in two view.html.php files with the following:

   if($config->get('characteristics_values_sorting')=='old'){
      $order = 'characteristic_id ASC';
   }else{
      $order = 'characteristic_value ASC';
   }

But changing these does not effect the way the pop-up is displayed on the front end.

Any help would be appreciated.

Last edit: 12 years 6 months ago by esotechie.

Please Log in or Create an account to join the conversation.

  • Posts: 82822
  • Thank you received: 13369
  • MODERATOR
12 years 6 months ago #50104

There is no ordering column for characteristic values.

Change that code to :
$order = 'characteristic_alias ASC';

and then set the alias for each of your values via phpmyadmin in the table "hikashop_characteristic". I don't see any other "easy" alternative.

Please Log in or Create an account to join the conversation.

  • Posts: 180
  • Thank you received: 13
12 years 6 months ago #50126

Thank you for the response Nocolas.

It seems that I did not make myself clear. Changing the code in these two files has absolutely no effect on the popup shown in the front-end. As a test I set the sort to be by id in the settings, and then change the code to the following:

     //if($config->get('characteristics_values_sorting')=='old'){
     //	$order = 'characteristic_id ASC';
     //}else{
     //	$order = 'characteristic_value ASC';
     //}
 
     $order = 'characteristic_value ASC';

In the front end the sort is still by ID. If I change the settings, the sort changes, so the two view.html.php files are not the correct files to change. What I was asking is if someone could tell me which file I actually need to change.

Last edit: 12 years 6 months ago by esotechie.

Please Log in or Create an account to join the conversation.

  • Posts: 82822
  • Thank you received: 13369
  • MODERATOR
12 years 6 months ago #50166

That's actually where you need to change that (note that this code is in two places in that file).
Also, you didn't change the code, like I said. It's characteristic_alias not characteristic_value.
Finally, that won't work as long as you don't set your ordering in the "characteristic_alias column of the table hiakshop_characteristic via phpmyadmin.

The following user(s) said Thank You: esotechie

Please Log in or Create an account to join the conversation.

  • Posts: 180
  • Thank you received: 13
12 years 6 months ago #50177

Thanks for taking the time Nicolas.

I had changed the code by commenting out the original config if statement and setting it to be by name in order to test that I have the correct place in the code. I tested by setting the config to use ID and had the code use the name, so I can see if a code change in that place would work.

As it happens I had not seen the second instance further down in the code. Changing the code there worked like a charm.

Thank you very much indeed for the help, I am happy to continue from here :)

I personally think a sort column would be more suitable for the task, as neither ID or Name are suitable for characteristics such as Size.

Please Log in or Create an account to join the conversation.

  • Posts: 82822
  • Thank you received: 13369
  • MODERATOR
12 years 6 months ago #50234

In 95% of the cases, it is enough like it is now, but I agree that a sorting system would help.

The following user(s) said Thank You: esotechie

Please Log in or Create an account to join the conversation.

Time to create page: 0.064 seconds
Powered by Kunena Forum