Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a service to get associated products #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions service/popstore/ProductServices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,36 @@ along with this software (see the LICENSE.md file). If not, see
<!-- <set field="imageSmallList" from="contentList.findAll({ 'PcntImageSmall' == it.productContentTypeEnumId })"/> -->
</actions>
</service>

<!-- Service to get associated products for such thigns as upsells. -->
<service verb="get" noun="ProductAssocAndDetails">
<in-parameters>
<parameter name="productId" />
<parameter name="assocType" default="PatVariant" />
<parameter name="productStoreId"/>
</in-parameters>
<out-parameters>
<parameter name="products" type="List" />
</out-parameters>
<actions>
<entity-find entity-name="ProductAssocAndTo" list="assocs">
<search-form-inputs default-order-by="sequenceNum"/>
<econdition field-name="productAssocTypeEnumId" from="assocType"/>
<econdition field-name="productId"/><date-filter/>
</entity-find>

<set field="products" from="[]"/>
<iterate list="assocs" entry="assoc">
<service-call name="mantle.product.PriceServices.get#ProductPrice" out-map="prices"
in-map="context + [productId:assoc.toProductId]" />

<service-call name="popstore.ProductServices.find#ProductContentList" out-map="content"
in-map="[productId:assoc.toProductId]"/>

<script>products.add(['product':assoc, 'prices':prices, 'content':content.productContentList ])</script>
</iterate>
</actions>
</service>

<!-- TODO: this service is not adequately constrained, will get inventory from all facilities, owners, pools, etc; see AssetServices.get#AvailableInventory -->
<service verb="get" noun="ProductQuantity">
Expand Down