Hi all - I’ve got a few questions pertaining to SC...
# suitecommerce
k
Hi all - I’ve got a few questions pertaining to SC: 1. How would I go about showing the total number of a given item in the cart from the
facets_item_collection
template? a. Assume I’ll need to write an extension to extend the child view and add a few more fields, but am wondering how to parse the cart object from here? 2. Is there an existing configuration or extension that makes adding items to the cart (from the facets collection, related items, etc.) possible? Or do I need to write my own extension to somehow mimic the standard add to cart script?
s
If the goal is to show many of a particular item is already in the cart then you would likely need to add a child view to each of the items in the collection that checks its ID against Cart.getLines() to see if it's already contained in there. It may be easier to do it in reverse, that is check the cart and then add a child view for each item it has in its cart. As for the adding to the cart, that is not something I think we have, but again, the Cart component should be able to help you there. When you have the item ID, you can just pass it in the item object for Cart.addLine(). I would recommend chaining on the new method for showing the add-to-cart confirmation dialog