def articles(self): """Returns list of dictionary of articles in shop :rtype: list """ res = [] for item in IShoppingSite(self.context).get_content_listing(IArticle, sort_on="sku"): obj = item.getObject() article = IArticleAdapter(obj) sbehavior = IStockBehavior(obj) stock = sbehavior.stock() stocks = sbehavior.stocks() if stocks: price = stocks[-1].price subtotal = price * stock price = getUtility(IPriceUtility, name="string")(price) subtotal = getUtility(IPriceUtility, name="string")(subtotal) else: price = subtotal = "N/A" res.append( { "price": price, "sku": item.sku, "stock": stock, "subtotal": subtotal, "title": article.title(), "url": item.getURL(), } ) return res