JGLOBAL_SELECT_AN_OPTION

  • Posts: 100
  • Thank you received: 1
11 years 8 months ago #93611

HI

When a product variant changes from quantity 1 to 0, the dropdown box displays JGLOBAL_SELECT_AN_OPTION. However I notice this doesn't happen if all the product variants have quantity 0.





Thanks

Patrick

Attachments:

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

  • Posts: 12953
  • Thank you received: 1778
11 years 8 months ago #93622

Hi,

Can you give me a link to your website, it would help me to understand what your problem really is ?

Thank you.

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

  • Posts: 100
  • Thank you received: 1
11 years 8 months ago #93670

Hi Mohamed

My website is in a password protected directory. Do you have an email address i can send the details to.

However I believe you can reproduce this problem by creating

1 Main Product
1 characteristic (with 1 value)
3 Options

Then assign the 1 characteristic to the 3 options, so each option will have 1 variant product. And assign the 3 options to the Main Product.

If you publish all 3 variants and set the quantity for any of the variants to 0, you will get the error text.

Products and Variants




Output




Thanks

Patrick





Thanks

Patrick

Attachments:
Last edit: 11 years 8 months ago by paddyrolls.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 8 months ago #93951

Hi,

That's something we indeed didn't take into account.

You need to add the code:
if(!count($this->values)) continue;

before the line:
$html = JHTML::_('select.genericlist', $this->values, $map, 'class="inputbox" size="1" onchange="hikashopChangeOption();"', 'value', 'text', (int)$value,$id );

in the file "option" of the view "product" via the menu Display->Views to not display the option at all when no variants are available for the option.

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

  • Posts: 100
  • Thank you received: 1
11 years 8 months ago #94042

HI Nicolas

Thank you for the solution.

But could I suggest rather than making the option disappear, could I change it to displaying a value from a custom field.

For example,
NoVariants_CustomField
Values: All sold out, None Available etc

By setting it to a custom field I can have different message for different category of products.

Is the code too difficult to alter for this solution.

Thanks

Patrick

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 8 months ago #94109

Hi,

Then, instead of the code:
if(!count($this->values)) continue;
you can use the code:
if(!count($this->values)){$html=$optionElement->CUSTOM_PRODUCT_FIELD_COLUMN;}else

where CUSTOM_PRODUCT_FIELD_COLUMN is the column name of your custom product field with the error message in it.

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

  • Posts: 100
  • Thank you received: 1
11 years 8 months ago #94697

Hi Nicolas

I have created a custom field with Columne Name: zero_quantity_message and Table: Product. I have created 2 values: All sold out and Not Available.

I have modified the file - Option and view - Product with the following:

if(!count($this->values)){$html=$optionElement->zero_quantity_message;}else

However in the front, I can see the Option being displayed, however instead of seeing the values, all I see an empty <td></td>




Not too sure what I am doing wrong.

Thanks

Patrick

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 8 months ago #94715

Hi,

It probably means that you didn't fill the value of the custom field in that option product. Edit it, fill that field and save.

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

  • Posts: 100
  • Thank you received: 1
11 years 8 months ago #94771

Hi Nicolas

I have set a value for the Option but I get the blank <td></td>. However, If I set a value in the Variant, then it works. However I am using $optionElement->zero_quantity_message but it is using the values from the variant and not the option. If I change to a new value in the Option, then nothing happens and it still uses details from the variant product.

Thanks

Patrick

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 8 months ago #94797

Hi,

Then try the line :
if(!count($this->values)){$html=$optionElement->main->zero_quantity_message;}else

instead of the one of your previous message and that should help.

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

Time to create page: 0.100 seconds
Powered by Kunena Forum