How to make a comparison table between CPT Product with Custom Fields
- This topic has 7 replies, 3 voices, and was last updated 2 years ago by
Tony.
-
AuthorPosts
-
April 9, 2022 at 9:39 PM #35546
Nikola Vladimirov
ParticipantHello,
I am building a product catalog website avoiding Woocommerce like wildfire.
It has no e-commerce functionality like user profiles, carts, checkouts etc., just plain products with custom fields. I'm using Oxygen Builder, if that's of any relevance.
I want to be able to add the products to a comparison table "cart" of sorts and when that cart is viewed to display the products side by side with their custom fields, and I'm thinking of Metabox favorite posts might be able to do the trick to some extent.
Why am I doing this instead of going the Woocommerce way? Simple answer - custom tables, less bloat from unrequired functionality, less plugins, etc.
Any pointers on how to achieve that?
I've seen that Toolset has something similar, and I found a plugin to compare CPTs, but it doesn't look trustworthy. Keep in mind that I have limited PHP knowledge.
Thanks
April 9, 2022 at 11:55 PM #35547Nikola Vladimirov
ParticipantOkay, MB Favorite posts is the thing that will do the trick.
Now, the question is how do I make it display the products' fields in a repeater...Is there a way to query the favorites area in the advanced query editor and get the fields so I can build the side by side comparison instead the table view?
Thanks
April 12, 2022 at 6:15 AM #35571Long Nguyen
ModeratorHi,
The frontend dashboard does not support customizing the table to display custom fields of listing posts. You can follow this topic to create your own dashboard with coding https://support.metabox.io/topic/duplicate-dashboard-shortcode/
If you have limited knowledge about coding, you can create a service request here https://metabox.io/contact/. Our developer will help you to create custom code as your requirements for a small extra fee.
April 14, 2022 at 10:19 PM #35640Nikola Vladimirov
ParticipantI see. Thank you very much. I will try to do it and learn a thing or two then 🙂
April 15, 2022 at 12:09 AM #35644Nikola Vladimirov
ParticipantAlright, I've been reading this: https://docs.metabox.io/mb-favorite-posts/#data in relation to this post here: https://support.metabox.io/topic/mb-favorite-posts-customization/
But I can't seem to make it output the posts custom fields that are assigned to it.
Should I use meta_query?
What am I missing?
Is there a snippet that I can use?
There are 5 field groups, primarily text fields and number fields. No repeaters.
April 15, 2022 at 1:35 AM #35645Nikola Vladimirov
ParticipantThis is what I'm adding to the code:
<?= esc_html(rwmb_the_value($marka)) ?>
in posts.phpStill doesn't display the custom field value.
April 16, 2022 at 6:47 PM #35672Long Nguyen
ModeratorHi,
You can pass the variable
$post_id
to the helper function in the loop to get the field value.$marka = rwmb_meta( 'field_id', '', $post_id ); echo $marka;
September 2, 2023 at 12:22 PM #43122Tony
ParticipantI was looking to do the very same thing, is this possible?
-
AuthorPosts
- You must be logged in to reply to this topic.