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

Get category and product by pseudo #38

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions data/PopRestStoreProductData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ along with this software (see the LICENSE.md file). If not, see

<!-- TODO: get original text instead of binary export, fine for demo images but for text makes it impossible to maintain -->

<mantle.product.category.ProductCategory productCategoryId="DEMO_CLOTHING" productCategoryTypeEnumId="PctCatalog" categoryName="Clothing" description=""/>
<mantle.product.category.ProductCategory productCategoryId="DEMO_CLOTHING" pseudoId="clothing" productCategoryTypeEnumId="PctCatalog" categoryName="Clothing" description=""/>
<mantle.product.category.ProductCategoryRollup productCategoryId="DEMO_CLOTHING" parentProductCategoryId="PopcBrowseRoot" fromDate="1265184000000" sequenceNum="1"/>
<mantle.product.category.ProductCategory productCategoryId="DEMO_OFFICE" productCategoryTypeEnumId="PctCatalog" categoryName="Office" description=""/>
<mantle.product.category.ProductCategory productCategoryId="DEMO_OFFICE" pseudoId="office-supplies" productCategoryTypeEnumId="PctCatalog" categoryName="Office" description=""/>
<mantle.product.category.ProductCategoryRollup productCategoryId="DEMO_OFFICE" parentProductCategoryId="PopcBrowseRoot" fromDate="1265184000000" sequenceNum="2"/>

<!-- Men's T-Shirt with size only variants -->
Expand Down Expand Up @@ -71,7 +71,7 @@ along with this software (see the LICENSE.md file). If not, see
assetTypeEnumId="AstTpInventory" assetClassEnumId="AsClsInventoryFin" copyCategoryMembers="false"/>

<!-- Women's T-Shirt with size and color variants -->
<mantle.product.Product productId="DEMO_TS_W" productTypeEnumId="PtVirtual" assetTypeEnumId="" assetClassEnumId=""
<mantle.product.Product productId="DEMO_TS_W" pseudoId="womens-tshirt" productTypeEnumId="PtVirtual" assetTypeEnumId="" assetClassEnumId=""
chargeShipping="Y" returnable="Y" productName="Women&apos;s T-Shirt" description="">
<prices productPriceId="DEMO_TS_W_L" pricePurposeEnumId="PppPurchase" priceTypeEnumId="PptList" fromDate="1265184000000"
minQuantity="1" price="19.99" priceUomId="USD"/>
Expand Down
6 changes: 4 additions & 2 deletions screen/store.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ along with this software (see the LICENSE.md file). If not, see
<field-map field-name="partyId" from="ec.user.userId"/>
</entity-find-one>
</if>

<service-call name="popstore.CartServices.get#CartInfo" in-map="context" out-map="productsInCart" />
</always-actions>

<transition name="config.js" read-only="true">
Expand Down Expand Up @@ -71,14 +73,14 @@ var storeInfo = ${storeInfoJson};
<!-- get browseRootCategoryInfo for subCategoryList used in header, etc -->
<if condition="browseRootCategoryId">
<service-call name="popstore.ProductServices.get#CategoryInfo" out-map="browseRootCategoryInfo"
in-map="[productCategoryId:browseRootCategoryId]"/>
in-map="[categoryId:browseRootCategoryId]"/>
</if>
<!-- get allProductsInfo for subCategoryList used in header, etc -->
<set field="allProducts" from="storeInfo.categoryByType.PsctSearch"/>
<set field="allProductsId" from="storeInfo.categoryByType.PsctSearch?.productCategoryId"/>
<if condition="allProductsId">
<service-call name="popstore.ProductServices.get#CategoryInfo" out-map="allProductsInfo"
in-map="[productCategoryId:allProductsId]"/>
in-map="[categoryId:allProductsId]"/>
</if>
<!-- cartInfo for cart count in header/navbar -->
<service-call name="popstore.CartServices.get#CartInfo" out-map="cartInfo" in-map="context"/>
Expand Down
Binary file added screen/store/assets/bolster/landing/banner1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screen/store/assets/bolster/landing/banner2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screen/store/assets/bolster/landing/banner3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screen/store/assets/bolster/landing/banner4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screen/store/assets/bolster/landing/banner5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 15 additions & 20 deletions screen/store/category.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,27 @@ along with this software (see the LICENSE.md file). If not, see
</transition>

<pre-actions>
<set field="extraPathNameList" from="sri.screenUrlInfo.extraPathNameList"/>
<if condition="extraPathNameList &amp;&amp; !categoryId"><set field="categoryId" from="extraPathNameList[0]"/></if>
<if condition="extraPathNameList &amp;&amp; !pageIndex">
<set field="pageIndex" from="extraPathNameList[1]"/>
<if condition="pageIndex == null">
<set field="pageIndex" from="0"/>
</if>
</if>
<if condition="extraPathNameList &amp;&amp; !orderBy">
<set field="orderBy" from="extraPathNameList[2]"/>
<if condition="orderBy == null">
<set field="orderBy" from="'default'"/>
</if>
</if>
<set field="pathParts" from="sri.screenUrlInfo.extraPathNameList"/>
<set field="categoryId" from="pathParts[0]"/>
<set field="pageIndex" from="(pathParts.size() &gt; 1) ? pathParts[1] : 0"/>
<set field="orderBy" from="(pathParts.size() &gt; 2) ? pathParts[2] : 'default'"/>
</pre-actions>
<actions>
<service-call name="popstore.ProductServices.get#CategoryProducts" out-map="products"
in-map="[productCategoryId:categoryId, orderBy: orderBy, pageIndex:pageIndex ? pageIndex : '0', pageSize:6]"/>

<service-call name="popstore.ProductServices.get#CategoryInfo" out-map="category" in-map="[productCategoryId:categoryId]"/>
<!-- if no category is passed in the url, we default to the browse root -->
<if condition="!categoryId">
<set field="categoryId" from="storeInfo.categoryByType.PsctBrowseRoot.productCategoryId"/>
</if>

<service-call name="popstore.ProductServices.get#CategoryInfo" out-map="category" in-map="[categoryId:categoryId]"/>

<service-call name="popstore.ProductServices.get#CategoryProducts" out-map="products"
in-map="[productCategoryId:category.productCategoryId, orderBy: orderBy, pageIndex:pageIndex ? pageIndex : '0', pageSize:6]"/>

<service-call name="popstore.ProductServices.find#ProductAvailability" in-map="context" out-map="context" />
<set field="inStock" from="false"/>

<service-call name="popstore.CartServices.get#CartInfo" in-map="context" out-map="productsInCart" />
<service-call name="popstore.ProductServices.get#SortedProductList" in-map="context + [productCategoryId:categoryId]" out-map="context"/>

<service-call name="popstore.ProductServices.get#SortedProductList" in-map="context + [productCategoryId:category.productCategoryId]" out-map="context"/>

<set field="pageSize" from="pageSize ?: 100"/>
<script>paginateList("productList", null, context)</script>
Expand Down
4 changes: 3 additions & 1 deletion screen/store/product.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ along with this software (see the LICENSE.md file). If not, see
</pre-actions>
<actions>
<service-call name="popstore.ProductServices.get#ProductInfo" out-map="product" in-map="[productId:productId]"/>
<set field="productId" from="product.productId" />

<service-call name="popstore.ProductServices.get#ProductQuantity" out-map="productQuantity" in-map="[productId:productId]"/>
<service-call name="popstore.ProductServices.get#ProductReviews" out-map="reviewsList" in-map="[productId:productId]"/>
<service-call name="popstore.ProductServices.find#ProductAvailability" in-map="context" out-map="context" />
Expand All @@ -99,7 +101,7 @@ along with this software (see the LICENSE.md file). If not, see
</if>

<if condition="categoryId">
<service-call name="popstore.ProductServices.get#CategoryInfo" out-map="category" in-map="[productCategoryId:categoryId]"/>
<service-call name="popstore.ProductServices.get#CategoryInfo" out-map="category" in-map="[categoryId:categoryId]"/>
</if>

<set field="specialInstrLocation" from="product.contentList.find({'PcntSpecialInstr' == it.productContentTypeEnumId})?.contentLocation"/>
Expand Down
29 changes: 25 additions & 4 deletions service/popstore/ProductServices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ along with this software (see the LICENSE.md file). If not, see
</out-parameters>
<actions>
<entity-find-one entity-name="mantle.product.Product" value-field="product"/>
<if condition="product == null">
<entity-find-one entity-name="mantle.product.Product" value-field="product">
<field-map field-name="pseudoId" from="productId"/></entity-find-one>
<set field="productId" from="product.productId" />
</if>
<if condition="product == null"><return error="true" message="Product not found with ID ${productId}"/></if>
<script>context.putAll(product)</script>

Expand Down Expand Up @@ -498,18 +503,34 @@ along with this software (see the LICENSE.md file). If not, see

<service verb="get" noun="CategoryInfo">
<in-parameters>
<parameter name="productCategoryId" required="true"/>
<parameter name="categoryId" required="false" />
<parameter name="productCategoryId" required="false"/><!-- deprecated -->
<parameter name="locale"/>
</in-parameters>
<out-parameters>
<auto-parameters entity-name="mantle.product.category.ProductCategory" include="nonpk"/>
<parameter name="subCategoryList" type="List"><parameter name="categoryInfo" type="Map"/></parameter>
<parameter name="productCategoryId" />
</out-parameters>
<actions>
<service-call name="popstore.CartServices.get#ActiveOrderAndCustomer" out-map="context"/>
<!-- this can be here until the productCategoryId parameter is removed -->
<if condition="productCategoryId &amp;&amp; !categoryId">
<set field="categoryId" from="productCategoryId"/>
</if>

<!-- first search for the category based on productCategoryId -->
<entity-find-one entity-name="mantle.product.category.ProductCategory" value-field="productCategory" cache="true">
<field-map field-name="productCategoryId" from="categoryId"/></entity-find-one>


<!-- if no category was found using productCategoryId, try using pseudoId -->
<if condition="!productCategory">
<entity-find-one entity-name="mantle.product.category.ProductCategory" value-field="productCategory" cache="true">
<field-map field-name="pseudoId" from="categoryId"/></entity-find-one>
</if>

<if condition="productCategory == null"><return error="true" message="Category not found with categoryId ${categoryId}"/></if>

<entity-find-one entity-name="mantle.product.category.ProductCategory" value-field="productCategory" cache="true"/>
<if condition="productCategory == null"><return error="true" message="Category not found with ID ${productCategoryId}"/></if>
<script>context.putAll(productCategory)</script>

<entity-find entity-name="mantle.product.category.ProductCategoryRollup" list="rollupList" cache="true">
Expand Down
14 changes: 7 additions & 7 deletions template/store/category.html.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@
<div class="customer-menu">
<ul class="deals-ul">
<#if (storeInfo.categoryByType.PsctSearch.productCategoryId)??>
<li><a <#if storeInfo.categoryByType.PsctSearch.productCategoryId == categoryId>class="category-select"</#if> href="/store/category/${storeInfo.categoryByType.PsctSearch.productCategoryId}">
<li><a <#if storeInfo.categoryByType.PsctSearch.productCategoryId == categoryId>class="category-select"</#if> href="/store/category/${storeInfo.categoryByType.PsctSearch.pseudoId}">
<i class="fas fa-th"></i> All</a></li>
</#if>
<#if (storeInfo.categoryByType.PsctPromotions.productCategoryId)??>
<li><a <#if storeInfo.categoryByType.PsctPromotions.productCategoryId == categoryId>class="category-select"</#if> href="/store/category/${storeInfo.categoryByType.PsctPromotions.productCategoryId}">
<li><a <#if storeInfo.categoryByType.PsctPromotions.productCategoryId == categoryId>class="category-select"</#if> href="/store/category/${storeInfo.categoryByType.PsctPromotions.pseudoId}">
<i class="fa fa-fire" aria-hidden="true"></i> Deals</a></li>
</#if>
<#if (storeInfo.categoryByType.PsctNewProducts.productCategoryId)??>
<li><a <#if storeInfo.categoryByType.PsctNewProducts.productCategoryId == categoryId>class="category-select"</#if> href="/store/category/${storeInfo.categoryByType.PsctNewProducts.productCategoryId}">
<li><a <#if storeInfo.categoryByType.PsctNewProducts.productCategoryId == categoryId>class="category-select"</#if> href="/store/category/${storeInfo.categoryByType.PsctNewProducts.pseudoId}">
<i class="fas fa-tag"></i> New</a></li>
</#if>
<#if (storeInfo.categoryByType.PsctFeatured.productCategoryId)??>
<li><a <#if storeInfo.categoryByType.PsctFeatured.productCategoryId == categoryId>class="category-select"</#if> href="/store/category/${storeInfo.categoryByType.PsctFeatured.productCategoryId}">
<i class="fas fa-bullhorn"></i> Best Sellers</a></li>
<li><a <#if storeInfo.categoryByType.PsctFeatured.productCategoryId == categoryId>class="category-select"</#if> href="/store/category/${storeInfo.categoryByType.PsctFeatured.pseudoId}">
<i class="fas fa-bullhorn"></i> Featured</a></li>
</#if>
</ul>
<hr width="180px" style="margin-left: -15px !important;">
<span class="deals-subtitle">Categories</span>
<ul class="deals-ul">
<#list browseRootCategoryInfo.subCategoryList as category>
<li><a <#if category.productCategoryId == categoryId>class="category-select"</#if> href="/store/category/${category.productCategoryId}">${category.categoryName}</a></li>
<li><a <#if category.productCategoryId == categoryId>class="category-select"</#if> href="/store/category/${category.pseudoId}">${category.categoryName}</a></li>
</#list>
</ul>
</div>
Expand All @@ -45,7 +45,7 @@
<#if products??>
<#list products.productList as localProd>
<div class="col col-lg-4 col-md-6 col-6">
<a href="/store/product/${localProd.productId}">
<a href="/store/product/${localProd.pseudoId}">
<div class="category-product">
<figure class="figure">
<#if localProd.mediumImageInfo?? || localProd.smallImageInfo??>
Expand Down
4 changes: 2 additions & 2 deletions template/store/home.html.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<div class="carousel-item">
</#if>
<div class="d-block col-lg-3 col-12">
<a class="category-product" href="/store/product/${product.productId}">
<a class="category-product" href="/store/product/${product.pseudoId}">
<figure class="figure">
<#if product.mediumImageInfo??>
<img width="90%" class="figure-img img-fluid" src="/store/content/productImage/${product.mediumImageInfo.productContentId}">
Expand Down Expand Up @@ -105,7 +105,7 @@
<div class="carousel-item">
</#if>
<div class="d-block col-lg-3 col-12">
<a class="category-product" href="/store/product/${product.productId}">
<a class="category-product" href="/store/product/${product.pseudoId}">
<figure class="figure">
<#if product.mediumImageInfo??>
<img width="90%" class="figure-img img-fluid" src="/store/content/productImage/${product.mediumImageInfo.productContentId}">
Expand Down
2 changes: 1 addition & 1 deletion template/store/search.html.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ productListPageRangeHigh = productSearchResults.productListPageRangeHigh>
<div class="row mt-5">
<#list productList![] as localProd>
<div class="col col-lg-4 col-md-6 col-6">
<a href="/store/product/${localProd.productId}">
<a href="/store/product/${localProd.pseudoId}">
<div class="category-product">
<figure class="figure">
<#if localProd.mediumImageInfo?? || localProd.smallImageInfo??>
Expand Down