def get_children(self): #!!!children ordering matches front-end select ordering!!! ''' Should get following info - price - stock_record - images ''' children = self.object.get_children() childrenImages = [] childrenPrices = [] selector = GSelector() strategy = selector.strategy() #get children images and prices if children != None: for child in children: img = ProductImage.objects.filter(product = child) if len(img) == 0: pass else: childrenImages.append(img[0]) childrenPrices.append(float( strategy.fetch_for_product(product = child).price.excl_tax)) return (childrenPrices, childrenImages) else: return None
def addPriceFilterOption(self): PriceFilter = CategoryFilter.objects.filter( code = "PRICE_FILTER") selector = GSelector() strategy = selector.strategy() price = strategy.fetch_for_product( product = self).price.excl_tax for option in PriceFilter[0].options.all(): temp = option.name.split("-") if temp[1] == "more": temp[1] = 999999 if int(temp[0]) < price and int(temp[1]) > price: if not option in self.filterOption.all(): self.filterOption.add(option) print("THIS SHOULD NOT")