This is an automated email from the ASF dual-hosted git repository.

nmalin pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 553472c  Fixed: Replace hardcoded label 'Popular categories' 
(OFBIZ-12323)
553472c is described below

commit 553472c052dad93cb55c2e66cf7257b2ace511a3
Author: Nicolas Malin <nicolas.ma...@nereide.fr>
AuthorDate: Tue Sep 28 16:51:00 2021 +0200

    Fixed: Replace hardcoded label 'Popular categories' (OFBIZ-12323)
    
    Labellise the 'Popular categories' title by adding an EcommerceBestSelling 
label and replace traduction by 'Best Selling' to avoid confusion with catalog 
category type 'Most Popular (one)'.
    
    Thanks: Charles STELTZLEN
---
 ecommerce/config/EcommerceUiLabels.xml                 |  4 ++++
 ecommerce/template/catalog/ShowBestSellingCategory.ftl | 17 ++++++++++-------
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/ecommerce/config/EcommerceUiLabels.xml 
b/ecommerce/config/EcommerceUiLabels.xml
index ba0956f..22d423e 100644
--- a/ecommerce/config/EcommerceUiLabels.xml
+++ b/ecommerce/config/EcommerceUiLabels.xml
@@ -350,6 +350,10 @@
         <value xml:lang="zh">分配明细</value>
         <value xml:lang="zh-TW">分配細項</value>
     </property>
+    <property key="EcommerceBestSelling">
+        <value xml:lang="en">Best Selling</value>
+        <value xml:lang="fr">Meilleures ventes</value>
+    </property>
     <property key="EcommerceBeSureToIncludeYourOrderNb">
         <value xml:lang="da">Husk at inkludere din ordre</value>
         <value xml:lang="en">Be sure to include your order #</value>
diff --git a/ecommerce/template/catalog/ShowBestSellingCategory.ftl 
b/ecommerce/template/catalog/ShowBestSellingCategory.ftl
index b3473e2..4091e8d 100644
--- a/ecommerce/template/catalog/ShowBestSellingCategory.ftl
+++ b/ecommerce/template/catalog/ShowBestSellingCategory.ftl
@@ -19,7 +19,7 @@ under the License.
 <#if productCategoryList?has_content>
 <div class="card">
   <h4 class="card-header">
-    Popular Categories
+    ${uiLabelMap.EcommerceBestSelling}
   </h4>
   <div class="card-body">
         <div class="row">
@@ -34,14 +34,14 @@ under the License.
             <#assign cateCount = 0/>
             </#if>
             <#assign productCategoryId = productCategory.productCategoryId/>
-            <#assign categoryImageUrl = "/images/defaultImage.jpg"/>
+            <#assign categoryContentWrapper = 
Static["org.apache.ofbiz.product.category.CategoryContentWrapper"].makeCategoryContentWrapper(productCategory,
 request)!>
+            <#assign categoryName = 
categoryContentWrapper.get("CATEGORY_NAME", "html")!/>
+            <#assign categoryImageUrl = 
categoryContentWrapper.get("CATEGORY_IMAGE_URL", "url")!/>
             <#assign productCategoryMembers = delegator
                     .findByAnd("ProductCategoryAndMember", 
Static["org.apache.ofbiz.base.util.UtilMisc"]
                     .toMap("productCategoryId", productCategoryId),
                     
Static["org.apache.ofbiz.base.util.UtilMisc"].toList("-quantity"), false)/>
-            <#if productCategory.categoryImageUrl?has_content>
-              <#assign categoryImageUrl = productCategory.categoryImageUrl/>
-              <#elseif productCategoryMembers?has_content>
+            <#if !categoryImageUrl?string?has_content && 
productCategoryMembers?has_content>
                 <#assign productCategoryMember =
                         
Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(productCategoryMembers)/>
                 <#assign product = delegator.findOne("Product",
@@ -59,7 +59,7 @@ under the License.
                 <div class="card-body">
                   <h4 class="card-title">
                     <a style="font-size:12px" href="<@ofbizCatalogAltUrl 
productCategoryId=productCategoryId/>">
-                      ${productCategory.categoryName!productCategoryId}
+                      ${categoryName!productCategoryId}
                     </a>
                   </h4>
                   <p class="card-text">
@@ -79,11 +79,14 @@ under the License.
                             <#assign product = delegator.findOne("Product",
                                     
Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("productId",
                                     productCategoryMember.productId), false)>
+                            <#assign productName =
+                                    
Static["org.apache.ofbiz.product.product.ProductContentWrapper"]
+                                    .getProductContentAsText(product, 
"PRODUCT_NAME", locale, dispatcher, "html")! />
                               <li>
                                 <a class="linktext"
                                    href="<@ofbizCatalogAltUrl 
productCategoryId="PROMOTIONS"
                                 productId="${product.productId}"/>">
-                                ${product.productName!product.productId}
+                                ${productName!product.productId}
                                 </a>
                               </li>
                           </#if>

Reply via email to