Extract configurations from website input

andrewq

Hello,

I'm in a situation where string values are being passed into the 3D player from a website frontend, but for unfortunate communication reasons, I cannot know what these string values are. I've been relying on guesswork, but it's not working for this particular product. Is there a way for me to use a custom script rule to console.log() configuration strings passed into the player, even if some of those attributes do not exist on the catalogue yet? It may be easier than requesting information every time a new attribute is needed.

For instance, if an api call to change "Attribute1" to "subcategory3" was sent to the player from the website, and those attributes mean nothing to the configurator, could I see that information by loading the frontend console and getting messages from the player?

thanks,

Andrew

Comments

1 comment

  • Comment author
    andrewq
    I got something working in case anyone needs this. It can be used in the catalogue custom script rule:

    //script

    const player = api.enableApi('player');
    const configurator = player.getConfigurator();
    if (!configurator)
      return console.log('[CUSTOM SCRIPT] - threekit api not loaded');

    //console.log('starting');

    const currentConfiguration = configurator.getConfiguration();
    const attributes = configurator.getAttributes();

    console.log(currentConfiguration);

    console.log('finished');
    0

Please sign in to leave a comment.