Skip to content

Commit 4a77b61

Browse files
committed
Примеры оформления чанков и шаблонов. Мелкие правки кода
1 parent 3a0d14a commit 4a77b61

File tree

22 files changed

+547
-288
lines changed

22 files changed

+547
-288
lines changed

_build/elements/chunks.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
'tpl.msProducts.row' => 'ms3_products_row',
66

77
'tpl.msCart' => 'ms3_cart',
8+
'tpl.msMiniCart' => 'ms3_minicart',
89
'tpl.msCustomerForm' => 'ms3_customer',
910
'tpl.msOrder' => 'ms3_order',
1011
'tpl.msGetOrder' => 'ms3_get_order',

_build/elements/settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
],
184184
'ms3_order_address_fields' => [
185185
'xtype' => 'textarea',
186-
'value' => 'first_name,last_name,phone,index,country,region,city,metro,street,building,entrance,floor,room,comment,text_address',
186+
'value' => 'first_name,last_name,email,phone,index,country,region,city,metro,street,building,entrance,floor,room,comment,text_address',
187187
'area' => 'ms3_order',
188188
],
189189
'ms3_order_product_fields' => [
Lines changed: 131 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,139 @@
1-
<div id="msCart">
2-
{if $products | length == 0}
3-
<div class="alert alert-warning">
4-
{'ms3_cart_is_empty' | lexicon}
5-
</div>
6-
{else}
1+
{if $products | length == 0}
2+
<div class="alert alert-warning">
3+
{'ms3_cart_is_empty' | lexicon}
4+
</div>
5+
{else}
76

8-
<div class="table-responsive">
9-
<table class="table table-striped">
10-
<tr class="ms-header">
11-
<th class="ms-title">{'ms3_cart_title' | lexicon}</th>
12-
<th class="ms-count">{'ms3_cart_count' | lexicon}</th>
13-
<th class="ms-weight">{'ms3_cart_weight' | lexicon}</th>
14-
<th class="ms-price">{'ms3_cart_price' | lexicon}</th>
15-
<th class="ms-cost">{'ms3_cart_cost' | lexicon}</th>
16-
<th class="ms-remove"></th>
17-
</tr>
7+
<div class="table-responsive">
8+
<table class="table table-striped">
9+
<tr class="ms-header">
10+
<th class="ms-title">{'ms3_cart_title' | lexicon}</th>
11+
<th class="ms-count">{'ms3_cart_count' | lexicon}</th>
12+
<th class="ms-weight">{'ms3_cart_weight' | lexicon}</th>
13+
<th class="ms-price">{'ms3_cart_price' | lexicon}</th>
14+
<th class="ms-cost">{'ms3_cart_cost' | lexicon}</th>
15+
<th class="ms-remove"></th>
16+
</tr>
1817

19-
{foreach $products as $product}
20-
{var $image}
21-
{if $product.thumb?}
22-
<img src="{$product.thumb}" alt="{$product.pagetitle}" title="{$product.pagetitle}"/>
23-
{else}
24-
<img src="{'assets_url' | option}components/minishop3/img/web/ms3_small.png"
25-
srcset="{'assets_url' | option}components/minishop3/img/web/ms3_small@2x.png 2x"
26-
alt="{$product.pagetitle}" title="{$product.pagetitle}"/>
27-
{/if}
28-
{/var}
29-
<tr id="{$product.product_key}">
30-
<td class="ms-title">
31-
<div class="d-flex">
32-
<div class="ms-image mw-100 pr-3">
33-
{if $product.id?}
34-
<a href="{$product.id | url}">{$image}</a>
35-
{else}
36-
{$image}
37-
{/if}
38-
</div>
39-
<div class="title">
40-
{if $product.id?}
41-
<a href="{$product.id | url}">{$product.pagetitle}</a>
42-
{else}
43-
{$product.name}
18+
{foreach $products as $product}
19+
{var $image}
20+
{if $product.thumb?}
21+
<img src="{$product.thumb}" alt="{$product.pagetitle}" title="{$product.pagetitle}"/>
22+
{else}
23+
<img src="{'assets_url' | option}components/minishop3/img/web/ms3_small.png"
24+
srcset="{'assets_url' | option}components/minishop3/img/web/ms3_small@2x.png 2x"
25+
alt="{$product.pagetitle}" title="{$product.pagetitle}"/>
26+
{/if}
27+
{/var}
28+
<tr id="{$product.product_key}">
29+
<td class="ms-title">
30+
<div class="d-flex gap-4">
31+
<div class="ms-image mw-100 pr-3">
32+
{if $product.id?}
33+
<a href="{$product.product_id | url}">{$image}</a>
34+
{else}
35+
{$image}
36+
{/if}
37+
</div>
38+
<div class="ms-title">
39+
{if $product.id?}
40+
<a href="{$product.product_id | url}">{$product.pagetitle}</a>
41+
{else}
42+
{$product.name}
43+
{/if}
44+
{if $product.options?}
45+
{if $product.color && $product.options.color}
46+
<form class="ms3_form mt-2">
47+
<input type="hidden" name="product_key" value="{$product.product_key}">
48+
<input type="hidden" name="ms3_action" value="cart/changeOption"/>
49+
<select name="options[color]" class="form-select ms3_cart_options" style="width:200px;">
50+
<option value="">Выбери цвет</option>
51+
{foreach $product.color as $option}
52+
<option value="{$option}"
53+
{if $product.options.color == $option}selected{/if}>{$option}</option>
54+
{/foreach}
55+
</select>
56+
</form>
4457
{/if}
45-
{if $product.options?}
46-
<div class="small">
47-
{$product.options | join : '; '}
48-
</div>
58+
59+
{if $product.size && $product.options.size}
60+
<form class="ms3_form mt-2">
61+
<input type="hidden" name="product_key" value="{$product.product_key}">
62+
<input type="hidden" name="ms3_action" value="cart/changeOption"/>
63+
<select name="options[size]" class="form-select mt-2 ms3_cart_options"
64+
style="width:200px;">
65+
<option value="">Выбери размер</option>
66+
{foreach $product.size as $option}
67+
<option value="{$option}"
68+
{if $product.options.size == $option}selected{/if}>{$option}</option>
69+
{/foreach}
70+
</select>
71+
</form>
4972
{/if}
50-
</div>
73+
{/if}
5174
</div>
52-
</td>
53-
<td class="ms-count">
54-
<form method="post" class="ms3_form" role="form">
55-
<input type="hidden" name="product_key" value="{$product.product_key}"/>
56-
<input type="hidden" name="ms3_action" value="cart/change">
57-
<div class="form-group">
58-
<div class="input-group input-group-sm">
59-
<input type="number" name="count" value="{$product.count}" class="form-control"/>
60-
<div class="input-group-append">
61-
<span class="input-group-text">{'ms3_frontend_count_unit' | lexicon}</span>
62-
</div>
63-
</div>
64-
<button class="btn btn-sm" type="submit">&#8635;</button>
65-
</div>
66-
</form>
67-
</td>
68-
<td class="ms-weight">
69-
<span class="text-nowrap">{$product.weight} {'ms3_frontend_weight_unit' | lexicon}</span>
70-
</td>
71-
<td class="ms-price">
72-
<span class="mr-2 text-nowrap">{$product.price} {'ms3_frontend_currency' | lexicon}</span>
73-
{if $product.old_price?}
74-
<span class="old_price text-nowrap">{$product.old_price} {'ms3_frontend_currency' | lexicon}</span>
75-
{/if}
76-
</td>
77-
<td class="ms-cost">
78-
<span class="mr-2 text-nowrap"><span class="ms3_cost">{$product.cost}</span> {'ms3_frontend_currency' | lexicon}</span>
79-
</td>
80-
<td class="ms-remove">
81-
<form method="post" class="ms3_form text-md-right">
82-
<input type="hidden" name="product_key" value="{$product.product_key}">
83-
<input type="hidden" name="ms3_action" value="cart/remove">
84-
<button class="btn btn-sm btn-danger" type="submit">&times;</button>
85-
</form>
86-
</td>
87-
</tr>
88-
{/foreach}
75+
</div>
76+
</td>
77+
<td class="ms-count">
78+
<form method="post" class="ms3_form">
79+
<input type="hidden" name="product_key" value="{$product.product_key}"/>
80+
<input type="hidden" name="ms3_action" value="cart/change"/>
8981

90-
<tr class="ms-footer">
91-
<th class="total">{'ms3_cart_total' | lexicon}:</th>
92-
<th class="total_count">
93-
<span class="ms3_total_count">{$total.count}</span>
94-
{'ms3_frontend_count_unit' | lexicon}
95-
</th>
96-
<th class="total_weight text-nowrap" colspan="2">
97-
<span class="ms3_total_weight">{$total.weight}</span>
98-
{'ms3_frontend_weight_unit' | lexicon}
99-
</th>
100-
<th class="total_cost text-nowrap" colspan="2">
101-
<span class="ms3_total_cost">{$total.cost}</span>
102-
{'ms3_frontend_currency' | lexicon}
103-
</th>
82+
<div class="quantity d-flex align-items-center justify-content-start">
83+
<button class="btn btn-primary qty-btn dec-qty" type="button">
84+
-
85+
</button>
86+
<input class="form-control qty-input" type="number" name="count" value="{$product.count}" min="0" style="max-width: 50px;">
87+
<button class="btn btn-primary qty-btn inc-qty" type="button">
88+
+
89+
</button>
90+
</div>
91+
</form>
92+
</td>
93+
<td class="ms-weight">
94+
<span class="text-nowrap">{$product.weight} {'ms3_frontend_weight_unit' | lexicon}</span>
95+
</td>
96+
<td class="ms-price">
97+
<span class="mr-2 text-nowrap">{$product.price} {'ms3_frontend_currency' | lexicon}</span>
98+
{if $product.old_price?}
99+
<span class="old_price text-nowrap">{$product.old_price} {'ms3_frontend_currency' | lexicon}</span>
100+
{/if}
101+
</td>
102+
<td class="ms-cost">
103+
<span class="mr-2 text-nowrap"><span class="ms3_cost">{$product.cost}</span> {'ms3_frontend_currency' | lexicon}</span>
104+
</td>
105+
<td class="ms-remove">
106+
<form method="post" class="ms3_form text-md-right">
107+
<input type="hidden" name="product_key" value="{$product.product_key}">
108+
<input type="hidden" name="ms3_action" value="cart/remove">
109+
<button class="btn btn-sm btn-danger" type="submit">&times;</button>
110+
</form>
111+
</td>
104112
</tr>
105-
</table>
106-
</div>
113+
{/foreach}
114+
115+
<tr class="ms-footer">
116+
<th class="total">{'ms3_cart_total' | lexicon}:</th>
117+
<th class="total_count">
118+
<span class="ms3_total_count">{$total.count}</span>
119+
{'ms3_frontend_count_unit' | lexicon}
120+
</th>
121+
<th class="total_weight text-nowrap" colspan="2">
122+
<span class="ms3_total_weight">{$total.weight}</span>
123+
{'ms3_frontend_weight_unit' | lexicon}
124+
</th>
125+
<th class="total_cost text-nowrap" colspan="2">
126+
<span class="ms3_total_cost">{$total.cost}</span>
127+
{'ms3_frontend_currency' | lexicon}
128+
</th>
129+
</tr>
130+
</table>
131+
</div>
107132

108-
<form method="post" class="ms3_form">
109-
<input type="hidden" name="ms3_action" value="cart/clean">
110-
<button type="submit" class="btn btn-danger">
111-
{'ms3_cart_clean' | lexicon}
112-
</button>
113-
</form>
114-
{/if}
115-
</div>
133+
<form method="post" class="ms3_form">
134+
<input type="hidden" name="ms3_action" value="cart/clean">
135+
<button type="submit" class="btn btn-danger">
136+
{'ms3_cart_clean' | lexicon}
137+
</button>
138+
</form>
139+
{/if}
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
<div id="msGallery">
1+
<div class="msGallery">
22
{if $files?}
3-
<div class="fotorama"
4-
data-nav="thumbs"
5-
data-width="100%"
6-
data-thumbheight="45"
7-
data-allowfullscreen="true"
8-
data-swipe="true"
9-
data-autoplay="5000">
3+
<div class="any_gallery_library">
104
{foreach $files as $file}
115
<a href="{$file['url']}" target="_blank">
126
<img src="{$file['small']}" alt="{$file['description']}" title="{$file['name']}">
137
</a>
148
{/foreach}
159
</div>
1610
{else}
17-
<img src="{('assets_url' | option) ~ 'components/minishop3/img/web/ms2_medium.png'}"
18-
srcset="{('assets_url' | option) ~ 'components/minishop3/img/web/ms2_medium@2x.png'} 2x"
11+
<img src="{('assets_url' | option) ~ 'components/minishop3/img/web/ms3_medium.png'}"
12+
srcset="{('assets_url' | option) ~ 'components/minishop3/img/web/ms3_medium@2x.png'} 2x"
1913
alt="" title=""/>
2014
{/if}
2115
</div>

0 commit comments

Comments
 (0)