Add custom field image to product

  • Posts: 3
  • Thank you received: 0
9 years 2 months ago #213527

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 2.5.28
-- PHP version -- : 5.5

Hi there,

I'm looking to use animated gifs as the featured image for products listed on the overall shop pages. Hikashop creates static images when uploaded to the product page, so I have currently added a custom field (ajax image) as a workaround, and am hoping to call these images using php on the views / product / img + field page in the backend.

I've had a good search and can't find anything that answers my query. I can add:

<?php echo $this->row->featuredimage; ?>

Which gives me the image filename, but also with added numbers on which are either caching or to keep the img secret? Either way calling the image that way doesn't work (the link works if I remove the numbers but I don't know how to call the image without these).

I then tried using the field class method that I read about:

<?php
$fieldsClass = hikashop_get('class.field');
$element=null;
$fields = $fieldsClass->getFields('',$element,'product');
echo $fieldsClass->show($fields, $this->row->featuredimage); ?>

Which displays an image, but again it is a static thumbnail and not the original image. I need to show the original, animated gif.

Many thanks for your help!

Graham

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

  • Posts: 82866
  • Thank you received: 13373
  • MODERATOR
9 years 2 months ago #213541

Hi,

The custom fields work the same as the normal image system and automatically resize the images when they are too big for the size configured.
The simplest is to use the normal image system. Then, in the file "listing_img_title" of the "product" view via the menu Display>views, change the code:
$img->url
to:
$img->origin_url

That way, it will use the original image you uploaded instead of the resized version and you'll see the animation.

The following user(s) said Thank You: novo

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

  • Posts: 3
  • Thank you received: 0
9 years 2 months ago #213548

Thank you Nicolas, that solved my problem!! Anyone wanting animated GIFs in Hikashop this is the way! :)

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

Time to create page: 0.055 seconds
Powered by Kunena Forum