Created
November 10, 2016 06:28
-
-
Save vgrish/4b3aea1958808707a830ea8e27512409 to your computer and use it in GitHub Desktop.
tpl.msCart modification
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
{$_modx->lexicon->load('minishop2:product')} | |
<div id="msCart"> | |
{if !count($products)} | |
{'ms2_cart_is_empty' | lexicon} | |
{else} | |
<div class="table-responsive"> | |
<table class="table table-striped"> | |
<tr class="header"> | |
<th class="image"> </th> | |
<th class="title">{'ms2_cart_title' | lexicon}</th> | |
<th class="count">{'ms2_cart_count' | lexicon}</th> | |
<th class="weight">{'ms2_cart_weight' | lexicon}</th> | |
<th class="price">{'ms2_cart_price' | lexicon}</th> | |
<th class="remove">{'ms2_cart_remove' | lexicon}</th> | |
</tr> | |
{foreach $products as $product} | |
<tr id="{$product.key}"> | |
<td class="image"> | |
{if $product.options and $product.options.modification?} | |
{set $modification = $_modx->runSnippet('!msOptionsPrice.modification',[ | |
'product' => $product.id, | |
'includeThumbs' => '120x90', | |
'where' => json_encode([ | |
'msopModification.id' => $product.options.modification | |
]), | |
'return' => 'data' | |
])} | |
{if $modification[0]['120x90']?} | |
{set $product.thumb = $modification[0]['120x90']} | |
{/if} | |
{/if} | |
{if $product.thumb?} | |
<img src="{$product.thumb}" 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/[email protected] 2x" | |
alt="{$product.pagetitle}" title="{$product.pagetitle}"/> | |
{/if} | |
</td> | |
<td class="title"> | |
{if $product.id?} | |
<a href="{$product.id | url}">{$product.pagetitle}</a> | |
{else} | |
{$product.name} | |
{/if} | |
{*print_r($product)*} | |
{if $product.options?} | |
{foreach $product.options as $key => $option} | |
{set $caption = $product[$key ~ '.caption']} | |
{set $caption = $caption ? $caption : ('ms2_product_' ~ $key) | lexicon} | |
{$caption} - {$option} <br> | |
{/foreach} | |
<!-- | |
<div class="small"> | |
{$product.options | join : '; '} | |
</div> | |
--> | |
{/if} | |
</td> | |
<td class="count"> | |
<form method="post" class="ms2_form form-inline" role="form"> | |
<input type="hidden" name="key" value="{$product.key}"/> | |
<div class="form-group"> | |
<input type="number" name="count" value="{$product.count}" | |
class="input-sm form-control"/> | |
<span class="hidden-xs">{'ms2_frontend_count_unit' | lexicon}</span> | |
<button class="btn btn-default" type="submit" name="ms2_action" value="cart/change"> | |
<i class="glyphicon glyphicon-refresh"></i> | |
</button> | |
</div> | |
</form> | |
</td> | |
<td class="weight"> | |
<span>{$product.weight}</span> {'ms2_frontend_weight_unit' | lexicon} | |
</td> | |
<td class="price"> | |
<span>{$product.price}</span> {'ms2_frontend_currency' | lexicon} | |
{if $product.old_price?} | |
<span class="old_price">{$product.old_price} {'ms2_frontend_currency' | lexicon} | |
{/if} | |
</td> | |
<td class="remove"> | |
<form method="post" class="ms2_form"> | |
<input type="hidden" name="key" value="{$product.key}"> | |
<button class="btn btn-default" type="submit" name="ms2_action" value="cart/remove"> | |
<i class="glyphicon glyphicon-remove"></i> | |
</button> | |
</form> | |
</td> | |
</tr> | |
{/foreach} | |
<tr class="footer"> | |
<th class="total" colspan="2">{'ms2_cart_total' | lexicon}:</th> | |
<th class="total_count"> | |
<span class="ms2_total_count">{$total.count}</span> | |
{'ms2_frontend_count_unit' | lexicon} | |
</th> | |
<th class="total_weight"> | |
<span class="ms2_total_weight">{$total.weight}</span> | |
{'ms2_frontend_weight_unit' | lexicon} | |
</th> | |
<th class="total_cost"> | |
<span class="ms2_total_cost">{$total.cost}</span> | |
{'ms2_frontend_currency' | lexicon} | |
</th> | |
<th> </th> | |
</tr> | |
</table> | |
</div> | |
<form method="post"> | |
<button class="btn btn-default" type="submit" name="ms2_action" value="cart/clean"> | |
<i class="glyphicon glyphicon-remove"></i> {'ms2_cart_clean' | lexicon} | |
</button> | |
</form> | |
{/if} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment