[Svn-src-all:1421] [version-2_5-dev 20312] #936(商品種別を指定せずにカートインすると変な動作をする)
nanasess
admin @ mail.ec-cube.net
2011年 2月 22日 (火) 04:53:09 JST
Subversion committed to /home/svn/open 20312
http://svn.ec-cube.net/open_trac/changeset/20312
┌────────────────────────────┐
│更新者 : nanasess │
│更新日時: 2011-02-22 04:53:09 +0900 (火, 22 2月 2011)│
└────────────────────────────┘
Log:
--------------------------------------------------------
#936(商品種別を指定せずにカートインすると変な動作をする)
* SC_CartSession::addProduct() の引数を商品規格IDと数量に修正
#982([フロント]商品)
* 商品一覧で JavaScript エラーが発生していたのを修正
Changed: [U:修正,A:追加,D:削除]
--------------------------------------------------------
U branches/version-2_5-dev/data/Smarty/templates/default/products/detail.tpl
U branches/version-2_5-dev/data/Smarty/templates/default/products/list.tpl
U branches/version-2_5-dev/data/class/SC_CartSession.php
U branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage_Order.php
U branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_Detail.php
U branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_List.php
変更: branches/version-2_5-dev/data/Smarty/templates/default/products/detail.tpl
===================================================================
--- branches/version-2_5-dev/data/Smarty/templates/default/products/detail.tpl 2011-02-21 16:18:48 UTC (rev 20311)
+++ branches/version-2_5-dev/data/Smarty/templates/default/products/detail.tpl 2011-02-21 19:53:09 UTC (rev 20312)
@@ -149,7 +149,6 @@
eleDynamic.style.display = '';
} else {
eleDynamic.value = ''
- eleDynamic.style.display = 'none';
}
// 商品種別
eleDynamic = document.getElementById('product_type');
@@ -162,7 +161,6 @@
eleDynamic.style.display = '';
} else {
eleDynamic.value = ''
- eleDynamic.style.display = 'none';
}
}
$(document).ready(function() {
変更: branches/version-2_5-dev/data/Smarty/templates/default/products/list.tpl
===================================================================
--- branches/version-2_5-dev/data/Smarty/templates/default/products/list.tpl 2011-02-21 16:18:48 UTC (rev 20311)
+++ branches/version-2_5-dev/data/Smarty/templates/default/products/list.tpl 2011-02-21 19:53:09 UTC (rev 20312)
@@ -110,7 +110,6 @@
eleDynamic.innerHTML = classcat2.price02;
} else {
eleDefault.style.display = '';
- eleDynamic.style.display = 'none';
eleDynamic.innerHTML = '';
}
// 商品規格
変更: branches/version-2_5-dev/data/class/SC_CartSession.php
===================================================================
--- branches/version-2_5-dev/data/class/SC_CartSession.php 2011-02-21 16:18:48 UTC (rev 20311)
+++ branches/version-2_5-dev/data/class/SC_CartSession.php 2011-02-21 19:53:09 UTC (rev 20312)
@@ -224,12 +224,15 @@
}
// カートへの商品追加
- function addProduct($id, $quantity, $productTypeId) {
+ function addProduct($product_class_id, $quantity) {
+ $objProduct = new SC_Product();
+ $arrProduct = $objProduct->getProductsClass($product_class_id);
+ $productTypeId = $arrProduct['product_type_id'];
$find = false;
$max = $this->getMax($productTypeId);
for($i = 0; $i <= $max; $i++) {
- if($this->cartSession[$productTypeId][$i]['id'] == $id) {
+ if($this->cartSession[$productTypeId][$i]['id'] == $product_class_id) {
$val = $this->cartSession[$productTypeId][$i]['quantity'] + $quantity;
if(strlen($val) <= INT_LEN) {
$this->cartSession[$productTypeId][$i]['quantity'] += $quantity;
@@ -238,7 +241,7 @@
}
}
if(!$find) {
- $this->cartSession[$productTypeId][$max+1]['id'] = $id;
+ $this->cartSession[$productTypeId][$max+1]['id'] = $product_class_id;
$this->cartSession[$productTypeId][$max+1]['quantity'] = $quantity;
$this->cartSession[$productTypeId][$max+1]['cart_no'] = $this->getNextCartID($productTypeId);
}
変更: branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage_Order.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage_Order.php 2011-02-21 16:18:48 UTC (rev 20311)
+++ branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage_Order.php 2011-02-21 19:53:09 UTC (rev 20312)
@@ -93,7 +93,7 @@
$order_count = $objQuery->count("dtb_order", "order_id = ? and customer_id = ?", array($order_id, $customer_id));
if ($order_count != 1) return array();
- $col = "product_class_id, quantity, product_type_id";
+ $col = "product_class_id, quantity";
$table = "dtb_order_detail LEFT JOIN dtb_products_class USING(product_class_id)";
$where = "order_id = ?";
$objQuery->setOrder("product_class_id");
@@ -108,8 +108,7 @@
foreach($arrOrderDetail as $order_row) {
$objCartSess->addProduct($order_row['product_class_id'],
- $order_row['quantity'],
- $order_row['product_type_id']);
+ $order_row['quantity']);
}
}
}
変更: branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_Detail.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_Detail.php 2011-02-21 16:18:48 UTC (rev 20311)
+++ branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_Detail.php 2011-02-21 19:53:09 UTC (rev 20312)
@@ -168,7 +168,7 @@
if(!$this->tpl_classcat_find2) {
$classcategory_id2 = '0';
}
- $objCartSess->addProduct($product_class_id, $this->objFormParam->getValue('quantity'), $product_type);
+ $objCartSess->addProduct($product_class_id, $this->objFormParam->getValue('quantity'));
// カート「戻るボタン」用に保持
if (SC_Utils_Ex::sfIsInternalDomain($_SERVER['HTTP_REFERER'])) {
変更: branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_List.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_List.php 2011-02-21 16:18:48 UTC (rev 20311)
+++ branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_List.php 2011-02-21 19:53:09 UTC (rev 20312)
@@ -153,11 +153,11 @@
unset($this->arrProducts["productStatus"]);
$objJson = new Services_JSON();
- $this->tpl_javascript .= 'var productsClassCategories = ' . $objJson->encode($objProduct->classCategories) . ';\n';
+ $this->tpl_javascript .= 'var productsClassCategories = ' . $objJson->encode($objProduct->classCategories) . ';';
//onloadスクリプトを設定
foreach ($this->arrProducts as $arrProduct) {
- $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']});\n";
+ $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']});";
}
//カート処理
@@ -184,7 +184,7 @@
$this->tpl_next_page = $this->objNavi->arrPagenavi['next'];
}
- $this->tpl_javascript .= 'function fnOnLoad(){' . $js_fnOnLoad . '}'."\n";
+ $this->tpl_javascript .= 'function fnOnLoad(){' . $js_fnOnLoad . '}';
$this->tpl_onload .= 'fnOnLoad(); ';
$this->tpl_rnd = SC_Utils_Ex::sfGetRandomString(3);
@@ -478,7 +478,7 @@
$arrProducts[$key]['classcategory_id2'] = $arrForm['classcategory_id2'];
$arrProducts[$key]['quantity'] = $arrForm['quantity'];
$arrProducts[$key]['arrErr'] = $arrErr;
- $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProducts[$key]['product_id']}, '{$arrForm['classcategory_id2']}');\n";
+ $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProducts[$key]['product_id']}, '{$arrForm['classcategory_id2']}');";
}
}
return $js_fnOnLoad;
@@ -505,7 +505,7 @@
$product_class_id = $arrForm['product_class_id'];
$product_type = $arrForm['product_type'];
$objCartSess = new SC_CartSession();
- $objCartSess->addProduct($product_class_id, $arrForm['quantity'], $product_type);
+ $objCartSess->addProduct($product_class_id, $arrForm['quantity']);
// カート「戻るボタン」用に保持
if (SC_Utils_Ex::sfIsInternalDomain($referer)) {
Svn-src-all メーリングリストの案内