示例#1
0
文件: plugins.py 项目: teserak/shoop
 def __init__(self, config):
     relation_type = config.get("type", None)
     if relation_type:
         # Map initial config string to enum type
         try:
             type = map_relation_type(relation_type)
         except AttributeError:
             type = ProductCrossSellType.RELATED
         config["type"] = type
     super(ProductCrossSellsPlugin, self).__init__(config)
示例#2
0
 def __init__(self, config):
     relation_type = config.get("type", None)
     if relation_type:
         # Map initial config string to enum type
         try:
             type = map_relation_type(relation_type)
         except AttributeError:
             type = ProductCrossSellType.RELATED
         config["type"] = type
     super(ProductCrossSellsPlugin, self).__init__(config)
示例#3
0
文件: plugins.py 项目: teserak/shoop
 def get_context_data(self, context):
     count = self.config.get("count", 4)
     product = context.get("product", None)
     orderable_only = self.config.get("orderable_only", True)
     relation_type = self.config.get("type")
     try:
         type = map_relation_type(relation_type)
     except AttributeError:
         type = ProductCrossSellType.RELATED
     return {
         "request": context["request"],
         "title": self.get_translated_value("title"),
         "product": product,
         "type": type,
         "count": count,
         "orderable_only": orderable_only,
     }
示例#4
0
 def get_context_data(self, context):
     count = self.config.get("count", 4)
     product = context.get("product", None)
     orderable_only = self.config.get("orderable_only", True)
     relation_type = self.config.get("type")
     try:
         type = map_relation_type(relation_type)
     except AttributeError:
         type = ProductCrossSellType.RELATED
     return {
         "request": context["request"],
         "title": self.get_translated_value("title"),
         "product": product,
         "type": type,
         "count": count,
         "orderable_only": orderable_only,
     }