Show images of options and options with variants

  • Posts: 94
  • Thank you received: 2
  • Hikashop Business
4 years 1 week ago #330477

-- HikaShop version -- : 4.4.1
-- Joomla version -- : 3.9.25
-- PHP version -- : 7.4
-- Browser(s) name and version -- : FF 86.0
-- Error-message(debug-mod must be tuned on) -- : not applicable

Is it possible to show the images of created options with and without variants? As far as I can see it's only possible to show the images of characteristics of a product, but not the images of the options made with and without variants? Am I missing something?

Cheers

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

  • Posts: 4816
  • Thank you received: 654
  • MODERATOR
4 years 1 week ago #330479

Hello,

Really sorry for this return but can you details more your need and especially what you means by "images of the options made with and without variants" ?
Can you illustrate with a concrete case ? Annotated screenshot ? A detailed example ?

Once again, sorry for this return and awaiting your elements to be able to answer you.
Regards

Last edit: 4 years 1 week ago by Philip.

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

  • Posts: 94
  • Thank you received: 2
  • Hikashop Business
4 years 1 week ago #330513

Hi Philipe,

You can check the page by visiting the (non public) URL I provided. The case is a (poster) frame
Base product is a frame with 21 variants (3 different frame colors, 5 different posters, a mirror or a whiteboard). The variants can be shown via images to that variant.
But there's also a option: a floor stand. The only possible information for a potential customer is textual instead of visual (image). Or am I missing something here?

It's becoming more complex when I want to change the 'content' variants into a 'contents' option with 21 variants. Why do I want to do that, you might ask? The advantage for a customer is that he/she will see the price for the base product (frame) and additional prices for the options (+ €x.xx), which isn't visible with variants. Another advantage is that they will be added as individual products in the shopbasket (with different images).

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

  • Posts: 83404
  • Thank you received: 13497
  • MODERATOR
4 years 6 days ago #330527

Hi,

There are ways to do it but you need to make concessions:
- You could create a Joomla article with the images and text you want for the option in the article and then provide the URL to the article with the parameter &tmpl=component in the "brand URL" setting of the option product.
That way, the name of the option will be clickable and it will open a popup with the page of the brand URL displayed inside.
- You could actually use a translation override of the product name of the option product to directly display the img tag next / instead of the option name. However, in the HikaShop configuration, you have the setting "Product selection method". If you set it to "radio" or "on a per product basis" and then configure the same option to "radio" in the option product, the option dropdown will be replaced with a radio selector. In that case, you can have HTML for each variant. And in that case, you can use a translation override on the variant name to have your img tag for each variant, before its price.
- Now this doesn't address having different images for different variants of the same product option. The main issue with this is that you can't directly display the images in the option dropdown.

The following user(s) said Thank You: RustyHika

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

  • Posts: 94
  • Thank you received: 2
  • Hikashop Business
4 years 4 days ago #330669

Hi Nicolas,

Another question about options (or do I have to start a new topic?): Is it possible to show the stock amount and availability of options within a product? Now options are visible when there is stock and invisible when there is not. I like to show an option when it's out of stock and the date when it's available again. It's possible with variants, but not with options. Or am I missing something?

Thanks in advance!

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

  • Posts: 83404
  • Thank you received: 13497
  • MODERATOR
4 years 4 days ago #330705

Hi,

Well, with variants the display of the stock of the main product area is replaced with the display of the current variant.
But for options there is no such area. And in the dropdown, you might not want to display such information. But if you want to add extra information in the option dropdown, it sure is possible with some extra PHP code in the product / option.php view file.

For example, you add the stock after the variant name in that dropdown you could just add the line:
$text .= ' ('.$variant->product_quantity.')';
Before the line:
if(!empty($variant->prices) && $this->params->get('show_price')) {

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

  • Posts: 94
  • Thank you received: 2
  • Hikashop Business
4 years 4 days ago #330718

Hi Nicolas,

Beside showing the quantity of options in the dropdown, more important is that the option remain visible when there's no stock of that option at the moment and that the customer will see the date when there is stock again. Is that possible?

Cheers

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

  • Posts: 83404
  • Thank you received: 13497
  • MODERATOR
4 years 3 days ago #330729

Hi,

In the same file you can see this line:
if(!$variant->product_published || empty($variant->product_quantity)) continue;
change it to :
if(!$variant->product_published) continue;
and it should display products without stock in the option dropdown.

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

  • Posts: 94
  • Thank you received: 2
  • Hikashop Business
4 years 3 days ago #330747

Hi Nicolas,

I can't find both lines in the product / option.php view file:

if(!empty($variant->prices) && $this->params->get('show_price')) {
and
if(!$variant->product_published || empty($variant->product_quantity)) continue;

Am I looking the wrong way?

Attachments:

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

  • Posts: 4816
  • Thank you received: 654
  • MODERATOR
4 years 1 day ago #330789

Hello,

Strange, we will try like this, first try to for "foreach($optionElement->variants as $variant)", normally you should find this around line 83.
Then see my screenshot :



Hope this will help you to progress on your subject.
Regards

Last edit: 4 years 1 day ago by Philip.

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

  • Posts: 94
  • Thank you received: 2
  • Hikashop Business
3 years 11 months ago #330841

Hi,

Well, with variants the display of the stock of the main product area is replaced with the display of the current variant.
But for options there is no such area. And in the dropdown, you might not want to display such information. But if you want to add extra information in the option dropdown, it sure is possible with some extra PHP code in the product / option.php view file.

For example, you add the stock after the variant name in that dropdown you could just add the line:
$text .= ' ('.$variant->product_quantity.')';
Before the line:
if(!empty($variant->prices) && $this->params->get('show_price')) {


Hi Nicolas,
This worked, but only affected the options with variants and not the options without. There you will only see a dropdown with 'no' or 'yes (€ x.xx). See screenshots!

Attachments:
Last edit: 3 years 11 months ago by RustyHika.

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

  • Posts: 94
  • Thank you received: 2
  • Hikashop Business
3 years 11 months ago #330843

nicolas wrote: Hi,

In the same file you can see this line:
if(!$variant->product_published || empty($variant->product_quantity)) continue;
change it to :
if(!$variant->product_published) continue;
and it should display products without stock in the option dropdown.


Hi Nicolas,

This didn't work unfortunately!

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

  • Posts: 83404
  • Thank you received: 13497
  • MODERATOR
3 years 11 months ago #330847

Hi,

For the options without variants, it's the same change needed but on this line:

if(!empty($optionElement->prices) && $this->params->get('show_price')) {

For the display of options without stock, I've tested the change myself and it works fine. Note that this change is to display variants without stock of options. If your option doesn't have variants, that would explain why you don't see any change.
Similar to the price change above, you have this line that you need to change too if you want to change it for options without variants:
if(!$optionElement->product_published || empty($optionElement->product_quantity))

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

  • Posts: 94
  • Thank you received: 2
  • Hikashop Business
3 years 11 months ago #331038

Hi Nicolas,

Thanks for the answer! Last questions regarding this topic (;-): Is it possible to apply text after the stock numbers? Now a customer only sees a number after the variant, but not something like "4 in stock" or "out of stock, available 2021-03-21". And what to do with variants with an unlimited stock....now a customer will only see "-1", which isn't very communicative ;-)

Cheers,
Remco

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

  • Posts: 83404
  • Thank you received: 13497
  • MODERATOR
3 years 11 months ago #331056

Hi,

Well, it's up to you to customize the line

$text .= ' ('.$variant->product_quantity.')';
that you added with the text you want...
For example:
if($variant->product_quantity==-1)
$text .= '';
if($variant->product_quantity==0)
$text .= ' out of stock';
else
$text .= ' '.$variant->product_quantity.' in stock';

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

Time to create page: 0.081 seconds
Powered by Kunena Forum