def get_all_properties(self, variant=None):
        if not self.is_product_with_variants():
            return []
        properties = []
        if self.variants_display_type == SELECT:
            # Get all properties (sorted). We need to traverse through all
            # property/options to select the options of the current variant.
            for prop_dict in self.get_variants_properties():
                options = []
                selected_option_value = ''
                prop = prop_dict['property']
                property_group = prop_dict['property_group']
                for property_option in prop.options.all():
                    # check if option exists in any variant
                    option_used = ProductPropertyValue.objects.filter(parent_id=self.pk,
                                                                      product__active=True,
                                                                      property=prop,
                                                                      property_group=property_group,
                                                                      type=PROPERTY_VALUE_TYPE_VARIANT,
                                                                      value=property_option.pk).exists()
                    if option_used:
                        if variant and variant.has_option(property_group, prop, property_option):
                            selected = True
                            selected_option_value = property_option.pk
                        else:
                            selected = False
                        options.append({
                            "id": property_option.id,
                            "name": property_option.name,
                            "selected": selected,
                        })

                # check for variants that do not have such property and if such variants exists add empty option
                ppv_count = ProductPropertyValue.objects.filter(parent_id=self.pk,
                                                                product__active=True,
                                                                type=PROPERTY_VALUE_TYPE_VARIANT,
                                                                property=prop,
                                                                property_group=property_group).count()
                if ppv_count != self.get_variants().count():
                    selected = False
                    if variant and selected_option_value == '':
                        selected = True
                    options.insert(0, {'id': '', 'name': '', 'selected': selected})
                if not (len(options) == 1 and options[0]['id'] == ''):
                    properties.append({
                        "id": prop.id,
                        "name": prop.name,
                        "title": prop.title,
                        "unit": prop.unit,
                        "options": options,
                        "property_group": property_group,
                        "property_group_id": property_group.id if property_group else 0
                    })
        else:
            for prop_dict in self.get_variants_properties():
                selected_option_name = ''
                selected_option_value = ''
                prop = prop_dict['property']
                property_group = prop_dict['property_group']
                if variant:
                    try:
                        ppv = ProductPropertyValue.objects.get(product=variant,
                                                               type=PROPERTY_VALUE_TYPE_VARIANT,
                                                               property=prop,
                                                               property_group=property_group)
                        selected_option_value = ppv.value
                        selected_option_name = prop.options.get(pk=ppv.value).name
                    except (ProductPropertyValue.DoesNotExist, PropertyOption.DoesNotExist):
                        pass
                properties.append({
                                    "id": prop.id,
                                    "name": prop.name,
                                    "title": prop.title,
                                    "unit": prop.unit,
                                    "selected_option_name": selected_option_name,
                                    "selected_option_value": selected_option_value,
                                    "property_group": property_group,
                                    "property_group_id": property_group.id if property_group else 0
                                 })
        return properties
Output an order in orderlogfile
dataset/ETHPy150Open diefenbach/django-lfs/lfs/catalog/models.py/Product.get_all_properties--crossover with--dataset/ETHPy150Open jcbagneris/fms/fms/engines/__init__.py/Engine.output_order