Subversion Repositories SmartDukaan

Rev

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

Rev 13155 Rev 13169
Line 67... Line 67...
67
 
67
 
68
    total_discounts = 0
68
    total_discounts = 0
69
    cart_has_specified_item = False
69
    cart_has_specified_item = False
70
    discounts = []
70
    discounts = []
71
    
71
    
-
 
72
    foundDeal=False
-
 
73
    
72
    for line in cart.lines:
74
    for line in cart.lines:
73
        if line.itemId in dealItems:
75
        if line.itemId in dealItems:
74
            print "continued  line.itemId",  line.itemId 
76
            print "continued  line.itemId",  line.itemId
-
 
77
            foundDeal = True 
75
            continue
78
            continue
76
        if discount_left > 0 :
79
        if discount_left > 0 :
77
            discount_value = 0
80
            discount_value = 0
78
            
81
            
79
            if min_amount is not None and line.actualPrice < min_amount:
82
            if min_amount is not None and line.actualPrice < min_amount:
Line 103... Line 106...
103
                    continue
106
                    continue
104
 
107
 
105
            elif 'categoriesexcept' in args:
108
            elif 'categoriesexcept' in args:
106
                catalog_client = CatalogClient().get_client()
109
                catalog_client = CatalogClient().get_client()
107
                category = catalog_client.getItem(line.itemId).category
110
                category = catalog_client.getItem(line.itemId).category
108
                if category in args['categoriesexcept']:
111
                if category not in args['categoriesexcept']:
109
                    if type(args['categoriesexcept'])==dict:
-
 
110
                        discount_value = discountJ 
112
                        discount_value = discountJ 
111
                        cart_has_specified_item = True
113
                        cart_has_specified_item = True
112
                else:
114
                else:
113
                    continue
115
                    continue
114
 
116
 
Line 167... Line 169...
167
        else:
169
        else:
168
            break
170
            break
169
            
171
            
170
        
172
        
171
    if cart_has_specified_item is False:
173
    if cart_has_specified_item is False:
-
 
174
        if foundDeal:
-
 
175
            raise PromotionException(115, '''Deal items can't be discounted''')
-
 
176
        else:
172
        raise PromotionException(115, 'This coupon is applicable only for ' + args['handset_display_name'])
177
            raise PromotionException(115, 'This coupon is applicable only for ' + args['handset_display_name'])
-
 
178
            
-
 
179
    
173
    
180
    
174
    cart.discountedPrice = cart.totalPrice - round(total_discounts, 0)
181
    cart.discountedPrice = cart.totalPrice - round(total_discounts, 0)
175
    print "cart.discountedPrice----",  cart.discountedPrice
182
    print "cart.discountedPrice----",  cart.discountedPrice
176
    return cart, discounts
183
    return cart, discounts
177
 
184