almost finished new design on product page / reproduced bug with amount not updating

This commit is contained in:
Senad Uka
2015-05-13 16:32:53 +02:00
parent fe452d359f
commit 49dd10acbc
16 changed files with 158 additions and 234 deletions

View File

@@ -101,6 +101,19 @@ var takeItemOut = function(itemId) {
saveCartStateForItem(itemId);
};
var setItemCount = function(itemId, count) {
var state = states[itemId] || new ItemInCart({
item_id: itemId,
count: 0
})
console.log("Old state", state.get('count'));
state.set('count', state.get('count') + count);
console.log("New state", state.get('count'));
states[itemId] = state;
saveCartStateForItem(itemId);
}
var changeDeliveryDestinationProperty = function(property, value) {
_deliveryDestination.set(property, value);
@@ -274,6 +287,9 @@ AppDispatcher.register(function(payload) {
case CartConstants.CONFIRM_DELIVERY:
saveDeliveryDestination();
break;
case CartConstants.SET_ITEM_COUNT:
setItemCount(action.itemId, action.count);
break;
default:
return true;
}