Author: ashish
Date: Mon Jun 8 05:58:52 2009 New Revision: 782536 URL: http://svn.apache.org/viewvc?rev=782536&view=rev Log: Applied patch from jira issue OFBIZ-2573 (On the Product Detail Page Images with alternate views.) I have done following changes in this patch. -- Changed the ID field as it was using 10000 or 20000. It can create issue while creating new record in those entities. So we should either create Alpha-numeric value or value less then 10000 for primary keys. -- I have changed the location of images in data file and kept it into /images/products/additional/web_browser2.png folder. That place looks more appropriate place for such images. Thanks Arpit Singh Pandya for your patch. Special thanks to Arun Patidar for discussing things with Arpit. Added: ofbiz/trunk/specialpurpose/ecommerce/data/DemoProductAdditionalViewData.xml (with props) ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/productAddtionalView.js (with props) Modified: ofbiz/trunk/specialpurpose/ecommerce/ofbiz-component.xml ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl ofbiz/trunk/specialpurpose/ecommerce/widget/CatalogScreens.xml Added: ofbiz/trunk/specialpurpose/ecommerce/data/DemoProductAdditionalViewData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/data/DemoProductAdditionalViewData.xml?rev=782536&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/data/DemoProductAdditionalViewData.xml (added) +++ ofbiz/trunk/specialpurpose/ecommerce/data/DemoProductAdditionalViewData.xml Mon Jun 8 05:58:52 2009 @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<entity-engine-xml> + <DataResource dataResourceId="GZ-2644-Add1" dataResourceTypeId="SHORT_TEXT" dataTemplateTypeId="NONE" objectInfo="/images/products/additional/web_browser2.png" /> + <Content contentId="GZ-2644-Add1-CTNT" contentTypeId="DOCUMENT" dataResourceId="GZ-2644-Add1" statusId="CTNT_IN_PROGRESS"/> + <ProductContent productId="GZ-2644" contentId="GZ-2644-Add1-CTNT" productContentTypeId="ADDITIONAL_IMAGE_1" fromDate="2001-05-13 12:00:00.0"/> + + <DataResource dataResourceId="GZ-2644-Add2" dataResourceTypeId="SHORT_TEXT" dataTemplateTypeId="NONE" objectInfo="/images/products/additional/web_browser3.png" /> + <Content contentId="GZ-2644-Add2-CTNT" contentTypeId="DOCUMENT" dataResourceId="GZ-2644-Add2" statusId="CTNT_IN_PROGRESS"/> + <ProductContent productId="GZ-2644" contentId="GZ-2644-Add2-CTNT" productContentTypeId="ADDITIONAL_IMAGE_2" fromDate="2001-05-13 12:00:00.0"/> + + <DataResource dataResourceId="GZ-2644-Add3" dataResourceTypeId="SHORT_TEXT" dataTemplateTypeId="NONE" objectInfo="/images/products/additional/web_browser4.png" /> + <Content contentId="GZ-2644-Add3-CTNT" contentTypeId="DOCUMENT" dataResourceId="GZ-2644-Add3" statusId="CTNT_IN_PROGRESS"/> + <ProductContent productId="GZ-2644" contentId="GZ-2644-Add3-CTNT" productContentTypeId="ADDITIONAL_IMAGE_3" fromDate="2001-05-13 12:00:00.0"/> + + <DataResource dataResourceId="GZ-2644-Add4" dataResourceTypeId="SHORT_TEXT" dataTemplateTypeId="NONE" objectInfo="/images/products/additional/web_browser5.png" /> + <Content contentId="GZ-2644-Add4-CTNT" contentTypeId="DOCUMENT" dataResourceId="GZ-2644-Add4" statusId="CTNT_IN_PROGRESS"/> + <ProductContent productId="GZ-2644" contentId="GZ-2644-Add4-CTNT" productContentTypeId="ADDITIONAL_IMAGE_4" fromDate="2001-05-13 12:00:00.0"/> + + <DataResource dataResourceId="WG-5569-Add1" dataResourceTypeId="SHORT_TEXT" dataTemplateTypeId="NONE" objectInfo="/images/products/additional/cellphone_shandy2.png" /> + <Content contentId="WG-5569-Add1-CTNT" contentTypeId="DOCUMENT" dataResourceId="WG-5569-Add1" statusId="CTNT_IN_PROGRESS"/> + <ProductContent productId="WG-5569" contentId="WG-5569-Add1-CTNT" productContentTypeId="ADDITIONAL_IMAGE_1" fromDate="2001-05-13 12:00:00.0"/> + + <DataResource dataResourceId="WG-5569-Add2" dataResourceTypeId="SHORT_TEXT" dataTemplateTypeId="NONE" objectInfo="/images/products/additional/cellphone_shandy3.png" /> + <Content contentId="WG-5569-Add2-CTNT" contentTypeId="DOCUMENT" dataResourceId="WG-5569-Add2" statusId="CTNT_IN_PROGRESS"/> + <ProductContent productId="WG-5569" contentId="WG-5569-Add2-CTNT" productContentTypeId="ADDITIONAL_IMAGE_2" fromDate="2001-05-13 12:00:00.0"/> + + <DataResource dataResourceId="WG-5569-Add3" dataResourceTypeId="SHORT_TEXT" dataTemplateTypeId="NONE" objectInfo="/images/products/additional/cellphone_shandy4.png" /> + <Content contentId="WG-5569-Add3-CTNT" contentTypeId="DOCUMENT" dataResourceId="WG-5569-Add3" statusId="CTNT_IN_PROGRESS"/> + <ProductContent productId="WG-5569" contentId="WG-5569-Add3-CTNT" productContentTypeId="ADDITIONAL_IMAGE_3" fromDate="2001-05-13 12:00:00.0"/> + + <DataResource dataResourceId="WG-5569-Add4" dataResourceTypeId="SHORT_TEXT" dataTemplateTypeId="NONE" objectInfo="/images/products/additional/cellphone_shandy5.png" /> + <Content contentId="WG-5569-Add4-CTNT" contentTypeId="DOCUMENT" dataResourceId="WG-5569-Add4" statusId="CTNT_IN_PROGRESS"/> + <ProductContent productId="WG-5569" contentId="WG-5569-Add4-CTNT" productContentTypeId="ADDITIONAL_IMAGE_4" fromDate="2001-05-13 12:00:00.0"/> +</entity-engine-xml> Propchange: ofbiz/trunk/specialpurpose/ecommerce/data/DemoProductAdditionalViewData.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/ecommerce/data/DemoProductAdditionalViewData.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/specialpurpose/ecommerce/data/DemoProductAdditionalViewData.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: ofbiz/trunk/specialpurpose/ecommerce/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/ofbiz-component.xml?rev=782536&r1=782535&r2=782536&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/ofbiz-component.xml (original) +++ ofbiz/trunk/specialpurpose/ecommerce/ofbiz-component.xml Mon Jun 8 05:58:52 2009 @@ -51,6 +51,7 @@ <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoProductCategoriesI18nData.xml"/> <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoTreeContent.xml"/> <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoTestSurveyData.xml"/> + <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoProductAdditionalViewData.xml"/> <webapp name="ecommerce" title="eCommerce" Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl?rev=782536&r1=782535&r2=782536&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl Mon Jun 8 05:58:52 2009 @@ -260,6 +260,10 @@ </script> <div id="productdetail"> +<#assign productAdditionalImage1 = productContentWrapper.get("ADDITIONAL_IMAGE_1")?if_exists> +<#assign productAdditionalImage2 = productContentWrapper.get("ADDITIONAL_IMAGE_2")?if_exists> +<#assign productAdditionalImage3 = productContentWrapper.get("ADDITIONAL_IMAGE_3")?if_exists> +<#assign productAdditionalImage4 = productContentWrapper.get("ADDITIONAL_IMAGE_4")?if_exists> <table border="0" cellpadding="2" cellspacing="0" width="100%"> <#-- Category next/previous --> @@ -288,7 +292,33 @@ <#assign productLargeImageUrl = firstLargeImage> </#if> <#if productLargeImageUrl?string?has_content> - <a href="javascript:popupDetail();"><img src="<@ofbizContentUrl>${contentPathPrefix?if_exists}${productLargeImageUrl?if_exists}</@ofbizContentUrl>" name="mainImage" vspace="5" hspace="5" border="0" width="200"></a> + <a href="javascript:popupDetail();"><img id="detailImage" src="<@ofbizContentUrl>${contentPathPrefix?if_exists}${productLargeImageUrl?if_exists}</@ofbizContentUrl>" name="mainImage" vspace="5" hspace="5" border="0" width="200"/></a> + <input type="hidden" id="originalImage" name="originalImage" value="<@ofbizContentUrl>${contentPathPrefix?if_exists}${productLargeImageUrl?if_exists}</@ofbizContentUrl>"/> + </#if> + <#if !productLargeImageUrl?string?has_content> + <img id="detailImage" src="/images/defaultImage.jpg" name="mainImage"/> + </#if> + </td> + <td> + <#if productAdditionalImage1?string?has_content> + <div class="additionalImage"> + <a href="javascript:void(0);" swapDetail="<@ofbizContentUrl>${productAdditionalImage1}</@ofbizContentUrl>"><img src="<@ofbizContentUrl>${productAdditionalImage1}</@ofbizContentUrl>" vspace="5" hspace="5" border="0" width="200"/></a> + </div></br> + </#if> + <#if productAdditionalImage2?string?has_content> + <div class="additionalImage"> + <a href="javascript:void(0);" swapDetail="<@ofbizContentUrl>${productAdditionalImage2}</@ofbizContentUrl>"><img src="<@ofbizContentUrl>${productAdditionalImage2}</@ofbizContentUrl>" vspace="5" hspace="5" border="0" width="200"/></a> + </div></br> + </#if> + <#if productAdditionalImage3?string?has_content> + <div class="additionalImage"> + <a href="javascript:void(0);" swapDetail="<@ofbizContentUrl>${productAdditionalImage3}</@ofbizContentUrl>"><img src="<@ofbizContentUrl>${productAdditionalImage3}</@ofbizContentUrl>" vspace="5" hspace="5" border="0" width="200"/></a> + </div> + </#if> + <#if productAdditionalImage4?string?has_content> + <div class="additionalImage"> + <a href="javascript:void(0);" swapDetail="<@ofbizContentUrl>${productAdditionalImage4}</@ofbizContentUrl>"><img src="<@ofbizContentUrl>${productAdditionalImage4}</@ofbizContentUrl>" vspace="5" hspace="5" border="0" width="200"/></a> + </div> </#if> </td> <td align="right" valign="top"> Added: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/productAddtionalView.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/productAddtionalView.js?rev=782536&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/productAddtionalView.js (added) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/productAddtionalView.js Mon Jun 8 05:58:52 2009 @@ -0,0 +1,37 @@ +imgView = { + init: function() { + if (document.getElementById) { + allAnchors = document.getElementsByTagName('a'); + if (allAnchors.length) { + for (var i = 0; i < allAnchors.length; i++) { + if (allAnchors[i].getAttributeNode('swapDetail') && allAnchors[i].getAttributeNode('swapDetail').value != '') { + allAnchors[i].onmouseover = imgView.showImage; + allAnchors[i].onmouseout = imgView.showDetailImage; + } + } + } + } + }, + showDetailImage: function() { + var mainImage = $('detailImage'); + mainImage.src = $F('originalImage'); + return false; + }, + showImage: function() { + var mainImage = $('detailImage'); + mainImage.src = this.getAttributeNode('swapDetail').value; + return false; + }, + addEvent: function(element, eventType, doFunction, useCapture) { + if (element.addEventListener) { + element.addEventListener(eventType, doFunction, useCapture); + return true; + }else if (element.attachEvent) { + var r = element.attachEvent('on' + eventType, doFunction); + return r; + }else { + element['on' + eventType] = doFunction; + } + } +} +Event.observe(window, 'load', imgView.init, false); Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/productAddtionalView.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/productAddtionalView.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/productAddtionalView.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/specialpurpose/ecommerce/widget/CatalogScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CatalogScreens.xml?rev=782536&r1=782535&r2=782536&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/widget/CatalogScreens.xml (original) +++ ofbiz/trunk/specialpurpose/ecommerce/widget/CatalogScreens.xml Mon Jun 8 05:58:52 2009 @@ -245,6 +245,7 @@ <set field="MainColumnStyle" value="center"/> <set field="titleProperty" value="PageTitleProductPage"/> <set field="layoutSettings.javaScripts[]" value="/images/prototypejs/prototype.js" global="true"/> + <set field="layoutSettings.javaScripts[]" value="/ecommerce/images/productAddtionalView.js" global="true"/> <set field="configproductdetailScreen" value="component://ecommerce/widget/CatalogScreens.xml#configproductdetail"/> <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy"/> </actions> |
Free forum by Nabble | Edit this page |