Search Products Based On A Feature

How can we add products to a Product block based on a Feature Value? There is no such option to search while adding in a block.

Or is there any way where we can mention multiple Product Codes together for search while adding in a block.

If you want to add an ability to search products by feature values in the picker, please open the app/controllers/common/products.post.php file and add the following code:

$feature_params = array(
        'plain' => true,
        'variants' => true,
        'exclude_group' => true,
        'exclude_filters' => true,
        'skip_variants_threshould' => true
    );
    list($features, $features_search) = fn_get_product_features($feature_params, PRODUCT_FEATURES_THRESHOLD);
if ($features_search['total_items'] <= PRODUCT_FEATURES_THRESHOLD) {
    Tygh::$app['view']->assign('feature_items', $features);
} else {
    Tygh::$app['view']->assign('feature_items_too_many', true);
}

before this line:

Tygh::$app['view']->display('pickers/products/picker_contents.tpl');

The result is:

http://prntscr.com/9efcaa

I cant find this code it seems this is for v4.3.x and we are on 4.2.x

Could you please provide the matching code for 4.2.x

i suppose this doesnt work in 4.2.x so i changed it but still it doesnt show up http://prntscr.com/9efg3j

Tygh::$app['view']

Add

$feature_params = array(
        'plain' => true,
        'variants' => true,
        'exclude_group' => true,
        'exclude_filters' => true
    );
    list($features) = fn_get_product_features($feature_params);
    Registry::get('view')->assign('feature_items', $features);

before:

Registry::get('view')->display('pickers/products/picker_contents.tpl');

Great it works ecom.

You are welcome!