GX-Bug #52088 » QuickEditDivisionByZeroFix.patch
src/GXMainComponents/Extensions/QuickEdit/QuickEditOverviewTooltips.inc.php (revision ) | ||
---|---|---|
89 | 89 |
protected function _getSpecials(QuickEditProductListItem $data) |
90 | 90 |
{ |
91 | 91 |
$expiresDate = $data->getSpecialPriceExpiresDate(); |
92 |
|
|
92 | ||
93 |
$dividedByPrice = $data->getPrice(); |
|
94 | ||
95 |
if($dividedByPrice == 0) |
|
96 |
{ |
|
97 |
$dividedByPrice = 1; |
|
98 |
} |
|
99 | ||
93 | 100 |
$templateData['specials'] = [ |
94 | 101 |
'products_id' => $data->getId(), |
95 | 102 |
'products_price' => $data->getPrice(), |
96 | 103 |
'special_price_id' => $data->getSpecialPriceId(), |
97 |
'special_price_percentage' => round(abs(($data->getPrice() - $data->getSpecialPrice()) / $data->getPrice()
|
|
104 |
'special_price_percentage' => round(abs(($data->getPrice() - $data->getSpecialPrice()) / $dividedByPrice
|
|
98 | 105 |
* 100), 2), |
99 | 106 |
'special_price' => $data->getSpecialPriceId() !== 0 ? $data->getSpecialPrice() : false, |
100 | 107 |
'special_price_expires_date' => $expiresDate !== '01.01.1970' && $expiresDate !== '01.01.1000' ? $expiresDate : '-', |