Kai Diefenbach avatar Kai Diefenbach committed 5732178

Quick fix to display displayed properties correctly sorted on positions.

Comments (0)

Files changed (1)


             return properties
         properties = []
-        for ppv in self.property_values.filter(property__display_on_product=True, type=PROPERTY_VALUE_TYPE_DISPLAY).order_by("property__position"):
+        for ppv in self.property_values.filter(property__display_on_product=True, type=PROPERTY_VALUE_TYPE_DISPLAY):
             if ppv.property.is_select_field:
                     po = PropertyOption.objects.get(pk=int(float(ppv.value)))
                     value = po.name
+                    position = po.position
                 value = ppv.value
+                position = 1
+            print ppv.property.position
+                "position": (ppv.property.position * 1000) + position,
                 "name"  : ppv.property.name,
                 "title" : ppv.property.title,
                 "value" : value,
                 "unit"  : ppv.property.unit,
+        properties.sort(lambda a, b: cmp(a["position"], b["position"]))
         cache.set(cache_key, properties)
         return properties
         if self.manage_stock_amount and self.stock_amount <= 0 and not self.order_time:
             return False
-        else:    
+        else:
             return self.deliverable
     # 3rd party contracts
         min = int("%.0f" % (self.min + 0.001))
         max = int("%.0f" % (self.max + 0.001))
-        return DeliveryTime(min=min, max=max, unit=self.unit)
+        return DeliveryTime(min=min, max=max, unit=self.unit)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.