Subversion Repositories SmartDukaan

Rev

Rev 3126 | Rev 3903 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3126 Rev 3830
Line 3... Line 3...
3
import in.shop2020.logistics.Provider;
3
import in.shop2020.logistics.Provider;
4
import in.shop2020.model.v1.order.Order;
4
import in.shop2020.model.v1.order.Order;
5
import in.shop2020.model.v1.user.Address;
5
import in.shop2020.model.v1.user.Address;
6
import in.shop2020.model.v1.user.User;
6
import in.shop2020.model.v1.user.User;
7
import in.shop2020.model.v1.user.UserContextException;
7
import in.shop2020.model.v1.user.UserContextException;
-
 
8
import in.shop2020.serving.utils.FormattingUtils;
8
import in.shop2020.serving.utils.Utils;
9
import in.shop2020.serving.utils.Utils;
9
import in.shop2020.thrift.clients.LogisticsClient;
10
import in.shop2020.thrift.clients.LogisticsClient;
10
import in.shop2020.thrift.clients.TransactionClient;
11
import in.shop2020.thrift.clients.TransactionClient;
11
import in.shop2020.thrift.clients.UserClient;
12
import in.shop2020.thrift.clients.UserClient;
12
 
13
 
Line 146... Line 147...
146
		return htmlString;
147
		return htmlString;
147
	}
148
	}
148
 
149
 
149
 
150
 
150
 
151
 
151
	public String getHeaderHtml(boolean isLoggedIn, String  userName, String url) {
152
	public String getHeaderHtml(boolean isLoggedIn, String  userName, String url, long catId) {
152
		VelocityContext context = new VelocityContext();
153
		VelocityContext context = new VelocityContext();
153
		if (isLoggedIn) {
154
		if (isLoggedIn) {
154
			context.put("LOGGED_IN", "TRUE");
155
			context.put("LOGGED_IN", "TRUE");
155
			context.put("WELCOME_MESSAGE", "Hi, " + userName);
156
			context.put("WELCOME_MESSAGE", "Hi, " + userName);
156
		} else {
157
		} else {
157
			context.put("WELCOME_MESSAGE", "Hi, Welcome to Saholic");
158
			context.put("WELCOME_MESSAGE", "Hi, Welcome to Saholic");
158
			context.put("REDIRECT_URL", url);
159
			context.put("REDIRECT_URL", url);
159
		}		
160
		}		
160
		
161
		
-
 
162
		context.put("CAT_ID", catId);
-
 
163
		
161
		String templateFile = "templates/header.vm";
164
		String templateFile = "templates/header.vm";
162
		
165
		
163
		return getHtmlFromVelocity(templateFile, context);
166
		return getHtmlFromVelocity(templateFile, context);
164
	}
167
	}
165
 
168
 
Line 369... Line 372...
369
            logger.error("Unable to generate the HTML from the template file " + templateFile, e);
372
            logger.error("Unable to generate the HTML from the template file " + templateFile, e);
370
        }
373
        }
371
	
374
	
372
		return null;
375
		return null;
373
	}
376
	}
-
 
377
 
-
 
378
	public String getCartWidgetSnippet(int totalItems, double totalAmount) {
-
 
379
		String htmlString = "";
-
 
380
		VelocityContext context = new VelocityContext();
-
 
381
		String templateFile = "templates/cartwidget.vm";
-
 
382
		FormattingUtils formattingUtils = new FormattingUtils(0);
-
 
383
		context.put("itemCount", totalItems);
-
 
384
		context.put("totalAmount", formattingUtils.formatPrice(totalAmount));
-
 
385
		
-
 
386
		htmlString = getHtmlFromVelocity(templateFile, context);
-
 
387
		return htmlString;
-
 
388
	}
-
 
389
 
374
}
390
}