Product Details group option products by category

  • Posts: 38
  • Thank you received: 1
9 years 2 months ago #244395

-- HikaShop version -- : latest
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.4.35
-- Browser(s) name and version -- : Chrome latest

Help please,

What I have:
I have products with "option products" linked.
Eg. Main product = Computer, Option products = ram upgrade 8GB, HDD upgrade 2TB etc.

What I need:
I simply need the product details page to show each category of the option products, and then show the option products with a radio button or single select drop-down option.
Eg. If there are option products linked to this product from the RAM and HDD categories, we need a heading for "RAM" followed by the RAM category option products, then a heading for "HDD" followed by the RAM category option products and so on, only letting them select one option from each category.

My questions:
1) I believe I only need to edit the Product Details view to make this happen, is this right?
2) I desperately need this urgently today, I may not figure it out in time. Could any of you suggest code to point me in the right direction? I am also willing to pay a freelancer but cannot find a reliable one soon enough. Can any of you help me within 6 hours at a reasonable rate?

Any helpful response within the next few hours would be appreciated.

Thank you,

MA.

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

  • Posts: 38
  • Thank you received: 1
9 years 2 months ago #244401

Solved mostly:
I might just add Option products in place of category and add variants / characteristics to those option products.

New question related:
3)
How do I get the image of the option product selected to show on the page somewhere when selected?

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

  • Posts: 84313
  • Thank you received: 13702
  • MODERATOR
9 years 2 months ago #244417

Hi,

Using options is the way to go I think.
However, there is no system to display the images of the options and refresh them.
It will require adding custom code in the file "option" of the view "product" via the menu Display>Views to load the images, add their HTML to the page and hide/display that HTML based on what is selected by the customer.

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

  • Posts: 38
  • Thank you received: 1
9 years 2 months ago #244443

I figured that, thank you.

What calls the image? I just need the code to past in here:

This line 126:
$options='<img src="'.HIKASHOP_IMAGES.'info.png" alt="Information"/>';

I want to replace "info.png" with something like:
$optionInfo->product_image

What is the correct way to call the image?

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

  • Posts: 38
  • Thank you received: 1
9 years 2 months ago #244444

It has to call the image of the option, or the option's variant I should say. All of the options have variants with images attached that need to show when the variant of the option is selected.

Am I close with
$optionInfo->product_image
?

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

  • Posts: 84313
  • Thank you received: 13702
  • MODERATOR
9 years 2 months ago #244463

Hi,

The options images are not loaded on the product page since there is no need to normally.
So, as I said, you first need to load them. You can do that with a MySQL query on the hikashop_file table like that:

$db = JFactory::getDBO();
$db->setQuery('SELECT * FROM #__hikashop_file WHERE file_ref_id IN (XXX, YYY, ZZZ) AND file_type=\'product\'');
$images = $db->loadObjectList();
And XXX, YYY and ZZZ are the ids of your products or variants (if you have options with variants, then it's the ids of the variants that you want to set in the query).
Then, to display the image with the index $k in the array $images, you can do like that:
$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($images[$k]->file_path, array('width' => $width, 'height' => $height), $image_options);
if(@$img->success) {
 echo '<img title="'.$this->escape($images[$k]->file_description).'" alt="'.$this->escape($images[$k]->file_name).'" src="'.$img->url.'"/>';
}

The following user(s) said Thank You: doitsolutions

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

  • Posts: 38
  • Thank you received: 1
9 years 2 months ago #244531

Thank you so very much for your solution, we will be applying it soon.
I appreciate your input, our devs were having trouble figuring out how to do that, I think you have just given them the key then need.

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

Time to create page: 0.062 seconds
Powered by Kunena Forum