Ejemplo n.º 1
0
 /**
  * 複数配送情報を一時保存する.
  *
  * 会員ログインしている場合は, その他のお届け先から住所情報を取得する.
  *
  * @param   integer         $uniqid       一時受注テーブルのユニークID
  * @param   FormParam       $objFormParam FormParam インスタンス
  * @param   Customer        $objCustomer  Customer インスタンス
  * @param   PurchaseHelper  $objPurchase  PurchaseHelper インスタンス
  * @param   AddressHelper   $objAddress
  * @return  void
  */
 public function saveMultipleShippings($uniqid, FormParam &$objFormParam, Customer &$objCustomer, PurchaseHelper &$objPurchase, AddressHelper &$objAddress)
 {
     $arrValues = array();
     $arrItemTemp = array();
     $arrParams = $objFormParam->getSwapArray();
     foreach ($arrParams as $arrParam) {
         $other_deliv_id = $arrParam['shipping'];
         if ($objCustomer->isLoginSuccess(true)) {
             if ($other_deliv_id != 0) {
                 $otherDeliv = $objAddress->getAddress($other_deliv_id, $objCustomer->getValue('customer_id'));
                 if (!$otherDeliv) {
                     Utils::sfDispSiteError(FREE_ERROR_MSG, '', false, "入力値が不正です。<br />正しい値を入力してください。");
                     Application::alias('eccube.response')->actionExit();
                 }
                 foreach ($otherDeliv as $key => $val) {
                     $arrValues[$other_deliv_id]['shipping_' . $key] = $val;
                 }
             } else {
                 $objPurchase->copyFromCustomer($arrValues[0], $objCustomer, 'shipping');
             }
         } else {
             $arrValues = $objPurchase->getShippingTemp();
         }
         if (!isset($arrItemTemp[$other_deliv_id])) {
             $arrItemTemp[$other_deliv_id] = array();
         }
         if (!isset($arrItemTemp[$other_deliv_id][$arrParam['product_class_id']])) {
             $arrItemTemp[$other_deliv_id][$arrParam['product_class_id']] = 0;
         }
         $arrItemTemp[$other_deliv_id][$arrParam['product_class_id']] += $arrParam['quantity'];
     }
     $objPurchase->clearShipmentItemTemp();
     foreach ($arrValues as $shipping_id => $arrVal) {
         $objPurchase->saveShippingTemp($arrVal, $shipping_id);
     }
     foreach ($arrItemTemp as $other_deliv_id => $arrProductClassIds) {
         foreach ($arrProductClassIds as $product_class_id => $quantity) {
             if ($quantity == 0) {
                 continue;
             }
             $objPurchase->setShipmentItemTemp($other_deliv_id, $product_class_id, $quantity);
         }
     }
     //不必要な配送先を削除
     foreach ($_SESSION['shipping'] as $id => $arrShipping) {
         if (!isset($arrShipping['shipment_item'])) {
             $objPurchase->unsetOneShippingTemp($id);
         }
     }
     // $arrValues[0] には, 購入者の情報が格納されている
     $objPurchase->saveOrderTemp($uniqid, $arrValues[0], $objCustomer);
 }
Ejemplo n.º 2
0
 /**
  * Add product to authenticated user's favorites. (for Smart phone)
  *
  * @param  Customer $objCustomer
  * @return void
  */
 public function doAddFavoriteSphone(Customer $objCustomer)
 {
     // ログイン中のユーザが商品をお気に入りにいれる処理(スマートフォン用)
     if ($objCustomer->isLoginSuccess() === true && $this->objFormParam->getValue('favorite_product_id') > 0) {
         $this->arrErr = $this->lfCheckError($this->mode, $this->objFormParam);
         if (count($this->arrErr) == 0) {
             if ($this->lfRegistFavoriteProduct($this->objFormParam->getValue('favorite_product_id'), $objCustomer->getValue('customer_id'))) {
                 $objPlugin = PluginHelper::getSingletonInstance($this->plugin_activate_flg);
                 $objPlugin->doAction('LC_Page_Products_Detail_action_add_favorite_sphone', array($this));
                 print 'true';
                 Application::alias('eccube.response')->actionExit();
             }
         }
         print 'error';
         Application::alias('eccube.response')->actionExit();
     }
 }
Ejemplo n.º 3
0
 /**
  * 会員情報を受注情報にコピーする.
  *
  * ユーザーがログインしていない場合は何もしない.
  * 会員情報を $dest の order_* へコピーする.
  * customer_id は強制的にコピーされる.
  *
  * @param  array       $dest        コピー先の配列
  * @param  Customer $objCustomer Customer インスタンス
  * @param  string      $prefix      コピー先の接頭辞. デフォルト order
  * @param  array       $keys        コピー対象のキー
  * @return void
  */
 public function copyFromCustomer(&$dest, &$objCustomer, $prefix = 'order', $keys = array('name01', 'name02', 'kana01', 'kana02', 'company_name', 'sex', 'zip01', 'zip02', 'country_id', 'zipcode', 'pref', 'addr01', 'addr02', 'tel01', 'tel02', 'tel03', 'fax01', 'fax02', 'fax03', 'job', 'birth', 'email'))
 {
     if ($objCustomer->isLoginSuccess(true)) {
         foreach ($keys as $key) {
             if (in_array($key, $keys)) {
                 $dest[$prefix . '_' . $key] = $objCustomer->getValue($key);
             }
         }
         if (Application::alias('eccube.display')->detectDevice() == DEVICE_TYPE_MOBILE && in_array('email', $keys)) {
             $email_mobile = $objCustomer->getValue('email_mobile');
             if (empty($email_mobile)) {
                 $dest[$prefix . '_email'] = $objCustomer->getValue('email');
             } else {
                 $dest[$prefix . '_email'] = $email_mobile;
             }
         }
         $dest['customer_id'] = $objCustomer->getValue('customer_id');
         $dest['update_date'] = 'CURRENT_TIMESTAMP';
     }
 }