Skip to main content

product Options part image

More
12 years 4 months ago - 12 years 4 months ago #158289 by kaya
Hi dear
when create a product we have a Options part and when select a item in Options don't show Options product image.
I want show in my product page Options selected item image. how can do it?


this code for option part in my fronted:
Code:
$html='<span class="hikashop_option_name" ><a href="'.$optionInfo->product_url.'">'.$optionInfo->product_name.$options.'</a></span></td><tr><td><span style="padding-left:9px">'.JText::_( 'MAIN_OPTION_AF' ).'</span>'.$html;

i want show each options item image.
Last edit: 12 years 4 months ago by kaya.

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

More
12 years 4 months ago #158356 by Xavier
Replied by Xavier on topic product Options part image
Hi,

You have to edit the view "product / show_default" and display the images thanks to a code like the one which can be found in the view "product / show_block_img".
The code to adapt is this one:
Code:
$image_options = array('default' => true,'forcesize'=>$this->config->get('image_force_size',true),'scale'=>$this->config->get('image_scale_mode','inside')); $img = $this->image->getThumbnail(@$image->file_path, array('width' => $width, 'height' => $height), $image_options); if($img->success) { $attr = ''; if (!empty ($this->element->images) && count($this->element->images) > 1) { $attr = 'onclick="return window.localPage.openImage(\'hikashop_main_image'.$variant_name.'\');"'; } }
The following user(s) said Thank You: kaya

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

More
12 years 4 months ago #158374 by kaya
Replied by kaya on topic product Options part image
Thank you dear Xavier
what code add in my view "product / show_default" for display options images?

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

More
12 years 4 months ago #158377 by Mohamed Thelji
Hello Kaya,
Note that another solution can be to simply add your option images through your main product description.

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

More
12 years 3 months ago - 12 years 3 months ago #159317 by kaya
Replied by kaya on topic product Options part image
Thank you dear Mohamed Thelji
but I want show images of selected product in options part.
this code show option part in product page
Code:
$this->setLayout('option'); echo $this->loadTemplate();
I want show images of option layout
please help me how can do it?
thank you
Last edit: 12 years 3 months ago by kaya.

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

More
12 years 3 months ago #159421 by kaya
Replied by kaya on topic product Options part image
no one help me?

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

More
12 years 3 months ago #159478 by nicolas
Replied by nicolas on topic product Options part image
Hi,

Displaying the images of the options on the product page is not easy.
First, the options images need to be loaded from the database with a MySQL query on the hikashp_files table.
Then, the images need to be displayed with code similar (but a bit adapted) to the one of the show_img_block.
And if you want the option image displayed to change dynamically based on the selected option, you also need custom javascript code to do that.
Basically, it's not easy to do and requires proper development by a developer. If you're not one yourself, I would recommend to contact our partners for a quote on the project ( www.hikashop.com/home/our-partners.html ), or to find a developer via our commercial jobs forum, joomlancers.com or resources.joomla.org
The following user(s) said Thank You: kaya

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

More
12 years 3 months ago - 12 years 3 months ago #159527 by kaya
Replied by kaya on topic product Options part image
Thank you dear nicolas
i can echo option part images in product page by this code:
Code:
foreach($this->element->options as $optionElement){ $image_options = array('default' => true); $height = $this->config->get('product_image_y'); $width = $this->config->get('product_image_x'); $product_id = $optionElement->product_id; $producturl = JRoute::_("index.php?option=com_hikashop&ctrl=product&task=show&cid=$product_id"); foreach($optionElement->images as $img){ $imgs = $this->image->getThumbnail(@$img->file_path, array('width' =>$width, 'height' => $height), $image_options); echo '<img src="'.$imgs->url.'" />'; }
it's php foreach loop now i want show each option product image with product name.
this code echo option product name outside my php foreach loop:
Code:
$html='<span class="hikashop_option_name" >'.$optionInfo->product_name.$options.'</span></td><td>'.$html
thank you
Last edit: 12 years 3 months ago by kaya.

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

Time to create page: 0.197 seconds
Powered by Kunena Forum