Skip to content

Commit f835084

Browse files
author
Marcel Schmäing
committed
Merge pull request #2748 in SW/shopware from sw-12024/5.0/introduce-has-pseudoprice-property to 5.0
* commit '3bb1f52cd09081d7af3599bceaf4dca9019cb1a0': SW-12024 - Introduce has_pseudoprice property
2 parents c747113 + 3bb1f52 commit f835084

File tree

23 files changed

+166
-154
lines changed

23 files changed

+166
-154
lines changed

engine/Library/Enlight/Template/Plugins/modifier.number.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,14 @@
2727
*
2828
* @link http://framework.zend.com/manual/de/zend.locale.parsing.html
2929
* @param int|float $value
30-
* @param array $options
30+
* @param array $format
3131
* @return mixed
3232
*/
33-
function smarty_modifier_number($value, $options = array())
33+
function smarty_modifier_number($value, $format = array())
3434
{
35-
$options['locale'] = empty($options['locale']) ? Enlight_Application::Instance()->Locale() : $options['locale'];
36-
$options['precision'] = empty($options['precision']) ? 2 : $options['precision'];
37-
38-
//remove all separators
39-
$value = str_replace(['.', ','], '', $value, $availableSeparators);
40-
41-
// add decimal separator
42-
if ($availableSeparators > 0) {
43-
$value = substr_replace($value, '.', strlen($value) - $options['precision'], 0);
35+
if (empty($format['locale'])) {
36+
$format['locale'] = Enlight_Application::Instance()->Locale();
4437
}
45-
return Zend_Locale_Format::toNumber($value, $options);
38+
39+
return Zend_Locale_Format::toNumber($value, $format);
4640
}

engine/Shopware/Components/Compatibility/LegacyStructConverter.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,11 @@ public function convertListProductStruct(StoreFrontBundle\Struct\ListProduct $pr
190190
$promotion = array_merge(
191191
$promotion,
192192
array(
193+
'has_pseudoprice' => $cheapestPrice->getCalculatedPseudoPrice() > $cheapestPrice->getCalculatedPrice(),
193194
'price' => $price,
195+
'price_numeric' => $cheapestPrice->getCalculatedPrice(),
194196
'pseudoprice' => $pseudoPrice,
197+
'pseudoprice_numeric' => $cheapestPrice->getCalculatedPseudoPrice(),
195198
'pricegroup' => $cheapestPrice->getCustomerGroup()->getKey(),
196199
)
197200
);
@@ -228,10 +231,10 @@ public function convertListProductStruct(StoreFrontBundle\Struct\ListProduct $pr
228231
$promotion['image'] = $this->convertMediaStruct($product->getCover());
229232
}
230233

231-
234+
232235
if ($product->getVoteAverage()) {
233236
$promotion['sVoteAverage'] = $this->convertVoteAverageStruct($product->getVoteAverage());
234-
237+
235238
/** @deprecated sVoteAverange value, use sVoteAverage instead */
236239
$promotion['sVoteAverange'] = $promotion['sVoteAverage'];
237240
}
@@ -282,13 +285,11 @@ public function convertProductStruct(StoreFrontBundle\Struct\Product $product)
282285
/** @var $variantPrice StoreFrontBundle\Struct\Product\Price */
283286
$variantPrice = $product->getVariantPrice();
284287

285-
$data['price'] = $this->sFormatPrice(
286-
$variantPrice->getCalculatedPrice()
287-
);
288-
289-
$data['pseudoprice'] = $this->sFormatPrice(
290-
$variantPrice->getCalculatedPseudoPrice()
291-
);
288+
$data['price'] = $this->sFormatPrice($variantPrice->getCalculatedPrice());
289+
$data['price_numeric'] = $variantPrice->getCalculatedPrice();
290+
$data['pseudoprice'] = $this->sFormatPrice($variantPrice->getCalculatedPseudoPrice());
291+
$data['pseudoprice_numeric'] = $variantPrice->getCalculatedPseudoPrice();
292+
$data['has_pseudoprice'] = $variantPrice->getCalculatedPseudoPrice() > $variantPrice->getCalculatedPrice();
292293

293294
if ($variantPrice->getCalculatedPseudoPrice()) {
294295
$discPseudo = $variantPrice->getCalculatedPseudoPrice();
@@ -332,14 +333,14 @@ public function convertProductStruct(StoreFrontBundle\Struct\Product $product)
332333
}
333334

334335
$data['sVoteAverage'] = array('average' => 0, 'count' => 0);
335-
336+
336337
/** @deprecated averange value, use average instead */
337338
$data['sVoteAverage']['averange'] = 0;
338-
339+
339340
if ($product->getVoteAverage()) {
340341
$data['sVoteAverage'] = $this->convertVoteAverageStruct($product->getVoteAverage());
341342
}
342-
343+
343344
/** @deprecated sVoteAverange value, use sVoteAverage instead */
344345
$data['sVoteAverange'] = $data['sVoteAverage'];
345346

@@ -406,7 +407,7 @@ public function convertVoteAverageStruct(StoreFrontBundle\Struct\Product\VoteAve
406407
);
407408

408409
$data['attributes'] = $average->getAttributes();
409-
410+
410411
/** @deprecated averange value, use average instead */
411412
$data['averange'] = $data['average'];
412413

engine/Shopware/Core/sAdmin.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4247,6 +4247,8 @@ private function processOpenOrderDetails($orderValue, $getOrders, $orderKey)
42474247
$getOrderDetails[$orderDetailsKey]['currentPseudoprice'] = $tmpArticle['pseudoprice'];
42484248
}
42494249

4250+
$getOrderDetails[$orderDetailsKey]['currentHas_pseudoprice'] = $tmpArticle['has_pseudoprice'];
4251+
42504252
// Set article in deactivate state if it's an variant or configurator article
42514253
if ($tmpArticle['sVariantArticle'] === true || $tmpArticle['sConfigurator'] === true) {
42524254
$getOrderDetails[$orderDetailsKey]['active'] = 0;

templates/_emotion/frontend/account/order_item.tpl

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
<div class="grid_3">
66
{$offerPosition.datum|date}
77
</div>
8-
8+
99
<div class="grid_2 bold">
1010
{$offerPosition.ordernumber}
1111
</div>
12-
12+
1313
<div class="grid_3">
1414
{if $offerPosition.dispatch.name}
1515
{$offerPosition.dispatch.name}
1616
{else}
1717
{se name="OrderInfoNoDispatch"}{/se}
1818
{/if}
1919
</div>
20-
20+
2121
<div class="grid_5">
2222
<div class="status{$offerPosition.status}">&nbsp;</div>
2323
{if $offerPosition.status==0}
@@ -40,7 +40,7 @@
4040
{se name="OrderItemInfoClarificationNeeded"}{/se}
4141
{/if}
4242
</div>
43-
43+
4444
<div class="grid_2">
4545
<div class="textright">
4646
<strong>
@@ -76,22 +76,22 @@
7676
</div>
7777
</div>
7878
{/block}
79-
79+
8080
<input type="hidden" name="sAddAccessories" value="{$ordernumber|escape}" />
8181
{foreach from=$offerPosition.details item=article}
8282
<div class="table_row">
83-
83+
8484
<div class="grid_8">
8585
{block name='frontend_account_order_item_name'}
86-
86+
8787
{* Name *}
8888
{if $article.modus == 10}
8989
<strong class="articleName">{se name='OrderItemInfoBundle'}{/se}</strong>
9090
{else}
9191
<strong class="articleName">{$article.name}</strong>
92-
{/if}
92+
{/if}
9393
{/block}
94-
94+
9595
{block name='frontend_account_order_item_unitprice'}
9696
{if $article.purchaseunit}
9797
<div class="article_price_unit">
@@ -110,14 +110,14 @@
110110
<div class="currentPrice">
111111
{if $article.currentPrice}
112112
<strong>{se name="OrderItemInfoCurrentPrice"}{/se}:</strong>
113-
{if $article.currentPseudoprice|number > $article.currentPrice|number}
113+
{if $article.currentHas_pseudoprice}
114114
<em>{s name="reducedPrice" namespace="frontend/listing/box_article"}{/s} {$article.currentPseudoprice|currency} {s name="Star" namespace="frontend/listing/box_article"}{/s}</em>
115115
{/if}
116116
{$article.currentPrice|currency} {s name="Star" namespace="frontend/listing/box_article"}{/s}
117117
{/if}
118118
</div>
119119
{/block}
120-
120+
121121
{block name='frontend_account_order_item_downloadlink'}
122122
{* If ESD-Article *}
123123
{if $article.esdarticle && $offerPosition.cleared|in_array:$sDownloadAvailablePaymentStatus}
@@ -131,15 +131,15 @@
131131
{/if}
132132
{/block}
133133
</div>
134-
134+
135135
<div class="grid_2 center">
136136
<div class="center">
137137
{block name='frontend_account_order_item_quantity'}
138138
{$article.quantity}
139139
{/block}
140140
</div>
141141
</div>
142-
142+
143143
<div class="grid_3 textright">
144144
<div class="textright">
145145
{block name='frontend_account_order_item_price'}
@@ -151,7 +151,7 @@
151151
{/block}
152152
</div>
153153
</div>
154-
154+
155155
<div class="grid_2 bold textright">
156156
<div class="textright">
157157
<strong>
@@ -167,7 +167,7 @@
167167
</div>
168168
</div>
169169
{/foreach}
170-
170+
171171
<div class="table_foot">
172172
<div class="grid_3">
173173
{block name="frontend_account_order_item_label_date"}
@@ -176,14 +176,14 @@
176176
<strong>{se name="OrderItemColumnDate"}{/se}</strong>
177177
</p>
178178
{/block}
179-
179+
180180
{block name="frontend_account_order_item_label_ordernumber"}
181181
<p>
182182
{* Order number *}
183183
<strong>{se name="OrderItemColumnId"}{/se}</strong>
184184
</p>
185185
{/block}
186-
186+
187187
{block name="frontend_account_order_item_label_dispatch"}
188188
{if $offerPosition.dispatch}
189189
<p>
@@ -192,46 +192,46 @@
192192
</p>
193193
{/if}
194194
{/block}
195-
195+
196196
{block name="frontend_account_order_item_label_trackingcode"}
197197
{if $offerPosition.trackingcode}
198198
<p>
199199
{* Package tracking code *}
200-
<strong>{se name="OrderItemColumnTracking"}{/se}</strong>
200+
<strong>{se name="OrderItemColumnTracking"}{/se}</strong>
201201
</p>
202202
{/if}
203203
{/block}
204204
</div>
205-
205+
206206
<div class="grid_3">
207207
{block name='frontend_account_order_item_date'}
208208
<p>
209209
{$offerPosition.datum|date}
210210
</p>
211211
{/block}
212-
212+
213213
{block name='frontend_account_order_item_ordernumber'}
214214
<p>
215215
{$offerPosition.ordernumber}
216216
</p>
217217
{/block}
218-
218+
219219
{block name='frontend_account_order_item_dispatch'}
220220
{if $offerPosition.dispatch}
221221
<p>
222222
{$offerPosition.dispatch.name}
223223
</p>
224224
{/if}
225225
{/block}
226-
226+
227227
{block name='frontend_account_order_item_trackingcode'}
228228
{if $offerPosition.trackingcode}
229229
<p>
230230
{if $offerPosition.dispatch.status_link}
231231
{eval var=$offerPosition.dispatch.status_link}
232232
{else}
233233
{$offerPosition.trackingcode}
234-
{/if}
234+
{/if}
235235
</p>
236236
{/if}
237237
{/block}
@@ -263,7 +263,7 @@
263263
{$offerPosition.invoice_shipping} {$offerPosition.currency_html}
264264
</p>
265265
{/block}
266-
266+
267267
{block name="frontend_acccount_order_item_amount"}
268268
{if $offerPosition.taxfree}
269269
<p class="bold">
@@ -278,39 +278,39 @@
278278
</div>
279279
</div>
280280
<div class="clear">&nbsp;</div>
281-
281+
282282
{* Repeat order *}
283283
{block name="frontend_account_order_item_repeat_order"}
284284
<form method="post" action="{url controller='checkout' action='add_accessories'}">
285285
{foreach from=$offerPosition.details item=article}{if $article.modus == 0}
286286
<input name="sAddAccessories[]" type="hidden" value="{$article.articleordernumber|escape}" />
287287
<input name="sAddAccessoriesQuantity[]" type="hidden" value="{$article.quantity|escape}" />
288288
{/if}{/foreach}
289-
289+
290290
{if $offerPosition.activeBuyButton}
291291
<input type="submit" class="button-right small_right" value="{s name='OrderLinkRepeat'}{/s}" />
292292
{/if}
293293
</form>
294294
{/block}
295-
295+
296296
<div class="doublespace">&nbsp;</div>
297297
{if $offerPosition.customercomment}
298298
<h4 class="bold">{se name="OrderItemCustomerComment"}Ihr Kommentar{/se}</h4>
299299
<blockquote>
300300
{$offerPosition.customercomment}
301301
</blockquote>
302302
{/if}
303-
303+
304304
<div class="space">&nbsp;</div>
305-
305+
306306
{if $offerPosition.comment}
307307
<h4 class="bold">{se name="OrderItemComment"}Unser Kommentar{/se}</h4>
308308
<blockquote>
309309
{$offerPosition.comment}
310310
</blockquote>
311311
{/if}
312312

313-
313+
314314
</div>
315315
</div>
316316
</div>

templates/_emotion/frontend/checkout/ajax_add_article.tpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="heading">
22
<h2>{if !$sBasketInfo}{s name="AjaxAddHeader"}{/s}{else}{s name='AjaxAddHeaderError'}Hinweis:{/s}{/if}</h2>
3-
3+
44
{* Close button *}
55
<a href="#" class="modal_close" title="{s name='LoginActionClose'}{/s}">
66
{s name='LoginActionClose'}{/s}
@@ -59,7 +59,7 @@
5959
<div class="space">&nbsp;</div>
6060
</div>
6161
{/block}
62-
62+
6363
<div class="bottom">
6464
{block name='frontend_checkout_ajax_add_article_cross_selling'}
6565
{if $sCrossSimilarShown|@count || $sCrossBoughtToo|@count}
@@ -99,9 +99,9 @@
9999
{/if}
100100

101101
<p class="price">
102-
<span class="price{if $article.pseudoprice|number > $article.price|number} pseudo{/if}">
102+
<span class="price{if $article.has_pseudoprice} pseudo{/if}">
103103
{if $article.priceStartingFrom && !$article.liveshoppingData}{s name='ListingBoxArticleStartsAt'}{/s} {/if}{$article.price|currency} {s name="Star" namespace="frontend/listing/box_article"}{/s}
104-
{if $article.pseudoprice|number > $article.price|number}
104+
{if $article.has_pseudoprice}
105105
<em>{s name="reducedPrice" namespace="frontend/listing/box_article"}{/s} {$article.pseudoprice|currency} {s name="Star" namespace="frontend/listing/box_article"}{/s}</em>
106106
{/if}
107107
</span>
@@ -116,4 +116,4 @@
116116
{/if}
117117
{/block}
118118
</div>
119-
</div>
119+
</div>

0 commit comments

Comments
 (0)