Source for file LC_Page_Mypage_DeliveryAddr.php
Documentation is available at LC_Page_Mypage_DeliveryAddr.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once CLASS_EX_REALDIR . 'page_extends/LC_Page_Ex.php';
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_Mypage_DeliveryAddr.php 21012 2011-07-04 05:46:12Z shutta $
$this->tpl_title = "お届け先の追加・変更";
$masterData = new SC_DB_MasterData_Ex();
$this->arrPref = $masterData->getMasterData('mtb_pref');
$this->httpCacheControl('nocache');
$this->validUrl = array(MYPAGE_DELIVADDR_URLPATH,
$objCustomer = new SC_Customer_Ex();
$ParentPage = MYPAGE_DELIVADDR_URLPATH;
// GETでページを指定されている場合には指定ページに戻す
if (isset ($_GET['page'])) {
} else if (isset ($_POST['ParentPage'])) {
$this->ParentPage = $ParentPage;
* 未ログインでも, 複数配送設定ページからのアクセスの場合は表示する
* TODO 購入遷移とMyPageで別クラスにすべき
if (!$objCustomer->isLoginSuccess(true) && $ParentPage != MULTIPLE_URLPATH){
$this->tpl_onload = "fnUpdateParent('". $this->getLocation($_POST['ParentPage']) . "'); window.close();";
// other_deliv_id のあるなしで追加か編集か判定しているらしい
$_SESSION['other_deliv_id'] = $_REQUEST['other_deliv_id'];
// パラメーター管理クラス,パラメーター情報の初期化
$objFormParam = new SC_FormParam_Ex();
SC_Helper_Customer_Ex::sfCustomerOtherDelivParam($objFormParam);
$objFormParam->setParam($_POST);
$this->arrForm = $objFormParam->getHashArray();
switch ($this->getMode()) {
$this->arrErr = SC_Helper_Customer_Ex::sfCustomerOtherDelivErrorCheck($objFormParam);
if(empty($this->arrErr)) {
if (in_array($_POST['ParentPage'], $this->validUrl)) {
$this->tpl_onload = "fnUpdateParent('". $this->getLocation($_POST['ParentPage']) . "'); window.close();";
SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
if ($objCustomer->isLoginSuccess(true)) {
$this->lfRegistData($objFormParam, $objCustomer->getValue("customer_id"));
if(SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
SC_Response_Ex::sendRedirect($this->getLocation($_POST['ParentPage']));
if ($_GET['other_deliv_id'] != ""){
$arrOtherDeliv = $this->lfGetOtherDeliv($objCustomer->getValue("customer_id"), $_SESSION['other_deliv_id']);
if (!$objCustomer->isLoginSuccess(true)
|| count($arrOtherDeliv) == 0){
SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
$this->arrForm = $arrOtherDeliv[0];
if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
$this->tpl_mainpage = 'mypage/delivery_addr.tpl';
$this->setTemplate('mypage/delivery_addr.tpl');
* @param mixed $customer_id
* @param mixed $other_deliv_id
function lfGetOtherDeliv($customer_id, $other_deliv_id) {
$objQuery = & SC_Query_Ex::getSingletonInstance();
return $objQuery->select("*", "dtb_other_deliv", "customer_id = ? AND other_deliv_id = ?", array($customer_id, $other_deliv_id));
$objQuery = & SC_Query_Ex::getSingletonInstance();
$arrRet = $objFormParam->getHashArray();
$sqlval = $objFormParam->getDbArray();
$sqlval['customer_id'] = $customer_id;
if (strlen($arrRet['other_deliv_id'] == 0)) {
$deliv_count = $objQuery->count("dtb_other_deliv", "customer_id = ?", array($customer_id));
// 別のお届け先最大登録数に達している場合、エラー
if ($deliv_count >= DELIV_ADDR_MAX) {
SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", false, '別のお届け先最大登録数に達しています。');
$sqlval['other_deliv_id'] = $objQuery->nextVal('dtb_other_deliv_other_deliv_id');
$objQuery->insert("dtb_other_deliv", $sqlval);
$deliv_count = $objQuery->count("dtb_other_deliv","customer_id = ? AND other_deliv_id = ?" ,array($customer_id, $arrRet['other_deliv_id']));
SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", false, '一致する別のお届け先がありません。');
$objQuery->update("dtb_other_deliv", $sqlval, "other_deliv_id = ?", array($arrRet['other_deliv_id']));
$arrRegistColumn = $objFormParam->getDbArray();
foreach ($arrRegistColumn as $key => $val) {
$arrRegist['shipping_' . $key ] = $val;
if (count($_SESSION['shipping']) >= DELIV_ADDR_MAX) {
SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", false, '別のお届け先最大登録数に達しています。');
$_SESSION['shipping'][] = $arrRegist;
Documentation generated on Fri, 24 Feb 2012 14:02:06 +0900 by Seasoft
|