- Posts: 24
- Thank you received: 0
Display same custom field value for variants
When I choose a variant on main product page,the custom fields will disappear.
I realized that I have to input values on variants' edit page again.
If my variants have same values with main product,
What can I do to save the repeat work that input the same values in variant edit page.
So that the custom fields will show on main product page and variant page
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I modify this code in show_block_custom_main.php
<div id="hikashop_product_custom_info_main" class="hikashop_product_custom_info_main">
to
<div id="hikashop_product_custom_info_main1" class="hikashop_product_custom_info_main">
The custom fields will show on the main product and variants.
I don't know the reason , I thought it will cause other problems maybe.
Can someone could give me some advise?
Please Log in or Create an account to join the conversation.
That will be fixed in next version of HikaShop. Until then, your modification is a correct way to solve that.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Yes, it as been solved in HikaShop 2.0
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Is there a new setting to make it appear in the variants ?
Please Log in or Create an account to join the conversation.
But that's not really a problem since you can easily fix it yourself as you already did.
Please Log in or Create an account to join the conversation.
- Posts: 23
- Thank you received: 0
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- Posts: 23
- Thank you received: 0
nicolas wrote: Can you add the code:
after the lineCode:if(empty($variant->$fieldName) && !empty($this->element->main->$fieldName)){ $variant->$fieldName = $this->element->main->$fieldName; }in the file 'show' of the view 'product' via the menu Display->Views and try again ?Code:foreach ($this->fields as $fieldName => $oneExtraField) {
Thanks, Nicolas. Can you advise do we ALSO have to make the change suggested above by wzyefd to the file show_block_custom_main.php?
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.