- Posts: 60
- Thank you received: 1
Add images to 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.
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.
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.
Please Log in or Create an account to join the conversation.
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.
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.
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.
Please Log in or Create an account to join the conversation.
Maybe something for you guys to introduce in your next upgrade.
Please Log in or Create an account to join the conversation.
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.
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.
$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();
Please Log in or Create an account to join the conversation.
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.
Crispin
Please Log in or Create an account to join the conversation.
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.
Please Log in or Create an account to join the conversation.