Add images to options

  • Posts: 60
  • Thank you received: 1
12 years 4 months ago #55189

Simple, how do I add images to the options?

I want to be able to include extras such as gift wrapping, ballons etc to the product and this really needs to have images. It won't work if they are ordered as separate products.

Cheers

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

  • Posts: 82820
  • Thank you received: 13368
  • MODERATOR
12 years 4 months ago #55224

Options are "together" with the product in the order. So that's not a problem.
However, no image is displayed for options on the product page.
Where would you want to add that ? Instead of the name of the option ?
In that case, you could try to put the image HTML code directly in the name of the option.
Otherwise, I don't see how you could do it without custom coding.

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

  • Posts: 60
  • Thank you received: 1
12 years 4 months ago #55256

It would be ideal if a small thumbnail could be displayed for each option on the main product page. Each option could then have a radio button to select.

Does that make sense?

I'm a newbie to Hika, so still floundering a bit.

Thanks

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

  • Posts: 60
  • Thank you received: 1
12 years 4 months ago #55258

I don't have a problem with a little custom coding though some guidance would be handy. I can see how I could, possibly, manually add images to the options but this wouldn't work if my client was managing the site and adding product. Is there a way the options could be set up as products and then link to those in the options?

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

  • Posts: 60
  • Thank you received: 1
12 years 4 months ago #55302

I note that when an option is added the image for that option is displayed in the shopping cart.

Is there a way I can add the same code to the options in the option.php to display the image. All the layout stuff I can sort out.

In time I expect I'll work it out but it would be an enormous help if you could advise please.

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

  • Posts: 60
  • Thank you received: 1
12 years 4 months ago #55308

I can display the default 'barcode' image for options cavespidertemp1.co.uk/product/cid-10 how do I now get the correct image

The code as it stands

<td class="hikashop_cart_product_image_value">

<?php if($this->params->get('show_cart_image')) ?>
<div class="hikashop_cart_product_image_thumb" >
<?php echo $this->image->display($image->file_path,true,$image->file_name,'style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle"'); ?>
</div>
</td>


I have borrowed code from cart.php but haven't as yet managed to work out what is missing.

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

  • Posts: 82820
  • Thank you received: 13368
  • MODERATOR
12 years 4 months ago #55373

You indeed have to edit the file "option" of the view "product" in order to do that.

First, you will have to load the image of the option from the hikashop_file table via a MySQL query based on the product_id of the option.
Once you have the data of the image in $image, the code you posted in your previous message will display the image of the option.

The following user(s) said Thank You: nikmackey

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

  • Posts: 60
  • Thank you received: 1
12 years 4 months ago #55417

Thanks for the response, I shall have a go.

Maybe something for you guys to introduce in your next upgrade.

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

  • Posts: 60
  • Thank you received: 1
12 years 4 months ago #55441

Firstly thank you for your help

I've had a go at this and, frustratingly, can't quite make it work. I fear my PHP is not quite what it might be.

Could I ask a big favour and ask you to suggest the code that might be used in this section of option.php.

It would be a handy feature to have in your package anyway.

I shall continue to try and work this out.

Thanks

Crispin

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

  • Posts: 60
  • Thank you received: 1
12 years 4 months ago #55473

Though I have found the product_id in the table I can find no reference to the image in the same table.

I have tried to use code used in similar situations on other templates without success.

I would dearly love to get this sorted and move on with developing this shop.

All the best

Crispin

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

  • Posts: 82820
  • Thank you received: 13368
  • MODERATOR
12 years 4 months ago #55559

It's something like that:

$db =& JDatabase::getDBO();
$db->setQuery('select * from #__hikashop_file where file_ref_id='.$optionElement->product_id.' and file_type=\'product\' limit 1');
$image = $db->loadObject();

The following user(s) said Thank You: nikmackey

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

  • Posts: 60
  • Thank you received: 1
12 years 4 months ago #55661

nicolas wrote: It's something like that:

$db =& JDatabase::getDBO();
$db->setQuery('select * from #__hikashop_file where file_ref_id='.$optionElement->product_id.' and file_type=\'product\' limit 1');
$image = $db->loadObject();


Firstly thanks again for the above suggestion.

I ran the query select * from j25_hikashop_product where product_id = '.$optionElement->product_id.' and file_type = 'product' limit 1 The syntax all seems ok though it is returning zero data. I have plainly got one of the feilds wrong. Any clues please.

Thanks

Crispin

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

  • Posts: 60
  • Thank you received: 1
12 years 4 months ago #55703

Any thoughts on this one please.

Crispin

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

  • Posts: 82820
  • Thank you received: 13368
  • MODERATOR
12 years 4 months ago #55765

You of course need to replace '.$optionElement->product_id.' by the id of the option if you try to run it in phpmyadmin....
That piece of PHP code adds the id of the current option if you put it in the "option" file in the foreach which displays the options.

The following user(s) said Thank You: nikmackey

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

Time to create page: 0.079 seconds
Powered by Kunena Forum