Sauter la navigation

[Résolu] Impossible to manage a field with Toolset

This support ticket is created Il y a 5 années et 9 mois. 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.

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/Hong_Kong (GMT+08:00)

Marqué : 

Ce sujet contient 4 réponses, a 2 voix.

Dernière mise à jour par Pat Il y a 5 années et 9 mois.

Assisté par: Luo Yang.

Auteur
Publications
#1224854

Pat

Hello,

I'm working on a Toolset + WC site and wants to use a postmeta field as a conditional output.
This field is _wc_review_count but I'm not able to find it when I go to the page where I can define which fields are managed by Toolset.
I have tried to use this :
[wpv-conditional if="( $(_wc_review_count) ne '' )"]
but it's not working.

How can I use this field inside a conditional output?
Regards
Pat

#1224895

Dear Pat,

I have tried your codes in my localhost, it works fine, for example:

[wpv-conditional if="( $(_wc_review_count) ne '' )"]
[wpv-post-field name='_wc_review_count']
[/wpv-conditional]
<hr />
_wc_review_count: [wpv-post-field name='_wc_review_count']

It does output the custom hidden field "_wc_review_count" value without any problem.

I suggest you output the field value directly, see the above example codes, make sure it can output correct field value.

#1224906

Pat

Hi Luo,

Thanks for your answer.
Seems strange but it's not working for me.
In fact, whatever the value of the _wc_review_count field, it's always displayed. Did you try to use it in real conditions (ie : WC with a product having reviews and other products without reviews?). With non reviews, it seems that what WC returns is 0 (not sure if it is a number or a string).

Second issue : why it isnot possible to manage this field with Toolset (not appearing in the list of fields that Toolset can manage?).

For info, I have a workaround for another Toolset issue on this Views and have integrated the following JS code :

jQuery( document ).on( 'js_event_wpv_pagination_completed', function( event, data ) {
/**
* data.view_unique_id (string) The View unique ID hash
* data.effect (string) The View AJAX pagination effect
* data.speed (integer) The View AJAX pagination speed in miliseconds
* data.layout (object) The jQuery object for the View layout wrapper
*/
if ( typeof wc_add_to_cart_variation_params !== 'undefined' ) {
data.layout.find( '.variations_form' ).each( function() {
jQuery( this ).wc_variation_form();
});
}
});
 
jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) {
/**
* data.view_unique_id (string) The View unique ID hash
* data.layout (object) The jQuery object for the View layout wrapper
*/
if ( typeof wc_add_to_cart_variation_params !== 'undefined' ) {
data.layout.find( '.variations_form' ).each( function() {
jQuery( this ).wc_variation_form();
});
}
});

Not sure if this could have an impact on the conditional output?

Regards
Pat

#1224926

Q1) Yes, I have tried in a real product posts with multiple reviews, it works fine.
Please check these:
1) In case it is a compatibility problem, please deactivate other plugins, and switch to wordpress default theme 2019, deactivate all JS Custom codes, and test again
2) If the problem still persists, please provide database dump file(ZIP file) of your website, also point out the problem page URL and view URL, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

Q2) Since it is a hidden custom field, you can enable it within Views UI, like this:
Dashboard-> Toolset-> Settings-> Front-end Content
in section "Hidden custom fields", click button "Select custom fields", find and enable the custom field "_wc_review_count", and test again.

#1224960

Pat

Hi Luo,

Well, I changed a little and now uses this function :

[wpv-conditional if="( wpv_woo_products_rating_on_listing_func() ne '' )"]

and that's working fine ! (the other one was still not functioning for me ?)
Thanks
Pat