def testGetAllProducts(self): """ """ pm = IProductManagement(self.portal.myshop.categories.category_1) product_ids = [p.getId() for p in pm.getAllProducts()] self.assertEqual(product_ids, ["product_1", "product_2"]) pm = IProductManagement(self.portal.myshop.categories.category_1.category_11) product_ids = [p.getId() for p in pm.getAllProducts()] self.assertEqual(product_ids, ["product_1", "product_2"])
def testGetAllProducts(self): """ """ pm = IProductManagement(self.portal.myshop.categories.category_1) product_ids = [p.getId() for p in pm.getAllProducts()] self.assertEqual(product_ids, ["product_1", "product_2"]) pm = IProductManagement( self.portal.myshop.categories.category_1.category_11) product_ids = [p.getId() for p in pm.getAllProducts()] self.assertEqual(product_ids, ["product_1", "product_2"])
def _getAllProducts(self): """ """ mtool = getToolByName(self.context, "portal_membership") sorting = self.request.get("sorting", None) try: sorted_on, sort_order = sorting.split("-") except (AttributeError, ValueError): sorted_on = "price" sort_order = "desc" pm = IProductManagement(self.context) products = pm.getAllProducts(sorted_on=sorted_on, sort_order=sort_order) return products
def _getAllProducts(self): """ """ mtool = getToolByName(self.context, "portal_membership") sorting = self.request.get("sorting", None) try: sorted_on, sort_order = sorting.split("-") except (AttributeError, ValueError): sorted_on = "price" sort_order = "desc" pm = IProductManagement(self.context) products = pm.getAllProducts(sorted_on=sorted_on, sort_order = sort_order) return products