Skip Navigation

[Resolved] How to display different groups of related products

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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 6 replies, has 2 voices.

Last updated by tommyJ-3 3 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#2311113

I am building a site that promotes and sells measuring instruments. To each instrument you can connect probes of certain types. So under a product tab called Givare (probes), I need to show probes of different types, that can be used with the product.

Probe tab (tab title)
NTC probe type (probe type title)
A view (?) with all the probes of the NTC type (product with "Givare" and "NTC" as category or tag) should be displayed here (normally between 1 and 25)
Pt100 probe type (probe type title)
A view (?) with all the probes of the Pt100 type (product with "Givare" and "Pt100" as category or tag) should be displayed here (normally between 1 and 25)

And so on...

Take a look at a sample instrument in our old Drupal site: hidden link. Look under the tab "Givare". Lots of probes, sorted under different titles.

Can you advice me on the best way to replicate this in a Toolset template in our new WordPress site?
A custom product field (multiple lines) for entering the different probe types?

#2311281

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

If you want to display posts group by taxonomy term then you will have to use the nested view and nested view will be supported using the classic view. To activate the classic view, please check the following Doc:
- https://toolset.com/forums/topic/how-to-switch-to-classic-editor-when-creating-content-template/

Here is the detailed article how you can group posts by taxonomy term:
- https://toolset.com/2015/07/how-to-group-posts-by-category/

You will require to first decide is it ok for you to group posts by terms. In that case you will have to create taxonomy with term names like NTC and Pt100.

I suggest you first create a test site and run a test and see how nested view works. You can create a test site on our free test platform http://www.discover-wp.com where you can use any of our reference sites:
- https://discover-wp.com/site-templates/

You should play with the test site and the decide the site structure and what suits best as per your requirement.

#2311965
Field_has_no_content.PNG
Custom_field_single_line_multiple_instances.PNG
Result_with_my_solution.PNG

Hello
We sell hundreds of different measuring instruments and they differ from each other in many ways. Since I am dealing with a toolset template i still need a custom field in each instrument editing page, where I can assign which probes are going to be displayed for that particular instrument. Is that possible with the method you suggest? Or is everything configured in the View in the template?

I have found another solution also. If I explain how I do this, can you advice if this solution is a better option than Views?
This is what I did:
1. I created a new custom product field (single line, multiple fields possible) and named it "Givare"
2. In the template I added a "repeating field" block
3. I then used the dynamic source to link the block to my custom field "Givare"
4. In each instance of the custom field I then insert WooCommerce shortcodes like "[products tag="NTC" columns="4" etc....]"

See the attached images of how it looks. I can also add HTML in the field to create titles for each probe group. It seems to work, but one problem is that when I try to edit the template there are error messages at first (something about an empty field) and then finally the template opens in editing mode. The third attached image shows the template. For some reason it says that the repetable field is empty. But as you can see it works when viewing the product page.

EDITED: When accessing the template with the above configuration this error message shows:
Warning: Creating default object from empty value in /home/nordtecd/stage.nordtec.dev/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Sources/PostContent.php on line 59

And then after 2-3 seconds this message shows on top of the template:
Something went wrong while fetching the dynamic content from the selected source, with message: "Du saknar behörighet för att göra detta.". (Means "you do not have the authority to do this".

#2312035

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well, its on you how you want to setup the structure. The structure how you setup if it works for you, you can go with that, no issues.

Regarding on content template edit page, you see empty result, can you please select the post from top of the content template's section "View With" dropdown and select the post where you setup the repeating field Givare then you should be able to see the result.

#2312039
Result_with_my_solution.PNG
Template_editing_mode.PNG

OK, I did as you said and changed the "View With" post to an instrument that had something inserted in the "Givare" fields. That worked, but only halfways.

As you can see from the images attached, only my extra html is shown (the h3 titles). Not the shortcode's content. However when viewing the product page the shortcode content is showing. Why is it not showed in the template editing mode? Is the Woocommerce shortcodes not fully compatible with Toolset?

#2312057

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

The woocommerce shortcodes must be desired to work on frotnend not backend. You should try to add shortcode to non-Toolset element - does it work in backend.

As far as it works correctly on frontend, you may have to accept this limitation as its not the shortcode from Toolset. If you will try to add custom shortcode that should return "hello" if that should work that means toolset is not issue here.

#2312059

My issue is resolved now. Thank you!