delivery costs are now shown

This commit is contained in:
Senad Uka
2015-07-05 13:22:47 +02:00
parent 52a03f3334
commit f5664dee88
7 changed files with 76 additions and 59 deletions

View File

@@ -1,6 +1,5 @@
var React = require('react'),
Globals = require('../../globals');
;
Globals = require('../../globals');;
var Router = require('react-router');
@@ -8,29 +7,30 @@ var Router = require('react-router');
var CartTotal = React.createClass({
render: function() {
render: function() {
var counts = this.props.itemCounts;
var total = 0;
if (counts && this.props.items) {
var items = this.props.items.models;
for (var i = 0; i < items.length; i++) {
var item = items[i];
var count = counts[item.get('id')].get('count');
var price = item.get('list_price');
total += (price * count)
};
}
if (this.props.deliveryCosts) {
total += Number(this.props.deliveryCosts.get('delivery_price'))
}
var counts = this.props.itemCounts;
var total = 0;
var items = this.props.items.models;
for (var i = 0; i < items.length; i++) {
var item = items[i];
var count = counts[item.get('id')].get('count');
var price = item.get('list_price');
total += (price * count)
};
return ( <span>{Globals.FormatCurrency(total)}</span>);
return ( < span > {
Globals.FormatCurrency(total)
} < /span>);
}
});
module.exports = CartTotal;
module.exports = CartTotal;