• Resolved mauinsons

    (@mauinsons)


    Hi, I have previously managed to pre-sort the data using the following code:

    {
        "searching": false,
        "paging": false,
        "order": [
            [
                2,
                "asc"
            ]
        ]
    }

    the [gdoc] shortcode was inserted into the short description of my product and it works fine.

    However, I’ve changed my approach and wanted to display difference google sheet in the short description for different variations of a product. I’ve copied and pasted the [gdoc] shortcode in the “description” field for each variations.

    The table shows up nicely but it seems that I’ve lost the DataTable functions – as in I can’t sort the data anymore. I’ve checked to confirm the above DataTable default object code is still there.

    Is there any way to solve this?

    [ Don’t bump. ]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Meitar

    (@meitar)

    There’s nothing in this support request to work with; no link to see the problem, no clear description of the issue, just “it used to work, then I changed something, now it doesn’t work!” So, obviously, the problem you’re having is related to the change you made. Double check yourself.

    Thread Starter mauinsons

    (@mauinsons)

    ok these are the details

    Setting that I didn’t change is in Settings -> Inline Google Spreadsheet Viewer
    At the text field of DataTables defaults object I have this code:

    {
        "searching": false,
        "paging": false,
        "order": [
            [
                2,
                "asc"
            ]
        ]
    }

    I’m loading the google sheet table in the short description of my product in woocommerce. When I use this code for a simple product, this code works as intended, sorting the 3rd column of my table when it is loading. Example: https://pricehero.com.my/product/test/

    later I decided to group similar products together and put them as variable products instead. Since I wanted different table to load at the short description when a different variable product is selected by my visitor, instead of inserting the [gdoc] shortcode at the short description of the product, I inserted the code at the “description” field for each variation. Refer to this screenshot: https://imgur.com/a/GvRx4

    After the change, it worked as intended, displaying the correct table when visitor has chosen a different option. But the table no longer sort when loading as the previous simple product case.

    You can refer to this example: https://pricehero.com.my/product/similac-gain-kid-step-4/

    I’ve double checked, the DataTables defaults object remains unchanged. the [gdoc] shortcode I’ve used for both case is the same: [gdoc key=”1USfj7j6GE_rMXnUyddi_RvQCQUe8nYtozzTE8V00X0Q” gid=”1012573332″ ]

    I hope my explanation is clear enough so that you can shed some light to me on how to solve this.

    Thank you

    Thread Starter mauinsons

    (@mauinsons)

    Hi @meitar, is the explanation detailed enough? Sorry for bothering you

    Plugin Author Meitar

    (@meitar)

    Two things:

    1. The defaults object applies to all this plugin’s tables across your whole site. If you’re just trying to sort one table, then you should use a shortcode attribute (maybe datatables_order in your case) on the one shortcode invocation itself, not the plugin’s site-wide Settings screen.
    2. If I were you, I wouldn’t use this plugin at all for what you’re trying to do. Unless you have some reason to put your product detail data in a Google Spreadsheet and not in WooCommerce (which is designed to hold product detail data), you’re making a lot of unnecessary work for yourself. Why not use WooCommerce the way it was intended, and this plugin the way it was intended, instead of fighting against both tools?
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Pre-Sort Data in variable product short description’ is closed to new replies.