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

@@ -53,33 +53,34 @@ var fetchItemWithDetails = function() {
}
var fetchItemsByCategory = function(categoryId, offset, limit, query) {
//var items = _itemsByCategory;
var items = new ItemCollection();
items.clearFilter();
items.setClassificationType(2);
items.setClassificationId(categoryId);
items.setLimit(limit);
items.setOffset(offset);
//var items = _itemsByCategory;
var items = new ItemCollection();
items.clearFilter();
items.setClassificationType(2);
items.setClassificationId(categoryId);
items.setLimit(limit);
items.setOffset(offset);
for(var key in query) {
if (query.hasOwnProperty(key) && key != 'limit' && key !='offset') {
items.addFilter(key, query[key]);
for (var key in query) {
if (query.hasOwnProperty(key) && key != 'limit' && key != 'offset') {
items.addFilter(key, query[key]);
}
}
}
items.fetch({
success: function(collection, response, options) {
var total = options.xhr.getResponseHeader('x-total-count');
items.setTotalCount(total);
items.fetch({
success: function(collection, response, options) {
var total = options.xhr.getResponseHeader('x-total-count');
items.setTotalCount(total);
ItemStore.emitChange();
}});
ItemStore.emitChange();
}
});
_itemsByCategory = items;
_itemsByCategory = items;
};
var fetchBestSellingItemsForSection = function(sectionId) {
console.log('getting section', sectionId);
console.log('getting section', sectionId);
var items = _bestSellingForSection;
items.setClassificationType(1);
items.setClassificationId(sectionId);
@@ -87,15 +88,15 @@ var fetchBestSellingItemsForSection = function(sectionId) {
items.setOffset(0);
items.fetch({
success: function() {
ItemStore.emitChange();
}
success: function() {
ItemStore.emitChange();
}
});
};
var fetchBestSellingItemsForGroup = function(groupId) {
console.log('getting group', groupId);
console.log('getting group', groupId);
var items = _bestSellingForGroup;
items.setClassificationType(4);
items.setClassificationId(groupId);
@@ -103,9 +104,9 @@ var fetchBestSellingItemsForGroup = function(groupId) {
items.setOffset(0);
items.fetch({
success: function() {
ItemStore.emitChange();
}
success: function() {
ItemStore.emitChange();
}
});
};
@@ -113,19 +114,19 @@ var fetchBestSellingItemsForGroup = function(groupId) {
// Extend ItemStore with EventEmitter to add eventing capabilities
var ItemStore = _.extend({}, EventEmitter.prototype, {
getItemsForCategory: function() {
return _itemsByCategory;
},
getItemsForCategory: function() {
return _itemsByCategory;
},
getBestSellingForSection: function() {
return _bestSellingForSection;
return _bestSellingForSection;
},
// item with details
getLoadedItemWithDetails: function() {
return _itemWithDetails;
},
getItemsForGroup: function () {
getItemsForGroup: function() {
return _bestSellingForGroup;
},
@@ -190,4 +191,4 @@ AppDispatcher.register(function(payload) {
});
module.exports = ItemStore;
module.exports = ItemStore;