Дмитрий

Дмитрий

Был в сети 01 апреля 2023, 11:17
Заказы не принимаю
Вот скрин модификации:


Скрин товара на сайте:


Так выводятся опции «color, memory», опцию «to_order» выводить не нужно, нужно только сделать проверку по ней:
{$_modx->runSnippet('msOptionsPrice.option', [
		'options' => 'color, memory',
		'product' => $id,
		'tpl' => '@FILE chunks/tpl_product_options_iphone.tpl',
		'sortOptions' => 'memory:SORT_ASC:SORT_NUMERIC',
		'processColors' => 1,
		'constraintOptions' => [
			'color' => ['memory']
	]
])}
Чанк «tpl_product_options_iphone.tpl»:
{foreach $options as $name => $values}
    <div class="uk-text-emphasis uk-margin-small-bottom uk-text-center">{('ms2_product_' ~ $name) | lexicon}</div>
    <div class="uk-margin-bottom options_box uk-text-center"
            {if $constraints[$name]}
                data-constraints="{$constraints[$name]| json_encode: 256 | htmlentities}"
            {/if}
    >
        {foreach $values as $value index=$index}
            <label class="radio input-parent">
                <input type="radio" value="{$values[$index]}" name="options[{$name}]"
                       {if $index == 0}checked="checked"{/if}

                        {if $constraints[$name]}
                            data-relations="{$relations[$name][$value]| json_encode: 256 | htmlentities}"
                        {/if}

                />

                {if $colors[$name] && $colors[$name][$value]}

                    {if $colors[$name][$value]['pattern']?}
                         <span title="{$value}" data-uk-tooltip="{$value}" class="uk-background-center-center uk-background-norepeat uk-display-inline-block uk-margin-small-right option_color"
                        style="background-image:url({$colors[$name][$value]['pattern']}); background-position: center; width:40px; height:40px;"></span>
                    {else}
                        <!--<span class="uk-margin-small-right" data-uk-tooltip="{$values[$index]}">{$values[$index]}</span>-->
                <span title="{$values[$index]}" class="uk-display-inline-block uk-margin-small-right option_color" style="background-color:#{$colors[$name][$value]['color']}; width:40px; height:40px;" data-uk-tooltip="title: {$values[$index]}"></span>
                    {/if}

                {else}
                    {if $name=='memory'}
                        <span class="uk-margin-small-right uk-margin-small-bottom rectangle" data-uk-tooltip="{$values[$index]}">{$values[$index]}</span>
                    {else}
                        <span class="uk-margin-small-right" data-uk-tooltip="{$values[$index]}">{$values[$index]}</span>
                    {/if}


                {/if}

            </label>
        {/foreach}
    </div>
{/foreach}