Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Product images are not displayed
This topic contains 16 replies, has 2 voices, and was last updated by Ernest Marcinko 2 years, 7 months ago.
- AuthorPosts
- October 17, 2020 at 3:29 pm #29850
Good day,
I bought your plugin, but I can’t set it to load images when searching.
I use multisite and woocommerce. Images are stored on Google Cloud using the WP-Stateless plugin.
I looked at all the instructions and tried everything, but the pictures are still not in search.
Could you please help me with that?
I still have a question about the number of products displayed in the search. Can I set 120 products to be displayed per page?
October 19, 2020 at 9:54 am #29855Hi,
Thank you very much for the details, it was very helpful to us.
I actually found a bug within the code via FTP, where the live results list was not properly switching the blogs to parse the images. I made a direct change to the code, it should be all right now: https://i.imgur.com/7KMqI7Z.png
I will make sure to incorporate this change to the upcoming plugin release.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 19, 2020 at 10:30 am #29856Good day,
Thanks, but I still don’t see the images in the web search.
I would also like to see 120 products per results page.
How can I do that?
Thanks for help.
Attachments:
You must be logged in to view attached files.October 19, 2020 at 12:21 pm #29858Hi,
The plugin cannot affect the images/layout of the results page unfortunately, it is not possible. That is handled by the theme excplicitly (or theme builder plugin if you are using any).
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 19, 2020 at 12:30 pm #29859Good day,
there must be a problem with the plugin. Everything is fine without the plugin. When I turn on plugin, the search does not work and the images are not displayed.
I’m also sending an example with and without a plugin.
Attachments:
You must be logged in to view attached files.October 19, 2020 at 1:26 pm #29863Hi,
On the main site, if I search star wars with the plugin disabled, I get no results: https://i.imgur.com/o4lKFJV.png
That is, because cross-multisite results are not possible to search in default WooCommerce. With the search enabled, the results will appear, but the images cannot be fetched by the theme, as they exits on a different multisite blog and the theme cannot recognize that.If you search on the same blog, as the results are from, the images will work all right. For example searching on blog “/filmy-knihy-hry/” phrase “plagueis” will yield results with the images correctly: https://i.imgur.com/t2H4vS6.png
You can access the search images via the search plugin API theme functions, via the
the_asp_result_field('image');
function.You can try a custom code solution to automatically hook into the search result images and try a replacement, but this may cause other issues, so please make sure to carefully test it. 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!
// ASP add_filter('wp_get_attachment_image_src', 'asp_wp_get_attachment_image_src', 10, 1); function asp_wp_get_attachment_image_src($image) { //var_dump($image); if ( !empty(get_asp_result_field('image')) ) return array(get_asp_result_field('image'), 300, 300, true); else return $image; }
Once again, if this does not work, then the only solution is to edit the theme to fetch the images cross network.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 19, 2020 at 1:32 pm #29865Good day,
perfect. This works. Well thank you.
I have one last question. How do I change the number of products in my search results? Now showing 10 products on 5 pages.
Can we adjust this so that I see 120 search results per page?
October 19, 2020 at 1:45 pm #29867It is atuomatically fetched from WordPress, but you can manually change it here: https://i.imgur.com/gQrorkg.png
Best,
If your theme has an option to adjust the posts per page, use the same values for both options, otherwise there will be mismatching page numbers. If not, then WooCommerce needs to be adjusted as well.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 19, 2020 at 5:40 pm #29873Thanks for help. I still have one more question.
I use external links on the website and the code is used by the visitor to click on an external page directly from the catalog.
For example: https://www.bedy.sk/elektro/kategoria-produktu/inteligentne-hodinky/
However, when I search within multisite, external links stop working and replace them with links to products on the web.
As for products from the same blog, it works.
However, if the product is from another blog, an original link to my site will appear.
For example, when I search from the main page, all external product links are replaced with internal ones.
https://www.bedy.sk/?s=xiaomi&post_type=product
I’m not sure if I explained it correctly. However, I’m sending code that ensures that the user gets to an external page when they click on the product.
echo apply_filters( ‘kapee_template_loop_product_thumbnail’, $html );
}
function woocommerce_template_loop_product_title() {if( ! kapee_get_loop_prop( ‘products-title’) ) return;
global $product;
$link = apply_filters( ‘woocommerce_loop_product_link’, get_the_permalink(), $product );
$target = ‘_self’;
if( kapee_get_option( ‘open-product-page-new-tab’, 0 ) ){
$target = ‘_blank’;
}
if( $product->is_type( ‘external’ ) ) {
$target = ‘_blank’;
$link = apply_filters( ‘woocommerce_loop_product_link’, $product->get_product_url(), $product );
}echo ‘<h3 class=”product-title”>‘ . get_the_title() . ‘</h3>’;
}October 19, 2020 at 5:57 pm #29874The search also doesn’t show prices. Could this be resolved, please?
I want to thank you for your fantastic support.
Example of search from the multisite main page:
October 20, 2020 at 12:08 pm #29890The problem with using custom codes in this context is, that the products are not actually available on the main site or cross site (WordPress does not support that) – these are non-existent there. So the custom codes may not be able to execute correctly on them.
Best,
Product details, including the price is therefore not avialable in this context. It might be possible to fetch via switching the blogs – but it has to be custom coded within the theme. You can fetch the product blog IDs in the main loop via theget_asp_result_field('blogid');
function call, more details about this here.
Unfortunately this is theme dependent, I cannot suggest custom codes for this, it needs to be integrated to the theme.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 20, 2020 at 1:35 pm #29899Thanks, but I can’t do this.
Can I pay for your programming services?
October 20, 2020 at 1:51 pm #29904Unfortunately we are not available for custom jobs. I usually recommend envato studio if you are looking for developers: https://studio.envato.com/
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 20, 2020 at 2:01 pm #29905Thank you for your response.
Could you at least help me with the price in the search results?
That would help me a lot.
October 20, 2020 at 2:10 pm #29907I would love to help you with that, but I don’t exactly know how either. It probably requires direct theme modifications, and I am not familiar with that.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.