Skip Navigation

[Resolved] Split: Product price is not showing after search filter is used

This support ticket is created 3 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 1.83 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#1905255

Did you test both as a logged in and logged out user? All caches are cleared and I tested it with a fresh browser installation. Since the changes, the prices are no longer displayed after filtering. However, I can only reliably reproduce this for users who are not logged in.

#1906659

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for waiting.

During troubleshooting on your website's clone, I was able to narrow down the issue of missing price for guests, to the plugin "B2B Market".

If that plugin is deactivated, the price starts showing correctly, to the guests, when a search filter is used.

I'm not familiar with this plugin's functionality, but you can get in touch with its official support team to get some information about what could cause the missing price for guests, only when the results are updated through the AJAX.

A quick and temporary fix meanwhile can be to set the view to show search results without AJAX (i.e. by reloading the page).

regards,
Waqar

#1908763

Hi Waqar,

I'm a little unhappy about this serve. On the one hand it worked before you made the changes according to the first ticket, moreover the other vendor says it's not them, it's supposed to be the view of Toolset responsible. Now I am at an impasse. However, I also see that the functionality is better after disabling the mentioned plugin. However, I'd like to keep this thread open until the problem is solved, as I'm not sure if it might not (also) be Toolset's fault.

regards, Florian

#1909313

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Florian,

I can understand that troubleshooting an issue like this, when multiple plugins are involved can be frustrating and time-consuming, however, it is very important to narrow it down to the root cause.

I can assure you that the information I shared with you in the previous reply, was gathered after thorough testing and I'll do my best to be as logical as possible to ensure that you can reach an acceptable solution or at least a workaround, without sounding like I'm shifting responsibility on the other plugin:

1. "On the one hand it worked before you made the changes according to the first ticket"
- I'm afraid, my test results are different than this observation, and the two changes from the previous ticket ( ref: https://toolset.com/forums/topic/after-filtering-first-product-is-hidden/#post-1903579 ) have no impact on this issue in hand.

I have a clone/snapshot of your website from the other ticket, in which those changes haven't been applied yet and still the prices disappear when the search filter is applied through the AJAX.
( if you'd prefer, I can share that clone/snapshot with you so that you can test it on your server too )

Likewise, you can undo those 2 changes on the live website and still you'll note that prices will keep disappearing.

2. Toolset's shortcode "wpv-woo-product-price" gets the price information from WooCommerce, but the "B2B Market" plugin adds its own features by filtering that price. If the price starts showing correctly when that plugin is deactivated (as it is now on your actual website too), it means that filtering from that plugin has something to do with this disappearance.

One dirty hack is to replace "[wpv-woo-product-price]" shortcode in the view with "wpv-post-field" shortcode, to fetch the raw price value from the database, e.g.

[wpv-post-field name="_regular_price"]
OR
[wpv-post-field name="_price"]

Bu the downside is that this would be only a numeric value and you'll have to include the decimal separator and currency symbol manually.

3. The "B2B Market" plugin doesn't have a compatibility issue with Toolset's search filters or view in general, but it only fails, when the view's results are updated without page reloading (AJAX).

Here is another quick test for which you can temporarily activate the "B2B Market" plugin back on.

As a guest (non-logged in visitor), first, visit the page ( {yourwebsite.com}/produkt-kategorie/gehaltsdaten-fuer-gehaltsvergleich/ ) and select "Deutschland" under the "Land". You'll see the price will disappear when the loading of results is completed.

Next, copy this page's URL with search parameters ( {yourwebsite.com}/produkt-kategorie/gehaltsdaten-fuer-gehaltsvergleich/?wpv-pa_country%5B%5D=deutschland&wpv_aux_current_post_id=4694&wpv_aux_parent_post_id=4694&wpv_view_count=6130 ) and input it in a new tab and open it directly. This time the prices will show, even though the "B2B Market" plugin is active and the search filters are the same. This means that the "B2B Market" plugin's price filtering has no difficultly in executing, when the page is reloaded.

I hope these points will help in your discussion with the "B2B Market" plugin's support and let us know if we can be of any further assistance.

regards,
Waqar

#1909423

Hi Waqar,

i get a reply from the producer of B2b Market: "Unfortunately, this cannot be adjusted from our side. Please contact Toolset support once here. You would need to pull the B2B Market price instead of the WooCommerce price at this point:
$product = wc_get_product( $product_id );
$cheapest_price = floatval( BM_Live_Price::get_cheapest_price( $product->get_price(), $product, false ) );
"

Is this feasible?

Many thanks at this point for your extensive efforts!

Regards
Florian

#1910859

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for sharing this code example and it helped.

During testing your website's clone, I was able to make this work, using these steps:

1. In the active theme's "functions.php" file, I added this code to register a new custom shortcode:


add_shortcode( 'get_B2B_price', 'get_B2B_price_func');
function get_B2B_price_func($atts)
{
  $product_id = $atts['product'];
  $product = wc_get_product( $product_id );
  $cheapest_price = floatval( BM_Live_Price::get_cheapest_price( $product->get_price(), $product, false ) );
  $final_price = BM_Live_Price::single_product_price($cheapest_price, $product);
  return $final_price;
}

Next, I added "get_B2B_price" in the "Third-party shortcode arguments" section, at WP Admin -> Toolset -> Settings -> Front-end Content.

2. After that, I replaced the price shortcode in the view's loop item content, from


<strong>[wpv-woo-product-price]</strong>

To:


[wpv-conditional if="( '[wpv-current-user]' ne '' )"]
<strong>[wpv-woo-product-price]</strong>
[/wpv-conditional]
[wpv-conditional if="( '[wpv-current-user]' eq '' )"]
<strong>[get_B2B_price product="[wpv-post-id]"]</strong>
[/wpv-conditional]

As a result, the logged-in users will continue to see price through the shortcode "wpv-woo-product-price" and the non-logged in guests will see the price from the new shortcode "get_B2B_price".

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.