Last active
February 2, 2023 14:53
-
-
Save Sentinel-7/356d6a61fbd80ef0bc3e7dc872005b26 to your computer and use it in GitHub Desktop.
Выводим опции с проверкой остатков msOptionsPrice2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{set $tmp = '!msOptionsPrice.modification'|snippet:[ | |
'product' => $_modx->resource.id, | |
'tpl' => 'tpl.msOptionsPrice.modification', | |
'return' => 'data', | |
'processOptions' => 1, | |
'showZeroPrice' => 0 | |
]} | |
{if $tmp?} | |
<div class="size-row"> | |
{'!msOptionsPrice.option' | snippet : [ | |
'options' => 'size,color' ~ $_modx->config.msoptionsprice_include_modification_options, | |
'tpl' => '@INLINE {foreach $options as $name => $values} | |
<div class="card_content_info-label">{("ms2_product_" ~ $name) | lexicon}:</div> | |
<div class="selector"> | |
<select name="options[{$name}]" class="selector__input input-sm form-control" id="option_{$name}"> | |
<option value="" disabled>Пожалуйста, выберите</option> | |
{/foreach} ' | |
]} | |
{foreach $tmp as $key => $row} | |
{set $mod = $row.modification} | |
{set $options = $row.options} | |
{if $mod.count > 0} | |
{foreach $options as $name => $v index=$index} | |
{if ($name|preg_match:'#.key#')}{var $k = $v}{else}{continue}{/if} | |
{set $value = $options[$k~'.value']} | |
{set $caption = $options[$k~'.caption']} | |
{set $unit = $options[$k~'.measure_unit']} | |
<option value="{$value}" name="options[{$k}]" id="options-{$k}-{$key}-{$_modx->resource.id}"> {$value}</option> | |
{/foreach} | |
{/if} | |
{/foreach} | |
</select> | |
</div> | |
</div> | |
{/if} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment