- Posts: 40
- Thank you received: 0
Custom field values don't change based on variants
11 years 4 months ago #203251
by RGB
Custom field values don't change based on variants was created by RGB
-- url of the page with the problem -- :
ark.developwithrgb.com/categories2/Produ...toothpaste-small-med
-- HikaShop version -- : 1504301217
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.4.38
-- Error-message(debug-mod must be tuned on) -- : I would like custom fields to change based on the variants selected.
Like when the user selects a different pet size, I want the short description and the dog / cat icons to change based on the selection
ark.developwithrgb.com/categories2/Produ...toothpaste-small-med
Could you please let me know how to modify this. I see the non-custom fields do change but not the custom ones
I would like custom fields to change based on the variants selected.
Like when the user selects a different pet size, I want the short description and the dog / cat icons to change based on the selection
ark.developwithrgb.com/categories2/Produ...toothpaste-small-med
Could you please let me know how to modify this. I see the non-custom fields do change but not the custom ones
-- HikaShop version -- : 1504301217
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.4.38
-- Error-message(debug-mod must be tuned on) -- : I would like custom fields to change based on the variants selected.
Like when the user selects a different pet size, I want the short description and the dog / cat icons to change based on the selection
ark.developwithrgb.com/categories2/Produ...toothpaste-small-med
Could you please let me know how to modify this. I see the non-custom fields do change but not the custom ones
I would like custom fields to change based on the variants selected.
Like when the user selects a different pet size, I want the short description and the dog / cat icons to change based on the selection
ark.developwithrgb.com/categories2/Produ...toothpaste-small-med
Could you please let me know how to modify this. I see the non-custom fields do change but not the custom ones
Please Log in or Create an account to join the conversation.
11 years 4 months ago #203293
by nicolas
Replied by nicolas on topic Custom field values don't change based on variants
Hi,
There is no easy system to change custom fields based on characteristics selection.
It would require custom JavaScript code to be added to the characteristics display system.
That would have to be added by a professional developer.
Otherwise, you could simply put your text/image in the product description, which can be different for each variant.
There is no easy system to change custom fields based on characteristics selection.
It would require custom JavaScript code to be added to the characteristics display system.
That would have to be added by a professional developer.
Otherwise, you could simply put your text/image in the product description, which can be different for each variant.
Please Log in or Create an account to join the conversation.
11 years 4 months ago #203375
by RGB
Replied by RGB on topic Custom field values don't change based on variants
I can write JS. Please let me know what file to edit and where are the non-custom fields are being updated based on variants.
Thank you
Thank you
Please Log in or Create an account to join the conversation.
11 years 4 months ago #203379
by nicolas
Replied by nicolas on topic Custom field values don't change based on variants
HI,
This is done in the file administrator/components/com_hikashop/types/characteristic.php
But that would mean that you would hack a core file of HikaShop and you would loose your changes after each update.
A cleaner solution would be to edit the file "show_block_characteristic" via the menu Display>Views and change the line:
You could for example write:
and then you could do like that in order to add your custom JS:
That way, you won't loose your changes during updates.
This is done in the file administrator/components/com_hikashop/types/characteristic.php
But that would mean that you would hack a core file of HikaShop and you would loose your changes after each update.
A cleaner solution would be to edit the file "show_block_characteristic" via the menu Display>Views and change the line:
Code:
echo $this->characteristic->displayFE($this->element, $this->params) . '</div>';
You could for example write:
Code:
echo str_replace('onclick="','onclick="mycustomJSFunction(this);',$this->characteristic->displayFE($this->element, $this->params) . '</div>');
Code:
$js="
function mycustomJSFunction(characteristicDropdownElement){
if(characteristicDropdownElement.value=='value1'){
//do your stuff here
}
}
";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration("\n<!--\n".$js."\n//-->\n");
That way, you won't loose your changes during updates.
Please Log in or Create an account to join the conversation.
Time to create page: 0.175 seconds