A
A
Aieron2019-07-20 00:09:29
MODX
Aieron, 2019-07-20 00:09:29

How to sort modx option values?

Hello. I have a store on modx revo and I created additional options set values
​​up to 280 cm
up to 330 cm
up to 350 cm
I set up the modifier so that it adds 330 and 350 to 1000 r to the size
, the call of the option itself did this

{'msProductOptions_ext' | snippet : [
    'onlyOptions' => 'height',
    'tpl' => '@INLINE
  {foreach $options as $key => $option}
  <div class="info-line">
    <div class="label">Высота лестницы:</div>
    <div class="delimetr"></div>
    <div class="block-sel-size">
    {if $option.value is array}
    <select name="options[{$key}]">
    {foreach $option.value as $i => $value}
    <option value="{$value}">{$value}</option>
                {/foreach}
                </select>
    {/if}
    </div>
  </div>   
    {/foreach}'
]}

Why did I fill in from 280 to 350 in order, but it mixes in the admin panel as it wants after saving, for example 350 330 280 , respectively, on the product page it is shown from the maximum price ((with hatch sizes it’s even more fun, there are 20 of them and mixed everything like that, that the logic could not be found even with a box of vodka. Apparently, randomly (((
How and where is the main thing (I'm not a very special specialist yet) to prescribe sorting from the minimum value to the maximum, and not just randomly? and it remains, what for he does not understand mixing them at all ((
ps. letters TO and CM values ​​​​are important for sorting? maybe we don’t understand each other and I didn’t fill in something somewhere?
because I did it following the example of extSize Then I added in the msoptions spippet the keys of their additional fields
//$modx->log(1, print_r($options, 1));
if(isset($options['extSize']['value']['luk']['height'])){
    $tmpVal = $options['extSize']['value']['luk']['height'];
    sort($tmpVal);
    $options['extSize']['value']['luk']['height'] = $tmpVal;
}

only this didn’t give a damn) there is some kind of sort here, but I don’t know who tmpval is ( extsize is also out of order, by the way, I just looked ..

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question