/** * lfGetProductsDetailData. * * @param str $mode モード * @param str $product_id 商品ID * @return array $arrProduct 商品情報の配列を返す */ function lfGetProductsDetailData($mode, $product_id) { $objQuery = SC_Query_Ex::getSingletonInstance(); //商品詳細を取得 if ($mode == 'all') { $arrProduct = $this->lfGetProductsDetail($objQuery, $mode); } else { $arrProduct = $this->lfGetProductsDetail($objQuery, $product_id); } // 値の整形 foreach ($arrProduct as $key => $val) { //販売価格を税込みに編集 $arrProduct[$key]['price02'] = SC_Helper_DB_Ex::sfCalcIncTax($arrProduct[$key]['price02']); // 画像ファイルのURLセット if (file_exists(IMAGE_SAVE_REALDIR . $arrProduct[$key]['main_list_image'])) { $dir = IMAGE_SAVE_RSS_URL; } else { $dir = IMAGE_TEMP_RSS_URL; } $arrProduct[$key]['main_list_image'] = $dir . $arrProduct[$key]['main_list_image']; if (file_exists(IMAGE_SAVE_REALDIR . $arrProduct[$key]['main_image'])) { $dir = IMAGE_SAVE_RSS_URL; } else { $dir = IMAGE_TEMP_RSS_URL; } $arrProduct[$key]['main_image'] = $dir . $arrProduct[$key]['main_image']; if (file_exists(IMAGE_SAVE_REALDIR . $arrProduct[$key]['main_large_image'])) { $dir = IMAGE_SAVE_RSS_URL; } else { $dir = IMAGE_TEMP_RSS_URL; } $arrProduct[$key]['main_large_image'] = $dir . $arrProduct[$key]['main_large_image']; // ポイント計算 $arrProduct[$key]['point'] = SC_Utils_Ex::sfPrePoint($arrProduct[$key]['price02'], $arrProduct[$key]['point_rate']); // 在庫無制限 if ($arrProduct[$key]['stock_unlimited'] == 1) { $arrProduct[$key]['stock_unlimited'] = t('c_Unlimited inventory_02'); } else { $arrProduct[$key]['stock_unlimited'] = NULL; } } return $arrProduct; }
/** * 商品IDに紐づく商品規格を自分自身に設定する. * * 引数の商品IDの配列に紐づく商品規格を取得し, 自分自身のフィールドに * 設定する. * * @param array $arrProductId 商品ID の配列 * @param boolean $has_deleted 削除された商品規格も含む場合 true; 初期値 false * @return void */ function setProductsClassByProductIds($arrProductId, $has_deleted = false) { foreach ($arrProductId as $productId) { $arrProductClasses = $this->getProductsClassFullByProductId($productId, $has_deleted); $classCats1 = array(); $classCats1['__unselected'] = t('c_Please make a selection_01'); // 規格1クラス名 $this->className1[$productId] = isset($arrProductClasses[0]['class_name1']) ? $arrProductClasses[0]['class_name1'] : ''; // 規格2クラス名 $this->className2[$productId] = isset($arrProductClasses[0]['class_name2']) ? $arrProductClasses[0]['class_name2'] : ''; // 規格1が設定されている $this->classCat1_find[$productId] = $arrProductClasses[0]['classcategory_id1'] > 0; // 要変更ただし、他にも改修が必要となる // 規格2が設定されている $this->classCat2_find[$productId] = $arrProductClasses[0]['classcategory_id2'] > 0; // 要変更ただし、他にも改修が必要となる $this->stock_find[$productId] = false; $classCategories = array(); $classCategories['__unselected']['__unselected']['name'] = t('c_Please make a selection_01'); $classCategories['__unselected']['__unselected']['product_class_id'] = $arrProductClasses[0]['product_class_id']; // 商品種別 $classCategories['__unselected']['__unselected']['product_type'] = $arrProductClasses[0]['product_type_id']; $this->product_class_id[$productId] = $arrProductClasses[0]['product_class_id']; // 商品種別 $this->product_type[$productId] = $arrProductClasses[0]['product_type_id']; foreach ($arrProductClasses as $arrProductsClass) { $arrClassCats2 = array(); $classcategory_id1 = $arrProductsClass['classcategory_id1']; $classcategory_id2 = $arrProductsClass['classcategory_id2']; // 在庫 $stock_find_class = $arrProductsClass['stock_unlimited'] || $arrProductsClass['stock'] > 0; $arrClassCats2['classcategory_id2'] = $classcategory_id2; $arrClassCats2['name'] = $arrProductsClass['classcategory_name2'] . ($stock_find_class ? '' : ' ' . t('c_(Sold out)_01')); $arrClassCats2['stock_find'] = $stock_find_class; if ($stock_find_class) { $this->stock_find[$productId] = true; } if (!in_array($classcat_id1, $classCats1)) { $classCats1[$classcategory_id1] = $arrProductsClass['classcategory_name1'] . ($classcategory_id2 == 0 && !$stock_find_class ? ' ' . t('c_(Sold out)_01') : ''); } // 価格 $arrClassCats2['price01'] = strlen($arrProductsClass['price01']) ? number_format(SC_Helper_DB_Ex::sfCalcIncTax($arrProductsClass['price01'])) : ''; $arrClassCats2['price02'] = strlen($arrProductsClass['price02']) ? number_format(SC_Helper_DB_Ex::sfCalcIncTax($arrProductsClass['price02'])) : ''; // ポイント $arrClassCats2['point'] = number_format(SC_Utils_Ex::sfPrePoint($arrProductsClass['price02'], $arrProductsClass['point_rate'])); // 商品コード $arrClassCats2['product_code'] = $arrProductsClass['product_code']; // 商品規格ID $arrClassCats2['product_class_id'] = $arrProductsClass['product_class_id']; // 商品種別 $arrClassCats2['product_type'] = $arrProductsClass['product_type_id']; // #929(GC8 規格のプルダウン順序表示不具合)対応のため、2次キーは「#」を前置 if (!$this->classCat1_find[$productId]) { $classcategory_id1 = '__unselected2'; } $classCategories[$classcategory_id1]['#'] = array('classcategory_id2' => '', 'name' => t('c_Please make a selection_01')); $classCategories[$classcategory_id1]['#' . $classcategory_id2] = $arrClassCats2; } $this->classCategories[$productId] = $classCategories; // 規格1 $this->classCats1[$productId] = $classCats1; } }
/** * 入力内容のチェックを行う. * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @return array エラーメッセージの配列 */ function lfCheckError(&$objFormParam) { $objProduct = new SC_Product_Ex(); $arrErr = $objFormParam->checkError(); if (!SC_Utils_Ex::isBlank($objErr->arrErr)) { return $arrErr; } $arrValues = $objFormParam->getHashArray(); // 商品の種類数 $max = count($arrValues['quantity']); $subtotal = 0; $totalpoint = 0; $totaltax = 0; for ($i = 0; $i < $max; $i++) { // 小計の計算 $subtotal += SC_Helper_DB_Ex::sfCalcIncTax($arrValues['price'][$i]) * $arrValues['quantity'][$i]; // 小計の計算 $totaltax += SC_Helper_DB_Ex::sfTax($arrValues['price'][$i]) * $arrValues['quantity'][$i]; // 加算ポイントの計算 $totalpoint += SC_Utils_Ex::sfPrePoint($arrValues['price'][$i], $arrValues['point_rate'][$i]) * $arrValues['quantity'][$i]; // 在庫数のチェック $arrProduct = $objProduct->getDetailAndProductsClass($arrValues['product_class_id'][$i]); // 編集前の値と比較するため受注詳細を取得 $objPurchase = new SC_Helper_Purchase_Ex(); $arrOrderDetail = SC_Utils_Ex::sfSwapArray($objPurchase->getOrderDetail($objFormParam->getValue('order_id'), false)); if ($arrProduct['stock_unlimited'] != '1' && $arrProduct['stock'] < $arrValues['quantity'][$i] - $arrOrderDetail['quantity'][$i]) { $class_name1 = $arrValues['classcategory_name1'][$i]; $class_name1 = SC_Utils_Ex::isBlank($class_name1) ? 'なし' : $class_name1; $class_name2 = $arrValues['classcategory_name2'][$i]; $class_name2 = SC_Utils_Ex::isBlank($class_name2) ? 'なし' : $class_name2; $arrErr['quantity'][$i] .= $arrValues['product_name'][$i] . '/(' . $class_name1 . ')/(' . $class_name2 . ') の在庫が不足しています。 設定できる数量は「' . ($arrOrderDetail['quantity'][$i] + $arrProduct['stock']) . '」までです。<br />'; } } // 消費税 $arrValues['tax'] = $totaltax; // 小計 $arrValues['subtotal'] = $subtotal; // 合計 $arrValues['total'] = $subtotal - $arrValues['discount'] + $arrValues['deliv_fee'] + $arrValues['charge']; // お支払い合計 $arrValues['payment_total'] = $arrValues['total'] - $arrValues['use_point'] * POINT_VALUE; // 加算ポイント $arrValues['add_point'] = SC_Helper_DB_Ex::sfGetAddPoint($totalpoint, $arrValues['use_point']); // 最終保持ポイント $arrValues['total_point'] = $objFormParam->getValue('point') - $arrValues['use_point']; if ($arrValues['total'] < 0) { $arrErr['total'] = '合計額がマイナス表示にならないように調整して下さい。<br />'; } if ($arrValues['payment_total'] < 0) { $arrErr['payment_total'] = 'お支払い合計額がマイナス表示にならないように調整して下さい。<br />'; } if ($arrValues['total_point'] < 0) { $arrErr['use_point'] = '最終保持ポイントがマイナス表示にならないように調整して下さい。<br />'; } $objFormParam->setParam($arrValues); return $arrErr; }
if ((is_array($_tmp = $this->_tpl_vars['item']['productsClass']['classcategory_name2']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) != "") { ?> <?php echo is_array($_tmp = $this->_tpl_vars['item']['productsClass']['class_name2']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp); ?> :<?php echo is_array($_tmp = $this->_tpl_vars['item']['productsClass']['classcategory_name2']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp); ?> <?php } ?> </td> <td class="alignR"> <?php echo is_array($_tmp = is_array($_tmp = is_array($_tmp = $this->_tpl_vars['item']['price']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) ? $this->_run_mod_handler('sfCalcIncTax', true, $_tmp) : SC_Helper_DB_Ex::sfCalcIncTax($_tmp)) ? $this->_run_mod_handler('number_format', true, $_tmp) : number_format($_tmp); ?> 円 </td> <td class="alignC"><?php echo is_array($_tmp = $this->_tpl_vars['item']['quantity']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp); ?> <ul id="quantity_level"> <li><a href="?" onclick="fnFormModeSubmit('form<?php echo is_array($_tmp = $this->_tpl_vars['key']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp); ?> ','up','cart_no','<?php echo is_array($_tmp = $this->_tpl_vars['item']['cart_no']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp); ?> '); return false"><img src="<?php
private function setOrderData() { $arrOrder = array(); // DBから受注情報を読み込む $this->lfGetOrderData($this->arrData['order_id']); // 購入者情報 $text = '〒 ' . $this->arrDisp['order_zip01'] . ' - ' . $this->arrDisp['order_zip02']; $this->lfText(23, 43, $text, 10); //購入者郵便番号 $text = $this->arrPref[$this->arrDisp['order_pref']] . $this->arrDisp['order_addr01']; $this->lfText(27, 47, $text, 10); //購入者都道府県+住所1 $this->lfText(27, 51, $this->arrDisp['order_addr02'], 10); //購入者住所2 $text = $this->arrDisp['order_name01'] . ' ' . $this->arrDisp['order_name02'] . ' 様'; $this->lfText(27, 59, $text, 11); //購入者氏名 // お届け先情報 $this->SetFont('SJIS', '', 10); $this->lfText(25, 125, SC_Utils_Ex::sfDispDBDate($this->arrDisp['create_date']), 10); //ご注文日 $this->lfText(25, 135, $this->arrDisp['order_id'], 10); //注文番号 $this->SetFont('Gothic', 'B', 15); $this->Cell(0, 10, $this->tpl_title, 0, 2, 'C', 0, ''); //文書タイトル(納品書・請求書) $this->Cell(0, 66, '', 0, 2, 'R', 0, ''); $this->Cell(5, 0, '', 0, 0, 'R', 0, ''); $this->SetFont('SJIS', 'B', 15); $this->Cell(67, 8, number_format($this->arrDisp['payment_total']) . ' 円', 0, 2, 'R', 0, ''); $this->Cell(0, 45, '', 0, 2, '', 0, ''); $this->SetFont('SJIS', '', 8); $monetary_unit = '円'; $point_unit = 'Pt'; // 購入商品情報 for ($i = 0; $i < count($this->arrDisp['quantity']); $i++) { // 購入数量 $data[0] = $this->arrDisp['quantity'][$i]; // 税込金額(単価) $data[1] = SC_Helper_DB_Ex::sfCalcIncTax($this->arrDisp['price'][$i], $this->arrDisp['tax_rate'][$i], $this->arrDisp['tax_rule'][$i]); // 小計(商品毎) $data[2] = $data[0] * $data[1]; $arrOrder[$i][0] = $this->arrDisp['product_name'][$i] . ' / '; $arrOrder[$i][0] .= $this->arrDisp['product_code'][$i] . ' / '; if ($this->arrDisp['classcategory_name1'][$i]) { $arrOrder[$i][0] .= ' [ ' . $this->arrDisp['classcategory_name1'][$i]; if ($this->arrDisp['classcategory_name2'][$i] == '') { $arrOrder[$i][0] .= ' ]'; } else { $arrOrder[$i][0] .= ' * ' . $this->arrDisp['classcategory_name2'][$i] . ' ]'; } } $arrOrder[$i][1] = number_format($data[0]); $arrOrder[$i][2] = number_format($data[1]) . $monetary_unit; $arrOrder[$i][3] = number_format($data[2]) . $monetary_unit; } $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = ''; $arrOrder[$i][3] = ''; $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = '商品合計'; $arrOrder[$i][3] = number_format($this->arrDisp['subtotal']) . $monetary_unit; $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = '送料'; $arrOrder[$i][3] = number_format($this->arrDisp['deliv_fee']) . $monetary_unit; $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = '手数料'; $arrOrder[$i][3] = number_format($this->arrDisp['charge']) . $monetary_unit; $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = '値引き'; $arrOrder[$i][3] = '- ' . number_format($this->arrDisp['use_point'] * POINT_VALUE + $this->arrDisp['discount']) . $monetary_unit; $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = '請求金額'; $arrOrder[$i][3] = number_format($this->arrDisp['payment_total']) . $monetary_unit; // ポイント表記 if ($this->arrData['disp_point'] && $this->arrDisp['customer_id']) { $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = ''; $arrOrder[$i][3] = ''; $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = '利用ポイント'; $arrOrder[$i][3] = number_format($this->arrDisp['use_point']) . $point_unit; $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = '加算ポイント'; $arrOrder[$i][3] = number_format($this->arrDisp['add_point']) . $point_unit; } $this->FancyTable($this->label_cell, $arrOrder, $this->width_cell); }
/** * 入力内容のチェックを行う. * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @return array エラーメッセージの配列 */ public function lfCheckError(&$objFormParam) { $objProduct = new SC_Product_Ex(); $arrValues = $objFormParam->getHashArray(); $arrErr = array(); $arrErrTemp = $objFormParam->checkError(); $arrErrDate = array(); foreach ($arrValues['shipping_date_year'] as $key_index => $year) { $month = $arrValues['shipping_date_month'][$key_index]; $day = $arrValues['shipping_date_day'][$key_index]; $objError = new SC_CheckError_Ex(array('shipping_date_year' => $year, 'shipping_date_month' => $month, 'shipping_date_day' => $day)); $objError->doFunc(array('お届け日', 'shipping_date_year', 'shipping_date_month', 'shipping_date_day'), array('CHECK_DATE')); $arrErrDate['shipping_date_year'][$key_index] = $objError->arrErr['shipping_date_year']; } $arrErrTemp = array_merge($arrErrTemp, $arrErrDate); // 複数項目チェック $year = $arrValues['order_birth_year']; $month = $arrValues['order_birth_month']; $day = $arrValues['order_birth_day']; $objError = new SC_CheckError_Ex(array('order_birth_year' => $year, 'order_birth_month' => $month, 'order_birth_day' => $day)); $objError->doFunc(array('生年月日', 'order_birth_year', 'order_birth_month', 'order_birth_day'), array('CHECK_BIRTHDAY')); $arrErrTemp['order_birth_year'] = $objError->arrErr['order_birth_year']; // 商品の種類数 $max = count($arrValues['quantity']); $subtotal = 0; $totalpoint = 0; $totaltax = 0; for ($i = 0; $i < $max; $i++) { // 小計の計算 $subtotal += SC_Helper_DB_Ex::sfCalcIncTax($arrValues['price'][$i], $arrValues['tax_rate'][$i], $arrValues['tax_rule'][$i]) * $arrValues['quantity'][$i]; // 小計の計算 $totaltax += SC_Utils_Ex::sfTax($arrValues['price'][$i], $arrValues['tax_rate'][$i], $arrValues['tax_rule'][$i]) * $arrValues['quantity'][$i]; // 加算ポイントの計算 $totalpoint += SC_Utils_Ex::sfPrePoint($arrValues['price'][$i], $arrValues['point_rate'][$i]) * $arrValues['quantity'][$i]; // 在庫数のチェック $arrProduct = $objProduct->getDetailAndProductsClass($arrValues['product_class_id'][$i]); // 編集前の値と比較するため受注詳細を取得 $objPurchase = new SC_Helper_Purchase_Ex(); $arrOrderDetail = SC_Utils_Ex::sfSwapArray($objPurchase->getOrderDetail($objFormParam->getValue('order_id'), false)); if ($arrProduct['stock_unlimited'] != '1' && $arrProduct['stock'] < $arrValues['quantity'][$i] - $arrOrderDetail['quantity'][$i]) { $class_name1 = $arrValues['classcategory_name1'][$i]; $class_name1 = SC_Utils_Ex::isBlank($class_name1) ? 'なし' : $class_name1; $class_name2 = $arrValues['classcategory_name2'][$i]; $class_name2 = SC_Utils_Ex::isBlank($class_name2) ? 'なし' : $class_name2; $arrErr['quantity'][$i] .= $arrValues['product_name'][$i] . '/(' . $class_name1 . ')/(' . $class_name2 . ') の在庫が不足しています。 設定できる数量は「' . ($arrOrderDetail['quantity'][$i] + $arrProduct['stock']) . '」までです。<br />'; } } // 消費税 $arrValues['tax'] = $totaltax; // 小計 $arrValues['subtotal'] = $subtotal; // 合計 $arrValues['total'] = $subtotal - $arrValues['discount'] + $arrValues['deliv_fee'] + $arrValues['charge']; // お支払い合計 $arrValues['payment_total'] = $arrValues['total'] - $arrValues['use_point'] * POINT_VALUE; // 加算ポイント $arrValues['add_point'] = SC_Helper_DB_Ex::sfGetAddPoint($totalpoint, $arrValues['use_point']) + $arrValues['birth_point']; // 最終保持ポイント $arrValues['total_point'] = $objFormParam->getValue('point') - $arrValues['use_point']; if ($arrValues['total'] < 0) { $arrErr['total'] = '合計額がマイナス表示にならないように調整して下さい。<br />'; } if ($arrValues['payment_total'] < 0) { $arrErr['payment_total'] = 'お支払い合計額がマイナス表示にならないように調整して下さい。<br />'; } if ($arrValues['total_point'] < 0) { $arrErr['use_point'] = '最終保持ポイントがマイナス表示にならないように調整して下さい。<br />'; } $objFormParam->setParam($arrValues); $arrErr = array_merge($arrErr, $arrErrTemp); return $arrErr; }
/** * 配送商品を設定する. * * @param integer $shipping_id 配送先ID * @param integer $product_class_id 商品規格ID * @param integer $quantity 数量 * @return void */ function setShipmentItemTemp($shipping_id, $product_class_id, $quantity) { // 配列が長くなるので, リファレンスを使用する $arrItems =& $_SESSION['shipping'][$shipping_id]['shipment_item'][$product_class_id]; $arrItems['shipping_id'] = $shipping_id; $arrItems['product_class_id'] = $product_class_id; $arrItems['quantity'] = $quantity; $objProduct = new SC_Product_Ex(); // カート情報から読みこめば済むと思うが、一旦保留。むしろ、カート情報も含め、セッション情報を縮小すべきかもしれない。 /* $objCartSession = new SC_CartSession_Ex(); $cartKey = $objCartSession->getKey(); // 詳細情報を取得 $cartItems = $objCartSession->getCartList($cartKey); */ if (empty($arrItems['productsClass'])) { $product =& $objProduct->getDetailAndProductsClass($product_class_id); $arrItems['productsClass'] = $product; } $arrItems['price'] = $arrItems['productsClass']['price02']; $inctax = SC_Helper_DB_Ex::sfCalcIncTax($arrItems['price']); $arrItems['total_inctax'] = $inctax * $arrItems['quantity']; }
/** * lfGetProductsAllData. * * @return array $arrProduct 商品情報の配列を返す */ function lfGetProductsAllData() { $objQuery = SC_Query_Ex::getSingletonInstance(); //商品情報を取得 $arrProduct = $this->lfGetProductsAllclass($objQuery); // 値の整形 foreach ($arrProduct as $key => $val) { //販売価格を税込みに編集 $arrProduct[$key]['price02_max'] = SC_Helper_DB_Ex::sfCalcIncTax($arrProduct[$key]['price02_max']); $arrProduct[$key]['price02_min'] = SC_Helper_DB_Ex::sfCalcIncTax($arrProduct[$key]['price02_min']); // 画像ファイルのURLセット if (file_exists(IMAGE_SAVE_REALDIR . $arrProduct[$key]['main_list_image'])) { $dir = IMAGE_SAVE_RSS_URL; } else { $dir = IMAGE_TEMP_RSS_URL; } $arrProduct[$key]['main_list_image'] = $dir . $arrProduct[$key]['main_list_image']; if (file_exists(IMAGE_SAVE_REALDIR . $arrProduct[$key]['main_image'])) { $dir = IMAGE_SAVE_RSS_URL; } else { $dir = IMAGE_TEMP_RSS_URL; } $arrProduct[$key]['main_image'] = $dir . $arrProduct[$key]['main_image']; if (file_exists(IMAGE_SAVE_REALDIR . $arrProduct[$key]['main_large_image'])) { $dir = IMAGE_SAVE_RSS_URL; } else { $dir = IMAGE_TEMP_RSS_URL; } $arrProduct[$key]['main_large_image'] = $dir . $arrProduct[$key]['main_large_image']; // ポイント計算 $arrProduct[$key]['point_max'] = SC_Utils_Ex::sfPrePoint($arrProduct[$key]['price02_max'], $arrProduct[$key]['point_rate']); $arrProduct[$key]['point_min'] = SC_Utils_Ex::sfPrePoint($arrProduct[$key]['price02_min'], $arrProduct[$key]['point_rate']); } return $arrProduct; }
<?php if ((is_array($_tmp = $this->_tpl_vars['arrProductsClassList'][$this->_sections['i']['index']]['classcategory_name2']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) != '') { ?> : <?php echo is_array($_tmp = is_array($_tmp = $this->_tpl_vars['arrProductsClassList'][$this->_sections['i']['index']]['classcategory_name2']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) ? $this->_run_mod_handler('h', true, $_tmp) : smarty_modifier_h($_tmp); ?> <?php } ?> </td> <td> <!--★価格★--> <?php echo is_array($_tmp = is_array($_tmp = $this->_tpl_vars['arrProductsClassList'][$this->_sections['i']['index']]['price02']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) ? $this->_run_mod_handler('sfCalcIncTax', true, $_tmp) : SC_Helper_DB_Ex::sfCalcIncTax($_tmp); ?> 円 </td> <td> <!--★在庫数★--> <?php echo is_array($_tmp = $this->_tpl_vars['arrProductsClassList'][$this->_sections['i']['index']]['stock']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp); ?> 個 </td> </tr> <?php } } ?>
/** * カート内の商品の妥当性をチェックする. * * エラーが発生した場合は, 商品をカート内から削除又は数量を調整し, * エラーメッセージを返す. * * 1. 商品種別に関連づけられた配送業者の存在チェック * 2. 削除/非表示商品のチェック * 3. 販売制限数のチェック * 4. 在庫数チェック * * @param string $productTypeId 商品種別ID * @return string エラーが発生した場合はエラーメッセージ */ function checkProducts($productTypeId) { $objProduct = new SC_Product_Ex(); $tpl_message = ''; // カート内の情報を取得 $arrItems = $this->getCartList($productTypeId); foreach ($arrItems as &$arrItem) { $product =& $arrItem['productsClass']; /* * 表示/非表示商品のチェック */ if (SC_Utils_Ex::isBlank($product) || $product['status'] != 1) { $this->delProduct($arrItem['cart_no'], $productTypeId); $tpl_message .= "※ 現時点で販売していない商品が含まれておりました。該当商品をカートから削除しました。\n"; } else { /* * 配送業者のチェック */ $arrDeliv = SC_Helper_Purchase_Ex::getDeliv($productTypeId); if (SC_Utils_Ex::isBlank($arrDeliv)) { $tpl_message .= '※「' . $product['name'] . '」はまだ配送の準備ができておりません。'; $tpl_message .= '恐れ入りますがお問い合わせページよりお問い合わせください。' . "\n"; $this->delProduct($arrItem['cart_no'], $productTypeId); } /* * 販売制限数, 在庫数のチェック */ $limit = $objProduct->getBuyLimit($product); if (!is_null($limit) && $arrItem['quantity'] > $limit) { if ($limit > 0) { $this->setProductValue($arrItem['id'], 'quantity', $limit, $productTypeId); $total_inctax = SC_Helper_DB_Ex::sfCalcIncTax($arrItem['price']) * $limit; $this->setProductValue($arrItem['id'], 'total_inctax', $total_inctax, $productTypeId); $tpl_message .= '※「' . $product['name'] . '」は販売制限(または在庫が不足)しております。'; $tpl_message .= "一度に数量{$limit}を超える購入はできません。\n"; } else { $this->delProduct($arrItem['cart_no'], $productTypeId); $tpl_message .= '※「' . $product['name'] . "」は売り切れました。\n"; continue; } } } } return $tpl_message; }
/** * カート内の商品の妥当性をチェックする. * * エラーが発生した場合は, 商品をカート内から削除又は数量を調整し, * エラーメッセージを返す. * * 1. 商品種別に関連づけられた配送業者の存在チェック * 2. 削除/非表示商品のチェック * 3. 販売制限数のチェック * 4. 在庫数チェック * * @param string $productTypeId 商品種別ID * @return string エラーが発生した場合はエラーメッセージ */ function checkProducts($productTypeId) { $objProduct = new SC_Product_Ex(); $tpl_message = ''; // カート内の情報を取得 $arrItems = $this->getCartList($productTypeId); foreach ($arrItems as &$arrItem) { $product =& $arrItem['productsClass']; /* * 表示/非表示商品のチェック */ if (SC_Utils_Ex::isBlank($product) || $product['status'] != 1) { $this->delProduct($arrItem['cart_no'], $productTypeId); $tpl_message .= t('c_* A product in your cart is no longer being sold at this time. The item was deleted from your cart._01'); } else { /* * 配送業者のチェック */ $arrDeliv = SC_Helper_Purchase_Ex::getDeliv($productTypeId); if (SC_Utils_Ex::isBlank($arrDeliv)) { $tpl_message .= t('c_* Delivery preparations are not ready for T_ARG1. Please access the inquiry page for more details._01', array('T_ARG1' => $product['name'])); $this->delProduct($arrItem['cart_no'], $productTypeId); } /* * 販売制限数, 在庫数のチェック */ $limit = $objProduct->getBuyLimit($product); if (!is_null($limit) && $arrItem['quantity'] > $limit) { if ($limit > 0) { $this->setProductValue($arrItem['id'], 'quantity', $limit, $productTypeId); $total_inctax = SC_Helper_DB_Ex::sfCalcIncTax($arrItem['price']) * $limit; $this->setProductValue($arrItem['id'], 'total_inctax', $total_inctax, $productTypeId); $tpl_message .= t('c_* There is a sale restriction (or inventory shortage) for T_ARG1. It is not possible to purchase a quantity that exceeds T_ARG2 in a single purchase._01', array('T_ARG1' => $product['name'], 'T_ARG2' => $limit)); } else { $this->delProduct($arrItem['cart_no'], $productTypeId); $tpl_message .= t('c_* T_ARG1 is sold out._01', array('T_ARG1' => $product['name'])); continue; } } } } return $tpl_message; }
function setOrderData() { $arrOrder = array(); // DBから受注情報を読み込む $this->lfGetOrderData($this->arrData['order_id']); // 購入者情報 // $text = '〒 '.$this->arrDisp['order_zip01'].' - '.$this->arrDisp['order_zip02']; $text = t('c_postal code mark_01') . $this->arrDisp['order_zipcode']; $this->lfText(23, 43, $text, 10); //購入者郵便番号 $text = $this->arrPref[$this->arrDisp['order_pref']] . $this->arrDisp['order_addr01']; $this->lfText(27, 47, $text, 10); //購入者都道府県+住所1 $this->lfText(27, 51, $this->arrDisp['order_addr02'], 10); //購入者住所2 $text = t('f_NAME_FULL_SIR_01', array('T_ARG1' => $this->arrDisp['order_name01'], 'T_ARG2' => $this->arrDisp['order_name02'])); $this->lfText(27, 59, $text, 11); //購入者氏名 // お届け先情報 $this->SetFont('SJIS', '', 10); $this->lfText(25, 125, SC_Utils_Ex::sfDispDBDate($this->arrDisp['create_date']), 10); //ご注文日 $this->lfText(25, 135, $this->arrDisp['order_id'], 10); //注文番号 $this->SetFont('Gothic', 'B', 15); $this->Cell(0, 10, $this->tpl_title, 0, 2, 'C', 0, ''); //文書タイトル(納品書・請求書) $this->Cell(0, 66, '', 0, 2, 'R', 0, ''); $this->Cell(5, 0, '', 0, 0, 'R', 0, ''); $this->SetFont('SJIS', 'B', 15); $this->Cell(67, 8, t('c_$ T_ARG1_01', array('T_ARG1' => number_format($this->arrDisp['payment_total']))), 0, 2, 'R', 0, ''); $this->Cell(0, 45, '', 0, 2, '', 0, ''); $this->SetFont('SJIS', '', 8); $point_unit = t('c_Pts_01'); // 購入商品情報 for ($i = 0; $i < count($this->arrDisp['quantity']); $i++) { // 購入数量 $data[0] = $this->arrDisp['quantity'][$i]; // 税込金額(単価) $data[1] = SC_Helper_DB_Ex::sfCalcIncTax($this->arrDisp['price'][$i]); // 小計(商品毎) $data[2] = $data[0] * $data[1]; $arrOrder[$i][0] = $this->arrDisp['product_name'][$i] . ' / '; $arrOrder[$i][0] .= $this->arrDisp['product_code'][$i] . ' / '; if ($this->arrDisp['classcategory_name1'][$i]) { $arrOrder[$i][0] .= ' [ ' . $this->arrDisp['classcategory_name1'][$i]; if ($this->arrDisp['classcategory_name2'][$i] == '') { $arrOrder[$i][0] .= ' ]'; } else { $arrOrder[$i][0] .= ' * ' . $this->arrDisp['classcategory_name2'][$i] . ' ]'; } } $arrOrder[$i][1] = number_format($data[0]); $arrOrder[$i][2] = t('c_$ T_ARG1_01', array('T_ARG1' => number_format($data[1]))); $arrOrder[$i][3] = t('c_$ T_ARG1_01', array('T_ARG1' => number_format($data[2]))); } $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = ''; $arrOrder[$i][3] = ''; $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = t('c_Product total_01'); $arrOrder[$i][3] = t('c_$ T_ARG1_01', array('T_ARG1' => number_format($this->arrDisp['subtotal']))); $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = t('c_Shipping fee_01'); $arrOrder[$i][3] = t('c_$ T_ARG1_01', array('T_ARG1' => number_format($this->arrDisp['deliv_fee']))); $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = t('c_Processing fee_01'); $arrOrder[$i][3] = t('c_$ T_ARG1_01', array('T_ARG1' => number_format($this->arrDisp['charge']))); $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = t('c_Discount_01'); $arrOrder[$i][3] = t('c_$ T_ARG1_01', array('T_ARG1' => '- ' . number_format($this->arrDisp['use_point'] * POINT_VALUE + $this->arrDisp['discount']))); $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = t('c_Billing amount_01'); $arrOrder[$i][3] = t('c_$ T_ARG1_01', array('T_ARG1' => number_format($this->arrDisp['payment_total']))); // ポイント表記 if ($this->arrData['disp_point'] && $this->arrDisp['customer_id']) { $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = ''; $arrOrder[$i][3] = ''; $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = t('c_Used points_01'); $arrOrder[$i][3] = number_format($this->arrDisp['use_point']) . $point_unit; $i++; $arrOrder[$i][0] = ''; $arrOrder[$i][1] = ''; $arrOrder[$i][2] = t('c_Points added_01'); $arrOrder[$i][3] = number_format($this->arrDisp['add_point']) . $point_unit; } $this->FancyTable($this->label_cell, $arrOrder, $this->width_cell); }
function setOrderData() { // DBから受注情報を読み込む $this->lfGetOrderData($this->arrData['order_id']); // 購入者情報 $text = "〒 " . $this->arrDisp['order_zip01'] . " - " . $this->arrDisp['order_zip02']; $this->lfText(23, 43, $text, 10); //購入者郵便番号 $text = $this->arrPref[$this->arrDisp['order_pref']] . $this->arrDisp['order_addr01']; $this->lfText(27, 47, $text, 10); //購入者都道府県+住所1 $this->lfText(27, 51, $this->arrDisp['order_addr02'], 10); //購入者住所2 $text = $this->arrDisp['order_name01'] . " " . $this->arrDisp['order_name02'] . " 様"; $this->lfText(27, 59, $text, 11); //購入者氏名 // お届け先情報 $this->pdf->SetFontSize(10); $this->lfText(25, 125, SC_Utils_Ex::sfDispDBDate($this->arrDisp['create_date']), 10); //ご注文日 $this->lfText(25, 135, $this->arrDisp['order_id'], 10); //注文番号 $this->pdf->SetFont('', 'B', 15); $this->pdf->Cell(0, 10, $this->lfConvSjis($this->tpl_title), 0, 2, 'C', 0, ''); //文書タイトル(納品書・請求書) $this->pdf->Cell(0, 66, '', 0, 2, 'R', 0, ''); $this->pdf->Cell(5, 0, '', 0, 0, 'R', 0, ''); $this->pdf->Cell(67, 8, $this->lfConvSjis(number_format($this->arrDisp['payment_total']) . " 円"), 0, 2, 'R', 0, ''); $this->pdf->Cell(0, 45, '', 0, 2, '', 0, ''); $this->pdf->SetFontSize(8); $monetary_unit = $this->lfConvSjis("円"); $point_unit = $this->lfConvSjis('Pt'); // 購入商品情報 for ($i = 0; $i < count($this->arrDisp['quantity']); $i++) { // 購入数量 $data[0] = $this->arrDisp['quantity'][$i]; // 税込金額(単価) $data[1] = SC_Helper_DB_Ex::sfCalcIncTax($this->arrDisp['price'][$i]); // 小計(商品毎) $data[2] = $data[0] * $data[1]; $arrOrder[$i][0] = $this->lfConvSjis($this->arrDisp['product_name'][$i] . " / "); $arrOrder[$i][0] .= $this->lfConvSjis($this->arrDisp['product_code'][$i] . " / "); if ($this->arrDisp['classcategory_name1'][$i]) { $arrOrder[$i][0] .= $this->lfConvSjis(" [ " . $this->arrDisp['classcategory_name1'][$i]); if ($this->arrDisp['classcategory_name2'][$i] == "") { $arrOrder[$i][0] .= " ]"; } else { $arrOrder[$i][0] .= $this->lfConvSjis(" * " . $this->arrDisp['classcategory_name2'][$i] . " ]"); } } $arrOrder[$i][1] = number_format($data[0]); $arrOrder[$i][2] = number_format($data[1]) . $monetary_unit; $arrOrder[$i][3] = number_format($data[2]) . $monetary_unit; } $arrOrder[$i][0] = ""; $arrOrder[$i][1] = ""; $arrOrder[$i][2] = ""; $arrOrder[$i][3] = ""; $i++; $arrOrder[$i][0] = ""; $arrOrder[$i][1] = ""; $arrOrder[$i][2] = $this->lfConvSjis("商品合計"); $arrOrder[$i][3] = number_format($this->arrDisp['subtotal']) . $monetary_unit; $i++; $arrOrder[$i][0] = ""; $arrOrder[$i][1] = ""; $arrOrder[$i][2] = $this->lfConvSjis("送料"); $arrOrder[$i][3] = number_format($this->arrDisp['deliv_fee']) . $monetary_unit; $i++; $arrOrder[$i][0] = ""; $arrOrder[$i][1] = ""; $arrOrder[$i][2] = $this->lfConvSjis("手数料"); $arrOrder[$i][3] = number_format($this->arrDisp['charge']) . $monetary_unit; $i++; $arrOrder[$i][0] = ""; $arrOrder[$i][1] = ""; $arrOrder[$i][2] = $this->lfConvSjis("値引き"); $arrOrder[$i][3] = "- " . number_format($this->arrDisp['use_point'] * POINT_VALUE + $this->arrDisp['discount']) . $monetary_unit; $i++; $arrOrder[$i][0] = ""; $arrOrder[$i][1] = ""; $arrOrder[$i][2] = $this->lfConvSjis("請求金額"); $arrOrder[$i][3] = number_format($this->arrDisp['payment_total']) . $monetary_unit; // ポイント表記 if ($this->arrData['disp_point'] && $this->arrDisp['customer_id']) { $i++; $arrOrder[$i][0] = ""; $arrOrder[$i][1] = ""; $arrOrder[$i][2] = ""; $arrOrder[$i][3] = ""; $i++; $arrOrder[$i][0] = ""; $arrOrder[$i][1] = ""; $arrOrder[$i][2] = $this->lfConvSjis("利用ポイント"); $arrOrder[$i][3] = number_format($this->arrDisp['use_point']) . $point_unit; $i++; $arrOrder[$i][0] = ""; $arrOrder[$i][1] = ""; $arrOrder[$i][2] = $this->lfConvSjis("加算ポイント"); $arrOrder[$i][3] = number_format($this->arrDisp['add_point']) . $point_unit; } $this->pdf->FancyTable($this->label_cell, $arrOrder, $this->width_cell); }
/** * カート内の商品の妥当性をチェックする. * * エラーが発生した場合は, 商品をカート内から削除又は数量を調整し, * エラーメッセージを返す. * * 1. 商品種別に関連づけられた配送業者の存在チェック * 2. 削除/非表示商品のチェック * 3. 商品購入制限数のチェック * 4. 在庫数チェック * * @param string $key 商品種別ID * @return string エラーが発生した場合はエラーメッセージ */ function checkProducts($productTypeId) { $objProduct = new SC_Product_Ex(); $tpl_message = ""; // カート内の情報を取得 $items = $this->getCartList($productTypeId); foreach (array_keys($items) as $key) { $item =& $items[$key]; $product =& $item['productsClass']; /* * 表示/非表示商品のチェック */ if (SC_Utils_Ex::isBlank($product)) { $this->delProduct($item['cart_no'], $productTypeId); $tpl_message .= "※ 現時点で販売していない商品が含まれておりました。該当商品をカートから削除しました。\n"; } else { /* * 配送業者のチェック */ $arrDeliv = SC_Helper_Purchase_Ex::getDeliv($productTypeId); if (SC_Utils_Ex::isBlank($arrDeliv)) { $tpl_message .= "※「" . $product['name'] . "」はまだ配送の準備ができておりません。恐れ入りますがお問い合わせページよりお問い合わせください。\n"; $this->delProduct($item['cart_no'], $productTypeId); } /* * 商品購入制限数, 在庫数のチェック */ $limit = $objProduct->getBuyLimit($product); if (!is_null($limit) && $item['quantity'] > $limit) { if ($limit > 0) { $this->setProductValue($item['id'], 'quantity', $limit, $productTypeId); $this->setProductValue($item['id'], 'total_inctax', SC_Helper_DB_Ex::sfCalcIncTax($item['price']) * $limit, $productTypeId); $tpl_message .= "※「" . $product['name'] . "」は販売制限(または在庫が不足)しております。一度に数量{$limit}以上の購入はできません。\n"; } else { $this->delProduct($item['cart_no'], $productTypeId); $tpl_message .= "※「" . $product['name'] . "」は売り切れました。\n"; continue; } } } } return $tpl_message; }
/** * 入力内容のチェックを行う. * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @return array エラーメッセージの配列 */ function lfCheckError(&$objFormParam) { $objProduct = new SC_Product_Ex(); $arrErr = $objFormParam->checkError(); if (!SC_Utils_Ex::isBlank($objErr->arrErr)) { return $arrErr; } $arrValues = $objFormParam->getHashArray(); // 商品の種類数 $max = count($arrValues['quantity']); $subtotal = 0; $totalpoint = 0; $totaltax = 0; for ($i = 0; $i < $max; $i++) { // 小計の計算 $subtotal += SC_Helper_DB_Ex::sfCalcIncTax($arrValues['price'][$i]) * $arrValues['quantity'][$i]; // 小計の計算 $totaltax += SC_Helper_DB_Ex::sfTax($arrValues['price'][$i]) * $arrValues['quantity'][$i]; // 加算ポイントの計算 $totalpoint += SC_Utils_Ex::sfPrePoint($arrValues['price'][$i], $arrValues['point_rate'][$i]) * $arrValues['quantity'][$i]; // 在庫数のチェック $arrProduct = $objProduct->getDetailAndProductsClass($arrValues['product_class_id'][$i]); // 編集前の値と比較するため受注詳細を取得 $objPurchase = new SC_Helper_Purchase_Ex(); $arrOrderDetail = SC_Utils_Ex::sfSwapArray($objPurchase->getOrderDetail($objFormParam->getValue('order_id'), false)); if ($arrProduct['stock_unlimited'] != '1' && $arrProduct['stock'] < $arrValues['quantity'][$i] - $arrOrderDetail['quantity'][$i]) { $class_name1 = $arrValues['classcategory_name1'][$i]; $class_name1 = SC_Utils_Ex::isBlank($class_name1) ? t('c_None_01') : $class_name1; $class_name2 = $arrValues['classcategory_name2'][$i]; $class_name2 = SC_Utils_Ex::isBlank($class_name2) ? t('c_None_01') : $class_name2; $arrErr['quantity'][$i] .= t('c_There is an inventory shortage for T_ARG1/(T_ARG2)/(T_ARG3). Up to T_ARG4 can be set for the quantity.<br />_1', array('T_ARG1' => $arrValues['product_name'][$i], 'T_ARG2' => $class_name1, 'T_ARG3' => $class_name2, 'T_ARG4' => $arrOrderDetail['quantity'][$i] + $arrProduct['stock'])); } } // 消費税 $arrValues['tax'] = $totaltax; // 小計 $arrValues['subtotal'] = $subtotal; // 合計 $arrValues['total'] = $subtotal - $arrValues['discount'] + $arrValues['deliv_fee'] + $arrValues['charge']; // お支払い合計 $arrValues['payment_total'] = $arrValues['total'] - $arrValues['use_point'] * POINT_VALUE; // 加算ポイント $arrValues['add_point'] = SC_Helper_DB_Ex::sfGetAddPoint($totalpoint, $arrValues['use_point']); // 最終保持ポイント $arrValues['total_point'] = $objFormParam->getValue('point') - $arrValues['use_point']; if ($arrValues['total'] < 0) { $arrErr['total'] = t('c_Adjust so that the total amount is not a negative number.<br />_01'); } if ($arrValues['payment_total'] < 0) { $arrErr['payment_total'] = t('c_Adjust so that a negative number is not displayed for the payment total.<br />_01'); } if ($arrValues['total_point'] < 0) { $arrErr['use_point'] = t('c_Adjust the final number of points registered so that it does not become a negative number.<br />_01'); } $objFormParam->setParam($arrValues); return $arrErr; }