/** * 配送業者IDから, 支払い方法, お届け時間の配列を取得する. * * 結果の連想配列の添字の値は以下の通り * - 'arrDelivTime' - お届け時間の配列 * - 'arrPayment' - 支払い方法の配列 * - 'img_show' - 支払い方法の画像の有無 * * @param CartSession $objCartSess CartSession インスタンス * @param integer $deliv_id 配送業者ID * @return array 支払い方法, お届け時間を格納した配列 */ public function getSelectedDeliv(CartSession &$objCartSess, $deliv_id) { $arrResults = array(); if (strval($deliv_id) === strval(intval($deliv_id))) { $arrResults['arrDelivTime'] = Application::alias('eccube.helper.delivery')->getDelivTime($deliv_id); $total = $objCartSess->getAllProductsTotal($objCartSess->getKey()); $payments_deliv = Application::alias('eccube.helper.delivery')->getPayments($deliv_id); /* @var $objPayment PaymentHelper */ $objPayment = Application::alias('eccube.helper.payment'); $payments_total = $objPayment->getByPrice($total); $arrPayment = array(); foreach ($payments_total as $payment) { if (in_array($payment['payment_id'], $payments_deliv)) { $arrPayment[] = $payment; } } $arrResults['arrPayment'] = $arrPayment; $arrResults['img_show'] = $this->hasPaymentImage($arrResults['arrPayment']); } return $arrResults; }
/** * カートに変化が無いか検証する. * * ユニークIDとセッションのユニークIDを比較し, 異なる場合は * エラー画面を表示する. * * カートが空の場合, 購入ボタン押下後にカートが変更された場合は * カート画面へ遷移する. * * @param string $uniqId ユニークID * @param CartSession $objCartSession * @return void */ public function verifyChangeCart($uniqId, &$objCartSession) { $cartKey = $objCartSession->getKey(); // カート内が空でないか if (Utils::isBlank($cartKey)) { Application::alias('eccube.response')->sendRedirect(CART_URL); exit; } // 初回のみカートの内容を保存 $objCartSession->saveCurrentCart($uniqId, $cartKey); /* * POSTのユニークIDとセッションのユニークIDを比較 *(ユニークIDがPOSTされていない場合はスルー) */ if (!Application::alias('eccube.site_session')->checkUniqId()) { Utils::sfDispSiteError(CANCEL_PURCHASE); exit; } // 購入ボタンを押してから変化がないか $quantity = $objCartSession->getTotalQuantity($cartKey); if ($objCartSession->checkChangeCart($cartKey) || !($quantity > 0)) { Application::alias('eccube.response')->sendRedirect(CART_URL); exit; } }