kapilt / getpaid

Automatically exported from code.google.com/p/getpaid
0 stars 0 forks source link

flatrateshipping getCost doesn't care of the quantity of the same article #261

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
def getCost( self, order ):
        settings = self.settings
        if(settings.flatrate_option == "Percentage"):
            return self.settings.flat_rate
        else: # we're calculating the percentage
            items = filter( IShippableLineItem.providedBy,
order.shopping_cart.values() )
            cost = 0
            for item in items:
                cost += item.cost
            shipcost = cost * (settings.flatrate_percentage / 100)
            if shipcost > settings.flatrate_max:
                shipcost = settings.flatrate_max
            return shipcost)
1)
I've doubt about the condition 
 if(settings.flatrate_option == "Percentage")
I've filled one issue report about it. On my file, I've changed it for 
 if(settings.flatrate_option == "Flat Rate")
2) Now it seems that in case I choose 
flatrate_options="Percentage" that the cost is computed for only one item
of each type, I mean if I buy 10 times the same item, I'm charged only once
no matter the quantity if I may say

but if I write
 cost += item.cost * item.quantity
I've got the expected result 

Original issue reported on code.google.com by danielle...@gmail.com on 24 Apr 2009 at 9:26

GoogleCodeExporter commented 8 years ago
Committed revision 3339
critical for the shopkeeper

Original comment by danielle...@gmail.com on 27 Feb 2010 at 8:00