Skip to content

Instantly share code, notes, and snippets.

@vgrish
Last active December 14, 2018 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vgrish/0223ac5c801603bef6963f63b632391c to your computer and use it in GitHub Desktop.
Save vgrish/0223ac5c801603bef6963f63b632391c to your computer and use it in GitHub Desktop.
tpl.msOptionsPrice.modification processOptions
<div class="row ms2_product">
<div class="col-md-8">
<form method="post" class="ms2_form">
<a href="{$rid | url}">{$product_pagetitle}</a>
{if $_pls['small']?}
<img src="{$_pls['small']}" alt="{$product_pagetitle}" title="{$product_pagetitle}"/>
{else}
<img src="{'assets_url' | option}components/minishop2/img/web/ms2_small.png"
srcset="{'assets_url' | option}components/minishop2/img/web/ms2_small@2x.png 2x"
alt="{$product_pagetitle}" title="{$product_pagetitle}"/>
{/if}
<span class="flags">
{if $data_new?}
<i class="glyphicon glyphicon-flag" title="{'ms2_frontend_new' | lexicon}"></i>
{/if}
{if $data_popular?}
<i class="glyphicon glyphicon-star" title="{'ms2_frontend_popular' | lexicon}"></i>
{/if}
{if $data_favorite?}
<i class="glyphicon glyphicon-bookmark" title="{'ms2_frontend_favorite' | lexicon}"></i>
{/if}
</span>
<span class="options">
{foreach $options as $name => $value}
{if ($name|preg_match:'#.key#')}{var $k = $value}{else}{continue}{/if}
{$options[$k~'.value']}
{/foreach}
<!--
{if $options?}
<span class="small">
{$options | join : '; '}
</span>
{/if}
-->
</span>
<span class="price">
{$price} {'ms2_frontend_currency' | lexicon}
</span>
{if $old_price?}
<span class="old_price">{$old_price} {'ms2_frontend_currency' | lexicon}</span>
{/if}
{if $article?}
<span class="article">{'ms2_product_article' | lexicon}: {$article}</span>
{/if}
{if $weight?}
<span class="weight">{'ms2_product_weight' | lexicon}
: {$weight} {'ms2_frontend_weight_unit' | lexicon}</span>
{/if}
<input type="hidden" name="id" value="{$rid}">
<input type="hidden" name="count" value="1">
<input type="hidden" name="options" value="[]">
{foreach $options as $name => $value}
{if ($name|preg_match:'#.key#')}{var $k = $value}{else}{continue}{/if}
<input type="hidden" name="options[{$k}]" value="{$options[$k~'.value']}">
{/foreach}
<!--
{foreach $options as $name => $value}
<input type="hidden" name="options[{$name}]" value="{$value}">
{/foreach}
-->
<button class="btn btn-default btn-sm pull-right" type="submit" name="ms2_action" value="cart/add">
<i class="glyphicon glyphicon-barcode"></i> {'ms2_frontend_add_to_cart' | lexicon}
</button>
</form>
</div>
</div>
@vgrish
Copy link
Author

vgrish commented Dec 14, 2018

{set $rows = '!msOptionsPrice.modification'|snippet:[
                                                    'product' => $_modx->resource.id,
                			                        'includeThumbs' => 'product',
                			                        'processOptions' => 1,
                			                        'return' => 'data',
                			                        'limit'=> 0
            			                        ]}
            			                        {include 'modification.options' rows=$rows}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment