Home › Forums › WoodMart support forum › Child theme search template
Child theme search template
- This topic has 9 replies, 2 voices, and was last updated 1 year, 4 months ago by
Luke Nielsen.
-
AuthorPosts
-
March 18, 2024 at 11:15 pm #550106
admin-8893ParticipantHi I have installed global cart and global search plugin cause I have multisite network so I can search all products of my 3 sites also in child site as woodamart
the devloper of global cart has modified the search template in inc/modules/search.php adding few line of code that u can see here
https://wpglobalcart.com/documentation/loop-though-the-cart-items/so the developer of global cart said this:
“Hi,
For the file \wp-content\themes\woodmart\inc\modules/search.php see lines 544 and 562
Also the \wp-content\themes\flatsome\inc\extensions\flatsome-live-search/flatsome-live-search.php lines 165 and 188Please check with the theme support on how these files can be overwritten from the child theme.
Can u tell me how can I have in child theme my custom search.php I have copied in Child theme directory copy also the directory structure inc/modules/search.php but not work
I attach the file search.php edited by global cart u can check from line 544 to 562
Thx
Jack
March 19, 2024 at 11:46 am #550227
Luke NielsenKeymasterHello,
Just copy the function itself to the functions.php file in your child theme and recheck the issue.
Kind Regards
March 19, 2024 at 4:43 pm #550385
admin-8893Participanthi I have added the code: `function woodmart_ajax_suggestions() {
add_action ( ‘wp_ajax_woodmart_ajax_search’, ‘woodmart_ajax_suggestions’, 10 );
add_action ( ‘wp_ajax_nopriv_woodmart_ajax_search’, ‘woodmart_ajax_suggestions’
, 10 );
}`but still stuck
I want to avoid the loop in main theme search.php file as it nowwhile ( $results->have_posts() ) { $results->the_post(); do_action( 'woocommerce/cart_loop/start', $post ); if ( $post_type == 'product' && woodmart_woocommerce_installed() ) { $product = $factory->get_product( get_the_ID() ); $suggestions[] = array( 'value' => html_entity_decode( get_the_title() ), 'permalink' => get_the_permalink(), 'price' => $product->get_price_html(), 'thumbnail' => $product->get_image(), 'sku' => $product->get_sku() ? esc_html__( 'SKU:', 'woodmart' ) . ' ' . $product->get_sku() : '', ); } else { $suggestions[] = array( 'value' => html_entity_decode( get_the_title() ), 'permalink' => get_the_permalink(), 'thumbnail' => get_the_post_thumbnail( null, 'medium', '' ), ); } do_action( 'woocommerce/cart_loop/end', $post ); }
I need all in child theme how I can do that?
March 20, 2024 at 10:55 am #550595
Luke NielsenKeymasterHello,
Please send me access to the admin panel so I can check your child theme.
Thank you in advance.
Kind Regards
March 20, 2024 at 11:17 am #550605
admin-8893ParticipantHi here below the admin access
March 20, 2024 at 3:32 pm #550727
Luke NielsenKeymasterHello,
Please explain how access to the Theme File editor: https://prnt.sc/tZUNUQ2e2LBK
Thank you for your time.
Kind Regards
March 20, 2024 at 3:39 pm #550730
admin-8893Participantsorry is multisite network use SFTP credential below
March 21, 2024 at 3:31 pm #551147
Luke NielsenKeymasterHello,
You need to copy the full function
woodmart_ajax_suggestions
. https://prnt.sc/uMZHRcVfIVti . In this screenshot I just hid a part of the function – https://prnt.sc/u6go5AY6CGQf but you need to copy it fully – https://prnt.sc/PouZ7pVYOnu1 and paste the changes that the plugin support mentioned.Thank you for your time.
Kind Regards
March 21, 2024 at 9:10 pm #551247
admin-8893Participantok thx u now works
March 22, 2024 at 11:31 am #551378
Luke NielsenKeymasterHello,
You are welcome! In case you need any additional help, I’d be more than happy to assist you.
Wish you all the best.
Kind Regards
-
AuthorPosts
The topic ‘Child theme search template’ is closed to new replies.
- You must be logged in to create new topics. Login / Register