Created
September 20, 2011 22:09
-
-
Save farmerbradllc/1230561 to your computer and use it in GitHub Desktop.
CKOUT - Display Products
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Authors: | |
## Bradley Wood | |
## Ray Augé | |
## | |
## Getting Services | |
## | |
#set ($portalBeanLocator = $portal.getClass().forName('com.liferay.portal.kernel.bean.PortalBeanLocatorUtil')) | |
#set ($booleanQueryFactory = $portalBeanLocator.locate('com.liferay.portal.kernel.search.BooleanQueryFactoryUtil')) | |
#set ($searchEngine = $portalBeanLocator.locate('com.liferay.portal.kernel.search.SearchEngineUtil')) | |
#set ($sortFactory = $portalBeanLocator.locate('com.liferay.portal.kernel.search.SortFactoryUtil')) | |
#set ($searchContext = $portal.getClass().forName('com.liferay.portal.kernel.search.SearchContext').newInstance()) | |
#set ($journalContentUtil = $portalBeanLocator.locate('com.liferay.portlet.journalcontent.util.JournalContentUtil')) | |
#set ($localizationUtil = $portal.getClass().forName('com.liferay.portal.kernel.util.LocalizationUtil')) | |
#set ($journalStructureService = $serviceLocator.findService('com.liferay.portlet.journal.service.JournalStructureLocalService')) | |
#set ($journalTemplateService = $serviceLocator.findService('com.liferay.portlet.journal.service.JournalTemplateService')) | |
#set($communityStructures = $journalStructureService.getStructures($groupId)) | |
#foreach($communityStructure in $communityStructures) | |
#set ($structureName = $localizationUtil.getLocalization($communityStructure.name, $request.theme-display.language-id)) | |
#if($structureName =="CKOUT - Product") | |
#set ($structureId = $communityStructure.structureId) | |
#end | |
#end | |
#set($templateLists = $journalTemplateService.getStructureTemplates($groupId, $structureId)) | |
#foreach ($temp in $templateLists) | |
#set ($templateName = $localizationUtil.getLocalization($temp.name, $request.theme-display.language-id)) | |
#if($templateName == 'CKOUT - Product Full-Detailed View') | |
#set($product-detailed-template-id = $temp.templateId) | |
#end | |
#if($templateName == 'CKOUT - Product Thumbnail View') | |
#set($product-thumbnail-template-id = $temp.templateId) | |
#end | |
#end | |
## | |
## Setting Variables | |
## | |
#set ($companyId = $getterUtil.getLong($request.theme-display.company-id)) | |
#set ($ns = $request.portlet-namespace) | |
#set ($scopeGroupId = $getterUtil.getLong($request.theme-display.scope-group-id)) | |
#set ($languageId = $request.theme-display.language-id) | |
#set ($V = $searchContext.setCompanyId($companyId)) | |
#set ($V = $searchContext.setGroupIds([$scopeGroupId])) | |
## get product_id from URL | |
#set ($friendlyURL = $request.get('attributes').get('CURRENT_COMPLETE_URL')) | |
#set ($productId = $httpUtil.getParameter($friendlyURL, "product_id")) | |
#set ($tag = $httpUtil.getParameter($friendlyURL, "tag")) | |
## | |
## Define Search Query | |
## | |
#set ($fullQuery = $booleanQueryFactory.create($searchContext)) | |
#set ($searchQuery = $booleanQueryFactory.create($searchContext)) | |
#set ($V = $searchQuery.addRequiredTerm('portletId', '15')) | |
#set ($V = $searchQuery.addRequiredTerm('structureId', $structureId)) | |
#if($filter-by-category.data != "none") | |
#set ($V = $searchQuery.addRequiredTerm('assetCategoryNames', $filter-by-category.data)) | |
#end | |
#if($tag != '') | |
#set ($V = $searchQuery.addRequiredTerm('assetTagNames', $tag)) | |
#end | |
#set ($V = $fullQuery.add($searchQuery, 'MUST')) | |
#set ($hits = $searchEngine.search($companyId, $fullQuery, $sortFactory.getDefaultSorts(), -1, -1)) | |
## Display only one product | |
#if($productId && $productId != '') | |
$journalContentUtil.getContent($scopeGroupId, $productId, $product-detailed-template-id, null, $languageId, $xmlRequest) | |
<br/> | |
#else | |
## Display search results of products | |
#foreach ($doc in $hits.docs) | |
$journalContentUtil.getContent($scopeGroupId, $doc.articleId, $product-thumbnail-template-id, null, $languageId, $xmlRequest) | |
#end | |
#end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<root> | |
<dynamic-element name='filter-by-category' type='list' index-type='' repeatable='false'> | |
<dynamic-element name='none' type='none' index-type='' repeatable='false'> </dynamic-element> | |
<dynamic-element name='men' type='men' index-type='' repeatable='false'> </dynamic-element> | |
<dynamic-element name='women' type='women' index-type='' repeatable='false'> </dynamic-element> | |
<dynamic-element name='children' type='children' index-type='' repeatable='false'></dynamic-element> | |
</dynamic-element> | |
</root> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set ($localizationUtil = $portal.getClass().forName('com.liferay.portal.kernel.util.LocalizationUtil')) | |
#set ($title = $localizationUtil.getLocalization($reserved-article-title.data, $request.theme-display.language-id)) | |
#set ($layoutLocalService = $serviceLocator.findService('com.liferay.portal.service.LayoutLocalService')) | |
#set ($themeDisplay = $request.get('theme-display')) | |
#set ($currentPlid = $getterUtil.getLong($themeDisplay.get('plid'))) | |
#set($pageName = $layoutLocalService.getLayout($currentPlid).name) | |
#set ($jobListingId = $request.parameters.product_id) | |
<div class="aui-column aui-w55 aui-column-first"> | |
<div class="aui-column-content"> | |
<div id="gallery1" class="gallery"> | |
#set($image-count = 0) | |
#set($length = $image.siblings.size()) | |
#foreach ($image in $image.siblings) | |
#set($image-count = $image-count + 1) | |
#if($image-count == 2) | |
<div class="thumbnails-wrapper"> | |
<div class="small-thumbnails"> | |
#end | |
<a href="$!{image.data}" title="$!{title}" alt="Click to Enlarge"> | |
<img class="product-image item-${image-count}" src="$!{image.data}" /> | |
</a> | |
#if($image-count == $length && $length > 1) | |
</div> | |
</div> | |
#end | |
#end | |
</div> | |
</div> | |
</div> | |
<div class="aui-column aui-w45 aui-column-last"> | |
<div class="product aui-column-content"> | |
<a href="?"><h4><< Display All ${pageName}'s Products</h4></a><br/> | |
<img class="product-image" src="$!{image.data}" style="display: none;"/> | |
<span class="product-title">$!{title}</span><br/> | |
<span class="product-attr-sku"> #language('sku'): $!{reserved-article-id.data}</span><br/> | |
#if($orig-price.data && $orig-price.data !='') | |
#language('price'): <span class="product-price discounted">$!numberTool.currency($price.data)</span><br/> | |
#language('original-price'): <span class="orig">$!numberTool.currency($orig-price.data)</span><br/> | |
#else | |
#language('price'): <span class="product-price">$!numberTool.currency($price.data)</span><br/> | |
#end | |
#if($shipping-price.data && $shipping-price.data != '') | |
#language('shipping'): <span class="product-shipping">$$!{shipping-price.data}</span> <br/> | |
#end | |
#if($attr.data != '') | |
#foreach($attrs in $attr.siblings) | |
#if($attrs.show-radio.data == 'true') | |
<br/> | |
${attrs.data.toLowerCase()}: | |
#set($radioCount = 0) | |
#foreach($options in $attrs.attr-option.siblings) | |
#set($attr-var = $options.toLowerCase()) | |
<br/> | |
<input class="product-attr-${attrs.data.toLowerCase()}" name="${attrs.data.toLowerCase()}" type="radio" value="${options.data}" #if($radioCount == 0) checked #end/> | |
${options.data} | |
#set($radioCount = $radioCount + 1) | |
#end | |
#else | |
<br/> | |
${attrs.data.toLowerCase()}: | |
<select class="product-attr-${attrs.data.toLowerCase()}"> | |
#foreach($options in $attrs.attr-option.siblings) | |
<option>${options.data}</option> | |
#end | |
</select> | |
#end | |
#end | |
#end | |
<div role="button" alt="Add to cart" tabindex="0" class="googlecart-add-button">#language('add-to-shopping-cart')</div> | |
</div> | |
</div> | |
<div class="aui-column aui-w100 aui-column-only"> | |
<div id="desc" class="aui-column-content"> | |
<h3>#language('description')</h3> | |
$!description.data | |
</div> | |
#if($tabs && $tabs.data != '') | |
<div id="markupTabs"> | |
<ul class="aui-tabview-list aui-widget-hd" id="product-tab-list"> | |
#foreach($tab in $tabs.siblings) | |
<li class="aui-tab"><a class="aui-tab-label" href="javascript:;">$!tab.data</a></li> | |
#end | |
</ul> | |
<div class="aui-tabview-content aui-widget-bd" id="product-tab-content"> | |
#foreach($tab in $tabs.siblings) | |
<div class="aui-tabview-content-item"> | |
$!tab.content.data | |
</div> | |
#end | |
</div> | |
<script type="text/javascript"> | |
AUI().ready('aui-image-viewer-gallery','aui-tabs', 'substitute', function(A) { | |
var tabs1 = new A.TabView( | |
{ | |
boundingBox: '#markupTabs', | |
listNode: '#product-tab-list', | |
contentNode: '#product-tab-content' | |
} | |
); | |
tabs1.render(); | |
}); | |
</script> | |
</div> | |
#end | |
<script type="text/javascript"> | |
AUI().ready('aui-image-viewer-gallery', function(A) { | |
var imageGallery1 = new A.ImageGallery({ | |
links: '#gallery1 a', | |
//useOriginalImage: true, | |
// showPlayer: false, | |
// playingLabel: '- Playing', | |
// pausedLabel: '- Paused', | |
paginator: { | |
//maxPageLinks: 2 | |
}, | |
maxHeight: 600, | |
maxWidth: 600, | |
// toolbar: { | |
// children: [ | |
// { | |
// id: 'stop', | |
// icon: 'stop' | |
// } | |
// ] | |
// }, | |
// autoPlay: true, | |
// repeat: false, | |
// currentIndex: 4, | |
// anim: false, | |
// random: true, | |
delay: 2000 | |
}) | |
.render(); | |
// imageGallery1.show(); | |
// imageGallery1.play(); | |
// imageGallery1.pause(); | |
// imageGallery1.stop(); | |
// imageGallery1.destroy(); | |
A.one('#log').html('Ready, click on the images.'); | |
}); | |
</script> | |
</div> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set ($localizationUtil = $portal.getClass().forName('com.liferay.portal.kernel.util.LocalizationUtil')) | |
#set ($title = $localizationUtil.getLocalization($reserved-article-title.data, $request.theme-display.language-id)) | |
<div class="product-thumb" > | |
<a href="?product_id=$!{reserved-article-id.data}"> | |
<img height="100px" src="$!{image.data}"> | |
<br> | |
<ul style="list-style: none;"> | |
<li>$!{title}</li> | |
<li>$!numberTool.currency($price.data)</li> | |
</ul> | |
</a> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<root> | |
<dynamic-element name='description' type='text_area' index-type='text' repeatable='false'> | |
<meta-data> | |
<entry name="displayAsTooltip"><![CDATA[false]]></entry> | |
<entry name="required"><![CDATA[true]]></entry> | |
<entry name="instructions"><![CDATA[]]></entry> | |
<entry name="label"><![CDATA[Description]]></entry> | |
<entry name="predefinedValue"><![CDATA[]]></entry> | |
</meta-data> | |
</dynamic-element> | |
<dynamic-element name='image' type='image' index-type='text' repeatable='true'> | |
<meta-data> | |
<entry name="displayAsTooltip"><![CDATA[false]]></entry> | |
<entry name="required"><![CDATA[false]]></entry> | |
<entry name="instructions"><![CDATA[]]></entry> | |
<entry name="label"><![CDATA[image]]></entry> | |
<entry name="predefinedValue"><![CDATA[]]></entry> | |
</meta-data> | |
</dynamic-element> | |
<dynamic-element name='price' type='text' index-type='text' repeatable='false'> | |
<meta-data> | |
<entry name="displayAsTooltip"><![CDATA[false]]></entry> | |
<entry name="required"><![CDATA[true]]></entry> | |
<entry name="instructions"><![CDATA[]]></entry> | |
<entry name="label"><![CDATA[Product Price]]></entry> | |
<entry name="predefinedValue"><![CDATA[]]></entry> | |
</meta-data> | |
</dynamic-element> | |
<dynamic-element name='orig-price' type='text' index-type='keyword' repeatable='false'> | |
<meta-data> | |
<entry name="displayAsTooltip"><![CDATA[true]]></entry> | |
<entry name="required"><![CDATA[false]]></entry> | |
<entry name="instructions"><![CDATA[If Orig. Price is set then it will strike out Orig. price and make the current price red]]></entry> | |
<entry name="label"><![CDATA[Original Price]]></entry> | |
<entry name="predefinedValue"><![CDATA[]]></entry> | |
</meta-data> | |
</dynamic-element> | |
<dynamic-element name='shipping-price' type='text' index-type='text' repeatable='false'> | |
<meta-data> | |
<entry name="displayAsTooltip"><![CDATA[false]]></entry> | |
<entry name="required"><![CDATA[false]]></entry> | |
<entry name="instructions"><![CDATA[]]></entry> | |
<entry name="label"><![CDATA[Flat Rate to Ship this Item]]></entry> | |
<entry name="predefinedValue"><![CDATA[]]></entry> | |
</meta-data> | |
</dynamic-element> | |
<dynamic-element name='attr' type='text' index-type='keyword' repeatable='true'> | |
<meta-data> | |
<entry name="displayAsTooltip"><![CDATA[false]]></entry> | |
<entry name="required"><![CDATA[false]]></entry> | |
<entry name="instructions"><![CDATA[]]></entry> | |
<entry name="label"><![CDATA[Attribute Name]]></entry> | |
<entry name="predefinedValue"><![CDATA[]]></entry> | |
</meta-data> | |
<dynamic-element name='show-radio' type='boolean' index-type='keyword' repeatable='false'> | |
<meta-data> | |
<entry name="displayAsTooltip"><![CDATA[false]]></entry> | |
<entry name="required"><![CDATA[false]]></entry> | |
<entry name="instructions"><![CDATA[]]></entry> | |
<entry name="label"><![CDATA[show-radio]]></entry> | |
<entry name="predefinedValue"><![CDATA[]]></entry> | |
</meta-data> | |
</dynamic-element> | |
<dynamic-element name='attr-option' type='text' index-type='keyword' repeatable='true'> | |
<meta-data> | |
<entry name="displayAsTooltip"><![CDATA[false]]></entry> | |
<entry name="required"><![CDATA[false]]></entry> | |
<entry name="instructions"><![CDATA[]]></entry> | |
<entry name="label"><![CDATA[Attribute Option]]></entry> | |
<entry name="predefinedValue"><![CDATA[]]></entry> | |
</meta-data> | |
</dynamic-element> | |
</dynamic-element> | |
<dynamic-element name='tabs' type='text' index-type='keyword' repeatable='true'> | |
<meta-data> | |
<entry name="displayAsTooltip"><![CDATA[false]]></entry> | |
<entry name="required"><![CDATA[false]]></entry> | |
<entry name="instructions"><![CDATA[]]></entry> | |
<entry name="label"><![CDATA[Information Tab]]></entry> | |
<entry name="predefinedValue"><![CDATA[]]></entry> | |
</meta-data> | |
<dynamic-element name='content' type='text_area' index-type='text' repeatable='false'> | |
<meta-data> | |
<entry name="displayAsTooltip"><![CDATA[false]]></entry> | |
<entry name="required"><![CDATA[false]]></entry> | |
<entry name="instructions"><![CDATA[]]></entry> | |
<entry name="label"><![CDATA[content]]></entry> | |
<entry name="predefinedValue"><![CDATA[]]></entry> | |
</meta-data> | |
</dynamic-element> | |
</dynamic-element> | |
</root> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!DOCTYPE look-and-feel PUBLIC "-//Liferay//DTD Look and Feel 6.1.0//EN" "http://www.liferay.com/dtd/liferay-look-and-feel_6_1_0.dtd"> | |
<look-and-feel> | |
<compatibility> | |
<version>6.1.0+</version> | |
</compatibility> | |
<theme id="checkout" name="Checkout Theme"> | |
<settings> | |
<setting configurable="true" key="portlet-setup-show-borders-default" type="checkbox" value="true"></setting> | |
<setting configurable="true" key="shopping-cart-name" type="text" value="View Shopping Cart"></setting> | |
<setting configurable="true" key="merchant-id" type="text" value="853989395876916"></setting> | |
<setting configurable="true" key="post-cart-to-sandbox" type="checkbox" value="true"></setting> | |
<setting configurable="true" key="show-breadcrumb" type="checkbox" value="true"></setting> | |
</settings> | |
<layout-templates> | |
<custom> | |
<layout-template id="2-3-columns" name="2-3 Columns Layout"> | |
<template-path>/layouttpl/custom/2-3-columns-layouttpl/2_3_columns.tpl</template-path> | |
<wap-template-path>/layouttpl/custom/2-3-columns-layouttpl/2_3_columns.tpl</wap-template-path> | |
<thumbnail-path>/layouttpl/custom/2-3-columns-layouttpl/2_3_columns.png</thumbnail-path> | |
</layout-template> | |
<layout-template id="3-1-columns" name="3-1 Columns Layout"> | |
<template-path>/layouttpl/custom/3-1-columns-layouttpl/3_1_columns.tpl</template-path> | |
<wap-template-path>/layouttpl/custom/3-1-columns-layouttpl/3_1_columns.tpl</wap-template-path> | |
<thumbnail-path>/layouttpl/custom/3-1-columns-layouttpl/3_1_columns.png</thumbnail-path> | |
</layout-template> | |
<layout-template id="2-1-columns" name="2-1 Columns Layout"> | |
<template-path>/layouttpl/custom/2-1-columns-layouttpl/2_1_columns.tpl</template-path> | |
<wap-template-path>/layouttpl/custom/2-1-columns-layouttpl/2_1_columns.tpl</wap-template-path> | |
<thumbnail-path>/layouttpl/custom/2-1-columns-layouttpl/2_1_columns.png</thumbnail-path> | |
</layout-template> | |
</custom> | |
</layout-templates> | |
</theme> | |
</look-and-feel> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment