public function doAction($arrParam) { $arrRequest = $this->doInitParam($arrParam); if (!$this->isParamError()) { $objProduct = new SC_Product_Ex(); switch ($arrRequest['IdType']) { case 'product_code': $search_column = 'product_code'; break; case 'product_class_id': $arrProduct = $objProduct->getDetailAndProductsClass($arrRequest['ItemId']); break; case 'product_id': default: $arrProduct = $objProduct->getDetail($arrRequest['ItemId']); break; } $objProduct->setProductsClassByProductIds(array($arrProduct['product_id'])); if ($arrProduct['del_flg'] == '0' && $arrProduct['status'] == '1') { unset($arrProduct['note']); $this->setResponse('product_id', $arrProduct['product_id']); $this->setResponse('DetailPageURL', HTTP_URL . 'products/detail.php?product_id=' . $arrProduct['product_id']); $this->setResponse('Title', $arrProduct['name']); $this->setResponse('ItemAttributes', $arrProduct); return true; } else { $this->addError('ItemLookup.Error', t('c_* The requested information was not found._01')); } } return false; }
function sfSendOrderMail($order_id, $template_id, $subject = "", $header = "", $footer = "", $send = true) { $arrTplVar = new stdClass(); $arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); $arrTplVar->arrInfo = $arrInfo; $objQuery = new SC_Query_Ex(); if ($subject == "" && $header == "" && $footer == "") { // メールテンプレート情報の取得 $where = "template_id = ?"; $arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($template_id)); $arrTplVar->tpl_header = $arrRet[0]['header']; $arrTplVar->tpl_footer = $arrRet[0]['footer']; $tmp_subject = $arrRet[0]['subject']; } else { $arrTplVar->tpl_header = $header; $arrTplVar->tpl_footer = $footer; $tmp_subject = $subject; } // 受注情報の取得 $where = "order_id = ?"; $arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id)); $arrOrder = $arrRet[0]; $objQuery->setOrder('order_detail_id'); $arrTplVar->arrOrderDetail = $objQuery->select("*", "dtb_order_detail", $where, array($order_id)); $objProduct = new SC_Product_Ex(); $objQuery->setOrder('shipping_id'); $arrRet = $objQuery->select("*", "dtb_shipping", "order_id = ?", array($order_id)); foreach (array_keys($arrRet) as $key) { $objQuery->setOrder('shipping_id'); $arrItems = $objQuery->select("*", "dtb_shipment_item", "order_id = ? AND shipping_id = ?", array($order_id, $arrRet[$key]['shipping_id'])); foreach ($arrItems as $itemKey => $arrDetail) { foreach ($arrDetail as $detailKey => $detailVal) { $arrRet[$key]['shipment_item'][$arrDetail['product_class_id']][$detailKey] = $detailVal; } $arrRet[$key]['shipment_item'][$arrDetail['product_class_id']]['productsClass'] =& $objProduct->getDetailAndProductsClass($arrDetail['product_class_id']); } } $arrTplVar->arrShipping = $arrRet; $arrTplVar->Message_tmp = $arrOrder['message']; // 会員情報の取得 $customer_id = $arrOrder['customer_id']; $objQuery->setOrder('customer_id'); $arrRet = $objQuery->select('point', "dtb_customer", "customer_id = ?", array($customer_id)); $arrCustomer = isset($arrRet[0]) ? $arrRet[0] : ""; $arrTplVar->arrCustomer = $arrCustomer; $arrTplVar->arrOrder = $arrOrder; //その他決済情報 if ($arrOrder['memo02'] != "") { $arrOther = unserialize($arrOrder['memo02']); foreach ($arrOther as $other_key => $other_val) { if (SC_Utils_Ex::sfTrim($other_val['value']) == "") { $arrOther[$other_key]['value'] = ""; } } $arrTplVar->arrOther = $arrOther; } // 都道府県変換 $arrTplVar->arrPref = $this->arrPref; $objCustomer = new SC_Customer_Ex(); $arrTplVar->tpl_user_point = $objCustomer->getValue('point'); if (Net_UserAgent_Mobile::isMobile() === true) { $objMailView = new SC_MobileView_Ex(); } else { $objMailView = new SC_SiteView_Ex(); } // メール本文の取得 $objMailView->assignobj($arrTplVar); $body = $objMailView->fetch($this->arrMAILTPLPATH[$template_id]); // メール送信処理 $objSendMail = new SC_SendMail_Ex(); $bcc = $arrInfo['email01']; $from = $arrInfo['email03']; $error = $arrInfo['email04']; $tosubject = $this->sfMakeSubject($tmp_subject, $objMailView); $objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc); $objSendMail->setTo($arrOrder["order_email"], $arrOrder["order_name01"] . " " . $arrOrder["order_name02"] . " 様"); // 送信フラグ:trueの場合は、送信する。 if ($send) { if ($objSendMail->sendMail()) { $this->sfSaveMailHistory($order_id, $template_id, $tosubject, $body); } } return $objSendMail; }
/** * 配送商品を取得する. * * @param integer $order_id 受注ID * @param integer $shipping_id 配送先ID * @param boolean $has_detail 商品詳細も取得する場合 true * @return array 商品規格IDをキーにした配送商品の配列 */ public function getShipmentItems($order_id, $shipping_id, $has_detail = true) { $objQuery =& SC_Query_Ex::getSingletonInstance(); $objProduct = new SC_Product_Ex(); $arrResults = array(); $objQuery->setOrder('order_detail_id'); $arrItems = $objQuery->select('dtb_shipment_item.*', 'dtb_shipment_item join dtb_order_detail ON dtb_shipment_item.product_class_id = dtb_order_detail.product_class_id AND dtb_shipment_item.order_id = dtb_order_detail.order_id', 'dtb_order_detail.order_id = ? AND shipping_id = ?', array($order_id, $shipping_id)); foreach ($arrItems as $key => $arrItem) { $product_class_id = $arrItem['product_class_id']; foreach ($arrItem as $detailKey => $detailVal) { $arrResults[$key][$detailKey] = $detailVal; } // 商品詳細を関連づける if ($has_detail) { $arrResults[$key]['productsClass'] =& $objProduct->getDetailAndProductsClass($product_class_id); } } return $arrResults; }
/** * 商品種別ごとにカート内商品の一覧を取得する. * * @param integer $productTypeId 商品種別ID * @param integer $pref_id 税金計算用注文者都道府県ID * @param integer $country_id 税金計算用注文者国ID * @return array カート内商品一覧の配列 */ public function getCartList($productTypeId, $pref_id = 0, $country_id = 0) { $objProduct = new SC_Product_Ex(); $max = $this->getMax($productTypeId); $arrRet = array(); /* $const_name = '_CALLED_SC_CARTSESSION_GETCARTLIST_' . $productTypeId; if (defined($const_name)) { $is_first = true; } else { define($const_name, true); $is_first = false; } */ for ($i = 0; $i <= $max; $i++) { if (isset($this->cartSession[$productTypeId][$i]['cart_no']) && $this->cartSession[$productTypeId][$i]['cart_no'] != '') { // 商品情報は常に取得 // TODO: 同一インスタンス内では1回のみ呼ぶようにしたい // TODO: ここの商品の合計処理は getAllProductsTotalや getAllProductsTaxとで類似重複なので統一出来そう /* // 同一セッション内では初回のみDB参照するようにしている if (!$is_first) { $this->setCartSession4getCartList($productTypeId, $i); } */ $this->cartSession[$productTypeId][$i]['productsClass'] =& $objProduct->getDetailAndProductsClass($this->cartSession[$productTypeId][$i]['id']); $price = $this->cartSession[$productTypeId][$i]['productsClass']['price02']; $this->cartSession[$productTypeId][$i]['price'] = $price; $this->cartSession[$productTypeId][$i]['point_rate'] = $this->cartSession[$productTypeId][$i]['productsClass']['point_rate']; $quantity = $this->cartSession[$productTypeId][$i]['quantity']; $arrTaxRule = SC_Helper_TaxRule_Ex::getTaxRule($this->cartSession[$productTypeId][$i]['productsClass']['product_id'], $this->cartSession[$productTypeId][$i]['productsClass']['product_class_id'], $pref_id, $country_id); $incTax = $price + SC_Helper_TaxRule_Ex::calcTax($price, $arrTaxRule['tax_rate'], $arrTaxRule['tax_rule'], $arrTaxRule['tax_adjust']); $total = $incTax * $quantity; $this->cartSession[$productTypeId][$i]['price_inctax'] = $incTax; $this->cartSession[$productTypeId][$i]['total_inctax'] = $total; $this->cartSession[$productTypeId][$i]['tax_rate'] = $arrTaxRule['tax_rate']; $this->cartSession[$productTypeId][$i]['tax_rule'] = $arrTaxRule['tax_rule']; $this->cartSession[$productTypeId][$i]['tax_adjust'] = $arrTaxRule['tax_adjust']; $arrRet[] = $this->cartSession[$productTypeId][$i]; // セッション変数のデータ量を抑制するため、一部の商品情報を切り捨てる // XXX 上で「常に取得」するのだから、丸ごと切り捨てて良さそうにも感じる。 $this->adjustSessionProductsClass($this->cartSession[$productTypeId][$i]['productsClass']); } } return $arrRet; }
/** * 受注商品の追加/更新を行う. * * 小画面で選択した受注商品をフォームに反映させる. * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @return void */ function doRegisterProduct(&$objFormParam) { $product_class_id = $objFormParam->getValue('add_product_class_id'); if (SC_Utils_Ex::isBlank($product_class_id)) { $product_class_id = $objFormParam->getValue('edit_product_class_id'); $changed_no = $objFormParam->getValue('no'); } // FXIME バリデーションを通さず $objFormParam の値で DB 問い合わせしている。(管理機能ため、さほど問題は無いと思うものの…) // 商品規格IDが指定されていない場合、例外エラーを発生 if (strlen($product_class_id) === 0) { trigger_error('商品規格指定なし', E_USER_ERROR); } // 選択済みの商品であれば数量を1増やす $exists = false; $arrExistsProductClassIds = $objFormParam->getValue('product_class_id'); foreach ($arrExistsProductClassIds as $key => $value) { $exists_product_class_id = $arrExistsProductClassIds[$key]; if ($exists_product_class_id == $product_class_id) { $exists = true; $exists_no = $key; $arrExistsQuantity = $objFormParam->getValue('quantity'); $arrExistsQuantity[$key]++; $objFormParam->setValue('quantity', $arrExistsQuantity); } } // 新しく商品を追加した場合はフォームに登録 // 商品を変更した場合は、該当行を変更 if (!$exists) { $objProduct = new SC_Product_Ex(); $arrProduct = $objProduct->getDetailAndProductsClass($product_class_id); // 一致する商品規格がない場合、例外エラーを発生 if (empty($arrProduct)) { trigger_error('商品規格一致なし', E_USER_ERROR); } $arrProduct['quantity'] = 1; $arrProduct['price'] = $arrProduct['price02']; $arrProduct['product_name'] = $arrProduct['name']; $arrUpdateKeys = array('product_id', 'product_class_id', 'product_type_id', 'point_rate', 'product_code', 'product_name', 'classcategory_name1', 'classcategory_name2', 'quantity', 'price'); foreach ($arrUpdateKeys as $key) { $arrValues = $objFormParam->getValue($key); // FIXME getValueで文字列が返る場合があるので配列であるかをチェック if (!is_array($arrValues)) { $arrValues = array(); } if (isset($changed_no)) { $arrValues[$changed_no] = $arrProduct[$key]; } else { $added_no = 0; if (is_array($arrExistsProductClassIds)) { $added_no = count($arrExistsProductClassIds); } $arrValues[$added_no] = $arrProduct[$key]; } $objFormParam->setValue($key, $arrValues); } } elseif (isset($changed_no) && $exists_no != $changed_no) { // 変更したが、選択済みの商品だった場合は、変更対象行を削除。 $this->doDeleteProduct($changed_no, $objFormParam); } }
/** * 商品種別ごとにカート内商品の一覧を取得する. * * @param integer $productTypeId 商品種別ID * @return array カート内商品一覧の配列 */ function getCartList($productTypeId) { $objProduct = new SC_Product_Ex(); $max = $this->getMax($productTypeId); $arrRet = array(); for ($i = 0; $i <= $max; $i++) { if (isset($this->cartSession[$productTypeId][$i]['cart_no']) && $this->cartSession[$productTypeId][$i]['cart_no'] != '') { // 商品情報は常に取得 // TODO 同一インスタンス内では1回のみ呼ぶようにしたい $this->cartSession[$productTypeId][$i]['productsClass'] =& $objProduct->getDetailAndProductsClass($this->cartSession[$productTypeId][$i]['id']); $price = $this->cartSession[$productTypeId][$i]['productsClass']['price02']; $this->cartSession[$productTypeId][$i]['price'] = $price; $this->cartSession[$productTypeId][$i]['point_rate'] = $this->cartSession[$productTypeId][$i]['productsClass']['point_rate']; $quantity = $this->cartSession[$productTypeId][$i]['quantity']; $incTax = SC_Helper_DB_Ex::sfCalcIncTax($price); $total = $incTax * $quantity; $this->cartSession[$productTypeId][$i]['total_inctax'] = $total; $arrRet[] = $this->cartSession[$productTypeId][$i]; // セッション変数のデータ量を抑制するため、一部の商品情報を切り捨てる // XXX 上で「常に取得」するのだから、丸ごと切り捨てて良さそうにも感じる。 $this->adjustSessionProductsClass($this->cartSession[$productTypeId][$i]['productsClass']); } } return $arrRet; }
/** * 商品を変更 * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @param integer $edit_product_class_id 変更商品規格ID * @param integer $change_no 変更対象 * @return void */ public function shipmentEditProduct(&$objFormParam, $edit_product_class_id, $change_no) { $arrPreProductClassIds = $objFormParam->getValue('product_class_id'); $select_shipping_id = $objFormParam->getValue('select_shipping_id'); $arrShipmentProducts = $this->getShipmentProducts($objFormParam); $pre_shipment_product_class_id = $arrShipmentProducts['shipment_product_class_id'][$select_shipping_id][$change_no]; if ($pre_shipment_product_class_id == $edit_product_class_id) { // 商品規格に変更がない場合は何もしない } elseif (in_array($edit_product_class_id, $arrShipmentProducts['shipment_product_class_id'][$select_shipping_id])) { // 商品規格の変更によって商品の重複が発生する場合は一つにまとめる $arrShipmentProducts = $this->deleteShipment($objFormParam, $this->arrShipmentItemKeys, $select_shipping_id, $change_no); foreach ($arrShipmentProducts['shipment_product_class_id'][$select_shipping_id] as $relation_index => $shipment_product_class_id) { if ($shipment_product_class_id == $edit_product_class_id) { $arrShipmentProducts['shipment_quantity'][$select_shipping_id][$relation_index]++; break; } } } else { $objProduct = new SC_Product_Ex(); $arrAddProductInfo = $objProduct->getDetailAndProductsClass($edit_product_class_id); //上書き $this->changeShipmentProducts($arrShipmentProducts, $arrAddProductInfo, $select_shipping_id, $change_no); //受注商品情報も上書き $arrTax = SC_Helper_TaxRule_Ex::getTaxRule(0, $edit_product_class_id); // 実際はedit $arrAddProductInfo['product_name'] = $arrAddProductInfo['product_name'] ? $arrAddProductInfo['product_name'] : $arrAddProductInfo['name']; $arrAddProductInfo['price'] = $arrAddProductInfo['price'] ? $arrAddProductInfo['price'] : $arrAddProductInfo['price02']; $arrAddProductInfo['quantity'] = 1; $arrAddProductInfo['tax_rate'] = $objFormParam->getValue('order_tax_rate') == '' ? $arrTax['tax_rate'] : $objFormParam->getValue('order_tax_rate'); $arrAddProductInfo['tax_rule'] = $objFormParam->getValue('order_tax_rule') == '' ? $arrTax['tax_rule'] : $objFormParam->getValue('order_tax_rule'); $arrProductClassIds = $objFormParam->getValue('product_class_id'); foreach ($arrProductClassIds as $key => $product_class_id) { if ($product_class_id == $pre_shipment_product_class_id) { foreach ($this->arrProductKeys as $insert_key) { $value = $objFormParam->getValue($insert_key); $arrAddProducts[$insert_key] = is_array($value) ? $value : array(); $arrAddProducts[$insert_key][$key] = $arrAddProductInfo[$insert_key]; } } } $objFormParam->setParam($arrAddProducts); } $objFormParam->setParam($arrShipmentProducts); foreach ($arrNewShipmentProducts['shipment_product_class_id'] as $shipping_id => $arrShipmentProductClassIds) { if (in_array($pre_shipment_product_class_id, $arrShipmentProductClassIds)) { $is_product_delete = false; break; } } //商品情報から削除 if ($is_product_delete) { $this->checkDeleteProducts($objFormParam, $arrPreProductClassIds, $pre_shipment_product_class_id, $this->arrProductKeys); } }
/** * 商品を変更 * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @param integer $add_product_class_id 変更商品規格ID * @param integer $change_no 変更対象 * @return void */ public function shipmentEditProduct(&$objFormParam, $edit_product_class_id, $change_no) { $arrPreProductClassIds = $objFormParam->getValue('product_class_id'); $select_shipping_id = $objFormParam->getValue('select_shipping_id'); $arrShipmentProducts = $this->getShipmentProducts($objFormParam); //既にあるデータは1つだけ数量を1増やす $pre_shipment_product_class_id = $arrShipmentProducts['shipment_product_class_id'][$select_shipping_id][$change_no]; if ($pre_shipment_product_class_id == $edit_product_class_id) { $arrShipmentProducts['shipment_quantity'][$select_shipping_id][$change_no]++; } elseif (in_array($edit_product_class_id, $arrShipmentProducts['shipment_product_class_id'][$select_shipping_id])) { //配送先データ削除 $arrShipmentProducts = $this->deleteShipment($objFormParam, $this->arrShipmentItemKeys, $select_shipping_id, $change_no); foreach ($arrShipmentProducts['shipment_product_class_id'][$select_shipping_id] as $relation_index => $shipment_product_class_id) { if ($shipment_product_class_id == $edit_product_class_id) { $arrShipmentProducts['shipment_quantity'][$select_shipping_id][$relation_index]++; break; } } } else { $objProduct = new SC_Product_Ex(); $arrAddProductInfo = $objProduct->getDetailAndProductsClass($edit_product_class_id); //上書き $this->changeShipmentProducts($arrShipmentProducts, $arrAddProductInfo, $select_shipping_id, $change_no); //受注商品情報に追加 $arrProducts = $this->checkInsertOrderProducts($objFormParam, $arrPreProductClassIds, $edit_product_class_id, $arrAddProductInfo); $objFormParam->setParam($arrProducts); } $objFormParam->setParam($arrShipmentProducts); //更新のみの場合、全配列を持っていないので、新しい配列を取得 $arrNewShipmentProducts = $this->getShipmentProducts($objFormParam); $is_product_delete = true; //変更前のproduct_class_idが他の届け先にも存在するか foreach ($arrNewShipmentProducts['shipment_product_class_id'] as $shipping_id => $arrShipmentProductClassIds) { if (in_array($pre_shipment_product_class_id, $arrShipmentProductClassIds)) { $is_product_delete = false; break; } } //商品情報から削除 if ($is_product_delete) { $this->checkDeleteProducts($objFormParam, $arrPreProductClassIds, $pre_shipment_product_class_id, $this->arrProductKeys); } }
protected function setOrderParam(SC_FormParam &$objFormParam, $vid, $aid, $re_download = false) { $config = SC_AuonePayment_Ex::getConfig(); $objProduct = new SC_Product_Ex(); $objPurchase = new SC_Helper_Purchase_Ex(); $objCustomer = new SC_Customer_Ex(); $this->lfInitParamOrder($objFormParam); $arrRet = array(); $objPurchase->copyFromCustomer($arrRet, $objCustomer); $objPurchase->copyFromCustomer($arrRet, $objCustomer, "shipping"); $arrRet["order_name01"] = str_replace(" ", "+", $arrRet["order_name01"]); $arrRet["order_name02"] = str_replace(" ", "+", $arrRet["order_name02"]); $arrRet["order_kana01"] = str_replace(" ", "+", $arrRet["order_kana01"]); $arrRet["order_kana02"] = str_replace(" ", "+", $arrRet["order_kana02"]); $product_class_id = SC_Utils_Ex::sfGetProductClassId($this->tpl_product_id); $arrProductClass = $objProduct->getDetailAndProductsClass($product_class_id); $objFormParam->setParam($arrProductClass); $objFormParam->setParam($arrRet); // きせかえタッチ情報 $objFormParam->setValue("kisekae_provider_id", $config['cpid']); $objFormParam->setValue("kisekae_site_id", $config['siteid']); $objFormParam->setValue("kisekae_contents_id", $objFormParam->getValue("product_code")); $objFormParam->setValue("kisekae_validateion_id", $vid); $objFormParam->setValue("kisekae_authentication_id", $aid); $use_point = 0; $objFormParam->setValue("use_point", $use_point); $objFormParam->setValue("quantity", 1); $objFormParam->setValue("product_name", $arrProductClass["name"]); $objFormParam->setValue("tax_rate", 0); $objFormParam->setValue("tax_rule", 0); $objFormParam->setValue("price", $arrProductClass["price02"]); $objFormParam->setValue("use_point", $arrProductClass["price02"]); if ($re_download) { $objFormParam->setValue("use_point", 0); } elseif ($objCustomer->getValue("buy_to_nopoint") == "1") { $objFormParam->setValue("use_point", 0); } $use_point = $objFormParam->getValue("use_point", 0); $use_point = intval($use_point); $objFormParam->setValue("deliv_id", 0); // 配送方法 0 基本管理画面では操作しない $objFormParam->setValue("payment_id", 0); // 支払方法 0 基本管理画面では操作しない $objFormParam->setValue("deliv_fee", 0); // 配送料金 0 基本管理画面では操作しない $objFormParam->setValue("status", ORDER_PENDING); // 配送料金 0 基本管理画面では操作しない $objFormParam->setValue("deliv_id", 0); $objFormParam->setValue("payment_id", 0); $objFormParam->setValue("deliv_fee", 0); // 注文合計 // 全ポイント払い $objFormParam->setValue('tax', 0); $objFormParam->setValue('subtotal', $use_point); $objFormParam->setValue('total', $use_point); $objFormParam->setValue('payment_total', 0); $objFormParam->setValue('discount', 0); $objFormParam->setValue('deliv_fee', 0); $objFormParam->setValue('charge', 0); }
function sfSendOrderMail($order_id, $template_id, $subject = '', $header = '', $footer = '', $send = true) { $arrTplVar = new stdClass(); $arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); $arrTplVar->arrInfo = $arrInfo; $objQuery =& SC_Query_Ex::getSingletonInstance(); if ($subject == '' && $header == '' && $footer == '') { // メールテンプレート情報の取得 $where = 'template_id = ?'; $arrRet = $objQuery->select('subject, header, footer', 'dtb_mailtemplate', $where, array($template_id)); $arrTplVar->tpl_header = $arrRet[0]['header']; $arrTplVar->tpl_footer = $arrRet[0]['footer']; $tmp_subject = $arrRet[0]['subject']; } else { $arrTplVar->tpl_header = $header; $arrTplVar->tpl_footer = $footer; $tmp_subject = $subject; } // 受注情報の取得 $where = 'order_id = ? AND del_flg = 0'; $arrOrder = $objQuery->getRow('*', 'dtb_order', $where, array($order_id)); if (empty($arrOrder)) { trigger_error("該当する受注が存在しない。(注文番号: {$order_id})", E_USER_ERROR); } $where = 'order_id = ?'; $objQuery->setOrder('order_detail_id'); $arrTplVar->arrOrderDetail = $objQuery->select('*', 'dtb_order_detail', $where, array($order_id)); $objProduct = new SC_Product_Ex(); $objQuery->setOrder('shipping_id'); $arrRet = $objQuery->select('*', 'dtb_shipping', 'order_id = ?', array($order_id)); foreach ($arrRet as $key => $value) { $objQuery->setOrder('shipping_id'); $arrItems = $objQuery->select('*', 'dtb_shipment_item', 'order_id = ? AND shipping_id = ?', array($order_id, $arrRet[$key]['shipping_id'])); foreach ($arrItems as $arrDetail) { foreach ($arrDetail as $detailKey => $detailVal) { $arrRet[$key]['shipment_item'][$arrDetail['product_class_id']][$detailKey] = $detailVal; } $arrRet[$key]['shipment_item'][$arrDetail['product_class_id']]['productsClass'] =& $objProduct->getDetailAndProductsClass($arrDetail['product_class_id']); } } $arrTplVar->arrShipping = $arrRet; $arrTplVar->Message_tmp = $arrOrder['message']; // 会員情報の取得 $customer_id = $arrOrder['customer_id']; $objQuery->setOrder('customer_id'); $arrRet = $objQuery->select('point', 'dtb_customer', 'customer_id = ?', array($customer_id)); $arrCustomer = isset($arrRet[0]) ? $arrRet[0] : ''; $arrTplVar->arrCustomer = $arrCustomer; $arrTplVar->arrOrder = $arrOrder; //その他決済情報 if ($arrOrder['memo02'] != '') { $arrOther = unserialize($arrOrder['memo02']); foreach ($arrOther as $other_key => $other_val) { if (SC_Utils_Ex::sfTrim($other_val['value']) == '') { $arrOther[$other_key]['value'] = ''; } } $arrTplVar->arrOther = $arrOther; } // 都道府県変換 $arrTplVar->arrPref = $this->arrPref; $objCustomer = new SC_Customer_Ex(); $arrTplVar->tpl_user_point = $objCustomer->getValue('point'); $objMailView = null; if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { $objMailView = new SC_MobileView_Ex(); } else { $objMailView = new SC_SiteView_Ex(); } // メール本文の取得 $objMailView->setPage($this->getPage()); $objMailView->assignobj($arrTplVar); $body = $objMailView->fetch($this->arrMAILTPLPATH[$template_id]); // メール送信処理 $objSendMail = new SC_SendMail_Ex(); $bcc = $arrInfo['email01']; $from = $arrInfo['email03']; $error = $arrInfo['email04']; $tosubject = $this->sfMakeSubject($tmp_subject, $objMailView); $objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc); $objSendMail->setTo($arrOrder['order_email'], $arrOrder['order_name01'] . ' ' . $arrOrder['order_name02'] . ' 様'); // 送信フラグ:trueの場合は、送信する。 if ($send) { if ($objSendMail->sendMail()) { $this->sfSaveMailHistory($order_id, $template_id, $tosubject, $body); } } return $objSendMail; }
/** * 商品種別ごとにカート内商品の一覧を取得する. * * @param integer $productTypeId 商品種別ID * @return array カート内商品一覧の配列 */ function getCartList($productTypeId) { $objProduct = new SC_Product_Ex(); $max = $this->getMax($productTypeId); $arrRet = array(); for ($i = 0; $i <= $max; $i++) { if (isset($this->cartSession[$productTypeId][$i]['cart_no']) && $this->cartSession[$productTypeId][$i]['cart_no'] != "") { // 商品情報は常に取得 $this->cartSession[$productTypeId][$i]['productsClass'] =& $objProduct->getDetailAndProductsClass($this->cartSession[$productTypeId][$i]['id']); $this->adjustSessionProductsClass($this->cartSession[$productTypeId][$i]['productsClass']); $price = $this->cartSession[$productTypeId][$i]['productsClass']['price02']; $this->cartSession[$productTypeId][$i]['price'] = $price; $this->cartSession[$productTypeId][$i]['point_rate'] = $this->cartSession[$productTypeId][$i]['productsClass']['point_rate']; $quantity = $this->cartSession[$productTypeId][$i]['quantity']; $incTax = SC_Helper_DB_Ex::sfCalcIncTax($price); $total = $incTax * $quantity; $this->cartSession[$productTypeId][$i]['total_inctax'] = $total; $arrRet[] =& $this->cartSession[$productTypeId][$i]; } } return $arrRet; }
/** * 受注商品の追加/更新を行う. * * 小画面で選択した受注商品をフォームに反映させる. * * @param SC_FormParam $objFormParam SC_FormParam インスタンス * @return void */ function doRegisterProduct(&$objFormParam) { $product_class_id = $objFormParam->getValue('add_product_class_id'); if (SC_Utils_Ex::isBlank($product_class_id)) { $product_class_id = $objFormParam->getValue('edit_product_class_id'); $changed_no = $objFormParam->getValue('no'); } // 選択済みの商品であれば数量を1増やす $exists = false; $arrExistsProductClassIds = $objFormParam->getValue('product_class_id'); foreach (array_keys($arrExistsProductClassIds) as $key) { $exists_product_class_id = $arrExistsProductClassIds[$key]; if ($exists_product_class_id == $product_class_id) { $exists = true; $exists_no = $key; $arrExistsQuantity = $objFormParam->getValue('quantity'); $arrExistsQuantity[$key]++; $objFormParam->setValue('quantity', $arrExistsQuantity); } } // 新しく商品を追加した場合はフォームに登録 // 商品を変更した場合は、該当行を変更 if (!$exists) { $objProduct = new SC_Product_Ex(); $arrProduct = $objProduct->getDetailAndProductsClass($product_class_id); $arrProduct['quantity'] = 1; $arrProduct['price'] = $arrProduct['price02']; $arrProduct['product_name'] = $arrProduct['name']; $arrUpdateKeys = array('product_id', 'product_class_id', 'product_type_id', 'point_rate', 'product_code', 'product_name', 'classcategory_name1', 'classcategory_name2', 'quantity', 'price'); foreach ($arrUpdateKeys as $key) { $arrValues = $objFormParam->getValue($key); if (isset($changed_no)) { $arrValues[$changed_no] = $arrProduct[$key]; } else { $added_no = 0; if (is_array($arrExistsProductClassIds)) { $added_no = count($arrExistsProductClassIds); } $arrValues[$added_no] = $arrProduct[$key]; } $objFormParam->setValue($key, $arrValues); } } elseif (isset($changed_no) && $exists_no != $changed_no) { // 変更したが、選択済みの商品だった場合は、変更対象行を削除。 $this->doDeleteProduct($changed_no, $objFormParam); } }