|
@@ -3395,7 +3395,8 @@
|
|
|
sqlite3 *db = [iSalesDB get_db];
|
|
sqlite3 *db = [iSalesDB get_db];
|
|
|
[iSalesDB AddExFunction:db];
|
|
[iSalesDB AddExFunction:db];
|
|
|
|
|
|
|
|
- int count = [iSalesDB get_recordcount:db table:@"model" where:[NSString stringWithFormat:@"category like'%%#%@#%%'",category]];
|
|
|
|
|
|
|
+ int count;
|
|
|
|
|
+ NSString *where = [NSString stringWithFormat:@"category like'%%#%@#%%'",category];
|
|
|
|
|
|
|
|
|
|
|
|
|
NSString *sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout from model m left join wishlist w on m.product_id=w.product_id where m.category like'%%#%@#%%' order by m.name limit %d offset %d ;",category,limit, offset];
|
|
NSString *sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout from model m left join wishlist w on m.product_id=w.product_id where m.category like'%%#%@#%%' order by m.name limit %d offset %d ;",category,limit, offset];
|
|
@@ -3441,8 +3442,8 @@
|
|
|
|
|
|
|
|
// best seller
|
|
// best seller
|
|
|
[self check:params[@"bestseller"] valueKey:@"best_seller" inDictionary:filter];
|
|
[self check:params[@"bestseller"] valueKey:@"best_seller" inDictionary:filter];
|
|
|
- NSString *best_seller = @"m.name asc";
|
|
|
|
|
- NSString *order_best_seller = @"";
|
|
|
|
|
|
|
+ NSString *best_seller = @"";
|
|
|
|
|
+ NSString *order_best_seller = @"m.name asc";
|
|
|
if ([params[@"bestseller"] isEqualToString:@"Yes"]) {
|
|
if ([params[@"bestseller"] isEqualToString:@"Yes"]) {
|
|
|
best_seller = @"and best_seller > 0";
|
|
best_seller = @"and best_seller > 0";
|
|
|
order_best_seller = @"m.best_seller desc";
|
|
order_best_seller = @"m.best_seller desc";
|
|
@@ -3495,9 +3496,13 @@
|
|
|
// where bestseller > 0 order by bestseller desc
|
|
// where bestseller > 0 order by bestseller desc
|
|
|
// sql query: alert availability(int) best_seller(int) price qty
|
|
// sql query: alert availability(int) best_seller(int) price qty
|
|
|
sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout from (select name,description,product_id,closeout,best_seller from model where %@ %@ %@ %@ %@ %@) m left join wishlist w on m.product_id=w.product_id order by %@ limit %d offset %d;",cateWhere,best_seller,alert,available_condition,qty,price,order_best_seller,limit,offset];
|
|
sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout from (select name,description,product_id,closeout,best_seller from model where %@ %@ %@ %@ %@ %@) m left join wishlist w on m.product_id=w.product_id order by %@ limit %d offset %d;",cateWhere,best_seller,alert,available_condition,qty,price,order_best_seller,limit,offset];
|
|
|
|
|
+
|
|
|
|
|
+ where =[NSString stringWithFormat:@"%@ %@ %@ %@ %@ %@",cateWhere,best_seller,alert,available_condition,qty,price];
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ count = [iSalesDB get_recordcount:db table:@"model" where:where];
|
|
|
|
|
+
|
|
|
if (!appDelegate.user) {
|
|
if (!appDelegate.user) {
|
|
|
[filter setValue:@{@"count" : @(0)} forKey:@"price"];
|
|
[filter setValue:@{@"count" : @(0)} forKey:@"price"];
|
|
|
}
|
|
}
|
|
@@ -3505,6 +3510,7 @@
|
|
|
[ret setValue:filter forKey:@"filter"];
|
|
[ret setValue:filter forKey:@"filter"];
|
|
|
|
|
|
|
|
DebugLog(@"offline_category sql:%@",sqlQuery);
|
|
DebugLog(@"offline_category sql:%@",sqlQuery);
|
|
|
|
|
+
|
|
|
sqlite3_stmt * statement;
|
|
sqlite3_stmt * statement;
|
|
|
[ret setValue:@"2" forKey:@"result"];
|
|
[ret setValue:@"2" forKey:@"result"];
|
|
|
[ret setValue:[NSString stringWithFormat:@"%d",count] forKey:@"item_total_count"];
|
|
[ret setValue:[NSString stringWithFormat:@"%d",count] forKey:@"item_total_count"];
|
|
@@ -3633,6 +3639,8 @@
|
|
|
sqlite3 *db = [iSalesDB get_db];
|
|
sqlite3 *db = [iSalesDB get_db];
|
|
|
[iSalesDB AddExFunction:db];
|
|
[iSalesDB AddExFunction:db];
|
|
|
|
|
|
|
|
|
|
+#warning count 在filter情况下不能使用get_recordcount:table:where:
|
|
|
|
|
+ int count;
|
|
|
|
|
|
|
|
NSString *sqlQuery = nil;
|
|
NSString *sqlQuery = nil;
|
|
|
sqlQuery=[NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout from model m left join wishlist w on m.product_id=w.product_id where %@ order by %@ limit %d offset %d ;",where,orderby,limit, offset];
|
|
sqlQuery=[NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout from model m left join wishlist w on m.product_id=w.product_id where %@ order by %@ limit %d offset %d ;",where,orderby,limit, offset];
|
|
@@ -3773,12 +3781,15 @@
|
|
|
// sql query: alert availability(int) best_seller(int) price qty
|
|
// sql query: alert availability(int) best_seller(int) price qty
|
|
|
sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout from (select name,description,product_id,closeout,best_seller from model where %@ %@ %@ %@ %@ %@) m left join wishlist w on m.product_id=w.product_id order by %@ limit %d offset %d;",cateWhere,best_seller,alert,available_condition,qty,price,order_best_seller,limit,offset];
|
|
sqlQuery = [NSString stringWithFormat:@"select m.name,m.description,m.product_id,w._id,m.closeout from (select name,description,product_id,closeout,best_seller from model where %@ %@ %@ %@ %@ %@) m left join wishlist w on m.product_id=w.product_id order by %@ limit %d offset %d;",cateWhere,best_seller,alert,available_condition,qty,price,order_best_seller,limit,offset];
|
|
|
|
|
|
|
|
|
|
+ // count
|
|
|
|
|
+ where =[NSString stringWithFormat:@"%@ %@ %@ %@ %@ %@",cateWhere,best_seller,alert,available_condition,qty,price];
|
|
|
|
|
|
|
|
- where = cateWhere;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ where = [where stringByReplacingOccurrencesOfString:@"m." withString:@""];
|
|
|
|
|
|
|
|
- // where == nil 在filterSearch时
|
|
|
|
|
- int count = [iSalesDB get_recordcount:db table:@"model" where:where];
|
|
|
|
|
|
|
+ count = [iSalesDB get_recordcount:db table:@"model" where:where];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!appDelegate.user) {
|
|
if (!appDelegate.user) {
|