svn commit: r1055774 [5/5] - in /ofbiz/trunk: applications/accounting/data/ applications/order/ applications/order/entitydef/ applications/order/script/org/ofbiz/order/olap/ applications/order/script/org/ofbiz/order/reports/ applications/order/serviced...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1055774 [5/5] - in /ofbiz/trunk: applications/accounting/data/ applications/order/ applications/order/entitydef/ applications/order/script/org/ofbiz/order/olap/ applications/order/script/org/ofbiz/order/reports/ applications/order/serviced...

hansbak-2
Modified: ofbiz/trunk/applications/order/widget/ordermgr/ReportForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/ReportForms.xml?rev=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/ReportForms.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/ReportForms.xml Thu Jan  6 07:37:45 2011
@@ -197,38 +197,16 @@ under the License.
     </form>
     
     <!--New From-->
-    <form name="SalesReport" type="single" target="SalesReport.pdf" title=""
+    <form name="SalesReport" type="single" target="checkReportBy" title=""
         header-row-style="header-row" default-table-style="basic-table">
-<!--        <field name="report">
-            <drop-down allow-empty="false">
-                <option key="BIC" description="BIC"/>
-                <option key="NBO" description="NBO"/>
-            </drop-down>
-        </field>-->
-<!--        <field name="productStoreId">
-            <drop-down allow-empty="false">
-                <option key="" description="- ${uiLabelMap.CommonSelectAny} -"/>
-                <entity-options entity-name="ProductStore" description="${storeName} [${productStoreId}]">
-                    <entity-order-by field-name="storeName"/>
-                </entity-options>
+        <field name="fromDate" title="${uiLabelMap.CommonFromDate}"><date-time type="date"/></field>
+        <field name="reportBy" title="Report By">
+            <drop-down>
+                <option key="day" description="Days"></option>
+                <option key="week" description="Weeks"></option>
+                <option key="month" description="Months"></option>
             </drop-down>
-        </field>-->
-<!--        <field name="orderTypeId">
-            <drop-down allow-empty="false">
-                <option key="SALES_ORDER" description="${uiLabelMap.OrderSalesOrder}"/>
-                <option key="PURCHASE_ORDER" description="${uiLabelMap.OrderPurchaseOrder}"/>
-            </drop-down>
-        </field>-->
-<!--        <field name="orderStatusId">
-            <drop-down allow-empty="false">
-                <option key="" description="- ${uiLabelMap.CommonSelectAny} -"/>
-                <entity-options entity-name="StatusItem" description="${description}" key-field-name="statusId">
-                    <entity-constraint name="statusTypeId" operator="equals" value="ORDER_STATUS"/>
-                </entity-options>
-            </drop-down>
-        </field>-->
-        <field name="fromDate" title="${uiLabelMap.OrderReportFromDate}"><date-time type="date"/></field>
-        <field name="thruDate" title="${uiLabelMap.OrderReportThruDate}"><date-time type="date"/></field>
+        </field>
         <field name="submitButton" title="${uiLabelMap.CommonRun}" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
 

Modified: ofbiz/trunk/applications/product/data/ProductTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductTypeData.xml?rev=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/data/ProductTypeData.xml (original)
+++ ofbiz/trunk/applications/product/data/ProductTypeData.xml Thu Jan  6 07:37:45 2011
@@ -175,6 +175,7 @@ under the License.
     <ProdCatalogCategoryType description="Purchase Allow (One)" prodCatalogCategoryTypeId="PCCT_PURCH_ALLW"/>
     <ProdCatalogCategoryType description="Admin Allow (One)" prodCatalogCategoryTypeId="PCCT_ADMIN_ALLW"/>
     <ProdCatalogCategoryType description="Ebay Root (One)" prodCatalogCategoryTypeId="PCCT_EBAY_ROOT"/>
+    <ProdCatalogCategoryType description="Best Selling (One)" prodCatalogCategoryTypeId="PCCT_BEST_SELL"/>
 
     <ProductAssocType description="Also Bought" hasTable="N" parentTypeId="" productAssocTypeId="ALSO_BOUGHT"/>
     <ProductAssocType description="Upgrade or Up-Sell" hasTable="N" parentTypeId="" productAssocTypeId="PRODUCT_UPGRADE"/>
@@ -209,6 +210,7 @@ under the License.
     <ProductCategoryType description="Tax" hasTable="N" parentTypeId="" productCategoryTypeId="TAX_CATEGORY"/>
     <ProductCategoryType description="Google Base" hasTable="N" parentTypeId="" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/>
     <ProductCategoryType description="Gift Cards" hasTable="N" parentTypeId="" productCategoryTypeId="GIFT_CARD_CATEGORY"/>
+    <ProductCategoryType description="Best Selling" hasTable="N" parentTypeId="" productCategoryTypeId="BEST_SELL_CATEGORY"/>
 
     <!-- product geo data -->
     <EnumerationType description="Product Geo Data" enumTypeId="PROD_GEO" hasTable="N" parentTypeId=""/>

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml?rev=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml Thu Jan  6 07:37:45 2011
@@ -869,4 +869,127 @@ under the License.
         <field-to-result field="products"/>
     </simple-method>
     
+    <!-- Load data of best selling category -->
+    <simple-method method-name="loadBestSellingCategory" short-description="Load data of best selling category by week.">
+        <now-date-to-env field="nowDate"/>
+        <set field="week" value="${groovy: import java.util.Calendar;
+            Calendar cal = Calendar.getInstance();
+            cal.setTime(nowDate);
+            return cal.get(Calendar.WEEK_OF_YEAR);}" type="Long"/>
+        <set field="year" value="${groovy: import java.util.Calendar;
+            Calendar cal = Calendar.getInstance();
+            cal.setTime(nowDate);
+            int aa = cal.get(Calendar.YEAR);
+            return aa;}" type="Long"/>
+        <if-compare field="week" operator="equals" value="1">
+            <set field="week" value="52"/>
+        <else>
+            <calculate field="week">
+                <calcop field="week" operator="subtract">
+                    <number value="1"/>
+                </calcop>
+            </calculate>
+        </else>
+        </if-compare>
+        
+        <entity-and entity-name="ProductStoreCatalog" list="productStoreCatalogs">
+            <field-map field-name="productStoreId" from-field="parameters.productStoreId"/>
+            <field-map field-name="thruDate" from-field="nullField"/>
+        </entity-and>
+        <if-not-empty field="productStoreCatalogs">
+            <first-from-list list="productStoreCatalogs" entry="productStoreCatalog"/>
+            <set field="callRemoveProductMap.prodCatalogId" from-field="productStoreCatalog.prodCatalogId"/>
+            <call-service service-name="RemoveProductFromBestSellCategory" in-map-name="callRemoveProductMap"/>
+            
+            <set field="callAddProductMap.productStoreId" from-field="parameters.productStoreId"/>
+            <set field="callAddProductMap.prodCatalogId" from-field="productStoreCatalog.prodCatalogId"/>
+            <set field="callAddProductMap.week" from-field="week" type="Long"/>
+            <set field="callAddProductMap.year" from-field="year" type="Long"/>
+            <call-service service-name="AddProductToBestSellCategory" in-map-name="callAddProductMap"/>
+        </if-not-empty>
+    </simple-method>
+    
+    <simple-method method-name="RemoveProductFromBestSellCategory" short-description="Remove products from best selling category.">
+        <entity-and entity-name="ProdCatalogCategory" list="prodCatalogCategorys">
+            <field-map field-name="prodCatalogId" from-field="parameters.prodCatalogId"/>
+            <field-map field-name="prodCatalogCategoryTypeId" value="PCCT_BEST_SELL"/>
+        </entity-and>
+        <iterate list="prodCatalogCategorys" entry="prodCatalogCategory">
+            <entity-and entity-name="ProductCategoryRollup" list="productCategoryRollups">
+                <field-map field-name="parentProductCategoryId" from-field="prodCatalogCategory.productCategoryId"/>
+            </entity-and>
+            <iterate list="productCategoryRollups" entry="productCategoryRollup">
+                <entity-and entity-name="ProductCategoryMember" list="productCategoryMembers">
+                    <field-map field-name="productCategoryId" from-field="productCategoryRollup.productCategoryId"/>
+                </entity-and>
+                <iterate list="productCategoryMembers" entry="productCategoryMember">
+                    <remove-value value-field="productCategoryMember"/>
+                </iterate>
+            </iterate>
+        </iterate>
+    </simple-method>
+    
+    <simple-method method-name="AddProductToBestSellCategory" short-description="Add products to best selling category.">
+        <entity-and entity-name="ProdCatalogCategory" list="prodCatalogCategorys">
+            <field-map field-name="prodCatalogId" from-field="parameters.prodCatalogId"/>
+            <field-map field-name="prodCatalogCategoryTypeId" value="PCCT_BEST_SELL"/>
+        </entity-and>
+        <first-from-list list="prodCatalogCategorys" entry="prodCatalogCategory"/>
+        <entity-and entity-name="ProductCategoryRollup" list="productCategoryRollupList">
+            <field-map field-name="parentProductCategoryId" from-field="prodCatalogCategory.productCategoryId"/>
+        </entity-and>
+        <iterate list="productCategoryRollupList" entry="productCategoryRollup">
+            <set-service-fields service-name="FindCategoryChild" map="parameters" to-map="CategoryChildMap"/>
+            <set field="CategoryChildMap.productCategoryId" from-field="productCategoryRollup.productCategoryId"/>
+            <set field="CategoryChildMap.primaryProductCategoryId" from-field="productCategoryRollup.productCategoryId"/>
+            <call-service service-name="FindCategoryChild" in-map-name="CategoryChildMap"/>
+        </iterate>
+    </simple-method>
+    
+    <simple-method method-name="FindCategoryChild" short-description="Find category child.">
+        <entity-and entity-name="ProductCategoryRollup" list="productCategoryRollupList">
+            <field-map field-name="parentProductCategoryId" from-field="parameters.productCategoryId"/>
+        </entity-and>
+        <if-empty field="productCategoryRollupList">
+            <set-service-fields service-name="FindBestSellingProduct" map="parameters" to-map="AddProductMap"/>
+            <set field="AddProductMap.productCategoryId" from-field="parameters.productCategoryId"/>
+            <call-service service-name="FindBestSellingProduct" in-map-name="AddProductMap">
+                <result-to-field result-name="productCategoryId"/>
+            </call-service>
+        <else>
+            <iterate list="productCategoryRollupList" entry="productCategoryRollup">
+                <set-service-fields service-name="FindCategoryChild" map="parameters" to-map="CategoryChildMap"/>
+                <set field="CategoryChildMap.productCategoryId" from-field="productCategoryRollup.productCategoryId"/>
+                <call-service service-name="FindCategoryChild" in-map-name="CategoryChildMap"/>
+            </iterate>
+        </else>
+        </if-empty>
+    </simple-method>
+    
+    <simple-method method-name="FindBestSellingProduct" short-description="Find best selling product.">
+        <now-timestamp field="nowTimestamp"/>
+        <entity-and entity-name="ProductCategoryMember" list="productCategoryMembers">
+            <field-map field-name="productCategoryId" from-field="parameters.productCategoryId"/>
+            <field-map field-name="thruDate" from-field="nullField"/>
+        </entity-and>
+        <iterate list="productCategoryMembers" entry="productCategoryMember">
+            <entity-condition entity-name="SalesOrderItemStarSchema" list="salesOrderItemStarSchemas" distinct="true">
+                <condition-list combine="and">
+                    <condition-expr field-name="productProductId" operator="equals" from-field="productCategoryMember.productId"/>
+                    <condition-expr field-name="productStoreId" operator="equals" from-field="parameters.productStoreId"/>
+                    <condition-expr field-name="orderDateWeekOfYear" operator="equals" from-field="parameters.week"/>
+                    <condition-expr field-name="orderDateYearName" operator="equals" from-field="parameters.year"/>
+                </condition-list>
+            </entity-condition>
+            <if-not-empty field="salesOrderItemStarSchemas">
+                <first-from-list list="salesOrderItemStarSchemas" entry="salesOrderItemStarSchema"/>
+                <make-value entity-name="ProductCategoryMember" value-field="newEntity"/>
+                <set field="newEntity.productCategoryId" from-field="parameters.primaryProductCategoryId"/>
+                <set field="newEntity.productId" from-field="salesOrderItemStarSchema.productProductId"/>
+                <set field="newEntity.fromDate" from-field="nowTimestamp"/>
+                <set field="newEntity.quantity" from-field="salesOrderItemStarSchema.quantity"/>
+                <create-value value-field="newEntity"/>
+            </if-not-empty>
+        </iterate>
+    </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/product/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services.xml?rev=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services.xml Thu Jan  6 07:37:45 2011
@@ -1493,5 +1493,48 @@ under the License.
         <attribute mode="IN" name="productId" optional="false" type="String"/>
     </service>
     
+    <!-- Best Selling Category Services -->
+    <service name="loadBestSellingCategory" engine="simple"
+        location="component://product/script/org/ofbiz/product/category/CategoryServices.xml" invoke="loadBestSellingCategory" auth="true">
+        <description>Load data of best selling category by week.</description>
+        <attribute name="productStoreId" mode="IN" type="String" optional="false"/>
+    </service>
+    
+    <service name="RemoveProductFromBestSellCategory" engine="simple"
+        location="component://product/script/org/ofbiz/product/category/CategoryServices.xml" invoke="RemoveProductFromBestSellCategory" auth="true">
+        <description>Remove products from best selling category.</description>
+        <attribute name="prodCatalogId" mode="IN" type="String" optional="false"/>
+    </service>
+    
+    <service name="AddProductToBestSellCategory" engine="simple"
+        location="component://product/script/org/ofbiz/product/category/CategoryServices.xml" invoke="AddProductToBestSellCategory" auth="true">
+        <description>Add products to best selling category.</description>
+        <attribute name="productStoreId" mode="IN" type="String" optional="false"/>
+        <attribute name="prodCatalogId" mode="IN" type="String" optional="false"/>
+        <attribute name="week" mode="IN" type="Long" optional="false"/>
+        <attribute name="year" mode="IN" type="Long" optional="false"/>
+    </service>
+    
+    <service name="FindCategoryChild" engine="simple"
+        location="component://product/script/org/ofbiz/product/category/CategoryServices.xml" invoke="FindCategoryChild" auth="true">
+        <description>Find category child.</description>
+        <attribute name="productStoreId" mode="IN" type="String" optional="false"/>
+        <attribute name="productCategoryId" mode="IN" type="String" optional="false"/>
+        <attribute name="primaryProductCategoryId" mode="IN" type="String" optional="false"/>
+        <attribute name="week" mode="IN" type="Long" optional="false"/>
+        <attribute name="year" mode="IN" type="Long" optional="false"/>
+        <attribute name="checkCategoryChild" mode="IN" type="List" optional="true"/>
+    </service>
+    
+    <service name="FindBestSellingProduct" engine="simple"
+        location="component://product/script/org/ofbiz/product/category/CategoryServices.xml" invoke="FindBestSellingProduct" auth="true">
+        <description>Find best selling product.</description>
+        <attribute name="productStoreId" mode="IN" type="String" optional="false"/>
+        <attribute name="productCategoryId" mode="IN" type="String" optional="false"/>
+        <attribute name="primaryProductCategoryId" mode="IN" type="String" optional="false"/>
+        <attribute name="week" mode="IN" type="Long" optional="false"/>
+        <attribute name="year" mode="IN" type="Long" optional="false"/>
+        <attribute name="productCategoryId" mode="OUT" type="String" optional="true"/>
+    </service>
     
 </services>

Modified: ofbiz/trunk/framework/birt/src/org/ofbiz/birt/BirtWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/birt/src/org/ofbiz/birt/BirtWorker.java?rev=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/framework/birt/src/org/ofbiz/birt/BirtWorker.java (original)
+++ ofbiz/trunk/framework/birt/src/org/ofbiz/birt/BirtWorker.java Thu Jan  6 07:37:45 2011
@@ -185,7 +185,7 @@ public class BirtWorker {
             security = (Security) request.getAttribute("security");
         }
         if (UtilValidate.isNotEmpty(security)) {
-            engine.getConfig().getAppContext().put("security", dispatcher);
+            engine.getConfig().getAppContext().put("security", security);
         }
     }
 }

Added: ofbiz/trunk/specialpurpose/ecommerce/data/DemoPopularCategoriesData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/data/DemoPopularCategoriesData.xml?rev=1055774&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/data/DemoPopularCategoriesData.xml (added)
+++ ofbiz/trunk/specialpurpose/ecommerce/data/DemoPopularCategoriesData.xml Thu Jan  6 07:37:45 2011
@@ -0,0 +1,43 @@
+<?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>
+
+    <!-- Popular Category -->
+    <ProductCategory productCategoryId="CATALOG1_BEST_SELL" productCategoryTypeId="BEST_SELL_CATEGORY" categoryName="Demo Best Selling"/>
+    <ProductCategory productCategoryId="BEST-SELL-1" productCategoryTypeId="BEST_SELL_CATEGORY" categoryName="Gizmos"/>
+    <ProductCategory productCategoryId="BEST-SELL-2" productCategoryTypeId="BEST_SELL_CATEGORY" categoryName="Widgets"/>
+    <ProdCatalogCategory prodCatalogId="DemoCatalog" productCategoryId="CATALOG1_BEST_SELL" fromDate="2010-01-01 12:00:00.0" sequenceNum="1" prodCatalogCategoryTypeId="PCCT_BEST_SELL"/>
+    <ProductCategoryRollup productCategoryId="BEST-SELL-1" parentProductCategoryId="CATALOG1_BEST_SELL" sequenceNum="01" fromDate="2010-01-01 12:00:00.0"/>
+    <ProductCategoryRollup productCategoryId="BEST-SELL-2" parentProductCategoryId="CATALOG1_BEST_SELL" sequenceNum="02" fromDate="2010-01-01 12:00:00.0"/>
+    <ProductCategoryRollup productCategoryId="101" parentProductCategoryId="BEST-SELL-1" fromDate="2010-01-01 12:00:00.0"/>
+    <ProductCategoryRollup productCategoryId="102" parentProductCategoryId="BEST-SELL-1" fromDate="2010-01-01 12:00:00.0"/>
+    <ProductCategoryRollup productCategoryId="202" parentProductCategoryId="BEST-SELL-2" fromDate="2010-01-01 12:00:00.0"/>
+    <ProductCategoryMember productCategoryId="BEST-SELL-1" productId="GZ-1000" quantity="10" fromDate="2010-01-01 12:00:00.0"/>
+    <ProductCategoryMember productCategoryId="BEST-SELL-1" productId="GZ-1001" quantity="8" fromDate="2010-01-01 12:00:00.0"/>
+    <ProductCategoryMember productCategoryId="BEST-SELL-1" productId="GZ-1004" quantity="6" fromDate="2010-01-01 12:00:00.0"/>
+    <ProductCategoryMember productCategoryId="BEST-SELL-1" productId="GZ-1005" quantity="4" fromDate="2010-01-01 12:00:00.0"/>
+    <ProductCategoryMember productCategoryId="BEST-SELL-1" productId="GZ-1006" quantity="2" fromDate="2010-01-01 12:00:00.0"/>
+    <ProductCategoryMember productCategoryId="BEST-SELL-2" productId="WG-9943" quantity="3" fromDate="2010-01-01 12:00:00.0"/>
+    <ProductCategoryMember productCategoryId="BEST-SELL-2" productId="WG-9944" quantity="5" fromDate="2010-01-01 12:00:00.0"/>
+    <ProductCategoryMember productCategoryId="BEST-SELL-2" productId="WG-1111" quantity="7" fromDate="2010-01-01 12:00:00.0"/>
+    <ProductCategoryMember productCategoryId="BEST-SELL-2" productId="WG-5569" quantity="1" fromDate="2010-01-01 12:00:00.0"/>
+
+</entity-engine-xml>

Modified: ofbiz/trunk/specialpurpose/ecommerce/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/ofbiz-component.xml?rev=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/ofbiz-component.xml (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/ofbiz-component.xml Thu Jan  6 07:37:45 2011
@@ -52,6 +52,7 @@ under the License.
     <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"/>
+    <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoPopularCategoriesData.xml"/>
     
     <webapp name="ecommerce"
         title="eCommerce"

Added: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/BestSellingCategory.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/BestSellingCategory.groovy?rev=1055774&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/BestSellingCategory.groovy (added)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/BestSellingCategory.groovy Thu Jan  6 07:37:45 2011
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.product.catalog.*;
+import org.ofbiz.product.category.*;
+import javolution.util.FastList;
+
+catalogId = CatalogWorker.getCurrentCatalogId(request);
+bestSellerCates = FastList.newInstance();
+
+if (UtilValidate.isNotEmpty(catalogId)) {
+    prodCatalogCategoryList = CatalogWorker.getProdCatalogCategories(request, catalogId, "PCCT_BEST_SELL");
+    if (prodCatalogCategoryList.size() > 0) {
+        for (int i = 0; i < prodCatalogCategoryList.size(); i++) {
+            prodCatalogCategory = prodCatalogCategoryList[i];
+            productCategoryId = prodCatalogCategory.getString("productCategoryId");
+            childCategoryList = CategoryWorker.getRelatedCategoriesRet(request, "childCategoryList", productCategoryId, true);
+            if (childCategoryList.size() > 0) {
+                bestSellerCates.add(childCategoryList);
+            }
+        }
+    }
+}
+
+context.productCategoryList = bestSellerCates;

Added: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ShowBestSellingCategory.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ShowBestSellingCategory.ftl?rev=1055774&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ShowBestSellingCategory.ftl (added)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/ShowBestSellingCategory.ftl Thu Jan  6 07:37:45 2011
@@ -0,0 +1,91 @@
+<#--
+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.
+-->
+
+<#if productCategoryList?has_content>
+    <h1>Popular Categories</h1>
+    <div class="productsummary-container matrix">
+       <table>
+           <tbody>
+
+            <#list productCategoryList as childCategoryList>
+                   <tr>
+                   <#assign cateCount = 0/>
+                   <#list childCategoryList as productCategory>
+                       <#if (cateCount > 2)>
+                            <tr>
+                            <#assign cateCount = 0/>
+                       </#if>
+                       <#assign productCategoryId = productCategory.productCategoryId/>
+                       <#assign categoryImageUrl = "/images/defaultImage.jpg">
+                       <#assign productCategoryMembers = delegator.findByAnd("ProductCategoryAndMember", Static["org.ofbiz.base.util.UtilMisc"].toMap("productCategoryId", productCategoryId), Static["org.ofbiz.base.util.UtilMisc"].toList("-quantity"))>
+                       <#if productCategory.categoryImageUrl?has_content>
+                            <#assign categoryImageUrl = productCategory.categoryImageUrl/>
+                       <#elseif productCategoryMembers?has_content>
+                            <#assign productCategoryMember = Static["org.ofbiz.entity.util.EntityUtil"].getFirst(productCategoryMembers)/>
+                            <#assign product = delegator.findByPrimaryKey("Product", Static["org.ofbiz.base.util.UtilMisc"].toMap("productId", productCategoryMember.productId))/>
+                            <#if product.smallImageUrl?has_content>
+                                <#assign categoryImageUrl = product.smallImageUrl/>
+                            </#if>
+                       </#if>
+                        <td>
+                            <div class="productsummary">
+                                <div class="smallimage">
+                                    <a href="/ecommerce/products/${productCategoryId}">
+                                        <span class="popup_link"><img alt="Small Image" src="${categoryImageUrl}"></span>
+                                    </a>
+                                </div>
+                                <div class="productbuy">
+                                    <a class="linktext"  style="font-size:12px" href="/ecommerce/products/${productCategoryId}">${productCategory.categoryName!productCategoryId}</a>
+                                </div>
+                                <div class="productinfo">
+                                    <ul>
+                                    <#if productCategoryMembers?exists>
+                                        <#assign i = 0/>
+                                        <#list productCategoryMembers as productCategoryMember>
+                                            <#if (i > 2)>
+                                                <#if productCategoryMembers[i]?has_content>
+                                                    <a class="linktext" href="/ecommerce/products/${productCategoryId}">
+                                                        <span>More...</span>
+                                                    </a>
+                                                </#if>
+                                                <#break>
+                                            </#if>
+                                            <#if productCategoryMember?has_content>
+                                                <#assign product = delegator.findByPrimaryKey("Product", Static["org.ofbiz.base.util.UtilMisc"].toMap("productId", productCategoryMember.productId))>
+                                                <li class="browsecategorytext">
+                                                    <a class="linktext" href="/ecommerce/products/PROMOTIONS/${product.productId}">
+                                                        ${product.productName!product.productId}
+                                                    </a>
+                                                </li>
+                                            </#if>
+                                            <#assign i = i+1/>
+                                        </#list>
+                                    </#if>
+                                    </ul>
+                                </div>
+                            </div>
+                        </td>
+                        <#assign cateCount = cateCount + 1/>
+                 </#list>
+               <tr/>
+            </#list>
+        </tbody>
+      </table>
+    </div>
+</#if>

Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/main.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/main.ftl?rev=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/main.ftl (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/main.ftl Thu Jan  6 07:37:45 2011
@@ -19,6 +19,7 @@ under the License.
 
 <#-- Render the category page -->
 <#if requestAttributes.productCategoryId?has_content>
+  ${screens.render("component://ecommerce/widget/CatalogScreens.xml#bestSellingCategory")}
   ${screens.render("component://ecommerce/widget/CatalogScreens.xml#category-include")}
 <#else>
   <center><h2>${uiLabelMap.EcommerceNoPROMOTIONCategory}</h2></center>

Modified: ofbiz/trunk/specialpurpose/ecommerce/widget/CatalogScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CatalogScreens.xml?rev=1055774&r1=1055773&r2=1055774&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/widget/CatalogScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/widget/CatalogScreens.xml Thu Jan  6 07:37:45 2011
@@ -465,4 +465,27 @@ under the License.
             </widgets>
         </section>
     </screen>
+    
+    <screen name="bestSellingCategory">
+        <section>
+            <widgets>
+                <section>
+                    <widgets>
+                        <!--<label style="h1" text="Popular Categories"/>-->
+                        <include-screen name="showBestSellingCategory"/>
+                    </widgets>
+                </section>
+            </widgets>
+        </section>
+    </screen>
+    <screen name="showBestSellingCategory">
+        <section>
+            <actions>
+                <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/BestSellingCategory.groovy"/>
+            </actions>
+            <widgets>
+                <platform-specific><html><html-template location="component://ecommerce/webapp/ecommerce/catalog/ShowBestSellingCategory.ftl"/></html></platform-specific>
+            </widgets>
+        </section>
+    </screen>
 </screens>