Skip to content
This repository has been archived by the owner on Sep 11, 2019. It is now read-only.

Commit

Permalink
Adapting products-grid to commerce section pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Pelka committed Nov 19, 2015
1 parent 264f9b9 commit 315fdac
Show file tree
Hide file tree
Showing 90 changed files with 1,030 additions and 852 deletions.
Expand Up @@ -178,12 +178,64 @@ use([
if (imageResourceFile) {
return true;
}
/*else {
productImageResource = resolver.getResource(jcrContentProperties.get('cq:productMaster')+'/image');
productImageResourceProperties = ResourceUtils.getResourceProperties(productImageResource);
if(productImageResourceProperties.get('fileReference')) {
return productImageResourceProperties.get('fileReference');
}
else {
productAssetResource = resolver.getResource(jcrContentProperties.get('cq:productMaster')+'/assets/asset0');
productAssetResourceProperties = ResourceUtils.getResourceProperties(productImageResource);
if(productAssetResourceProperties.get('fileReference')) {
return productAssetResourceProperties.get('fileReference');
}
}
}*/
}
}
}
return false;
};

/*var _getImage = function (resource) {
var jcrContent = resolver.getResource(resource, Constants.JCR_CONTENT),
jcrContentProperties = ResourceUtils.getResourceProperties(jcrContent),
imageResource = resolver.getResource(jcrContent, 'image'),
imageResourceProperties,
imageResourceFile;
if (jcrContentProperties.get('fileReference')) {
return jcrContentProperties.get('fileReference');
} else {
if (imageResource) {
imageResourceProperties = ResourceUtils.getResourceProperties(imageResource);
if (imageResourceProperties.get('fileReference')) {
return imageResourceProperties.get('fileReference');
} else {
imageResourceFile = resolver.getResource(imageResource, 'file');
if (imageResourceFile) {
return imageResourceFile;
}
else {
productImageResource = resolver.getResource(jcrContentProperties.get('cq:productMaster')+'/image');
productImageResourceProperties = ResourceUtils.getResourceProperties(productImageResource);
if(productImageResourceProperties.get('fileReference')) {
return productImageResourceProperties.get('fileReference');
}
else {
productAssetResource = resolver.getResource(jcrContentProperties.get('cq:productMaster')+'/assets/asset0');
productAssetResourceProperties = ResourceUtils.getResourceProperties(productImageResource);
if(productAssetResourceProperties.get('fileReference')) {
return productAssetResourceProperties.get('fileReference');
}
}
}
}
}
}
return false;
};*/

var _getRequestQueryString = function (replacedParameter, replacedParameterValue) {
var queryString = '',
requestParameters = request.getRequestParameterList().toArray(),
Expand Down Expand Up @@ -349,6 +401,7 @@ use([
count = 0,
page,
pageProperties,
productPath,
product;
if (!itemList) {
return;
Expand All @@ -368,18 +421,41 @@ use([
}
page = ResourceUtils.getContainingPage(item);
pageProperties = ResourceUtils.getPageProperties(page);
product = commerceService.getProduct(pageProperties.get("cq:productMaster", java.lang.String));
productPath = pageProperties.get("cq:productMaster", java.lang.String);

var colorVariants = [];
var tags = [];
var price;
if(productPath) {
product = commerceService.getProduct(productPath);
colorIterator = product.getVariants(new com.adobe.cq.commerce.common.EnumerateAxisFilter("color"));
while(colorIterator.hasNext()) {
colorVariants.push(colorIterator.next().getProperty("color", java.lang.String));
}
price = commerceSession.getProductPrice(product);
var productResource = resolver.getResource(productPath);
var productResourceProperties = ResourceUtils.getResourceProperties(productResource);
tags = productResourceProperties.get('cq:tags');

}
else {
colorVariants.push('none');
tags.push('none');
}
count++;
collector.push({
item : {
path : page.path,
orderByData: pageProperties.get(configuration.orderBy),
description: pageProperties.get(Constants.JCR_DESCRIPTION, '')
},
/*img : _getImage(item),*/
itemName : pageProperties.get(Constants.JCR_TITLE),
modifdate: _getModifiedDate(page),
hasimage : _hasImage(page),
itemPrice: commerceSession.getProductPrice(product)
itemPrice: price,
colors : colorVariants,
tags : tags
});
}
if (collector.length > 0) {
Expand Down
Expand Up @@ -54,7 +54,7 @@

<template data-sly-template.products="${@ renderItem}">
<div class="col-md-2" data-sly-use>
<div class="we-Product">
<div class="we-Product" data-price="${renderItem.itemPrice}" data-test="ok" data-colors="${renderItem.colors}" data-tags="${renderItem.tags}">
<div class="we-Product-image">
<img data-sly-test="${renderItem.hasimage}" src="${renderItem.item.path}/jcr:content.thumbnail.319.319.jpg" alt="${renderItem.itemName}"/>
<img data-sly-test="${!renderItem.hasimage}" src="http://placehold.it/300/c0c0c1/ffffff"/>
Expand All @@ -68,7 +68,7 @@ <h3 class="we-Product-title">${renderItem.itemName}</h3>
<span class="we-Product-price-new"></span>
<s class="we-Product-price-old"></s>
</strong>

<span class="we-Product-discount hidden"><span></span>off</span>
<a href="${renderItem.item.path}.html" class="we-Product-link"></a>
</div>
Expand Down

This file was deleted.

Expand Up @@ -6,10 +6,10 @@
cq:commerceProvider="geometrixx"
cq:commerceType="section"
cq:designPath="/etc/designs/we-retail"
cq:lastModified="{Date}2015-11-18T15:54:32.580+01:00"
cq:lastModified="{Date}2015-11-19T17:37:10.788+01:00"
cq:lastModifiedBy="admin"
cq:lastPropertyRollout="{Date}2015-11-18T15:54:32.580+01:00"
cq:lastRolledout="{Date}2015-11-18T15:54:32.599+01:00"
cq:lastPropertyRollout="{Date}2015-11-19T17:37:10.788+01:00"
cq:lastRolledout="{Date}2015-11-19T17:37:10.806+01:00"
cq:lastRolledoutBy="admin"
cq:template="/apps//templates/page-catalog"
jcr:language="en"
Expand All @@ -19,24 +19,24 @@
sling:resourceType="we-retail/components/structure/page"
pageTitle="We.Retail">
<cq:responsive
cq:lastRolledout="{Date}2015-11-18T15:54:32.588+01:00"
cq:lastRolledout="{Date}2015-11-19T17:37:10.797+01:00"
cq:lastRolledoutBy="admin"
jcr:mixinTypes="[cq:LiveRelationship]"
jcr:primaryType="nt:unstructured">
<breakpoints
cq:lastRolledout="{Date}2015-11-18T15:54:32.592+01:00"
cq:lastRolledout="{Date}2015-11-19T17:37:10.801+01:00"
cq:lastRolledoutBy="admin"
jcr:mixinTypes="[cq:LiveRelationship]"
jcr:primaryType="nt:unstructured">
<phone
cq:lastRolledout="{Date}2015-11-18T15:54:32.598+01:00"
cq:lastRolledout="{Date}2015-11-19T17:37:10.806+01:00"
cq:lastRolledoutBy="admin"
jcr:mixinTypes="[cq:LiveRelationship]"
jcr:primaryType="nt:unstructured"
title="Phone"
width="{Decimal}650"/>
<tablet
cq:lastRolledout="{Date}2015-11-18T15:54:32.598+01:00"
cq:lastRolledout="{Date}2015-11-19T17:37:10.806+01:00"
cq:lastRolledoutBy="admin"
jcr:mixinTypes="[cq:LiveRelationship]"
jcr:primaryType="nt:unstructured"
Expand All @@ -45,7 +45,7 @@
</breakpoints>
</cq:responsive>
<par
cq:lastRolledout="{Date}2015-11-18T15:54:32.599+01:00"
cq:lastRolledout="{Date}2015-11-19T17:37:10.806+01:00"
cq:lastRolledoutBy="admin"
jcr:mixinTypes="[cq:LiveRelationship]"
jcr:primaryType="nt:unstructured"
Expand Down
Expand Up @@ -4,52 +4,53 @@
<jcr:content
cq:catalogBlueprint="/content/catalogs/we-retail/en/base-catalog/equipment"
cq:commerceType="section"
cq:lastModified="{Date}2015-11-18T15:54:33.888+01:00"
cq:lastModified="{Date}2015-11-19T17:37:12.859+01:00"
cq:lastModifiedBy="admin"
cq:lastPropertyRollout="{Date}2015-11-10T14:18:07.319+01:00"
cq:lastRolledout="{Date}2015-11-18T15:54:33.925+01:00"
cq:lastRolledout="{Date}2015-11-19T17:37:12.887+01:00"
cq:lastRolledoutBy="admin"
cq:template="/apps/we-retail/templates/page-section"
jcr:mixinTypes="[cq:LiveSync]"
jcr:primaryType="cq:PageContent"
jcr:title="Equipment"
sling:resourceType="we-retail/components/structure/page">
<par
cq:lastRolledout="{Date}2015-11-18T15:54:33.912+01:00"
cq:lastRolledout="{Date}2015-11-19T17:37:12.876+01:00"
cq:lastRolledoutBy="admin"
jcr:mixinTypes="[cq:LiveRelationship]"
jcr:primaryType="nt:unstructured"
sling:resourceType="wcm/foundation/components/responsivegrid">
<section-products
cq:lastRolledout="{Date}2015-11-18T15:54:33.915+01:00"
<product-grid
cq:lastRolledout="{Date}2015-11-19T17:37:12.879+01:00"
cq:lastRolledoutBy="admin"
jcr:created="{Date}2015-11-10T15:00:43.278+01:00"
jcr:createdBy="admin"
jcr:lastModified="{Date}2015-11-10T15:00:43.278+01:00"
jcr:lastModified="{Date}2015-11-19T17:37:12.845+01:00"
jcr:lastModifiedBy="admin"
jcr:mixinTypes="[cq:LiveRelationship]"
jcr:primaryType="nt:unstructured"
sling:resourceType="we-retail/components/content/section-products"/>
sling:resourceType="we-retail/components/content/products-grid"
displayAs="products"/>
</par>
<cq:responsive
cq:lastRolledout="{Date}2015-11-18T15:54:33.916+01:00"
cq:lastRolledout="{Date}2015-11-19T17:37:12.879+01:00"
cq:lastRolledoutBy="admin"
jcr:mixinTypes="[cq:LiveRelationship]"
jcr:primaryType="nt:unstructured">
<breakpoints
cq:lastRolledout="{Date}2015-11-18T15:54:33.919+01:00"
cq:lastRolledout="{Date}2015-11-19T17:37:12.882+01:00"
cq:lastRolledoutBy="admin"
jcr:mixinTypes="[cq:LiveRelationship]"
jcr:primaryType="nt:unstructured">
<phone
cq:lastRolledout="{Date}2015-11-18T15:54:33.924+01:00"
cq:lastRolledout="{Date}2015-11-19T17:37:12.887+01:00"
cq:lastRolledoutBy="admin"
jcr:mixinTypes="[cq:LiveRelationship]"
jcr:primaryType="nt:unstructured"
title="Phone"
width="{Decimal}650"/>
<tablet
cq:lastRolledout="{Date}2015-11-18T15:54:33.925+01:00"
cq:lastRolledout="{Date}2015-11-19T17:37:12.887+01:00"
cq:lastRolledoutBy="admin"
jcr:mixinTypes="[cq:LiveRelationship]"
jcr:primaryType="nt:unstructured"
Expand Down

0 comments on commit 315fdac

Please sign in to comment.