Jump to content

Change Features value order V 1.6


ashadweb

Recommended Posts

  • 2 weeks later...

Hmm, I expected when adding something like ORDER BY fv.id_feature_value would do the trick, but 'somewhere' after getting the data it 'mixes it up' and reorders according to alphabetical order... :-(

 

No Idea yet... Witt try later. coming week on holiday, so please be patient...

 

pascal

Link to comment
Share on other sites

  • 10 months later...

Hello,

I know this is an old post, but I wondered if you found a solution.
Indeed, I tried to add ORDER BY information on Blocklayered.php without success. I also think there is something to do elsewhere.

Thanks,
Florent
 

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

Can't find any proper solution. Even if you make proper changes in sql query, all features' values are generated still in default order. Only workaround I've come up with is to add some number combination to each value and remove this part in .tpl file. Example:

Feature: SIZE

Values (in order presta is using): L  M  S  XL  XXL

What we want is: S  M  L  XL  XXL

So you need to change vaules to: 01_S  02_M  03_L  04_XL  05_XXL
To avoid this in url just fill URL field without this added part.

Now in /themes/your_theme/modules/blocklayered/blocklayered.tpl find (around line 100 in 1.6.1.17):

<label for="layered_{$filter.type_lite}_{$id_value}"{if !$value.nbr} class="disabled"{else}{if isset($filter.is_color_group) && $filter.is_color_group} name="layered_{$filter.type_lite}_{$id_value}" class="layered_color" data-rel="{$id_value}_{$filter.id_key}"{/if}{/if}>
	{if !$value.nbr}
		{$value.name|escape:'html':'UTF-8'}{if $layered_show_qties}<span> ({$value.nbr})</span>{/if}
	{else}
		<a href="{$value.link}"{if $value.rel|trim != ''} data-rel="{$value.rel}"{/if}>{$value.name|escape:'html':'UTF-8'}{if $layered_show_qties}<span> ({$value.nbr})</span>{/if}</a>
	{/if}
</label>

 

and change both

{$value.name|escape:'html':'UTF-8'}

to

{$value.name|escape:'html':'UTF-8'|regex_replace:"/^[0-9][0-9]_/":""}

or
 

{$value.name|escape:'html':'UTF-8'|regex_replace:"/^\d\d_/":""}

 

This will remove all double digits followed by _ from the beginning of each label. You can choose whatever you want to add to values names. Just make sure your regex is correct.

Link to comment
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
×
×
  • Create New...