This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Questions about plugin setup / features

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Questions about plugin setup / features Reply To: Questions about plugin setup / features

#25900
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

1. It might be possible via using a custom code only. Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

add_filter( 'asp_results', 'asp_get_main_prod_img', 10, 1 );
function asp_get_main_prod_img($results) {
	foreach ( $results as $k => &$r ) {
		if ( isset($r->post_type) && $r->post_type == 'product_variation' && empty($r->image) ) {
			$wc_prod_var_o = wc_get_product( $r->id );
			$img = wp_get_attachment_image_src(
				get_post_thumbnail_id($wc_prod_var_o->get_parent_id()),
				'single-post-thumbnail'
			);
			if (isset($img, $img[0]) && !is_wp_error($img))
				$r->image = $img[0];
		}
	}

	return $results;
}

2. This knowledge base should help you out.
3. Unfortunately no, as usually those images are uploaded only in a single dimention. There is however an automatic image cropper script, that you can enable, and will try to crop the images as close as possible to the size of the results output: https://i.imgur.com/BqgCzDQ.png