// VendorItemMiddleware populates all views and relations to display an item
VendorItemMiddleware populates all views and relations to display an item
// VendorItemMiddleware populates all views and relations to display an item
func (c *Context) PublicStoreItemMiddleware(w web.ResponseWriter, r *web.Request, next web.NextMiddlewareFunc) {
	item, _ := FindItemByUuid(r.PathParams["item"])
	if item == nil {
		http.NotFound(w, r.Request)
		return
	}
	if len(item.RatingReviews) > 10 {
		item.RatingReviews = item.RatingReviews[:10]
	}
	if item.StoreUuid != c.ViewStore.Uuid {
		http.NotFound(w, r.Request)
		return
	}
	viewItem := item.ViewItem(c.ViewUser.Language)
	c.ViewItem = &viewItem
	next(w, r)
}
func ( c * Context ) PublicStoreItemMiddleware ( w web . ResponseWriter , r * web . Request , next web . NextMiddlewareFunc ) { item , _ := FindItemByUuid ( r . PathParams [ " " ] ) if item == nil { http . NotFound ( w , r . Request ) return } if len ( item . RatingReviews ) > 10 { item . RatingReviews = item . RatingReviews [ : 10 ] } if item . StoreUuid != c . ViewStore . Uuid { http . NotFound ( w , r . Request ) return } viewItem := item . ViewItem ( c . ViewUser . Language ) c . ViewItem = & viewItem next ( w , r ) }
VendorItemMiddleware populates all views and relations to display an item
VendorItemMiddleware populates all views and relations to display an item