Skip to content

Commit

Permalink
Merge pull request #6 from butopea/develop
Browse files Browse the repository at this point in the history
Added discount
  • Loading branch information
Mohammad Tomaraei authored Nov 23, 2021
2 parents ebedb88 + 9906d41 commit eab5cb4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/catalog/controller/vsbridge/products.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,11 @@ public function populateProducts($input){
// Add the 'sale' label if the product is on sale
$product_array['sale'] = isset($special_price_incl_tax) ? '1' : '0';

// Discount percentage
$product_array['discount'] = round(
100 - (($product_array['final_price'] / $product_array['regular_price']) * 100)
);

array_push($response, $product_array);
}
}
Expand Down

0 comments on commit eab5cb4

Please sign in to comment.