Download list - FEATURE REQUEST

Phoca Cart - complex e-commerce extension
User avatar
shibumi
Phoca Enthusiast
Phoca Enthusiast
Posts: 97
Joined: 11 Sep 2016, 22:22

Download list - FEATURE REQUEST

Post by shibumi »

User - My Downloads - have a product image thumbnail showing along with download file name
User avatar
shibumi
Phoca Enthusiast
Phoca Enthusiast
Posts: 97
Joined: 11 Sep 2016, 22:22

Re: Download list - FEATURE REQUEST

Post by shibumi »

At the very least, how to edit the component to add it to the "my downloads" view so that the products item thumbnail image also shows?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Download list - FEATURE REQUEST

Post by Jan »

Hi, in this case you need to override the download output file:
components\com_phocacart\views\download\tmpl\default.php
(copy to your template so your template overrides the output)

But this is not all, it does not include the information about the image, so e.g. on line cca: 32 you need to load information from the product id, e.g.:

Code: Select all

$productInfo = PhocacartProduct::getProduct($v->id);
		if (isset($productInfo->image) && $productInfo->image != '') {
			
			$pathItem 	= PhocacartPath::getPath('productimage');
			$image 		= PhocacartImage::getThumbnailName($pathItem, $productInfo->image, 'small');
			if (isset($image->rel) && $image->rel != '') {
				echo '<img src="'.JURI::base(). $image->rel.'" alt="'.(isset($productInfo->title) ? $productInfo->title : '').'" />';
			}
		}
In short: 1) you get information about the product, including its image, 2) you get the path to the images, 3) you get the thumbnail of the image (in this case small), 4) and if there is an image for the product, you can echo it including alt information

Be aware:
1) do the changes in your template in override file so your changes will be not lost when updating Phoca Cart
2) the example with echo <img is not completet, you need to change your output, e.g. add the img tag into the bootstrap grid, etc. etc.

Jan
If you find Phoca extensions useful, please support the project
Post Reply