| 1 |
import { Product } from '@sale/js/product/product'; |
| 2 |
import { formatCurrency } from '@web/core/currency'; |
| 3 |
import { patch } from '@web/core/utils/patch'; |
| 4 |
|
| 5 |
patch(Product, { |
| 6 |
props: { |
| 7 |
...Product.props, |
| 8 |
strikethrough_price: { type: Number, optional: true }, |
| 9 |
can_be_sold: { type: Boolean, optional: true }, |
| 10 |
// The following fields are needed for tracking. |
| 11 |
category_name: { type: String, optional: true }, |
| 12 |
currency_name: { type: String, optional: true }, |
| 13 |
}, |
| 14 |
}); |
| 15 |
|
| 16 |
patch(Product.prototype, { |
| 17 |
/** |
| 18 |
* Return the strikethrough price, formatted using the environment's currency. |
| 19 |
* |
| 20 |
* @return {String} - The formatted strikethrough price. |
| 21 |
*/ |
| 22 |
get formattedStrikethroughPrice() { |
| 23 |
return formatCurrency(this.props.strikethrough_price, this.env.currency.id); |
| 24 |
}, |
| 25 |
}); |