How To Make A Field Mandatory In Product Detail Page Tabs

Is this still working because I dont find any code on this post, I need mandatory features for vendors.

I have corrected the post. So you can try it now. Do not forget to clear cache

Thank you ! I have several features IDs , how to add theme all ?

Please try

{if $feature_id|in_array:[123,56,89,104]}

Thanks alot, it shows as mandatory fields but when I try to save it doesnt work, it scrolls to the those fields even if they have features selected. How to fix it ? I also tried with initial code, same result , it wont get saved.

Here is the code

{if $feature.feature_type != "ProductFeatures::GROUP"|enum}
    {hook name="products:update_product_feature"}
        <div class="control-group control-group--hidden-input">
           <label class="control-label{if $feature_id|in_array:[553,554,552,555]} cm-required{/if}" for="feature_{$feature_id}">
                <a href="{"product_features.update?feature_id={$feature_id}"|fn_url}">
                    {$feature.internal_name}
                </a>

What feature type do you use (input text, selectbox, etc)?

This is it , select box Capture|690x435

It is required to examine the issue directly on your server. Possibly something was changed in the latest versions

Im using CS Cart Multi-Vendorv4.15.2. Here is the file product_assign_feature.tpl content

{$allow_enter_variant = $allow_add_feature && $feature|fn_allow_save_object:"product_features"}
{$product_id = $product_id|default:0}

{if $feature.feature_style == "ProductFeatureStyles::COLOR"|enum || $feature.filter_style == "ProductFilterStyles::COLOR"|enum}
    {$template_type = "color"}
    {$enable_images = false}
{elseif $feature.feature_style == "ProductFeatureStyles::BRAND"|enum}
    {$template_type = "image"}
    {$enable_images = true}
{else}
    {$template_type = "text"}
    {$enable_images = false}
{/if}

{if $feature.feature_type != "ProductFeatures::GROUP"|enum}
    {hook name="products:update_product_feature"}
        <div class="control-group control-group--hidden-input">
           <label class="control-label{if $feature_id|in_array:[553,554,552,555]} cm-required{/if}" for="feature_{$feature_id}">
                <a href="{"product_features.update?feature_id={$feature_id}"|fn_url}">
                    {$feature.internal_name}
                </a>
                <div>
                    <small>
                        {$feature.description}
                    </small>
                </div>
            </label>
            <div class="controls">
                <div class="product-assign-features__row">
                    {if $feature.prefix}<span>{$feature.prefix}</span>{/if}

                    {if $feature.feature_type == "ProductFeatures::TEXT_SELECTBOX"|enum
                        || $feature.feature_type == "ProductFeatures::NUMBER_SELECTBOX"|enum
                        || $feature.feature_type == "ProductFeatures::EXTENDED"|enum}
                        {$value_selected = false}
                        <input type="hidden"
                               name="product_data[product_features][{$feature_id}]"
                               id="feature_{$feature_id}"
                               value="{$selected|default:$feature.variant_id}"
                        />
                        <input type="hidden"
                               name="product_data[add_new_variant][{$feature_id}][variant]"
                               id="product_feature_{$feature_id}_add_new_variant"
                               value=""
                        />
                        {if $feature.variants[$feature.variant_id]}
                            {$item_ids=[$feature.variant_id => $feature.variants[$feature.variant_id]]}
                        {else}
                            {$item_ids=$feature.variants}
                        {/if}
                        {include file="views/product_features/components/variants_picker/picker.tpl"
                            feature_id=$feature.feature_id
                            input_name="product_data[product_features][{$feature_id}]"
                            item_ids=$item_ids|default:[]
                            multiple=false
                            template_type=$template_type
                            allow_clear=true
                            allow_add=$allow_enter_variant
                            new_value_holder_selector="#product_feature_{$feature_id}_add_new_variant"
                            enable_image=$enable_images
                        }
                    {elseif $feature.feature_type == "ProductFeatures::MULTIPLE_CHECKBOX"|enum}
                        <input type="hidden"
                               name="product_data[product_features][{$feature_id}]"
                               value=""
                        />
                        <input type="hidden"
                               name="product_data[add_new_variant][{$feature_id}][variant][]"
                               class="product_feature_{$feature_id}_add_new_variant"
                               value=""
                        />
                        {include file="views/product_features/components/variants_picker/picker.tpl"
                            multiple=true
                            feature_id=$feature.feature_id
                            input_name="product_data[product_features][{$feature_id}][]"
                            item_ids=$feature.variants|default:[]
                            template_type=$template_type
                            allow_clear=false
                            allow_add=$allow_enter_variant
                            new_value_holder_selector=".product_feature_{$feature_id}_add_new_variant"
                            enable_image=$enable_images
                        }
                    {elseif $feature.feature_type == "ProductFeatures::SINGLE_CHECKBOX"|enum}
                        <label class="checkbox">
                            <input type="hidden" name="product_data[product_features][{$feature_id}]" value="N" />
                            <input type="checkbox" name="product_data[product_features][{$feature_id}]" value="Y" id="feature_{$feature_id}" {if $feature.value == "Y"}checked="checked"{/if} /></label>
                    {elseif $feature.feature_type == "ProductFeatures::DATE"|enum}
                        {include file="common/calendar.tpl"
                            date_id="date_`$feature_id`"
                            date_name="product_data[product_features][$feature_id]"
                            date_val=$feature.value_int|default:""
                            extra="placeholder=\"-{__("none")}-\""
                        }
                    {else}
                        <input type="text"
                            name="product_data[product_features][{$feature_id}]"
                            value="{if $feature.feature_type == "ProductFeatures::NUMBER_FIELD"|enum}{if $feature.value_int != ""}{$feature.value_int|floatval}{/if}{else}{$feature.value}{/if}"
                            id="feature_{$feature_id}"
                            class="{if $feature.feature_type == "ProductFeatures::NUMBER_FIELD"|enum} cm-value-decimal{/if} input-large"
                            placeholder="-{__("none")}-"/>
                    {/if}
                    {if $feature.suffix}<span>{$feature.suffix}</span>{/if}
                    {if empty($product_id)}
                        {include file="buttons/button.tpl"
                            but_role="button-icon"
                            but_meta="btn cm-assign-features_delete-item"
                            but_icon="icon-trash product-update-features_delete-icon"
                            title=__("delete")
                        }
                    {/if}
                </div>
            </div>
        </div>
    {/hook}
{/if}

Can you please help me with that ? I can see all previous members had the same issue :frowning:

The code examination is required. If this issue is urgent, we can examine it on the paid basis. Feel free to contact us