shuup.front.template_helpers package¶
Submodules¶
shuup.front.template_helpers.category module¶
shuup.front.template_helpers.general module¶
-
shuup.front.template_helpers.general.
get_listed_products
(context, n_products, ordering=None, filter_dict=None, orderable_only=True)[source]¶ Returns all products marked as listed that are determined to be visible based on the current context.
Parameters: Return type: list[shuup.core.models.Product]
-
shuup.front.template_helpers.general.
get_best_selling_products
(context, n_products=12, cutoff_days=30, orderable_only=True)[source]¶
-
shuup.front.template_helpers.general.
get_newest_products
(context, n_products=6, orderable_only=True)[source]¶
-
shuup.front.template_helpers.general.
get_random_products
(context, n_products=6, orderable_only=True)[source]¶
-
shuup.front.template_helpers.general.
get_products_for_category
(context, category, n_products=6, orderable_only=True)[source]¶
shuup.front.template_helpers.product module¶
-
shuup.front.template_helpers.product.
get_product_cross_sells
(context, product, relation_type=<ProductCrossSellType.RELATED: 2>, count=4, orderable_only=True)[source]¶
-
shuup.front.template_helpers.product.
map_relation_type
(relation_type)[source]¶ Map relation type to enum value.
Return type: ProductCrossSellType Raises: LookupError
if unknown string is given
shuup.front.template_helpers.urls module¶
-
shuup.front.template_helpers.urls.
get_url
(url, *args, **kwargs)[source]¶ Try to get the reversed URL for the given route name, args and kwargs.
If reverse resolution fails, returns None (instead of throwing an exception).
Parameters: - url (str) – URL name.
- args (Iterable[object]) – URL args
- kwargs (dict[str, object]) – URL kwargs
Returns: Reversed URL or None
Return type: str|None
-
shuup.front.template_helpers.urls.
has_url
(url, *args, **kwargs)[source]¶ Try to get the reversed URL for the given route name, args and kwargs and return a success flag.
Parameters: - url (str) – URL name.
- args (Iterable[object]) – URL args
- kwargs (dict[str, object]) – URL kwargs
Returns: Success flag
Return type: