Skip to content
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
def compsPath = "screen/store/components"
// source JS files in load order
def compsJsFiles = [compsPath + "/utilities.js", compsPath + "/ApiServices.js", compsPath + "/ComponentsNav.js",
compsPath + "/ComponentsProduct.js", compsPath + "/ComponentsAccount.js", compsPath + "/ComponentsCheckout.js", compsPath + "/main.js"]
compsPath + "/ComponentsAccount.js", compsPath + "/ComponentsCheckout.js", compsPath + "/main.js"]

task combineBaseJs(type: com.eriwen.gradle.js.tasks.CombineJsTask) {
encoding = "UTF-8"
Expand Down
9 changes: 8 additions & 1 deletion screen/store/components/ComponentsCheckout.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ storeComps.CheckOutPage = {
name: "checkout-page",
extends: storeComps.CheckoutNavbar,
data: function() { return {
cvv: "", showCvvError: false, homePath: "", storePath: "", customerInfo: {}, productsInCart: {}, shippingAddress: {}, shippingAddressSelect: {}, paymentMethod: {}, shippingMethod: {},
cvv: "", showCvvError: false, homePath: "", storePath: "", customerInfo: {}, cartItemsImage:{}, productsInCart: {}, shippingAddress: {}, shippingAddressSelect: {}, paymentMethod: {}, shippingMethod: {},
showCheckoutMessages:false, billingAddress: {}, billingAddressOption: "", listShippingAddress: [], listPaymentMethods: [], promoCode: "", promoError: "", postalAddressStateGeoSelected: null,
countriesList: [], regionsList: [], shippingOption: "", addressOption: "", paymentOption: "", isSameAddress: "0", shippingItemPrice: 0,
isUpdate: false, isSpinner: false, responseMessage: "", toNameErrorMessage: "", countryErrorMessage: "", addressErrorMessage: "",
Expand Down Expand Up @@ -105,6 +105,12 @@ storeComps.CheckOutPage = {
return a + value;
}, 0);
},
getProductImage: function(productId) {
if (productId in this.cartItemsImage)
return storeConfig.productImageLocation + this.cartItemsImage[productId].productContentId;
else
return "/store/assets/default.png";
},
notAddressSeleted: function() {
return (this.addressOption == null || this.addressOption == ''
|| this.listShippingAddress == null || this.listShippingAddress.length == 0);
Expand Down Expand Up @@ -190,6 +196,7 @@ storeComps.CheckOutPage = {
this.addressOption = data.postalAddress.contactMechId + ':' + data.postalAddress.telecomContactMechId;
this.shippingAddressSelect = data.postalAddress;
this.shippingAddressSelect.contactNumber = data.telecomNumber.contactNumber;
this.cartItemsImage = data.cartItemsImage;
} else if (this.listShippingAddress.length) {
// Preselect first address
this.addressOption = this.listShippingAddress[0].postalContactMechId + ':' + this.listShippingAddress[0].telecomContactMechId;
Expand Down
29 changes: 0 additions & 29 deletions screen/store/components/ComponentsProduct.js

This file was deleted.

3 changes: 1 addition & 2 deletions screen/store/components/template/CheckoutPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
<hr class="hr">
<div class="row" v-for="(item, i) in productsInCart.orderItemList" :key="item.itemTypeEnumId + '' + item.productId" v-if="item.itemTypeEnumId != 'ItemShipping'">
<div class="col col-sm-2 d-none d-sm-block">
<product-image :productId="item.productId" v-if="item.itemTypeEnumId=='ItemProduct'"
class="mb-1"/>
<img v-if="item.itemTypeEnumId=='ItemProduct'" width="80px" height="80px" :src="getProductImage(item.productId)" >
</div>
<div class="col col-6 col-sm-5">
<p class="item-text-desc">
Expand Down
1 change: 0 additions & 1 deletion screen/store/d.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ along with this software (see the LICENSE.md file). If not, see
<script src="/store/components/ApiServices.js"></script>

<script src="/store/components/ComponentsNav.js"></script>
<script src="/store/components/ComponentsProduct.js"></script>
<script src="/store/components/ComponentsAccount.js"></script>
<script src="/store/components/ComponentsCheckout.js"></script>

Expand Down
7 changes: 7 additions & 0 deletions service/popstore/CartServices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ General Order Placement and eCommerce Usage
<auto-parameters entity-name="mantle.order.OrderItem"/></parameter></parameter>
<parameter name="orderItemWithChildrenSet" type="Set"><parameter name="orderItemSeqId"/></parameter>

<parameter name="cartItemsImage" type="Map"><auto-parameters entity-name="mantle.product.ProductContent"/></parameter>

<parameter name="paymentInfoList" type="List"><parameter name="partPaymentInfo" type="Map">
<parameter name="payment" type="Map"><auto-parameters entity-name="mantle.account.payment.Payment"/></parameter>
<parameter name="statusItem" type="Map"><auto-parameters entity-name="moqui.basic.StatusItem"/></parameter>
Expand Down Expand Up @@ -118,13 +120,18 @@ General Order Placement and eCommerce Usage
list="orderItemList" order-by-list="['orderItemSeqId']"/>
<script><![CDATA[
orderItemWithChildrenSet = new HashSet()
cartItemsImage = new HashMap<String, Map>()
List reverseList = orderItemList.cloneList().orderByFields(["-orderItemSeqId"])
for (orderItem in reverseList) {
if (orderItem.parentItemSeqId) {
orderItemWithChildrenSet.add(orderItem.parentItemSeqId)
orderItemList.move(orderItemList.indexMatching([orderItemSeqId:orderItem.orderItemSeqId]),
orderItemList.indexMatching([orderItemSeqId:orderItem.parentItemSeqId])+1)
}

cartItemsImage.put(orderItem.productId, ec.service.sync().name('popstore.ProductServices.get#ProductContentCascading')
.parameters([productId:orderItem.productId, contentTypes:['PcntImageSmall', 'PcntImageMedium', 'PcntImageLarge']])
.call().productContent);
}
]]></script>

Expand Down
49 changes: 25 additions & 24 deletions service/popstore/ProductServices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,27 @@ along with this software (see the LICENSE.md file). If not, see
</actions>
</service>

<!--
Iterates a list of content types looking to see if they exist on this product or productParent.
Once content is round, exits the loop and returns. Currently used in CartServices for the image.
-->
<service verb="get" noun="ProductContentCascading">
<in-parameters>
<parameter name="productId" />
<parameter name="contentTypes" type="List" />
</in-parameters>
<out-parameters>
<parameter name="productContent" />
</out-parameters>
<actions>
<iterate list="contentTypes" entry="type">
<service-call name="popstore.ProductServices.find#ProductContent"
in-map="[productId:productId, productContentTypeEnumId:type]" out-map="context"/>
<if condition="productContent"><return /></if>
</iterate>
</actions>
</service>

<service verb="get" noun="ProductVariantsDisplayInfo">
<in-parameters>
<parameter name="productId">
Expand Down Expand Up @@ -615,34 +636,14 @@ along with this software (see the LICENSE.md file). If not, see
<entity-find-one entity-name="mantle.product.Product" value-field="product" cache="true">
<field-map field-name="productId" from="pcmp.productId"/></entity-find-one>

<service-call name="mantle.product.PriceServices.get#ProductPrice" out-map="priceMap" out-map-add-to-existing="false"
in-map="[productId:pcmp.productId, priceUomId:priceUomId, productStoreId:productStoreId,
vendorPartyId:vendorPartyId, customerPartyId:customerPartyId]"/>
<service-call name="mantle.product.PriceServices.get#ProductPrice" in-map="[productId:pcmp.productId, priceUomId:priceUomId, productStoreId:productStoreId, vendorPartyId:vendorPartyId, customerPartyId:customerPartyId]" out-map-add-to-existing="false" out-map="priceMap"/>

<set field="smallImageInfo" from="null"/>
<set field="mediumImageInfo" from="null"/>
<entity-find entity-name="mantle.product.ProductContent" list="productContentList" cache="true">
<date-filter/><econdition field-name="productId" from="pcmp.productId"/>
<order-by field-name="sequenceNum,-fromDate"/>
</entity-find>
<if condition="locale">
<!-- filter after by locale to streamline cached find -->
<set field="langLocale" from="locale.contains('_') ? locale.substring(locale.indexOf('_')) : null"/>
<set field="productContentList" from="productContentList.findAll({ it.locale == null || it.locale == locale || it.locale == langLocale })"/>
</if>
<if condition="productContentList">
<!-- medium can be PcntImageMedium or PcntImageLarge -->
<set field="mediumImageInfo" from="productContentList.find({ 'PcntImageMedium'.equals(it.productContentTypeEnumId) })"/>
<if condition="mediumImageInfo == null">
<set field="mediumImageInfo" from="productContentList.find({ 'PcntImageLarge'.equals(it.productContentTypeEnumId) })"/></if>
<!-- small can be PcntImageSmall or from medium we just looked up -->
<set field="smallImageInfo" from="productContentList.find({ 'PcntImageSmall'.equals(it.productContentTypeEnumId) })"/>
<if condition="smallImageInfo == null"><set field="smallImageInfo" from="mediumImageInfo"/></if>
</if>
<service-call name="popstore.ProductServices.get#ProductContentCascading"
in-map="[productId:pcmp.productId, contentTypes:['PcntImageSmall', 'PcntImageMedium', 'PcntImageLarge']]" out-map-add-to-existing="false" out-map="imageMap" />

<script>productList.add([productId:pcmp.productId, pseudoId:product.pseudoId, productName:product.productName,
description:product.description, price:priceMap.price, listPrice:priceMap.listPrice, priceUomId:priceMap.priceUomId,
sequenceNum:pcmp.sequenceNum, smallImageInfo:smallImageInfo, mediumImageInfo:mediumImageInfo])</script>
sequenceNum:pcmp.sequenceNum, imageInfo:imageMap.productContent])</script>
</iterate>
</actions>
</service>
Expand Down
5 changes: 2 additions & 3 deletions template/store/category.html.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@
<a href="/store/product/${localProd.productId}">
<div class="category-product">
<figure class="figure">
<#if localProd.mediumImageInfo?? || localProd.smallImageInfo??>
<#assign img = localProd.smallImageInfo! localProd.mediumImageInfo>
<#if localProd.imageInfo??>
<img class="figure-img img-fluid product-img product-small-img"
src="/store/content/productImage/${img.productContentId}"
src="/store/content/productImage/${localProd.imageInfo.productContentId}"
alt="Product Image">
<#else>
<img class="figure-img img-fluid product-img product-small-img"
Expand Down
16 changes: 4 additions & 12 deletions template/store/home.html.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@
<div class="d-block col-lg-3 col-12">
<a class="category-product" href="/store/product/${product.productId}">
<figure class="figure">
<#if product.mediumImageInfo??>
<img width="90%" class="figure-img img-fluid" src="/store/content/productImage/${product.mediumImageInfo.productContentId}">
<#else>
<#if product.smallImageInfo??>
<img width="90%" class="figure-img img-fluid" src="/store/content/productImage/${product.smallImageInfo.productContentId}" >
</#if>
<#if product.imageInfo??>
<img width="90%" class="figure-img img-fluid" src="/store/content/productImage/${product.imageInfo.productContentId}">
</#if>
<figcaption class="text-left title-product-text figure-caption">
${product.productName}
Expand Down Expand Up @@ -107,12 +103,8 @@
<div class="d-block col-lg-3 col-12">
<a class="category-product" href="/store/product/${product.productId}">
<figure class="figure">
<#if product.mediumImageInfo??>
<img width="90%" class="figure-img img-fluid" src="/store/content/productImage/${product.mediumImageInfo.productContentId}">
<#else>
<#if product.smallImageInfo??>
<img width="90%" class="figure-img img-fluid" src="/store/content/productImage/${product.smallImageInfo.productContentId}" >
</#if>
<#if product.imageInfo??>
<img width="90%" class="figure-img img-fluid" src="/store/content/productImage/${product.imageInfo.productContentId}">
</#if>
<figcaption class="text-left title-product-text figure-caption">
${product.productName}
Expand Down