Characteristics and options selection method

  • Posts: 65
  • Thank you received: 2
11 years 1 month ago #127507

-- url of the page with the problem -- : www.canvascool.com
-- HikaShop version -- : 2.x.x
-- Joomla version -- : 3.x
-- PHP version -- : 5.x.x
-- Browser(s) name and version -- : chrome
-- Error-message(debug-mod must be tuned on) -- : Error_message

Hello,

I would like characteristics to have a different selection method than options.

For ex.
Characterisitcs: displayed as a dropdown
Options: displayed as radio box with associated color & description

As it is set up now I see that if you set characteristics selection method as a dropdown all characteristics & options are listed as dropdown.

Is their a way to change this?

Thank you in advance

Last edit: 11 years 1 month ago by epware.

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

  • Posts: 12953
  • Thank you received: 1778
11 years 1 month ago #127524

Hi,

The only way will be to do some code customization through your show_block_characteristic file of your product view of your front-end template, but some development skill will be required.

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

  • Posts: 65
  • Thank you received: 2
11 years 1 month ago #127531

Ok thank you.

But I just noticed that if I set the Characteristics selection method to radio box my options remains in a drop down format as seen here:http://www.canvascool.com/jml/index.php/commencez/product/1-canvas-simple. How come?

It seems that the Characteristics and the Options selection method can be set at different places but I can't seem to find the place where to manage the Options selection method.

Last edit: 11 years 1 month ago by epware.

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

  • Posts: 82906
  • Thank you received: 13378
  • MODERATOR
11 years 1 month ago #127609

Hi,

The "characteristic display method" option of the configuration only apply to characteristics, not to options.
So you can have the display method you want for the characteristics with that option.
However, there is no option to change the options display method. You will have to change the code of the "option" file of the view "product" via the menu Display>views if you want to change the display method of options.

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

  • Posts: 65
  • Thank you received: 2
11 years 1 month ago #127923

Thanks for your help. I managed to list the options with radio box. www.canvascool.com/jml/index.php/commenc...duct/1-canvas-simple

A few more questions:


1) I would like to list under each listed option its image and its description as well. I don't know in which variables these datas are stored and which one I should use.

2) When I select an option (radio box format) it does not refresh the total price.

Any suggestions how I can solve the above issues?

Thank you very much for your time & help.

Rgds

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

  • Posts: 13201
  • Thank you received: 2322
11 years 1 month ago #127981

Hi,

1. The values needed should be in the variable "$variant" in the foreach "foreach($optionElement->variants as $variant){"
2. By default the total price is not refreshed, but the price with option yes.
To refresh it you have to call the javascript function "hikashopChangeOption()" when selecting an option like it's done by default with the dropdown.

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

  • Posts: 65
  • Thank you received: 2
11 years 1 month ago #128021

Hello Xavier and thank you very much for your prompt response and very good service.

1.
$variant->characteristics_text; returns the title
$variant->characteristics_description; returns the Id (for some odd reason)

Which one returns the Description?

2. Can we change the default Total Price to Price with Option? I could not find a threaa about this.

Tx in advance

Eric

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

  • Posts: 13201
  • Thank you received: 2322
11 years 1 month ago #128099

Hi,

What you need is maybe in the object "$optionElement". The characteristics don't have image and descriptions, but the options have.

The easiest way seems to be to have the same display for the option price than the total price, and hide the total price if the option price exist. It will require some Javascript.

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

  • Posts: 65
  • Thank you received: 2
11 years 1 month ago #128132

I got the description now. I got it from $variant->product_description. All OK.

Since I changed the option listing with radio button using the JHTML::_('select.radiolist' its does not refresh the "Price with option:". May I ask you to check the code I use to see if I did anything wrong:

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

Thank you in advance for your kind help.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 1 month ago #128200

Hi,

What is the content of your $map variable ?
You should have an id like: "hikashop_product_option_0" and a name like "hikashop_product_option[0]"

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

  • Posts: 65
  • Thank you received: 2
11 years 1 month ago #128211

Hi and tx for the reply.

This is what I get:

hikashop_product_option[0] hikashop_product_option[1]

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

  • Posts: 26159
  • Thank you received: 4028
  • MODERATOR
11 years 1 month ago #128906

Hi,

I am sorry but, I discovered this thread, I read the last posts and.. I do not understand anything at your answer.
Your link for the product page is no more working so I have some troubles to see what you want to do exacly.

First at all, do you still have your problem or is it solved ?
Can you try to reformulate it ?

Thanks


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 65
  • Thank you received: 2
11 years 1 month ago #129079

Hello and Jerome and thank you for your reply. No I did not find a solution yet to my initial question.

This is the situation:


On the product page, the default layout for the Options is a dropdown button. I changed the code to display Radio button instead. I used the following code to do this:

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

The problem:
Since I changed the code to display Options with Radio button the "Price with option" at the bottom of the page does not add automatically the cost of an Option anymore. I would like to know if there is a solution to this issue. It seems the onchange="hikashopChangeOption() is not working anymore.

You can review the page here: www.canvascool.com/jml/index.php/product...duct/1-canvas-simple

Let me know if I was not clear enough.

Tx in advance for the support :)

Eric

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

  • Posts: 13201
  • Thank you received: 2322
11 years 1 month ago #129387

Hi,

The function "hikashopChangeOption()" parse the html to find the elements with the id "hikashop_product_option_X"
Where X is a numeric value starting at 0 incremented in a loop to find all the options, if the id is not found, the script is stopped, so the ids must start at 0 and be incremented one by one..

So the script take the value depending on the option id. In your case, the radio buttons don't have correct id.
What you have to do is to add an input hidden with a correct option id, and change the value of its hidden input with some javascript when clicking on a radio button.
Something like:

// one of your current radio button
<input id="hikashop_product_option_118510" class="inputbox" type="radio" onchange="updateHiddenOption(hikashop_product_option_0,18510); hikashopChangeOption();" size="1" value="18510" name="hikashop_product_option[1]" />

// the hidden input
<input id="hikashop_product_option_0" type="hidden" value="" />

// the function to update the value of the hidden input
<script>
updateHiddenOption(id,value){
    document.getElementById(id).value = value;
}
</script>

Last edit: 11 years 1 month ago by Xavier.

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

  • Posts: 65
  • Thank you received: 2
11 years 1 month ago #129392

Wow! Thanks a lot for this cool answer. I'll give it a try. All the best and thank you again for your kind help.

Eric

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

Time to create page: 0.109 seconds
Powered by Kunena Forum