Show product image from database, if it exists
only use POD image if we have nothing in our DB (and config doesn't say not to)
This commit is contained in:
		
							parent
							
								
									ab1ff48527
								
							
						
					
					
						commit
						1165fa8cdb
					
				
					 1 changed files with 15 additions and 4 deletions
				
			
		|  | @ -887,11 +887,22 @@ class ProductsView(MasterView): | |||
|         return pretty_quantity(value) | ||||
| 
 | ||||
|     def template_kwargs_view(self, **kwargs): | ||||
|         kwargs['image'] = False | ||||
|         product = kwargs['instance'] | ||||
|         if product.upc: | ||||
|             kwargs['image_url'] = pod.get_image_url(self.rattail_config, product.upc) | ||||
|             kwargs['image_path'] = pod.get_image_path(self.rattail_config, product.upc) | ||||
| 
 | ||||
|         # TODO: pretty sure this is no longer needed?  guess we'll find out | ||||
|         # kwargs['image'] = False | ||||
| 
 | ||||
|         # maybe provide image URL for product; we prefer image from our DB if | ||||
|         # present, but otherwise a "POD" image URL can be attempted. | ||||
|         if product.image: | ||||
|             kwargs['image_url'] = self.request.route_url('products.image', uuid=product.uuid) | ||||
| 
 | ||||
|         elif product.upc: | ||||
|             if self.rattail_config.getbool('tailbone', 'products.show_pod_image', default=False): | ||||
|                 # here we try to give a URL to a so-called "POD" image for the product | ||||
|                 kwargs['image_url'] = pod.get_image_url(self.rattail_config, product.upc) | ||||
|                 kwargs['image_path'] = pod.get_image_path(self.rattail_config, product.upc) | ||||
| 
 | ||||
|         kwargs['costs_label_preferred'] = "Pref." | ||||
|         kwargs['costs_label_vendor'] = "Vendor" | ||||
|         kwargs['costs_label_code'] = "Order Code" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar