Change characteristic popup if only one option
14 years 2 months ago #57616
by esotechie
Change characteristic popup if only one option was created by esotechie
There is a need to occasionally have a product with only one characteristic as a variant, e.g. we have a shirt only in Red. But we want it to be a product with a variant because in future we may add other colours.
Now with only one option in a characteristic, it looks on with a pop-up with only one choice. What I would like to do is to either not have the Characteristic appear as a pop-up on the product page, or for it to appear as a Text instead of a popup.
I see that the code is placed by view->product->show_block_charasteristic, but I can not see where it is put together. Can you please direct me to the correct file?
Thanks
Now with only one option in a characteristic, it looks on with a pop-up with only one choice. What I would like to do is to either not have the Characteristic appear as a pop-up on the product page, or for it to appear as a Text instead of a popup.
I see that the code is placed by view->product->show_block_charasteristic, but I can not see where it is put together. Can you please direct me to the correct file?
Thanks
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 12953
- Thank you received: 1778
14 years 2 months ago #57618
by Mohamed Thelji
Replied by Mohamed Thelji on topic Re: Change characteristic popup if only one option
Hello,
I think that you'll probably have to edit the show_default file of the product view.
Hope this will help you.
I think that you'll probably have to edit the show_default file of the product view.
Hope this will help you.
Please Log in or Create an account to join the conversation.
14 years 2 months ago - 14 years 2 months ago #57635
by esotechie
Replied by esotechie on topic Re: Change characteristic popup if only one option
Thanks for the reply Mohamed,
The view->product-> show_default does not render the characteristic popup. That is definitely done by view->product->show_block_charasteristic.
But I do not know what the following calls:
I need to know where the value which is fetched is put together. I may be wrong, but I do not think they are in any of the view files.
The view->product-> show_default does not render the characteristic popup. That is definitely done by view->product->show_block_charasteristic.
But I do not know what the following calls:
Code:
$this->characteristic->displayFE($this->element, $this->params)
I need to know where the value which is fetched is put together. I may be wrong, but I do not think they are in any of the view files.
Last edit: 14 years 2 months ago by esotechie.
Please Log in or Create an account to join the conversation.
14 years 2 months ago #57713
by nicolas
Replied by nicolas on topic Re: Change characteristic popup if only one option
You could simply add that code at the beginning of that show_block_characteristic file:
<?php if(empty($this->element->variants) || count($this->element->variants)<2) return true; ?>
That will skip the display of the characteristics if there is only one variant.
The characteristic itself is done via that file in the file administrator/components/com_hikashop/types/characteristic.php which you can override as explained in the documentation:
www.hikashop.com/en/support/documentatio...tation.html#override
But for such a small modification, you should rather do what I said.
<?php if(empty($this->element->variants) || count($this->element->variants)<2) return true; ?>
That will skip the display of the characteristics if there is only one variant.
The characteristic itself is done via that file in the file administrator/components/com_hikashop/types/characteristic.php which you can override as explained in the documentation:
www.hikashop.com/en/support/documentatio...tation.html#override
But for such a small modification, you should rather do what I said.
Please Log in or Create an account to join the conversation.
14 years 2 months ago #57776
by esotechie
Replied by esotechie on topic Re: Change characteristic popup if only one option
Thanks Nicolas,
Do we already have a function I can use to check the number variants or the number of elements in the popup?
Do we already have a function I can use to check the number variants or the number of elements in the popup?
Please Log in or Create an account to join the conversation.
14 years 2 months ago #57777
by nicolas
Replied by nicolas on topic Re: Change characteristic popup if only one option
What do you mean by "in the popup" ?
Please Log in or Create an account to join the conversation.
14 years 2 months ago #57784
by esotechie
Replied by esotechie on topic Re: Change characteristic popup if only one option
Drop down menu
Please Log in or Create an account to join the conversation.
14 years 2 months ago #57846
by nicolas
Replied by nicolas on topic Re: Change characteristic popup if only one option
Mmm. I'm not sure I understand.
The code I gave in my message does just that:
<?php if(empty($this->element->variants) || count($this->element->variants)<2) return true; ?>
See the count($this->element->variants)<2
It checks that count of variants is below 2 and if so, it returns (with the return true; code) so that it won't display the rest of the file.
The code I gave in my message does just that:
<?php if(empty($this->element->variants) || count($this->element->variants)<2) return true; ?>
See the count($this->element->variants)<2
It checks that count of variants is below 2 and if so, it returns (with the return true; code) so that it won't display the rest of the file.
Please Log in or Create an account to join the conversation.
14 years 2 months ago - 14 years 2 months ago #57849
by esotechie
Replied by esotechie on topic Re: Change characteristic popup if only one option
I'm sorry Nicoals. I did not read your post properly, I though because you said add "that" code at the beginning, you wrote the line of code which I should be adding my code before. But you actually had written the code for me to use.
Thank you very much. Working EXACTLY as I wanted it to. Sorry about the time wasting after that.
P.S. I'm not sure if you are aware, but for some reason the view file is called block_charasteristic. It can cause a little confusion when searching for a view with the term "characteristic".
Thank you very much. Working EXACTLY as I wanted it to. Sorry about the time wasting after that.
P.S. I'm not sure if you are aware, but for some reason the view file is called block_charasteristic. It can cause a little confusion when searching for a view with the term "characteristic".
Last edit: 14 years 2 months ago by esotechie.
Please Log in or Create an account to join the conversation.
14 years 2 months ago #57892
by nicolas
Replied by nicolas on topic Re: Change characteristic popup if only one option
Thank you for the feedback. We'll change the name of the file (you will have to do again your customization after updating).
Please Log in or Create an account to join the conversation.
Time to create page: 0.229 seconds