shuup.campaigns.utils package

Submodules

shuup.campaigns.utils.campaigns module

shuup.campaigns.utils.campaigns.get_lines_suppliers(basket)[source]

Returns a list of all suppliers from the basket

shuup.campaigns.utils.campaigns.get_product_ids_and_quantities(basket, supplier=None)[source]
shuup.campaigns.utils.campaigns.get_total_price_of_products(basket, campaign)[source]

shuup.campaigns.utils.matcher module

shuup.campaigns.utils.matcher.get_matching_for_product(shop_product, provide_category, skippable_classes=None)[source]

Get matching ids for shop product based on provide category

For example: matching_ids = get_matching_for_product(shop_product, “campaign_catalog_filter”)

Parameters:
Returns:

list of collected item ids

Return type:

list[int]

class shuup.campaigns.utils.matcher.ProductCampaignMatcher(shop_product, **kwargs)[source]

Bases: object

A class to match shop product to existing campaigns

Parameters:shop_product (shuup.core.models.ShopProduct) – a Shop Product to find matches for
matches(obj)[source]

Tries to match filters, conditions, effects etc to shop product

Returns:True or False based on the match
Return type:bool
product_type_matcher(field, obj)[source]
category_matcher(field, obj)[source]
product_matcher(field, obj)[source]

shuup.campaigns.utils.sales_range module

shuup.campaigns.utils.sales_range.get_total_sales(shop, customer)[source]
shuup.campaigns.utils.sales_range.assign_to_group_based_on_sales(cls, shop, customer, sales_range=None)[source]
shuup.campaigns.utils.sales_range.get_contacts_in_sales_range(shop, min_value, max_value)[source]

shuup.campaigns.utils.time_range module

shuup.campaigns.utils.time_range.is_in_time_range(date, hour_start, hour_end, valid_weekdays)[source]

Help util for hour conditions in basket and catalog campaigns.

Since the start and end hour is saved to database without any timezone information we need to get current hour not in UTC but shop local time.

Returns:Whether the current time is in time range and correct weekday
Return type:bool

Module contents