コード例 #1
0
ファイル: basket_effects.py プロジェクト: ruqaiya/shuup
    def apply_for_basket(self, order_source):
        from shuup.campaigns.models import CatalogCampaign
        campaign = self.campaign
        supplier = campaign.supplier if hasattr(campaign, "supplier") and campaign.supplier else None
        discounted_base_amount = get_total_price_of_products(order_source, campaign)

        context = PricingContext(order_source.shop, order_source.customer)
        for line in order_source.get_product_lines():
            if supplier and line.supplier != supplier:
                continue

            product = line.product
            if CatalogCampaign.get_matching(context, product.get_shop_instance(order_source.shop)):
                discounted_base_amount -= line.price
        return (discounted_base_amount * self.value)
コード例 #2
0
    def apply_for_basket(self, order_source):
        from shuup.campaigns.models import CatalogCampaign

        campaign = self.campaign
        supplier = campaign.supplier if hasattr(campaign, "supplier") and campaign.supplier else None
        discounted_base_amount = get_total_price_of_products(order_source, campaign)

        context = PricingContext(order_source.shop, order_source.customer)
        for line in order_source.get_product_lines():
            if supplier and line.supplier != supplier:
                continue

            product = line.product
            if CatalogCampaign.get_matching(context, product.get_shop_instance(order_source.shop)):
                discounted_base_amount -= line.price
        return discounted_base_amount * self.value
コード例 #3
0
ファイル: basket_conditions.py プロジェクト: ruqaiya/shuup
    def matches(self, basket, lines):
        from shuup.campaigns.models import CatalogCampaign
        campaign = self.campaign.first()
        total_of_products = get_total_price_of_products(basket, campaign)
        product_lines = basket.get_product_lines()

        if hasattr(campaign, "supplier") and campaign.supplier:
            product_lines = [line for line in product_lines if line.supplier == campaign.supplier]

        total_undiscounted_price_value = total_of_products.value
        shop = basket.shop
        context = PricingContext(shop, basket.customer)

        for line in product_lines:
            if CatalogCampaign.get_matching(context, line.product.get_shop_instance(shop)):
                total_undiscounted_price_value -= line.price.value
        return (total_undiscounted_price_value >= self.amount_value)
コード例 #4
0
ファイル: basket_conditions.py プロジェクト: wsmoyer/shuup
    def matches(self, basket, lines):
        from shuup.campaigns.models import CatalogCampaign
        campaign = self.campaign.first()
        total_of_products = get_total_price_of_products(basket, campaign)
        product_lines = basket.get_product_lines()

        if hasattr(campaign, "supplier") and campaign.supplier:
            product_lines = [
                line for line in product_lines
                if line.supplier == campaign.supplier
            ]

        total_undiscounted_price_value = total_of_products.value
        shop = basket.shop
        context = PricingContext(shop, basket.customer)

        for line in product_lines:
            if CatalogCampaign.get_matching(
                    context, line.product.get_shop_instance(shop)):
                total_undiscounted_price_value -= line.price.value
        return (total_undiscounted_price_value >= self.amount_value)
コード例 #5
0
ファイル: basket_effects.py プロジェクト: Bobby00/boss_shuup
 def apply_for_basket(self, order_source):
     total_price_of_products = get_total_price_of_products(
         order_source, self.campaign)
     return (total_price_of_products * self.value)
コード例 #6
0
ファイル: basket_conditions.py プロジェクト: wsmoyer/shuup
 def matches(self, basket, lines):
     campaign = self.campaign.first()
     total_of_products = get_total_price_of_products(basket, campaign)
     return (total_of_products.value >= self.amount_value)
コード例 #7
0
ファイル: basket_effects.py プロジェクト: ruqaiya/shuup
 def apply_for_basket(self, order_source):
     total_price_of_products = get_total_price_of_products(order_source, self.campaign)
     return (total_price_of_products * self.value)
コード例 #8
0
ファイル: basket_conditions.py プロジェクト: ruqaiya/shuup
 def matches(self, basket, lines):
     campaign = self.campaign.first()
     total_of_products = get_total_price_of_products(basket, campaign)
     return (total_of_products.value >= self.amount_value)