Subversion Repositories SmartDukaan

Rev

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

Rev 2867 Rev 2949
Line 74... Line 74...
74
    	    pageTitle = productPropertiesInJson.getString("title");
74
    	    pageTitle = productPropertiesInJson.getString("title");
75
    	    productName = productPropertiesInJson.getString("name");
75
    	    productName = productPropertiesInJson.getString("name");
76
    	    displayAccessories = productPropertiesInJson.getString("displayAccessories");
76
    	    displayAccessories = productPropertiesInJson.getString("displayAccessories");
77
    	}
77
    	}
78
    	catch (JSONException e) {
78
    	catch (JSONException e) {
79
            e.printStackTrace();
79
            log.error("Unable to parse product properties JSON", e);
80
            try {
80
            try {
81
                CatalogServiceClient catalogClientService = new CatalogServiceClient();
81
                CatalogServiceClient catalogClientService = new CatalogServiceClient();
82
                in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
82
                in.shop2020.model.v1.catalog.InventoryService.Client client = catalogClientService.getClient();
83
                
83
                
84
                Item item = client.getItemsByCatalogId(productId).get(0);
84
                Item item = client.getItemsByCatalogId(productId).get(0);
85
                redirectUrl = "/" + item.getBrand().toLowerCase().replace(" ", "-");
85
                redirectUrl = "/" + item.getBrand().toLowerCase().replace(" ", "-");
86
            } catch (Exception e1) {
86
            } catch (Exception e1) {
-
 
87
                log.error("Unable to get items by catalog id", e1);
87
                redirectUrl = "/";
88
                redirectUrl = "/";
88
                e.printStackTrace();
-
 
89
            }
89
            }
90
            log.info(redirectUrl);
90
            log.info(redirectUrl);
91
            return "redirect";
91
            return "redirect";
92
       }
92
       }
93
    	String currentUrl = request.getRequestURL().toString();
93
    	String currentUrl = request.getRequestURL().toString();
Line 121... Line 121...
121
			if(userId != -1){
121
			if(userId != -1){
122
				client.updateBrowseHistory(userId, itemId);
122
				client.updateBrowseHistory(userId, itemId);
123
			}
123
			}
124
		
124
		
125
		} catch (Exception e) {
125
		} catch (Exception e) {
126
			// TODO Auto-generated catch block
126
			log.warn("Unable to update the browsing history because of: ", e);
127
			e.printStackTrace();
-
 
128
		}
127
		}
129
    	
128
    	
130
		DataLogger.logData(EventType.PRODUCT_VIEW, session.getId(), userinfo.getUserId(), userinfo.getEmail(),
129
		DataLogger.logData(EventType.PRODUCT_VIEW, session.getId(), userinfo.getUserId(), userinfo.getEmail(),
131
                productName);
130
                productName);
132
		return "show";
131
		return "show";