Home › Forums › WoodMart support forum › Built-in list comparison functionality does not work!
Built-in list comparison functionality does not work!
- This topic has 10 replies, 4 voices, and was last updated 5 years, 10 months ago by Elise Noromit.
-
AuthorPosts
-
January 11, 2019 at 3:57 pm #101438
Navigator1974ParticipantI can not find the reason for the empty lists of the comparison page, help who can!
Attachments:
You must be logged in to view attached files.January 11, 2019 at 4:27 pm #101452
Elise NoromitMemberHello,
Please refer to this article and make sure you have configured everything https://xtemos.com/docs/woodmart/faq-guides/set-compare-wishlist-pages/
If you have configured everything but the problem still exists, please provide your site admin access for checking.
Best Regards
January 11, 2019 at 4:40 pm #101454
Navigator1974ParticipantI know it and did it for a long time, I am ready to provide access
January 11, 2019 at 4:46 pm #101455
Navigator1974ParticipantI have made a complete translation of your theme into Russian, I am ready to give it to you!
January 11, 2019 at 6:15 pm #101466
Eric WatsonParticipantHello,
Could you please disable all plugins that are not related to our theme and check the problem again?
Thank you in advance
January 11, 2019 at 6:36 pm #101468
Navigator1974ParticipantNow everything is turned off, but I did it before, it still does not work!
January 11, 2019 at 9:48 pm #101494
Artem TemosKeymasterIn this situation are you able to provide us your FTP access so we could troubleshoot it and provide you with a solution?
Best Regards
January 12, 2019 at 6:22 am #101519
Navigator1974ParticipantI give you the data FTP
January 12, 2019 at 7:53 am #101525
Eric WatsonParticipantHello,
Try to add the following PHP code snippet to the child theme functions.php file to do this
function woodmart_get_compared_products_data() { $ids = woodmart_get_compared_products(); if ( empty( $ids ) ) { return array(); } $args = array( 'include' => $ids, ); $products = array(); foreach ( $ids as $id ) { $products[] = wc_get_product( $id ); } $products_data = array(); $fields = woodmart_get_compare_fields(); $fields = array_filter( $fields, function( $field ) { return 'pa_' === substr( $field, 0, 3 ); }, ARRAY_FILTER_USE_KEY ); $divider = '-'; foreach ( $products as $product ) { $rating_count = $product->get_rating_count(); $average = $product->get_average_rating(); $products_data[ $product->get_id() ] = array( 'basic' => array( 'title' => $product->get_title() ? $product->get_title() : $divider, 'image' => $product->get_image() ? $product->get_image() : $divider, 'rating' => wc_get_rating_html( $average, $rating_count ), 'price' => $product->get_price_html() ? $product->get_price_html() : $divider, 'add_to_cart' => woodmart_compare_add_to_cart_html( $product ) ? woodmart_compare_add_to_cart_html( $product ) :$divider, ), 'id' => $product->get_id(), 'image_id' => $product->get_image_id(), 'permalink' => $product->get_permalink(), 'dimensions' => wc_format_dimensions( $product->get_dimensions( false ) ), 'description' => $product->get_short_description() ? $product->get_short_description() : $divider, 'weight' => $product->get_weight() ? $product->get_weight() : $divider, 'sku' => $product->get_sku() ? $product->get_sku() : $divider, 'availability' => woodmart_compare_availability_html( $product ), ); foreach ( $fields as $field_id => $field_name ) { if ( taxonomy_exists( $field_id ) ) { $products_data[ $product->get_id() ][ $field_id ] = array(); $terms = get_the_terms( $product->get_id(), $field_id ); if ( ! empty( $terms ) ) { foreach ( $terms as $term ) { $term = sanitize_term( $term, $field_id ); $products_data[ $product->get_id() ][ $field_id ][] = $term->name; } } else { $products_data[ $product->get_id() ][ $field_id ][] = '-'; } $products_data[ $product->get_id() ][ $field_id ] = implode( ', ', $products_data[ $product->get_id() ][ $field_id ] ); } } } return $products_data; }
Kind Regards
XTemos StudioJanuary 12, 2019 at 10:49 am #101539
Navigator1974ParticipantSolution with inserting code into functions.php of a child theme – Works !!
Is this a normal way out – inserting code into child functions.php? What is the cause of my problem?January 12, 2019 at 12:37 pm #101564
Elise NoromitMemberHello,
There was the problem in the functions which gets the products for further output in compare code which we have provided. This is just an alternative way so everything would work.
Best Regards
-
AuthorPosts
Tagged: compare
- You must be logged in to create new topics. Login / Register