Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search box width not looks good
- This topic has 23 replies, 2 voices, and was last updated 4 years, 5 months ago by
Ernest Marcinko.
-
AuthorPosts
-
December 5, 2021 at 10:29 am #35874
Ernest Marcinko
KeymasterThank you!
It looks like the meta name is simply “image”. I have put it here, and I am seeing some images.
December 5, 2021 at 10:53 am #35875rifatspir96
Participantthanks. is there any to change size image height and width to specific attribute or taxonomy?
For example my brand attribute not looking good. also the brand or category title is short. so i need to set it properly to look good.
I saw global option for all Image width/height. cant find any specific option for taxonomies
December 5, 2021 at 1:08 pm #35876Ernest Marcinko
KeymasterUnfortunaly there is no separate option for them.
You can use however custom CSS to align the titles to center, and to change the image sizes:
.item.asp_r_term .asp_image { width: 80px !important; } .item.asp_r_term .asp_content { display: flex; align-items: center; justify-content: left; }December 7, 2021 at 3:00 am #35885rifatspir96
ParticipantThank you
I have selected Post Type image source options for my woocommerce product. but in variation search it dont show up the product default image if the variation image not available.
Can you please tell me what is the Custom field containing the image for the woocommerce product?December 7, 2021 at 10:57 am #35898Ernest Marcinko
KeymasterThere is no option for that, however you can try a custom code:
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; }December 7, 2021 at 12:16 pm #35904rifatspir96
Participantapplied that in function php.
not working. can you please recheck your code.December 7, 2021 at 1:47 pm #35906Ernest Marcinko
KeymasterYou can try this variation, but even the previous one worked just fine on our ends:
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()) ); if (isset($img, $img[0]) && !is_wp_error($img)) { $r->image = $img[0]; } } } return $results; }December 7, 2021 at 2:36 pm #35907rifatspir96
Participantnow its working. both one is fine. sorry it was my Post Type image source options problem. I set different of each alternative and thats why it was not working.
I gave u five star for awesome support.
December 7, 2021 at 2:50 pm #35908Ernest Marcinko
KeymasterYou cannot access this content.
-
AuthorPosts
- You must be logged in to reply to this topic.