Product Images Location by URL - Feature Request

  • Posts: 30
  • Thank you received: 2
9 years 4 months ago #181783

Dear friends:
Thanks for your great work and excellent support. I have a feature request.
Our site and servers get clogged with lots of images. Of course, we developers pay for the space and backups take longer.
Increasingly, we are storing images which you use our our sites on third party sites which are much less expensive or free. (Flickr, Google+)
Please consider allowing for product images to be referenced by URL. That would be very useful.
Appreciate the consideration,
Nadine at Solia.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #181801

Hi,

To integrate that in HikaShop it will require to change all the system, because currently we are generating thumbnails, and to generate the thumbnails we need to have the image stored in local.
A way could to to not generate the thumbnails but only the external image and apply css properties on it, not sure that it's the best solution but it could be possible.

For now, what can be done is to create custom produt fields, then fill the full image path of the image (on the external website). Finally edit the view "product / show_block_img" and replace the current image display function by an image tag like that:

<img src="<?php echo $this->row->CUSTOMFIELD_NAME; ?>" />

The following user(s) said Thank You: solia

Please Log in or Create an account to join the conversation.

  • Posts: 344
  • Thank you received: 3
7 years 5 months ago #253971

Any plan of implementing this function in the future ?

So all images could be hosted on another server, and all I had to do was to paste the image url path in order for it to display on the product page.

Please Log in or Create an account to join the conversation.

  • Posts: 26007
  • Thank you received: 4004
  • MODERATOR
7 years 5 months ago #253974

Hi,

There is still no plan for such feature implementation in a short term.
Like Nicolas wrote, HikaShop need to generate the thumbnails and to do so, it needs to access to the image.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 344
  • Thank you received: 3
7 years 5 months ago #254071

OK tnx for reply.

Is this something that could be done with a simple plugin ?

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13069
  • MODERATOR
7 years 5 months ago #254073

Hi,

You don't need a plugin. Just create a custom product field, and on the listing and the product page view files, instead of the code used to display the thumbnails, you could add such code:

<img src="<?php echo $this->row->XX; ?>"/>
where XX would be the column name of your custom field where you would enter the image URL for each product.

Please Log in or Create an account to join the conversation.

  • Posts: 344
  • Thank you received: 3
7 years 5 months ago #254119

OK tnx for reply.

1. whould this code be the same for the main image of the product ?
Or should i write something different for the cutsom field for what would be the main image.

2. What product page view file would you recommend to place the code in ?

3. Can I use both image systems, any suggestion on what the code for that will be ?
I.e: I have some products using the standard system (images from the hikashop uppload folder - like I use now) and som for external image hosting.

Last edit: 7 years 5 months ago by river.

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13069
  • MODERATOR
7 years 5 months ago #254122

Hi,

1. For the main product page, you would change $this->row by $this->element in the code example

2. You would put it in the show_block_img view file.

3. Sure. You could do it like that:
<?php if(!empty($this->row->XX)){ ?>
<img src="<?php echo $this->row->XX; ?>"/>
<?php }else{ ?>
... standard code to display product images ....
<?php } ?>

Please Log in or Create an account to join the conversation.

  • Posts: 344
  • Thank you received: 3
7 years 5 months ago #254329

Tnx for all advice, this sounds good.

You don't need a plugin. Just create a custom product field, and on the listing and the product page view files, instead of the code used to display the thumbnails, you could add such code:


1. What kind of "Field type" should I use for the custom field ? ..to paste the image url path into ...
2. Which "Table" should I use for the custom field ?

Tnx

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13069
  • MODERATOR
7 years 5 months ago #254333

Hi,

A custom field of the table "product" and of the type "text".

Please Log in or Create an account to join the conversation.

  • Posts: 344
  • Thank you received: 3
7 years 5 months ago #254433

Tnx for reply
So I have decided to keep the main image for the product using the standard Hikashop image system.

But I want to be able to use extenal images for the thumbnails.

I have created a custom field type "text" in the table "product".

So this is my code for the thumbanils I need to implement:

<?php if(!empty($this->row->001)){ ?>
<img src="<?php echo $this->row->bilde01; ?>"/>
<?php }else{ ?>

Could you please advice me where in the "show_block_img" file I should place this code ?Tnx for reply
So I have decided to keep the main image for the product using the standard Hikashop image system.

But I want to be able to use extenal images for the thumbnails.

I have created a custom field type "text" in the table "product".

So this is my code for the thumbanils I need to implement:

<?php if(!empty($this->row->001)){ ?>
<img src="<?php echo $this->row->bilde01; ?>"/>
<?php }else{ ?>

Could you please advice me where in the "show_block_img" file I should place this code ?

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13069
  • MODERATOR
7 years 5 months ago #254436

Hi,

Then, you want to change that code which displays the thumbnails of the product:

$img = $this->image->getThumbnail(@$image->file_path, array('width' => $width, 'height' => $height), $image_options);
						if(@$img->success) {
							$id = null;
							$classname='hikashop_child_image';
							if($firstThunb) {
								$id = 'hikashop_first_thumbnail'.$variant_name;
								$firstThunb = false;
								$classname.=' hikashop_child_image_active';
							}
							$attr = 'title="'.$this->escape(@$image->file_description).'" onmouseover="return window.localPage.changeImage(this, \'hikashop_main_image'.$variant_name.'\', \''.$img->url.'\', '.$img->width.', '.$img->height.', \''.str_replace("'","\'",@$image->file_description).'\', \''.str_replace("'","\'",@$image->file_name).'\');"';
							$html = '<img class="'.$classname.'" title="'.$this->escape(@$image->file_description).'" alt="'.$this->escape(@$image->file_name).'" src="'.$img->url.'"/>';
							if(empty($variant_name)) {
								echo $this->popup->image($html, $img->origin_url, $id, $attr, array('gallery' => 'hikashop_main_image'));
							} else {
								echo $this->popup->image($html, $img->origin_url, $id, $attr, array('gallery' => 'hikashop_main_image_VARIANT_NAME'));
							}
						}

Please Log in or Create an account to join the conversation.

  • Posts: 344
  • Thank you received: 3
7 years 5 months ago #254488

OK tnx for reply. So I've tried placing the code like this

<?php if(!empty($this->row->bilde01)){ ?>
<img src="<?php echo $this->row->bilde01; ?>"/>
<?php }else{ ?>
$img = $this->image->getThumbnail(@$image->file_path, array('width' => $width, 'height' => $height), $image_options);
						if(@$img->success) {
							$id = null;
							$classname='hikashop_child_image';
							if($firstThunb) {
								$id = 'hikashop_first_thumbnail'.$variant_name;
								$firstThunb = false;
								$classname.=' hikashop_child_image_active';
							}
							$attr = 'title="'.$this->escape(@$image->file_description).'" onmouseover="return window.localPage.changeImage(this, \'hikashop_main_image'.$variant_name.'\', \''.$img->url.'\', '.$img->width.', '.$img->height.', \''.str_replace("'","\'",@$image->file_description).'\', \''.str_replace("'","\'",@$image->file_name).'\');"';
							$html = '<img class="'.$classname.'" title="'.$this->escape(@$image->file_description).'" alt="'.$this->escape(@$image->file_name).'" src="'.$img->url.'"/>';
							if(empty($variant_name)) {
								echo $this->popup->image($html, $img->origin_url, $id, $attr, array('gallery' => 'hikashop_main_image'));
							} else {
								echo $this->popup->image($html, $img->origin_url, $id, $attr, array('gallery' => 'hikashop_main_image_VARIANT_NAME'));

But then product site gets messed up. Could you please be more specific ?
My PHP levels are very limited, even tought Im learning :)

Please Log in or Create an account to join the conversation.

  • Posts: 26007
  • Thank you received: 4004
  • MODERATOR
7 years 5 months ago #254489

Hi,

messed up how ?
Please be a lot more specific.

The code you paste have some problem.
1 - on the third line, there is a closing php tag but with some php code just after.
2 - it looks uncompleted for me because there are some missing brackets at the end (3 to be exact).

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 344
  • Thank you received: 3
7 years 5 months ago #254631

OK tnx for reply

So when I use the above code I get the standard joomla page saying:

The requested page does not exist.

"0 syntax error, unexpected '<'"

Anyway... so this is the first paragraph of the code of above.

<?php if(!empty($this->row->bilde01)){ ?>
<img src="<?php echo $this->row->bilde01; ?>"/>
<?php }else{ ?>
$img = $this->image->getThumbnail(@$image->file_path, array('width' => $width, 'height' => $height), $image_options);
						if(@$img->success) {
							$id = null;
							$classname='hikashop_child_image';
							if($firstThunb) {
								$id = 'hikashop_first_thumbnail'.$variant_name;
								$firstThunb = false;
								$classname.=' hikashop_child_image_active';

Could you please advice me of what would be the correct way to write line 3 ?

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13069
  • MODERATOR
7 years 5 months ago #254633

Hi,

Instead of :
<?php }else{ ?>
you should have:
<?php }else{
because you don't want to stop the PHP code since you have PHP code just after that.

Please Log in or Create an account to join the conversation.

Time to create page: 0.104 seconds
Powered by Kunena Forum