Subversion Repositories SmartDukaan

Rev

Rev 637 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 637 Rev 650
Line 241... Line 241...
241
		
241
		
242
		return htmlSnippet;
242
		return htmlSnippet;
243
	}
243
	}
244
 
244
 
245
	
245
	
246
	private String getMainBannerHtml() {
246
	public String getMainBannerHtml() {
247
		String htmlString = "";
247
		String htmlString = "";
248
		VelocityContext context = new VelocityContext();
248
		VelocityContext context = new VelocityContext();
249
		String templateFile = "templates/mainbanner.vm";
249
		String templateFile = "templates/mainbanner.vm";
250
		htmlString = getHtmlFromVelocity(templateFile, context);
250
		htmlString = getHtmlFromVelocity(templateFile, context);
251
		return htmlString;
251
		return htmlString;
252
	}
252
	}
253
 
253
 
254
 
254
 
255
	private String getBestSellersHtml() {
255
	public String getBestSellersHtml() {
256
		String htmlString = "";
256
		String htmlString = "";
257
		VelocityContext context = new VelocityContext();
257
		VelocityContext context = new VelocityContext();
258
		String templateFile = "templates/bestsellers.vm";
258
		String templateFile = "templates/bestsellers.vm";
259
		
259
		
260
		CatalogServiceClient catalogServiceClient = null;
260
		CatalogServiceClient catalogServiceClient = null;
Line 278... Line 278...
278
		htmlString = getHtmlFromVelocity(templateFile, context);
278
		htmlString = getHtmlFromVelocity(templateFile, context);
279
		return htmlString;	
279
		return htmlString;	
280
	}
280
	}
281
 
281
 
282
 
282
 
283
	private String getLatestArrivalsHtml() {
283
	public String getLatestArrivalsHtml() {
284
		String htmlString = "";
284
		String htmlString = "";
285
		VelocityContext context = new VelocityContext();
285
		VelocityContext context = new VelocityContext();
286
		String templateFile = "templates/latestarrivals.vm";
286
		String templateFile = "templates/latestarrivals.vm";
287
		
287
		
288
		CatalogServiceClient catalogServiceClient = null;
288
		CatalogServiceClient catalogServiceClient = null;
Line 306... Line 306...
306
		htmlString = getHtmlFromVelocity(templateFile, context);
306
		htmlString = getHtmlFromVelocity(templateFile, context);
307
		return htmlString;
307
		return htmlString;
308
	}
308
	}
309
 
309
 
310
 
310
 
311
	private String getBestDealsHtml() {
311
	public String getBestDealsHtml() {
312
		String htmlString = "";
312
		String htmlString = "";
313
		VelocityContext context = new VelocityContext();
313
		VelocityContext context = new VelocityContext();
314
		String templateFile = "templates/bestdeals.vm";
314
		String templateFile = "templates/bestdeals.vm";
315
		
315
		
316
		CatalogServiceClient catalogServiceClient = null;
316
		CatalogServiceClient catalogServiceClient = null;
Line 411... Line 411...
411
		return htmlString;
411
		return htmlString;
412
	}
412
	}
413
 
413
 
414
 
414
 
415
 
415
 
416
//	private String getSlideGuideHtml(long productId) {
416
//	public String getSlideGuideHtml(long productId) {
417
//		String htmlString = "";
417
//		String htmlString = "";
418
//		try {
418
//		try {
419
//			VelocityContext context = new VelocityContext();
419
//			VelocityContext context = new VelocityContext();
420
//			String templateFile = "velocity/slideguide.vm";
420
//			String templateFile = "velocity/slideguide.vm";
421
//			// For an entity
421
//			// For an entity
Line 550... Line 550...
550
		return getHtmlFromVelocity(templateFile, context);
550
		return getHtmlFromVelocity(templateFile, context);
551
	}
551
	}
552
 
552
 
553
 
553
 
554
	
554
	
555
	private	String getWidgetDiv(long userId, WidgetType widgetType, String templateFile){
555
	public	String getWidgetDiv(long userId, WidgetType widgetType, String templateFile){
556
 
556
 
557
		UserContextServiceClient userServiceClient = null;
557
		UserContextServiceClient userServiceClient = null;
558
		in.shop2020.model.v1.user.UserContextService.Client client = null;
558
		in.shop2020.model.v1.user.UserContextService.Client client = null;
559
		Widget widget = null;
559
		Widget widget = null;
560
		try {
560
		try {
Line 594... Line 594...
594
		
594
		
595
		return getHtmlFromVelocity("templates/"+templateFile, context);
595
		return getHtmlFromVelocity("templates/"+templateFile, context);
596
	}
596
	}
597
 
597
 
598
	/*
598
	/*
599
	private	String getWidgetDiv(long productId, String userId, WidgetType widgetType, String templateFile){
599
	public	String getWidgetDiv(long productId, String userId, WidgetType widgetType, String templateFile){
600
		long userID;
600
		long userID;
601
		if(userId.compareTo("") == 0){
601
		if(userId.compareTo("") == 0){
602
			userID = 0;
602
			userID = 0;
603
		}else{
603
		}else{
604
			userID = Long.parseLong(userId);
604
			userID = Long.parseLong(userId);
Line 862... Line 862...
862
		return htmlSnippet;
862
		return htmlSnippet;
863
	}
863
	}
864
 
864
 
865
	
865
	
866
	
866
	
867
	private String getOrderDetailsHtml(long orderId) {
867
	public String getOrderDetailsHtml(long orderId) {
868
		String htmlString = "";
868
		String htmlString = "";
869
		VelocityContext context = new VelocityContext();
869
		VelocityContext context = new VelocityContext();
870
		String templateFile = "templates/orderdetails.vm";
870
		String templateFile = "templates/orderdetails.vm";
871
		TransactionServiceClient transactionServiceClient = null;
871
		TransactionServiceClient transactionServiceClient = null;
872
		in.shop2020.model.v1.order.TransactionService.Client orderClient = null;
872
		in.shop2020.model.v1.order.TransactionService.Client orderClient = null;
Line 891... Line 891...
891
		
891
		
892
		htmlString = getHtmlFromVelocity(templateFile, context);
892
		htmlString = getHtmlFromVelocity(templateFile, context);
893
		return htmlString;
893
		return htmlString;
894
	}
894
	}
895
	
895
	
896
	private String getMyaccountDetailsHtml(long userId) {
896
	public String getMyaccountDetailsHtml(long userId) {
897
		String htmlString = "";
897
		String htmlString = "";
898
		VelocityContext context = new VelocityContext();
898
		VelocityContext context = new VelocityContext();
899
		String templateFile = "templates/myaccount.vm";
899
		String templateFile = "templates/myaccount.vm";
900
		TransactionServiceClient transactionServiceClient = null;
900
		TransactionServiceClient transactionServiceClient = null;
901
		in.shop2020.model.v1.order.TransactionService.Client orderClient = null;
901
		in.shop2020.model.v1.order.TransactionService.Client orderClient = null;
Line 912... Line 912...
912
		htmlString = getHtmlFromVelocity(templateFile, context);
912
		htmlString = getHtmlFromVelocity(templateFile, context);
913
		return htmlString;
913
		return htmlString;
914
	}
914
	}
915
 
915
 
916
	
916
	
917
	private String getLoginDetailsHtml(long userId) {
917
	public String getLoginDetailsHtml(long userId) {
918
		String htmlString = "";
918
		String htmlString = "";
919
		VelocityContext context = new VelocityContext();
919
		VelocityContext context = new VelocityContext();
920
		String templateFile = "templates/logindetails.vm";
920
		String templateFile = "templates/logindetails.vm";
921
		String email = "";
921
		String email = "";
922
		try{
922
		try{
Line 1046... Line 1046...
1046
		System.out.println("SHIPPING_ADDRESS_BAR Snippet generated");
1046
		System.out.println("SHIPPING_ADDRESS_BAR Snippet generated");
1047
		
1047
		
1048
		htmlSnippet.put("CUSTOMER_SERVICE", getCustomerServiceHtml());
1048
		htmlSnippet.put("CUSTOMER_SERVICE", getCustomerServiceHtml());
1049
		System.out.println("CUSTOMER_SERVICE Snippet generated");
1049
		System.out.println("CUSTOMER_SERVICE Snippet generated");
1050
		
1050
		
1051
		htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, false));
1051
		htmlSnippet.put("MY_RESEARCH", getMyResearchHtml(userId, isLoggedIn));
1052
		System.out.println("MY_RESEARCH Snippet generated");
1052
		System.out.println("MY_RESEARCH Snippet generated");
1053
 
1053
 
1054
		htmlSnippet.put("BROWSE_HISTORY", getBrowseHistoryHtml(userId, isLoggedIn));
1054
		htmlSnippet.put("BROWSE_HISTORY", getBrowseHistoryHtml(userId, isLoggedIn));
1055
		System.out.println("BROWSE_HISTORY Snippet generated");
1055
		System.out.println("BROWSE_HISTORY Snippet generated");
1056
 
1056
 
Line 1067... Line 1067...
1067
		
1067
		
1068
		return htmlSnippet;
1068
		return htmlSnippet;
1069
	
1069
	
1070
	}
1070
	}
1071
 
1071
 
1072
	private String getShippingHeaderHtml() {
1072
	public String getShippingHeaderHtml() {
1073
		String htmlString = "";
1073
		String htmlString = "";
1074
		VelocityContext context = new VelocityContext();
1074
		VelocityContext context = new VelocityContext();
1075
		String templateFile = "templates/shippingheader.vm";
1075
		String templateFile = "templates/shippingheader.vm";
1076
		htmlString = getHtmlFromVelocity(templateFile, context);
1076
		htmlString = getHtmlFromVelocity(templateFile, context);
1077
		return htmlString;
1077
		return htmlString;
1078
	}
1078
	}
1079
 
1079
 
1080
	private String getShippingAddressDetailsHtml(long userId){
1080
	public String getShippingAddressDetailsHtml(long userId){
1081
		String htmlString = "";
1081
		String htmlString = "";
1082
		VelocityContext context = new VelocityContext();
1082
		VelocityContext context = new VelocityContext();
1083
		String templateFile = "templates/shippingaddressdetails.vm";
1083
		String templateFile = "templates/shippingaddressdetails.vm";
1084
		long defaultAddressId = 0;
1084
		long defaultAddressId = 0;
1085
		List<Address> addresses = null;
1085
		List<Address> addresses = null;
Line 1100... Line 1100...
1100
		
1100
		
1101
		htmlString = getHtmlFromVelocity(templateFile, context);
1101
		htmlString = getHtmlFromVelocity(templateFile, context);
1102
		return htmlString;
1102
		return htmlString;
1103
	}
1103
	}
1104
 
1104
 
1105
	private String getShippingDetailsHtml(long cartId, String errorMsg) {
1105
	public String getShippingDetailsHtml(long cartId, String errorMsg) {
1106
		String htmlString = "";
1106
		String htmlString = "";
1107
		VelocityContext context = new VelocityContext();
1107
		VelocityContext context = new VelocityContext();
1108
		String templateFile = "templates/shippingdetails.vm";
1108
		String templateFile = "templates/shippingdetails.vm";
1109
		List<Map<String,String>> items = null;
1109
		List<Map<String,String>> items = null;
1110
		double totalamount= 0.0;
1110
		double totalamount= 0.0;
Line 1149... Line 1149...
1149
					items.add(itemdetail);				
1149
					items.add(itemdetail);				
1150
				}
1150
				}
1151
			}
1151
			}
1152
			
1152
			
1153
			addresses = userClient.getAllAddressesForUser(cart.getUserId());
1153
			addresses = userClient.getAllAddressesForUser(cart.getUserId());
-
 
1154
			if(cart.isSetAddressId()){
-
 
1155
				defaultAddressId = cart.getAddressId();
-
 
1156
			}else{
1154
			defaultAddressId = userClient.getDefaultAddressId(cart.getUserId());
1157
				defaultAddressId = userClient.getDefaultAddressId(cart.getUserId());
-
 
1158
			}
1155
			
1159
			
1156
		}catch (Exception e){
1160
		}catch (Exception e){
1157
			e.printStackTrace();
1161
			e.printStackTrace();
1158
		}
1162
		}
1159
		
1163
		
Line 1205... Line 1209...
1205
		
1209
		
1206
		return htmlSnippet;
1210
		return htmlSnippet;
1207
	
1211
	
1208
	}
1212
	}
1209
 
1213
 
1210
	private String getCartHeaderHtml() {
1214
	public String getCartHeaderHtml() {
1211
		String htmlString = "";
1215
		String htmlString = "";
1212
		VelocityContext context = new VelocityContext();
1216
		VelocityContext context = new VelocityContext();
1213
		String templateFile = "templates/cartheader.vm";
1217
		String templateFile = "templates/cartheader.vm";
1214
		htmlString = getHtmlFromVelocity(templateFile, context);
1218
		htmlString = getHtmlFromVelocity(templateFile, context);
1215
		return htmlString;
1219
		return htmlString;
1216
	}
1220
	}
1217
 
1221
 
1218
 
1222
 
1219
	private String getCartDetailsHtml(long cartId, String errorMsg) {
1223
	public String getCartDetailsHtml(long cartId, String errorMsg) {
1220
		String htmlString = "";
1224
		String htmlString = "";
1221
		VelocityContext context = new VelocityContext();
1225
		VelocityContext context = new VelocityContext();
1222
		String templateFile = "templates/cartdetails.vm";
1226
		String templateFile = "templates/cartdetails.vm";
1223
		List<Map<String,String>> items = null;
1227
		List<Map<String,String>> items = null;
1224
		double totalamount= 0.0;
1228
		double totalamount= 0.0;