Created
October 30, 2019 14:37
-
-
Save OlegShchavelev/4814b5c15571d0496014f0776b7760b3 to your computer and use it in GitHub Desktop.
prepareData процент между price и old_price
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
{'!mFilter2' | snippet : [ | |
'prepareSnippet' => 'prepareData' | |
]} |
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
<?php | |
if (!is_array($row)) { | |
return '{}'; | |
} | |
$row['dsmc_discount'] = round(100 - (100 * $row['price']/ $row['old_price'])); | |
return json_encode($row); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment