Ejemplo n.º 1
0
 /**
  * 商品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;
     }
 }
 /**
  * lfGetProductsAllData.
  *
  * @return array $arrProduct 商品情報の配列を返す
  */
 function lfGetProductsAllData()
 {
     $objQuery = SC_Query_Ex::getSingletonInstance();
     //商品情報を取得
     $arrProduct = $this->lfGetProductsAllclass($objQuery);
     // 値の整形
     foreach ($arrProduct as $key => $val) {
         // 画像ファイルの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;
 }
    echo '';
    if ((is_array($_tmp = $this->_tpl_vars['arrProduct']['price02_min']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) == (is_array($_tmp = $this->_tpl_vars['arrProduct']['price02_max']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp))) {
        echo '';
        echo is_array($_tmp = is_array($_tmp = is_array($_tmp = $this->_tpl_vars['arrProduct']['price02_min']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) ? $this->_run_mod_handler('sfPrePoint', true, $_tmp, is_array($_tmp = $this->_tpl_vars['arrProduct']['point_rate']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) : SC_Utils_Ex::sfPrePoint($_tmp, is_array($_tmp = $this->_tpl_vars['arrProduct']['point_rate']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp))) ? $this->_run_mod_handler('n2s', true, $_tmp) : smarty_modifier_n2s($_tmp);
        echo '';
    } else {
        echo '';
        if ((is_array($_tmp = is_array($_tmp = $this->_tpl_vars['arrProduct']['price02_min']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) ? $this->_run_mod_handler('sfPrePoint', true, $_tmp, is_array($_tmp = $this->_tpl_vars['arrProduct']['point_rate']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) : SC_Utils_Ex::sfPrePoint($_tmp, is_array($_tmp = $this->_tpl_vars['arrProduct']['point_rate']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp))) == (is_array($_tmp = is_array($_tmp = $this->_tpl_vars['arrProduct']['price02_max']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) ? $this->_run_mod_handler('sfPrePoint', true, $_tmp, is_array($_tmp = $this->_tpl_vars['arrProduct']['point_rate']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) : SC_Utils_Ex::sfPrePoint($_tmp, is_array($_tmp = $this->_tpl_vars['arrProduct']['point_rate']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)))) {
            echo '';
            echo is_array($_tmp = is_array($_tmp = is_array($_tmp = $this->_tpl_vars['arrProduct']['price02_min']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) ? $this->_run_mod_handler('sfPrePoint', true, $_tmp, is_array($_tmp = $this->_tpl_vars['arrProduct']['point_rate']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) : SC_Utils_Ex::sfPrePoint($_tmp, is_array($_tmp = $this->_tpl_vars['arrProduct']['point_rate']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp))) ? $this->_run_mod_handler('n2s', true, $_tmp) : smarty_modifier_n2s($_tmp);
            echo '';
        } else {
            echo '';
            echo is_array($_tmp = is_array($_tmp = is_array($_tmp = $this->_tpl_vars['arrProduct']['price02_min']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) ? $this->_run_mod_handler('sfPrePoint', true, $_tmp, is_array($_tmp = $this->_tpl_vars['arrProduct']['point_rate']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) : SC_Utils_Ex::sfPrePoint($_tmp, is_array($_tmp = $this->_tpl_vars['arrProduct']['point_rate']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp))) ? $this->_run_mod_handler('n2s', true, $_tmp) : smarty_modifier_n2s($_tmp);
            echo '~';
            echo is_array($_tmp = is_array($_tmp = is_array($_tmp = $this->_tpl_vars['arrProduct']['price02_max']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) ? $this->_run_mod_handler('sfPrePoint', true, $_tmp, is_array($_tmp = $this->_tpl_vars['arrProduct']['point_rate']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) : SC_Utils_Ex::sfPrePoint($_tmp, is_array($_tmp = $this->_tpl_vars['arrProduct']['point_rate']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp))) ? $this->_run_mod_handler('n2s', true, $_tmp) : smarty_modifier_n2s($_tmp);
            echo '';
        }
        echo '';
    }
    echo '';
    ?>
</span><span id="point_dynamic"></span>
                        Pt
                    </div>
                <?php 
}
?>

                                <?php 
if ((is_array($_tmp = is_array($_tmp = $this->_tpl_vars['arrProduct']['maker_name']) ? $this->_run_mod_handler('script_escape', true, $_tmp) : smarty_modifier_script_escape($_tmp)) ? $this->_run_mod_handler('strlen', true, $_tmp) : strlen($_tmp)) >= 1) {
 /**
  * 入力内容のチェックを行う.
  *
  * @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;
 }
 public function getAllProductsPoint($productTypeId)
 {
     // ポイント合計
     $total = 0;
     if (USE_POINT !== false) {
         $max = $this->getMax($productTypeId);
         for ($i = 0; $i <= $max; $i++) {
             $price = $this->cartSession[$productTypeId][$i]['price'];
             $quantity = $this->cartSession[$productTypeId][$i]['quantity'];
             if (!isset($this->cartSession[$productTypeId][$i]['point_rate'])) {
                 $this->cartSession[$productTypeId][$i]['point_rate'] = '';
             }
             $point_rate = $this->cartSession[$productTypeId][$i]['point_rate'];
             if (!isset($this->cartSession[$productTypeId][$i]['id'][0])) {
                 $this->cartSession[$productTypeId][$i]['id'][0] = '';
             }
             $point = SC_Utils_Ex::sfPrePoint($price, $point_rate);
             $total += $point * $quantity;
         }
     }
     return $total;
 }
Ejemplo n.º 6
0
 /**
  * 入力内容のチェックを行う.
  *
  * @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;
 }
Ejemplo n.º 7
0
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     $objQuery = new SC_Query();
     $objView = new SC_SiteView();
     $objSiteInfo = new SC_SiteInfo();
     //店舗情報をセット
     $arrSiteInfo = $objSiteInfo->data;
     //商品IDを取得
     $product_id = $_GET['product_id'];
     $mode = $_GET['mode'];
     if ($product_id != "" and is_numeric($product_id) or $mode == "all") {
         //商品詳細を取得
         $mode == "all" ? $arrProduct = $this->lfGetProductsDetail($objQuery, $mode) : ($arrProduct = $this->lfGetProductsDetail($objQuery, $product_id));
         // 値のセットし直し
         foreach ($arrProduct as $key => $val) {
             //商品価格を税込みに編集
             $arrProduct[$key]["price02"] = SC_Utils_Ex::sfPreTax($arrProduct[$key]["price02"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
             // 画像ファイルのURLセット
             file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_list_image"]) ? $dir = IMAGE_SAVE_URL_RSS : ($dir = IMAGE_TEMP_URL_RSS);
             $arrProduct[$key]["main_list_image"] = $dir . $arrProduct[$key]["main_list_image"];
             file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_image"]) ? $dir = IMAGE_SAVE_URL_RSS : ($dir = IMAGE_TEMP_URL_RSS);
             $arrProduct[$key]["main_image"] = $dir . $arrProduct[$key]["main_image"];
             file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_large_image"]) ? $dir = IMAGE_SAVE_URL_RSS : ($dir = IMAGE_TEMP_URL_RSS);
             $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"], POINT_RULE, $arrProduct[$key]["product_id"]);
             // 在庫無制限
             $arrProduct[$key]["stock_unlimited"] = $arrProduct[$key]["stock_unlimited"] == 1 ? "在庫無制限" : NULL;
         }
     } elseif ($mode == "list") {
         //商品一覧を取得
         $arrProduct = $objQuery->getall("SELECT product_id, name AS product_name FROM dtb_products");
     } else {
         $arrProduct = $this->lfGetProductsAllclass($objQuery);
         // 値のセットし直し
         foreach ($arrProduct as $key => $val) {
             //商品価格を税込みに編集
             $arrProduct[$key]["price01_max"] = SC_Utils_Ex::sfPreTax($arrProduct[$key]["price01_max"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
             $arrProduct[$key]["price01_min"] = SC_Utils_Ex::sfPreTax($arrProduct[$key]["price01_min"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
             $arrProduct[$key]["price02_max"] = SC_Utils_Ex::sfPreTax($arrProduct[$key]["price02_max"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
             $arrProduct[$key]["price02_min"] = SC_Utils_Ex::sfPreTax($arrProduct[$key]["price02_min"], $arrSiteInfo["tax"], $arrSiteInfo["tax_rule"]);
             // 画像ファイルのURLセット
             file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_list_image"]) ? $dir = IMAGE_SAVE_URL_RSS : ($dir = IMAGE_TEMP_URL_RSS);
             $arrProduct[$key]["main_list_image"] = $dir . $arrProduct[$key]["main_list_image"];
             file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_image"]) ? $dir = IMAGE_SAVE_URL_RSS : ($dir = IMAGE_TEMP_URL_RSS);
             $arrProduct[$key]["main_image"] = $dir . $arrProduct[$key]["main_image"];
             file_exists(IMAGE_SAVE_DIR . $arrProduct[$key]["main_large_image"]) ? $dir = IMAGE_SAVE_URL_RSS : ($dir = IMAGE_TEMP_URL_RSS);
             $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"], POINT_RULE, $arrProduct[$key]["product_id"]);
             $arrProduct[$key]["point_min"] = SC_Utils_Ex::sfPrePoint($arrProduct[$key]["price02_min"], $arrProduct[$key]["point_rate"], POINT_RULE, $arrProduct[$key]["product_id"]);
         }
     }
     //商品情報をセット
     $this->arrProduct = $arrProduct;
     if (is_array(SC_Utils_Ex::sfswaparray($arrProduct))) {
         $this->arrProductKeys = array_keys(SC_Utils_Ex::sfswaparray($arrProduct));
     }
     //店舗情報をセット
     $this->arrSiteInfo = $arrSiteInfo;
     //セットしたデータをテンプレートファイルに出力
     $objView->assignobj($this);
     //キャッシュしない(念のため)
     header("Pragma: no-cache");
     //XMLテキスト(これがないと正常にRSSとして認識してくれないツールがあるため)
     header("Content-type: application/xml");
     DETAIL_P_HTML;
     //画面表示
     $objView->display($this->tpl_mainpage, true);
 }
Ejemplo n.º 8
0
 function lfCheek($arrInfo, $mode = "")
 {
     $objDb = new SC_Helper_DB_Ex();
     $arrVal = $this->objFormParam->getHashArray();
     $arrErr = array();
     // 商品の種類数
     $max = count($arrVal['quantity']);
     $subtotal = 0;
     $totalpoint = 0;
     $totaltax = 0;
     for ($i = 0; $i < $max; $i++) {
         // 小計の計算
         $subtotal += SC_Utils_Ex::sfPreTax($arrVal['price'][$i], $arrInfo['tax'], $arrInfo['tax_rule']) * $arrVal['quantity'][$i];
         // 小計の計算
         $totaltax += SC_Utils_Ex::sfTax($arrVal['price'][$i], $arrInfo['tax'], $arrInfo['tax_rule']) * $arrVal['quantity'][$i];
         // 加算ポイントの計算
         $totalpoint += SC_Utils_Ex::sfPrePoint($arrVal['price'][$i], $arrVal['point_rate'][$i]) * $arrVal['quantity'][$i];
     }
     // 消費税
     $arrVal['tax'] = $totaltax;
     // 小計
     $arrVal['subtotal'] = $subtotal;
     // 合計
     $arrVal['total'] = $subtotal - $arrVal['discount'] + $arrVal['deliv_fee'] + $arrVal['charge'];
     // お支払い合計
     $arrVal['payment_total'] = $arrVal['total'] - $arrVal['use_point'] * POINT_VALUE;
     // 加算ポイント
     $arrVal['add_point'] = SC_Utils_Ex::sfGetAddPoint($totalpoint, $arrVal['use_point'], $arrInfo);
     if (strlen($_POST['customer_id']) > 0) {
         list($arrVal['point'], $arrVal['total_point']) = $objDb->sfGetCustomerPointFromCid($_POST['customer_id'], $arrVal['use_point'], $arrVal['add_point']);
     } else {
         list($arrVal['point'], $arrVal['total_point']) = $objDb->sfGetCustomerPoint($_POST['order_id'], $arrVal['use_point'], $arrVal['add_point']);
     }
     if ($arrVal['total'] < 0) {
         $arrErr['total'] = '合計額がマイナス表示にならないように調整して下さい。<br />';
     }
     if ($arrVal['payment_total'] < 0) {
         $arrErr['payment_total'] = 'お支払い合計額がマイナス表示にならないように調整して下さい。<br />';
     }
     //新規追加受注のみ
     if ($mode == "add") {
         if ($arrVal['total_point'] < 0) {
             $arrErr['use_point'] = '最終保持ポイントがマイナス表示にならないように調整して下さい。<br />';
         }
     }
     $this->objFormParam->setParam($arrVal);
     return $arrErr;
 }
 /**
  * 入力内容のチェックを行う.
  *
  * @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;
 }
Ejemplo n.º 10
0
 function getAllProductsPoint()
 {
     // ポイント合計
     $total = 0;
     $max = $this->getMax();
     for ($i = 0; $i <= $max; $i++) {
         $price = $_SESSION[$this->key][$i]['price'];
         $quantity = $_SESSION[$this->key][$i]['quantity'];
         if (!isset($_SESSION[$this->key][$i]['point_rate'])) {
             $_SESSION[$this->key][$i]['point_rate'] = "";
         }
         $point_rate = $_SESSION[$this->key][$i]['point_rate'];
         if (!isset($_SESSION[$this->key][$i]['id'][0])) {
             $_SESSION[$this->key][$i]['id'][0] = "";
         }
         $id = $_SESSION[$this->key][$i]['id'][0];
         $point = SC_Utils_Ex::sfPrePoint($price, $point_rate, POINT_RULE, $id);
         $total += $point * $quantity;
     }
     return $total;
 }