Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

In Quote Configurator, folders can be logically created based on product attributes. 

Each time a user adds products, the code will run and automatically place the items in the folders.

In this example, the folders are based on Product Class.

The following code will be in the QuoteHeader logic:

  1. Ensure that the code only runs in the Pre Phase. Items cannot be deleted or moved in the Post Phase.
  2. Find items in the quote that are products and are not already present in the folders. We do not want to touch the items that are already sorted.

  3. Search for the Product Class of each item that meets the above criteria.

  4. Go in cycles through the line items and delete each of them. They will be re-added later.

  5. Create a new QuoteStructure to add to the quote later.
  6. Determine which folders to create. Some Product Classes may already have folders and we do not want duplicates.

  7. Find the added skus associated with the particular Product Class.

  8. If the folder needs to be created, add the items to the folder's QuoteStucture which you have created earlier. Be sure to use createPart, as addPart will cause the code to run again and result in duplicate items.

  9. If the folder already exists, find the folder's line id, and add the items to the folder. Alternatively, you could detect this condition earlier and use moveItem instead of deleting.

Finally, add the QuoteStructure to the quoteProcessor item. 

The end result will look like this:

The full code:

  • No labels