shuup.campaigns.utils package
Submodules
shuup.campaigns.utils.campaigns module
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:
shop_product (shuup.core.models.ShopProduct) – A Shop Product
provide_category (str) – Provide category name
skip (None or list) – Classes to skip
- Returns:
list of collected item ids
- Return type:
- 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
- __init__(shop_product, **kwargs)[source]
- Parameters:
shop_product (shuup.core.models.ShopProduct) – a Shop Product to find matches for
shuup.campaigns.utils.sales_range module
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: