1. Home
  2. ReHub Theme
  3. Comparison charts, tables
  4. Dynamic comparison charts

Dynamic comparison charts

Dynamic comparison works when user choose one or more products for comparison by clicking on  Add to compare  button. Theme supports multi group comparison (when product is added to own group based on product’s category). Also, you can create custom comparison chart to compare only those data which you want.

We added also several functions to create charts automatically. It’s available for WooCommerce products.

How to enable Comparison option?

It’s very easy. Go to theme option – dynamic comparison and choose one of page for comparison. You must have special shortcode in content of this page

[wpsm_woocharts]

Well, that’s all what you need

This will generate comparison chart automatically. Additionally, you can disable some fields in comparison chart via next parameter “disable”

Example

[wpsm_woocharts disable="description,brand,stock,userrate,review"]

So, for example, if you want to disable brand and stock field in chart, use

[wpsm_woocharts disable="brand,stock"]

If you want to make several groups of product comparison, then, instead of single page, create several pages (you can use the same shortcode for all pages) and add special values in Theme option – dynamic comparison – multi group

Example

6,22;Laptops;1168
5,30;Mobiles;1169

This means, that if item is in product category ID = 6 or 22, it will be added to the comparison group “Laptops” and comparison page for this group has ID = 1168. Items from categories 5 or 30 will be in “Mobiles” group and the comparison page is 1169 for this group.

How to find Ids

Attention! When you use multi group, add each post only to one category which you want to use for comparisons (don’t add posts to several categories at once). Also, each comparison group must be assigned to own page even if content on all pages are the same

If you want to configure fields which will be in comparison results, you can use Custom Comparison Charts constructor instead of shortcode

Attention! When you use multi group, you should add also categories to wpsm_woochart shortcode. Example

[wpsm_woocharts terms="1,2,3"]

Where 1,2,3 is product category ids which you want to assign to “Add more items” button. Without this, button will search inside all categories of products.

Check video how to use dynamic comparison

How to add an additional dynamic row?

Comparison shortcode is totally dynamic and automatic, but sometimes, you may need to add custom element inside table. There is next shortcode for this

[wpsm_woocharts contentlabel="Find prices"]My shortcode[/wpsm_woocharts]

As you see, you can use your custom shortcodes in place “My shortcode” and custom label in contentlabel parameter. For example, this can be very helpful if you use dynamic shortcodes which shows data from your post.

Creating custom comparison charts

You can also build your own comparison page with comparison chart builder. This allows to compare only those data which you want and control every row of chart. To use this, create page, choose Top chart constructor and page attributes and begin to add each row of chart.