• Resolved tpgtpg

    (@tpgtpg)


    Hi, thanks for great plugin.

    I have a shop where all the products are using the same set of layers and content of these layers (color groups and swatches). Only the pictures are different but these are not in consideration right now.

    If I have many products and colors availability may change because of supplier then I would like to be able to change layers and content for many products in bulk.

    Is it possible using your plugin or I can make it by myself using php/db script I write by myself or with help of a developer.

    The question is – how are layers and content saved in db and are they only in one place or some additional/extra knowledge needed for me to make this script?

    Thank you very much in advance for guiding me in right direction.

Viewing 1 replies (of 1 total)
  • Plugin Contributor Marc Lacroix

    (@marcusig)

    Hi there,
    The configurator data is currently saved in the postmeta table, in the fields prefixed _mkl_product_configurator_.
    E.g. _mkl_product_configurator_content, _mkl_product_configurator_layers, _mkl_product_configurator_angles

    There are filters available when requesting the data, so you could use these in order to change product data.

    For example if you have one main product which stores your configurator, the one you will edit in the future, you could replace the configurator in any other configurator with the data from that one.

    For example the filter mkl_pc_get_configurator_data is triggered every time the data is fetched from the frontend.

    So you could do something like this:

    add_filter( 'mkl_pc_get_configurator_data', 'override_product_configurator_data', 20, 2 );
    function override_product_configurator_data( $config_data, $product_id ) {
        // Check which product is being requested.
        // If it is our main configurator, we return the data
        if ( 123 === $product_id ) return $config_data;
    
        // get the data from the main product instead
        return mkl_pc( 'db' )->escape( mkl_pc( 'db' )->get_front_end_data( 123 ) );
    }

    Marc

Viewing 1 replies (of 1 total)
  • The topic ‘Bulk product layers/content update using custom php/db script’ is closed to new replies.