[pal-cvs 2853] [598] updated cart page.

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 9月 30日 (日) 22:20:44 JST


Revision: 598
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=598
Author:   shinsuke
Date:     2007-09-30 22:20:43 +0900 (Sun, 30 Sep 2007)

Log Message:
-----------
updated cart page.

Modified Paths:
--------------
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/UrlBuilderUtil.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/cart/ProductListAction.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/cart/ProductListPage.java
    pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/cart/productList.html


-------------- next part --------------
Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java	2007-09-29 21:57:07 UTC (rev 597)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java	2007-09-30 13:20:43 UTC (rev 598)
@@ -19,12 +19,16 @@
 
     public static final String ORDER_URL = "orderUrl";
 
+    public static final String REGISTER_URL = "registerUrl";
+
     public static final String DEFAULT_PRODUCT_LIST_URL = "/pompei/portal/products.psml";
 
     public static final String DEFAULT_CART_URL = "/pompei/portal/cart.psml";
 
     public static final String DEFAULT_ORDER_URL = "/pompei/portal/order.psml";
 
+    public static final String DEFAULT_REGISTER_URL = "/pompei/portal/register.psml";
+
     public static final String INSERT_MODE = "insert";
 
     public static final String UPDATE_MODE = "update";

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/UrlBuilderUtil.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/UrlBuilderUtil.java	2007-09-29 21:57:07 UTC (rev 597)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/util/UrlBuilderUtil.java	2007-09-30 13:20:43 UTC (rev 598)
@@ -44,4 +44,13 @@
         return url;
     }
 
+    public static String createRegisterUrl() {
+        String url = getPortletConfig().getInitParameter(
+                PompeiConstants.REGISTER_URL);
+        if (url == null) {
+            return PompeiConstants.DEFAULT_REGISTER_URL;
+        }
+        return url;
+    }
+
 }

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/cart/ProductListAction.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/cart/ProductListAction.java	2007-09-29 21:57:07 UTC (rev 597)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/cart/ProductListAction.java	2007-09-30 13:20:43 UTC (rev 598)
@@ -12,9 +12,8 @@
 import jp.sf.pal.common.util.FacesMessageUtil;
 import jp.sf.pal.pompei.PompeiConstants;
 import jp.sf.pal.pompei.dxo.ProductDxo;
+import jp.sf.pal.pompei.exentity.Customer;
 import jp.sf.pal.pompei.exentity.CustomerBasket;
-import jp.sf.pal.pompei.exentity.Customer;
-import jp.sf.pal.pompei.exentity.ManufacturerDescription;
 import jp.sf.pal.pompei.exentity.ProductDescription;
 import jp.sf.pal.pompei.service.CartService;
 import jp.sf.pal.pompei.service.CustomerService;
@@ -45,76 +44,6 @@
 
     private ProductDxo productDxo;
 
-    /**
-     * @return manufacturerService
-     */
-    public ManufacturerService getManufacturerService() {
-        return manufacturerService;
-    }
-
-    /**
-     * @param manufacturerService 設定する manufacturerService
-     */
-    public void setManufacturerService(ManufacturerService manufacturerService) {
-        this.manufacturerService = manufacturerService;
-    }
-
-    /**
-     * @return productService
-     */
-    public ProductService getProductService() {
-        return productService;
-    }
-
-    /**
-     * @param productService 設定する productService
-     */
-    public void setProductService(ProductService productService) {
-        this.productService = productService;
-    }
-
-    /**
-     * @return customerService
-     */
-    public CustomerService getCustomerService() {
-        return customerService;
-    }
-
-    /**
-     * @param customerService 設定する customerService
-     */
-    public void setCustomerService(CustomerService customerService) {
-        this.customerService = customerService;
-    }
-
-    /**
-     * @return cartService
-     */
-    public CartService getCartService() {
-        return cartService;
-    }
-
-    /**
-     * @param cartService 設定する cartService
-     */
-    public void setCartService(CartService cartService) {
-        this.cartService = cartService;
-    }
-
-    /**
-    * @return productDxo
-    */
-    public ProductDxo getProductDxo() {
-        return productDxo;
-    }
-
-    /**
-     * @param productDxo 設定する productDxo
-     */
-    public void setProductDxo(ProductDxo productDxo) {
-        this.productDxo = productDxo;
-    }
-
     public Class<?> doDelete() {
         getCartService().deleteCustomerBasket(
                 getProductListPage().getCustomerBasketId());
@@ -130,27 +59,32 @@
         // check login
         String remoteUser = FacesContext.getCurrentInstance()
                 .getExternalContext().getRemoteUser();
+        Customer customer = null;
         if (remoteUser == null) {
-            // TODO put message
+            getProductListPage().setLogin(false);
+            getProductListPage().setUser(false);
             return null;
+        } else {
+            getProductListPage().setLogin(true);
+            // check user
+            customer = getCustomerService().getCustomerByPortalId(remoteUser);
+            if (customer == null) {
+                getProductListPage().setUser(false);
+                return null;
+            } else {
+                getProductListPage().setUser(true);
+            }
         }
 
-        Customer customers = getCustomerService().getCustomerByPortalId(
-                remoteUser);
-        if (customers == null) {
-            // TODO put message
-            return null;
-        }
-
         // delete
         if (isDelete()) {
             doDelete();
         }
 
-        getCartService().cleanupCustomerBasket(customers.getCustomerId());
+        getCartService().cleanupCustomerBasket(customer.getCustomerId());
 
         List<CustomerBasket> baskets = getCartService().getCustomerBasketList(
-                customers.getCustomerId());
+                customer.getCustomerId());
 
         BigDecimal totalPrice = new BigDecimal(0);
         List<Map<String, Object>> products = new ArrayList<Map<String, Object>>();
@@ -159,17 +93,18 @@
             totalPrice = totalPrice.add(basket.getFinalPrice());
             ProductDescription pd = getProductService().getProdcutsDescription(
                     basket.getProductId());
-            ManufacturerDescription mi = getManufacturerService()
-                    .getManufactureDescription(
-                            basket.getProduct().getManufacturerId());
+            //            ManufacturerDescription mi = getManufacturerService()
+            //                    .getManufactureDescription(
+            //                            basket.getProduct().getManufacturerId());
             Map<String, Object> map = new HashMap<String, Object>();
             map.put("customerBasketId", basket.getCustomerBasketId());
             map.put("productName", pd.getName());
             map.put("productUrl", pd.getUrl());
             map.put("productModel", basket.getProduct().getModel());
-            map.put("manufacturerName", mi.getManufacturer().getName());
+            map.put("productCode", basket.getProduct().getCode());
+            map.put("productPrice", basket.getProduct().getPrice());
+            //            map.put("manufacturerName", mi.getManufacturer().getName());
             map.put("quantity", basket.getQuantity());
-            map.put("productsPrice", basket.getProduct().getPrice());
             map.put("finalPrice", basket.getFinalPrice());
             products.add(map);
         }
@@ -210,6 +145,76 @@
         this.productListPage = productListPage;
     }
 
+    /**
+     * @return manufacturerService
+     */
+    public ManufacturerService getManufacturerService() {
+        return manufacturerService;
+    }
+
+    /**
+     * @param manufacturerService 設定する manufacturerService
+     */
+    public void setManufacturerService(ManufacturerService manufacturerService) {
+        this.manufacturerService = manufacturerService;
+    }
+
+    /**
+     * @return productService
+     */
+    public ProductService getProductService() {
+        return productService;
+    }
+
+    /**
+     * @param productService 設定する productService
+     */
+    public void setProductService(ProductService productService) {
+        this.productService = productService;
+    }
+
+    /**
+     * @return customerService
+     */
+    public CustomerService getCustomerService() {
+        return customerService;
+    }
+
+    /**
+     * @param customerService 設定する customerService
+     */
+    public void setCustomerService(CustomerService customerService) {
+        this.customerService = customerService;
+    }
+
+    /**
+     * @return cartService
+     */
+    public CartService getCartService() {
+        return cartService;
+    }
+
+    /**
+     * @param cartService 設定する cartService
+     */
+    public void setCartService(CartService cartService) {
+        this.cartService = cartService;
+    }
+
+    /**
+    * @return productDxo
+    */
+    public ProductDxo getProductDxo() {
+        return productDxo;
+    }
+
+    /**
+     * @param productDxo 設定する productDxo
+     */
+    public void setProductDxo(ProductDxo productDxo) {
+        this.productDxo = productDxo;
+    }
+
     public String doJumpProductList() {
         return "../product/productList";
     }

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/cart/ProductListPage.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/cart/ProductListPage.java	2007-09-29 21:57:07 UTC (rev 597)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/cart/ProductListPage.java	2007-09-30 13:20:43 UTC (rev 598)
@@ -5,6 +5,8 @@
 import java.util.List;
 import java.util.Map;
 
+import org.seasar.teeda.extension.annotation.convert.BigDecimalConverter;
+
 import jp.sf.pal.pompei.util.UrlBuilderUtil;
 
 public class ProductListPage implements Serializable {
@@ -28,14 +30,24 @@
 
     private String productName;
 
+    //TODO i18n
+    @BigDecimalConverter(pattern = "###,###")
     private BigDecimal productPrice;
 
+    //TODO i18n
+    @BigDecimalConverter(pattern = "###,###")
     private BigDecimal finalPrice;
 
+    //TODO i18n
+    @BigDecimalConverter(pattern = "###,###")
     private BigDecimal totalPrice;
 
     private String mode;
 
+    private boolean user;
+
+    private boolean login;
+
     /**
      * @return customersBasketId
      */
@@ -153,4 +165,36 @@
     public String getOrderLinkHref() {
         return UrlBuilderUtil.createOrderUrl();
     }
+
+    public String getRegisterLinkHref() {
+        return UrlBuilderUtil.createRegisterUrl();
+    }
+
+    /**
+     * @return user
+     */
+    public boolean isUser() {
+        return user;
+    }
+
+    /**
+     * @param user 設定する user
+     */
+    public void setUser(boolean user) {
+        this.user = user;
+    }
+
+    /**
+     * @return login
+     */
+    public boolean isLogin() {
+        return login;
+    }
+
+    /**
+     * @param login 設定する login
+     */
+    public void setLogin(boolean login) {
+        this.login = login;
+    }
 }

Modified: pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/cart/productList.html
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/cart/productList.html	2007-09-29 21:57:07 UTC (rev 597)
+++ pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/cart/productList.html	2007-09-30 13:20:43 UTC (rev 598)
@@ -6,45 +6,78 @@
 <title id="title-head">カート画面</title>
 </head>
 <body>
-<form id="form" method="post">
-<table border="1">
+<form id="form" method="post">
+<div id="isUser" style="width: 100%;">
+<center>
+<table border="1" style="width: 80%;">
 	<thead>
-		<tr style="dummy" height="20px">
-			<th><label>NO</label></th>
-			<th><label>商品名</label></th>
-			<th><label>型番</label></th>
-			<th><label>メーカー</label></th>
-			<th><label>数量</label></th>
-			<th><label>価格</label></th>
+		<tr style="dummy">
+			<th align="center"><label>商品名</label></th>
+			<th align="center" width="100"><label>単価</label></th>
+			<th align="center" width="60"><label>数量</label></th>
+			<th align="center" width="100"><label>小計</label></th>
+			<th align="center" width="50"><label>消費税</label></th>
+			<th align="center" width="40"><label>送料</label></th>
+			<th align="center" width="50"><label>代引料</label></th>
 			<th>&nbsp;</th>
 		</tr>
 	</thead>
 	<tbody id="productItems">
 		<tr style="dummy">
-			<td><span id="productCount">1</span></td>
-			<td><span id="productName">XXX 01MAX</span></td>
-			<td><span id="productModel">MX-XXX</span></td>
-			<td><span id="manufacturerName">アディダス</span></td>
-			<td><span id="quantity">1</span></td>
-			<td><span id="finalPrice">30,000</span></td>
-			<td>
+			<td align="left">
+			  <span id="productName">XXX 01MAX</span><br/>
+			  &nbsp;<label>コード:</label><span id="productCode">MX-XXX</span><br/>
+			  &nbsp;<label>型番:</label><span id="productModel">MX-XXX</span>
+			</td>
+			<td align="right"><b style="color: #990000;"><span id="productPrice">30,000</span></b></td>
+			<td align="center"><span id="quantity">1</span></td>
+			<td align="right"><b style="color: #990000;"><span id="finalPrice">30,000</span></b></td>
+			<th align="center"><label>別</label></th>
+			<th align="center"><label>別</label></th>
+			<th align="center"><label>別</label></th>
+			<td align="center">
 				<a id="goProductDelete" href="./productList.html?customerBasketId=0&fixed_mode=delete" onclick="if(confirm('削除します。よろしいですか?')){return true;}else{return false;}">削除</a>
 			</td>
 		</tr>
 	</tbody>
 	<tfoot>
 		<tr>
-		<td colspan="5" align="right"><label>小計</label></td>
-		<td colspan="2"><span id="totalPrice">10000</span></td>
+			<td colspan="3" align="right"><label>商品代金小計</label></td>
+			<td align="right"><b style="color: #990000;"><span id="totalPrice">10000</span></b></td>
+			<td colspan="4" align="right"><input type="submit" id="doUpdate" value="カートを更新する" /></td>
 		</tr>
 	</tfoot>
-</table>
-<input type="submit" id="doUpdate" value="カートを更新する" />
-<br />
-<br />
-<a id="productListLink" href="">一覧へ戻る</a>
-<br />
-<br />
-<a id="orderLink" href="">注文画面へ</a>
+</table>
+  <div style="width: 80%;margin-top: 20px;">
+    <a id="orderLink" href="">購入手続きへ</a>
+    <hr style="border-top: 1px dashed #999999;height: 1px;color: #ffffff;" size="1" noshade="noshade"/>
+    <div>
+      <a id="productListLink" href="">お買物を続ける</a>
+    </div>
+  </div>
+</center>
+</div>
+<div id="isLogin" style="width: 100%;">
+  <center>
+    <label>
+      会員情報を登録する必要があります。<br/>
+      以下のリンクをクリックしてユーザー登録をお願いいたします。
+    </label>
+    <br/>
+    <br/>
+    <a id="registerLink" href="">ユーザー登録へ進む</a>
+  </center>
+</div>
+<div id="isNotLogin" style="width: 100%;">
+  <center>
+    <label>
+      商品をカートに入れるためにはログインする必要があります。<br/>
+      ユーザー登録をされていない場合は、以下のリンクをクリックしてユーザー登録をお願いいたします。
+    </label>
+    <br/>
+    <br/>
+    <a id="registerLink" href="">ユーザー登録へ進む</a>
+  </center>
+</div>
 </form>
 </body></html>


pal-cvs メーリングリストの案内
Back to archive index