Subversion Repositories SmartDukaan

Rev

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

Rev 5401 Rev 5639
Line 102... Line 102...
102
    '''
102
    '''
103
    Receives a list of products (returned from search results) &
103
    Receives a list of products (returned from search results) &
104
    returns a clustered dictionary, where products are grouped by
104
    returns a clustered dictionary, where products are grouped by
105
    the 'source'
105
    the 'source'
106
    '''
106
    '''
107
    clustered_results = {'adexmart': [], 'flipkart': [], 'homeshop18': [], 'infibeam': [], 'snapdeal': []}
107
    clustered_results = {'adexmart': [], 'flipkart': [], 'homeshop18': [], 'infibeam': [], 'snapdeal': [], 'tradus': [], 'sulekha': []}
108
    
108
    
109
    for product in products:
109
    for product in products:
110
        clustered_results[product['source']].append(product)
110
        clustered_results[product['source']].append(product)
111
    
111
    
112
    return clustered_results
112
    return clustered_results
Line 128... Line 128...
128
            'flipkart': 'http://www.flipkart.com/search-mobiles?query=$$&from=all&searchGroup=mobiles',
128
            'flipkart': 'http://www.flipkart.com/search-mobiles?query=$$&from=all&searchGroup=mobiles',
129
            'homeshop18': 'http://www.homeshop18.com/$$/search:$$/categoryid:3024',
129
            'homeshop18': 'http://www.homeshop18.com/$$/search:$$/categoryid:3024',
130
            'adexmart': 'http://adexmart.com/search.php?orderby=position&orderway=desc&search_query=$$',
130
            'adexmart': 'http://adexmart.com/search.php?orderby=position&orderway=desc&search_query=$$',
131
            'infibeam': 'http://www.infibeam.com/Mobiles/search?q=$$',
131
            'infibeam': 'http://www.infibeam.com/Mobiles/search?q=$$',
132
            'letsbuy': 'http://www.letsbuy.com/advanced_search_result.php?cPath=254&keywords=$$',
132
            'letsbuy': 'http://www.letsbuy.com/advanced_search_result.php?cPath=254&keywords=$$',
133
            'snapdeal': 'http://www.snapdeal.com/search?catId=&categoryId=12&locUsed=false&vertical=p&keyword=$$'
133
            'snapdeal': 'http://www.snapdeal.com/search?catId=&categoryId=12&locUsed=false&vertical=p&keyword=$$',
-
 
134
            'sulekha': 'http://mobiles.sulekha.com/search.htm?cx=partner-pub-3470583419345383%3A8ggsimfcaaa&cof=FORID%3A10&ie=ISO-8859-1&q=$$&sa=Go',
-
 
135
            'tradus': 'http://www.tradus.com/search/tradus_search/?query=$$'
-
 
136
    
134
        }
137
        }
135
        return search_urls[source].replace('$$', name)
138
        return search_urls[source].replace('$$', name)
136
 
139
 
137
def getDisplayInfo(filtered_cluster, product_name):
140
def getDisplayInfo(filtered_cluster, product_name):
138
    display_info = {'adexmart': {}, 'flipkart': {}, 'homeshop18': {}, 'infibeam': {}, 'snapdeal': {}}
141
    display_info = {'adexmart': {}, 'flipkart': {}, 'homeshop18': {}, 'infibeam': {}, 'snapdeal': {}, 'tradus':{}, 'sulekha':{}}
139
    
142
    
140
    for source, products in filtered_cluster.iteritems():
143
    for source, products in filtered_cluster.iteritems():
141
        
144
        
142
        if len(products) > 0:
145
        if len(products) > 0:
143
            if isPriceSame(products):
146
            if isPriceSame(products):