| 1 | <?php
|
|---|
| 2 | /*
|
|---|
| 3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
|
|---|
| 4 | *
|
|---|
| 5 | * http://www.lockon.co.jp/
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | require_once("../require.php");
|
|---|
| 9 |
|
|---|
| 10 | class LC_Page {
|
|---|
| 11 | function LC_Page() {
|
|---|
| 12 | $this->tpl_mainpage = 'shopping/complete.tpl';
|
|---|
| 13 | $this->tpl_css = URL_DIR.'css/layout/shopping/complete.css';
|
|---|
| 14 | $this->tpl_title = "¤´Ãíʸ´°Î»";
|
|---|
| 15 | global $arrCONVENIENCE;
|
|---|
| 16 | $this->arrCONVENIENCE = $arrCONVENIENCE;
|
|---|
| 17 | global $arrCONVENIMESSAGE;
|
|---|
| 18 | $this->arrCONVENIMESSAGE = $arrCONVENIMESSAGE;
|
|---|
| 19 | global $arrCONVENIENCE;
|
|---|
| 20 | global $arrCONVENIMESSAGE;
|
|---|
| 21 | $objPage->arrCONVENIENCE = $arrCONVENIENCE;
|
|---|
| 22 | $objPage->arrCONVENIMESSAGE = $arrCONVENIMESSAGE;
|
|---|
| 23 | /*
|
|---|
| 24 | session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
|
|---|
| 25 | ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤Î͸ú´ü¸ÂÀÚ¤ìɽ¼¨¤òÍÞÀ©¤¹¤ë¡£
|
|---|
| 26 | private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
|
|---|
| 27 | */
|
|---|
| 28 | session_cache_limiter('private-no-expire');
|
|---|
| 29 |
|
|---|
| 30 | }
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | $conn = new SC_DBConn();
|
|---|
| 34 | $objPage = new LC_Page();
|
|---|
| 35 | $objView = new SC_SiteView();
|
|---|
| 36 | $objSiteSess = new SC_SiteSession();
|
|---|
| 37 | $objCartSess = new SC_CartSession();
|
|---|
| 38 | $objCampaignSess = new SC_CampaignSession();
|
|---|
| 39 | $objSiteInfo = $objView->objSiteInfo;
|
|---|
| 40 | $arrInfo = $objSiteInfo->data;
|
|---|
| 41 | $objCustomer = new SC_Customer();
|
|---|
| 42 | $order_id = '';
|
|---|
| 43 |
|
|---|
| 44 | // Á°¤Î¥Ú¡¼¥¸¤ÇÀµ¤·¤¯ÅÐÏ¿¼ê³¤¤¬¹Ô¤ï¤ì¤¿¤«È½Äê
|
|---|
| 45 | sfIsPrePage($objSiteSess);
|
|---|
| 46 | // ¥æ¡¼¥¶¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ¤È¹ØÆþ¾õÂÖ¤ÎÀµÅöÀ¤ò¥Á¥§¥Ã¥¯
|
|---|
| 47 | $uniqid = sfCheckNormalAccess($objSiteSess, $objCartSess);
|
|---|
| 48 | if ($uniqid != "") {
|
|---|
| 49 |
|
|---|
| 50 | // ´°Î»½èÍý
|
|---|
| 51 | $objQuery = new SC_Query();
|
|---|
| 52 | $objQuery->begin();
|
|---|
| 53 | $order_id = lfDoComplete($objQuery, $uniqid);
|
|---|
| 54 | $objQuery->commit();
|
|---|
| 55 |
|
|---|
| 56 | // ¥»¥Ã¥·¥ç¥ó¤ËÊݴɤµ¤ì¤Æ¤¤¤ë¾ðÊó¤ò¹¹¿·¤¹¤ë
|
|---|
| 57 | $objCustomer->updateSession();
|
|---|
| 58 |
|
|---|
| 59 | // ´°Î»¥á¡¼¥ëÁ÷¿®
|
|---|
| 60 | if($order_id != "") {
|
|---|
| 61 | $order_email = $objQuery->select("order_email", "dtb_order", "order_id = ?", array($order_id));
|
|---|
| 62 |
|
|---|
| 63 | //ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬·ÈÂÓ¤«PC¤«¤Ë±þ¤¸¤ÆÃíʸ´°Î»¥á¡¼¥ë¤Î¥Æ¥ó¥×¥ì¡¼¥È¤òÊѤ¨¤ë
|
|---|
| 64 | if(ereg("(ezweb.ne.jp$|docomo.ne.jp$|softbank.ne.jp$|vodafone.ne.jp$)",$order_email[0]['order_email'])){
|
|---|
| 65 | // ¥â¥Ð¥¤¥ëÈÇ
|
|---|
| 66 | sfSendOrderMail($order_id, '2');
|
|---|
| 67 | }else{
|
|---|
| 68 | // PCÈÇ
|
|---|
| 69 | sfSendOrderMail($order_id, '1');
|
|---|
| 70 | }
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | // ¤½¤Î¾¾ðÊó¤Î¼èÆÀ
|
|---|
| 74 | $arrResults = $objQuery->getall("SELECT memo02, memo05 FROM dtb_order WHERE order_id = ? ", array($order_id));
|
|---|
| 75 |
|
|---|
| 76 | if (count($arrResults) > 0) {
|
|---|
| 77 | if (isset($arrResults[0]["memo02"]) || isset($arrResults[0]["memo05"])) {
|
|---|
| 78 | // ´°Î»²èÌ̤Çɽ¼¨¤¹¤ë·èºÑÆâÍÆ
|
|---|
| 79 | $arrOther = unserialize($arrResults[0]["memo02"]);
|
|---|
| 80 | // ´°Î»²èÌ̤«¤éÁ÷¿®¤¹¤ë·èºÑÆâÍÆ
|
|---|
| 81 | $arrModuleParam = unserialize($arrResults[0]["memo05"]);
|
|---|
| 82 |
|
|---|
| 83 | // ¥Ç¡¼¥¿¤òÊÔ½¸
|
|---|
| 84 | foreach($arrOther as $key => $val){
|
|---|
| 85 | // URL¤Î¾ì¹ç¤Ë¤Ï¥ê¥ó¥¯¤Ä¤¤Çɽ¼¨¤µ¤»¤ë
|
|---|
| 86 | if (preg_match('/^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/', $val["value"])) {
|
|---|
| 87 | $arrOther[$key]["value"] = "<a href='#' onClick=\"window.open('". $val["value"] . "'); \" >" . $val["value"] ."</a>";
|
|---|
| 88 | }
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | $objPage->arrOther = $arrOther;
|
|---|
| 92 | $objPage->arrModuleParam = $arrModuleParam;
|
|---|
| 93 | }
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | // ¥¢¥Õ¥£¥ê¥¨¥¤¥ÈÍÑ¥³¥ó¥Ð¡¼¥¸¥ç¥ó¥¿¥°¤ÎÀßÄê
|
|---|
| 97 | $objPage->tpl_conv_page = AFF_SHOPPING_COMPLETE;
|
|---|
| 98 | $objPage->tpl_aff_option = "order_id=$order_id";
|
|---|
| 99 | //¹ç·×²Á³Ê¤Î¼èÆÀ
|
|---|
| 100 | $total = $objQuery->get("dtb_order", "total", "order_id = ? ", array($order_id));
|
|---|
| 101 | if($total != "") {
|
|---|
| 102 | $objPage->tpl_aff_option.= "|total=$total";
|
|---|
| 103 | }
|
|---|
| 104 | }
|
|---|
| 105 |
|
|---|
| 106 | $objPage->arrInfo = $arrInfo;
|
|---|
| 107 | // ¥¥ã¥ó¥Ú¡¼¥ó¤«¤é¤ÎÁ«°Ü¤«¥Á¥§¥Ã¥¯
|
|---|
| 108 | $objPage->is_campaign = $objCampaignSess->getIsCampaign();
|
|---|
| 109 | $objPage->campaign_dir = $objCampaignSess->getCampaignDir();
|
|---|
| 110 |
|
|---|
| 111 | $objView->assignobj($objPage);
|
|---|
| 112 | // ¥Õ¥ì¡¼¥à¤òÁªÂò(¥¥ã¥ó¥Ú¡¼¥ó¥Ú¡¼¥¸¤«¤éÁ«°Ü¤Ê¤éÊѹ¹)
|
|---|
| 113 | $objCampaignSess->pageView($objView);
|
|---|
| 114 |
|
|---|
| 115 | // ¥»¥Ã¥·¥ç¥ó³«Êü
|
|---|
| 116 | $objCampaignSess->delCampaign();
|
|---|
| 117 | //--------------------------------------------------------------------------------------------------------------------------
|
|---|
| 118 | // ¥¨¥Ó¥¹¥¿¥°°úÅϤ·Íѥǡ¼¥¿¤òÀ¸À®¤¹¤ë
|
|---|
| 119 | function lfGetEbisData($order_id) {
|
|---|
| 120 | $objQuery = new SC_Query();
|
|---|
| 121 | $col = "customer_id, total, order_sex, order_job, to_number(to_char(age(current_timestamp, order_birth), 'YYY'), 999) AS order_age";
|
|---|
| 122 | $arrRet = $objQuery->select($col, "dtb_order", "order_id = ?", array($order_id));
|
|---|
| 123 |
|
|---|
| 124 | if($arrRet[0]['customer_id'] > 0) {
|
|---|
| 125 | // ²ñ°÷ÈÖ¹æ
|
|---|
| 126 | $arrEbis['m1id'] = $arrRet[0]['customer_id'];
|
|---|
| 127 | // Èó²ñ°÷or²ñ°÷
|
|---|
| 128 | $arrEbis['o5id'] = '1';
|
|---|
| 129 | } else {
|
|---|
| 130 | // ²ñ°÷ÈÖ¹æ
|
|---|
| 131 | $arrEbis['m1id'] = '';
|
|---|
| 132 | // Èó²ñ°÷or²ñ°÷
|
|---|
| 133 | $arrEbis['o5id'] = '2';
|
|---|
| 134 | }
|
|---|
| 135 |
|
|---|
| 136 | // ¹ØÆþ¶â³Û
|
|---|
| 137 | $arrEbis['a1id'] = $arrRet[0]['total'];
|
|---|
| 138 | // ÀÊÌ
|
|---|
| 139 | $arrEbis['o2id'] = $arrRet[0]['order_sex'];
|
|---|
| 140 | // ǯÎð
|
|---|
| 141 | $arrEbis['o3id'] = $arrRet[0]['order_age'];
|
|---|
| 142 | // ¿¦¶È
|
|---|
| 143 | $arrEbis['o4id'] = $arrRet[0]['order_job'];
|
|---|
| 144 |
|
|---|
| 145 | $objQuery->setgroupby("product_id");
|
|---|
| 146 | $arrRet = $objQuery->select("product_id", "dtb_order_detail", "order_id = ?", array($order_id));
|
|---|
| 147 | $arrProducts = sfSwapArray($arrRet);
|
|---|
| 148 |
|
|---|
| 149 | $line = "";
|
|---|
| 150 | // ¾¦ÉÊID¤ò¥¢¥ó¥À¡¼¥Ð¡¼¤ÇÀܳ¤¹¤ë¡£
|
|---|
| 151 | foreach($arrProducts['product_id'] as $val) {
|
|---|
| 152 | if($line != "") {
|
|---|
| 153 | $line .= "_$val";
|
|---|
| 154 | } else {
|
|---|
| 155 | $line .= "$val";
|
|---|
| 156 | }
|
|---|
| 157 | }
|
|---|
| 158 |
|
|---|
| 159 | // ¾¦ÉÊID
|
|---|
| 160 | $arrEbis['o1id'] = $line;
|
|---|
| 161 |
|
|---|
| 162 | return $arrEbis;
|
|---|
| 163 | }
|
|---|
| 164 |
|
|---|
| 165 | // ´°Î»½èÍý
|
|---|
| 166 | function lfDoComplete($objQuery, $uniqid) {
|
|---|
| 167 | global $objCartSess;
|
|---|
| 168 | global $objSiteSess;
|
|---|
| 169 | global $objCampaignSess;
|
|---|
| 170 | global $objCustomer;
|
|---|
| 171 | global $arrInfo;
|
|---|
| 172 |
|
|---|
| 173 | // °ì»þ¼õÃí¥Æ¡¼¥Ö¥ë¤ÎÆÉ¹þ
|
|---|
| 174 | $arrData = sfGetOrderTemp($uniqid);
|
|---|
| 175 |
|
|---|
| 176 | // ²ñ°÷¾ðÊóÅÐÏ¿½èÍý
|
|---|
| 177 | if ($objCustomer->isLoginSuccess()) {
|
|---|
| 178 | // ¿·¤ªÆÏ¤±Àè¤ÎÅÐÏ¿
|
|---|
| 179 | lfSetNewAddr($uniqid, $objCustomer->getValue('customer_id'));
|
|---|
| 180 | // ¹ØÆþ½¸·×¤ò¸ÜµÒ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
|
|---|
| 181 | lfSetCustomerPurchase($objCustomer->getValue('customer_id'), $arrData, $objQuery);
|
|---|
| 182 | } else {
|
|---|
| 183 | //¹ØÆþ»þ¶¯À©²ñ°÷ÅÐÏ¿
|
|---|
| 184 | switch(PURCHASE_CUSTOMER_REGIST) {
|
|---|
| 185 | //̵¸ú
|
|---|
| 186 | case '0':
|
|---|
| 187 | // ¹ØÆþ»þ²ñ°÷ÅÐÏ¿
|
|---|
| 188 | if($arrData['member_check'] == '1') {
|
|---|
| 189 | // ²¾²ñ°÷ÅÐÏ¿
|
|---|
| 190 | $customer_id = lfRegistPreCustomer($arrData, $arrInfo);
|
|---|
| 191 | // ¹ØÆþ½¸·×¤ò¸ÜµÒ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
|
|---|
| 192 | lfSetCustomerPurchase($customer_id, $arrData, $objQuery);
|
|---|
| 193 | }
|
|---|
| 194 | break;
|
|---|
| 195 | //͸ú
|
|---|
| 196 | case '1':
|
|---|
| 197 | // ²¾²ñ°÷ÅÐÏ¿
|
|---|
| 198 | $customer_id = lfRegistPreCustomer($arrData, $arrInfo);
|
|---|
| 199 | // ¹ØÆþ½¸·×¤ò¸ÜµÒ¥Æ¡¼¥Ö¥ë¤ËÈ¿±Ç
|
|---|
| 200 | lfSetCustomerPurchase($customer_id, $arrData, $objQuery);
|
|---|
| 201 | break;
|
|---|
| 202 | }
|
|---|
| 203 |
|
|---|
| 204 | }
|
|---|
| 205 | // °ì»þ¥Æ¡¼¥Ö¥ë¤ò¼õÃí¥Æ¡¼¥Ö¥ë¤Ë³ÊǼ¤¹¤ë
|
|---|
| 206 | $order_id = lfRegistOrder($objQuery, $arrData, $objCampaignSess);
|
|---|
| 207 | // ¥«¡¼¥È¾¦Éʤò¼õÃí¾ÜºÙ¥Æ¡¼¥Ö¥ë¤Ë³ÊǼ¤¹¤ë
|
|---|
| 208 | lfRegistOrderDetail($objQuery, $order_id, $objCartSess);
|
|---|
| 209 | // ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Î¾ðÊó¤òºï½ü¤¹¤ë¡£
|
|---|
| 210 | lfDeleteTempOrder($objQuery, $uniqid);
|
|---|
| 211 | // ¥¥ã¥ó¥Ú¡¼¥ó¤«¤é¤ÎÁ«°Ü¤Î¾ì¹çÅÐÏ¿¤¹¤ë¡£
|
|---|
| 212 | if($objCampaignSess->getIsCampaign() and $objCartSess->chkCampaign($objCampaignSess->getCampaignId())) {
|
|---|
| 213 | lfRegistCampaignOrder($objQuery, $objCampaignSess, $order_id);
|
|---|
| 214 | }
|
|---|
| 215 |
|
|---|
| 216 | // ¥»¥Ã¥·¥ç¥ó¥«¡¼¥ÈÆâ¤Î¾¦Éʤòºï½ü¤¹¤ë¡£
|
|---|
| 217 | $objCartSess->delAllProducts();
|
|---|
| 218 | // Ãíʸ°ì»þID¤ò²ò½ü¤¹¤ë¡£
|
|---|
| 219 | $objSiteSess->unsetUniqId();
|
|---|
| 220 |
|
|---|
| 221 | return $order_id;
|
|---|
| 222 | }
|
|---|
| 223 |
|
|---|
| 224 | // ²ñ°÷ÅÐÏ¿¡Ê²¾ÅÐÏ¿¡Ë
|
|---|
| 225 | function lfRegistPreCustomer($arrData, $arrInfo) {
|
|---|
| 226 | // ¹ØÆþ»þ¤Î²ñ°÷ÅÐÏ¿
|
|---|
| 227 | $sqlval['name01'] = $arrData['order_name01'];
|
|---|
| 228 | $sqlval['name02'] = $arrData['order_name02'];
|
|---|
| 229 | $sqlval['kana01'] = $arrData['order_kana01'];
|
|---|
| 230 | $sqlval['kana02'] = $arrData['order_kana02'];
|
|---|
| 231 | $sqlval['zip01'] = $arrData['order_zip01'];
|
|---|
| 232 | $sqlval['zip02'] = $arrData['order_zip02'];
|
|---|
| 233 | $sqlval['pref'] = $arrData['order_pref'];
|
|---|
| 234 | $sqlval['addr01'] = $arrData['order_addr01'];
|
|---|
| 235 | $sqlval['addr02'] = $arrData['order_addr02'];
|
|---|
| 236 | $sqlval['email'] = $arrData['order_email'];
|
|---|
| 237 | $sqlval['tel01'] = $arrData['order_tel01'];
|
|---|
| 238 | $sqlval['tel02'] = $arrData['order_tel02'];
|
|---|
| 239 | $sqlval['tel03'] = $arrData['order_tel03'];
|
|---|
| 240 | $sqlval['fax01'] = $arrData['order_fax01'];
|
|---|
| 241 | $sqlval['fax02'] = $arrData['order_fax02'];
|
|---|
| 242 | $sqlval['fax03'] = $arrData['order_fax03'];
|
|---|
| 243 | $sqlval['sex'] = $arrData['order_sex'];
|
|---|
| 244 | $sqlval['password'] = $arrData['password'];
|
|---|
| 245 | $sqlval['reminder'] = $arrData['reminder'];
|
|---|
| 246 | $sqlval['reminder_answer'] = $arrData['reminder_answer'];
|
|---|
| 247 |
|
|---|
| 248 | // ¥á¥ë¥Þ¥¬ÇÛ¿®Íѥե饰¤ÎȽÄê
|
|---|
| 249 | switch($arrData['mail_flag']) {
|
|---|
| 250 | case '1': // HTML¥á¡¼¥ë
|
|---|
| 251 | $mail_flag = 4;
|
|---|
| 252 | break;
|
|---|
| 253 | case '2': // TEXT¥á¡¼¥ë
|
|---|
| 254 | $mail_flag = 5;
|
|---|
| 255 | break;
|
|---|
| 256 | case '3': // ´õ˾¤Ê¤·
|
|---|
| 257 | $mail_flag = 6;
|
|---|
| 258 | break;
|
|---|
| 259 | default:
|
|---|
| 260 | $mail_flag = 6;
|
|---|
| 261 | break;
|
|---|
| 262 | }
|
|---|
| 263 | // ¥á¥ë¥Þ¥¬¥Õ¥é¥°
|
|---|
| 264 | $sqlval['mailmaga_flg'] = $mail_flag;
|
|---|
| 265 |
|
|---|
| 266 | // ²ñ°÷²¾ÅÐÏ¿
|
|---|
| 267 | $sqlval['status'] = 1;
|
|---|
| 268 | // URLȽÄêÍÑ¥¡¼
|
|---|
| 269 | $sqlval['secret_key'] = sfGetUniqRandomId("t");
|
|---|
| 270 |
|
|---|
| 271 | $objQuery = new SC_Query();
|
|---|
| 272 | $sqlval['create_date'] = "now()";
|
|---|
| 273 | $sqlval['update_date'] = "now()";
|
|---|
| 274 | $objQuery->insert("dtb_customer", $sqlval);
|
|---|
| 275 |
|
|---|
| 276 | // ¸ÜµÒID¤Î¼èÆÀ
|
|---|
| 277 | $arrRet = $objQuery->select("customer_id", "dtb_customer", "secret_key = ?", array($sqlval['secret_key']));
|
|---|
| 278 | $customer_id = $arrRet[0]['customer_id'];
|
|---|
| 279 |
|
|---|
| 280 | //¡¡²¾ÅÐÏ¿´°Î»¥á¡¼¥ëÁ÷¿®
|
|---|
| 281 | $objMailPage = new LC_Page();
|
|---|
| 282 | $objMailPage->to_name01 = $arrData['order_name01'];
|
|---|
| 283 | $objMailPage->to_name02 = $arrData['order_name02'];
|
|---|
| 284 | $objMailPage->CONF = $arrInfo;
|
|---|
| 285 | $objMailPage->uniqid = $sqlval['secret_key'];
|
|---|
| 286 | $objMailView = new SC_SiteView();
|
|---|
| 287 | $objMailView->assignobj($objMailPage);
|
|---|
| 288 | $body = $objMailView->fetch("mail_templates/customer_mail.tpl");
|
|---|
| 289 |
|
|---|
| 290 | $objMail = new GC_SendMail();
|
|---|
| 291 | $objMail->setItem(
|
|---|
| 292 | '' //¡¡°¸Àè
|
|---|
| 293 | , sfMakeSubject("²ñ°÷ÅÐÏ¿¤Î¤´³Îǧ") //¡¡¥µ¥Ö¥¸¥§¥¯¥È
|
|---|
| 294 | , $body //¡¡ËÜʸ
|
|---|
| 295 | , $arrInfo['email03'] //¡¡ÇÛÁ÷¸µ¥¢¥É¥ì¥¹
|
|---|
| 296 | , $arrInfo['shop_name'] //¡¡ÇÛÁ÷¸µ¡¡Ì¾Á°
|
|---|
| 297 | , $arrInfo["email03"] //¡¡reply_to
|
|---|
| 298 | , $arrInfo["email04"] //¡¡return_path
|
|---|
| 299 | , $arrInfo["email04"] // Errors_to
|
|---|
| 300 | , $arrInfo["email01"] // Bcc
|
|---|
| 301 | );
|
|---|
| 302 | // °¸Àè¤ÎÀßÄê
|
|---|
| 303 | $name = $arrData['order_name01'] . $arrData['order_name02'] ." ÍÍ";
|
|---|
| 304 | $objMail->setTo($arrData['order_email'], $name);
|
|---|
| 305 | $objMail->sendMail();
|
|---|
| 306 |
|
|---|
| 307 | return $customer_id;
|
|---|
| 308 | }
|
|---|
| 309 |
|
|---|
| 310 | // ¼õÃí¥Æ¡¼¥Ö¥ë¤ØÅÐÏ¿
|
|---|
| 311 | function lfRegistOrder($objQuery, $arrData, $objCampaignSess) {
|
|---|
| 312 | $sqlval = $arrData;
|
|---|
| 313 |
|
|---|
| 314 | // ¼õÃí¥Æ¡¼¥Ö¥ë¤Ë½ñ¤¹þ¤Þ¤Ê¤¤Îó¤ò½üµî
|
|---|
| 315 | unset($sqlval['mailmaga_flg']); // ¥á¥ë¥Þ¥¬¥Á¥§¥Ã¥¯
|
|---|
| 316 | unset($sqlval['deliv_check']); // Ê̤ΤªÆÏ¤±Àè¥Á¥§¥Ã¥¯
|
|---|
| 317 | unset($sqlval['point_check']); // ¥Ý¥¤¥ó¥ÈÍøÍÑ¥Á¥§¥Ã¥¯
|
|---|
| 318 | unset($sqlval['member_check']); // ¹ØÆþ»þ²ñ°÷¥Á¥§¥Ã¥¯
|
|---|
| 319 | unset($sqlval['password']); // ¥í¥°¥¤¥ó¥Ñ¥¹¥ï¡¼¥É
|
|---|
| 320 | unset($sqlval['reminder']); // ¥ê¥Þ¥¤¥ó¥À¡¼¼ÁÌä
|
|---|
| 321 | unset($sqlval['reminder_answer']); // ¥ê¥Þ¥¤¥ó¥À¡¼Åú¤¨
|
|---|
| 322 | unset($sqlval['mail_flag']); // ¥á¡¼¥ë¥Õ¥é¥°
|
|---|
| 323 | unset($sqlval['session']); // ¥»¥Ã¥·¥ç¥ó¾ðÊó
|
|---|
| 324 |
|
|---|
| 325 | // Ãíʸ¥¹¥Æ¡¼¥¿¥¹:»ØÄ̵꤬¤±¤ì¤Ð¿·µ¬¼õÉÕ¤ËÀßÄê
|
|---|
| 326 | if($sqlval["status"] == ""){
|
|---|
| 327 | $sqlval['status'] = '1';
|
|---|
| 328 | }
|
|---|
| 329 |
|
|---|
| 330 | // Ê̤ΤªÆÏ¤±Àè¤ò»ØÄꤷ¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢ÇÛÁ÷Àè¤ËÅÐÏ¿½»½ê¤ò¥³¥Ô¡¼¤¹¤ë¡£
|
|---|
| 331 | if($arrData["deliv_check"] == "-1") {
|
|---|
| 332 | $sqlval['deliv_name01'] = $arrData['order_name01'];
|
|---|
| 333 | $sqlval['deliv_name02'] = $arrData['order_name02'];
|
|---|
| 334 | $sqlval['deliv_kana01'] = $arrData['order_kana01'];
|
|---|
| 335 | $sqlval['deliv_kana02'] = $arrData['order_kana02'];
|
|---|
| 336 | $sqlval['deliv_pref'] = $arrData['order_pref'];
|
|---|
| 337 | $sqlval['deliv_zip01'] = $arrData['order_zip01'];
|
|---|
| 338 | $sqlval['deliv_zip02'] = $arrData['order_zip02'];
|
|---|
| 339 | $sqlval['deliv_addr01'] = $arrData['order_addr01'];
|
|---|
| 340 | $sqlval['deliv_addr02'] = $arrData['order_addr02'];
|
|---|
| 341 | $sqlval['deliv_tel01'] = $arrData['order_tel01'];
|
|---|
| 342 | $sqlval['deliv_tel02'] = $arrData['order_tel02'];
|
|---|
| 343 | $sqlval['deliv_tel03'] = $arrData['order_tel03'];
|
|---|
| 344 | }
|
|---|
| 345 |
|
|---|
| 346 | $order_id = $arrData['order_id']; // ¥ª¡¼¥À¡¼ID
|
|---|
| 347 | $sqlval['create_date'] = 'now()'; // ¼õÃíÆü
|
|---|
| 348 |
|
|---|
| 349 | // ¥¥ã¥ó¥Ú¡¼¥óID
|
|---|
| 350 | if($objCampaignSess->getIsCampaign()) $sqlval['campaign_id'] = $objCampaignSess->getCampaignId();
|
|---|
| 351 |
|
|---|
| 352 | // ¥²¥Ã¥È¤ÎÃͤò¥¤¥ó¥µ¡¼¥È
|
|---|
| 353 | //$sqlval = lfGetInsParam($sqlval);
|
|---|
| 354 |
|
|---|
| 355 | // INSERT¤Î¼Â¹Ô
|
|---|
| 356 | $objQuery->insert("dtb_order", $sqlval);
|
|---|
| 357 |
|
|---|
| 358 | return $order_id;
|
|---|
| 359 | }
|
|---|
| 360 |
|
|---|
| 361 | // ¼õÃí¾ÜºÙ¥Æ¡¼¥Ö¥ë¤ØÅÐÏ¿
|
|---|
| 362 | function lfRegistOrderDetail($objQuery, $order_id, $objCartSess) {
|
|---|
| 363 | // ¥«¡¼¥ÈÆâ¾ðÊó¤Î¼èÆÀ
|
|---|
| 364 | $arrCart = $objCartSess->getCartList();
|
|---|
| 365 | $max = count($arrCart);
|
|---|
| 366 |
|
|---|
| 367 | // ´û¤Ë¸ºß¤¹¤ë¾ÜºÙ¥ì¥³¡¼¥É¤ò¾Ã¤·¤Æ¤ª¤¯¡£
|
|---|
| 368 | $objQuery->delete("dtb_order_detail", "order_id = $order_id");
|
|---|
| 369 |
|
|---|
| 370 | // µ¬³Ê̾°ìÍ÷
|
|---|
| 371 | $arrClassName = sfGetIDValueList("dtb_class", "class_id", "name");
|
|---|
| 372 | // µ¬³ÊʬÎà̾°ìÍ÷
|
|---|
| 373 | $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
|
|---|
| 374 |
|
|---|
| 375 | for ($i = 0; $i < $max; $i++) {
|
|---|
| 376 | // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ
|
|---|
| 377 | $arrData = sfGetProductsClass($arrCart[$i]['id']);
|
|---|
| 378 |
|
|---|
| 379 | // ¸ºß¤¹¤ë¾¦ÉʤΤßɽ¼¨¤¹¤ë¡£
|
|---|
| 380 | if($arrData != "") {
|
|---|
| 381 | $sqlval['order_id'] = $order_id;
|
|---|
| 382 | $sqlval['product_id'] = $arrCart[$i]['id'][0];
|
|---|
| 383 | $sqlval['classcategory_id1'] = $arrCart[$i]['id'][1];
|
|---|
| 384 | $sqlval['classcategory_id2'] = $arrCart[$i]['id'][2];
|
|---|
| 385 | $sqlval['product_name'] = $arrData['name'];
|
|---|
| 386 | $sqlval['product_code'] = $arrData['product_code'];
|
|---|
| 387 | $sqlval['classcategory_name1'] = $arrClassCatName[$arrData['classcategory_id1']];
|
|---|
| 388 | $sqlval['classcategory_name2'] = $arrClassCatName[$arrData['classcategory_id2']];
|
|---|
| 389 | $sqlval['point_rate'] = $arrCart[$i]['point_rate'];
|
|---|
| 390 | $sqlval['price'] = $arrCart[$i]['price'];
|
|---|
| 391 | $sqlval['quantity'] = $arrCart[$i]['quantity'];
|
|---|
| 392 | lfReduceStock($objQuery, $arrCart[$i]['id'], $arrCart[$i]['quantity']);
|
|---|
| 393 | // INSERT¤Î¼Â¹Ô
|
|---|
| 394 | $objQuery->insert("dtb_order_detail", $sqlval);
|
|---|
| 395 | } else {
|
|---|
| 396 | sfDispSiteError(CART_NOT_FOUND);
|
|---|
| 397 | }
|
|---|
| 398 | }
|
|---|
| 399 | }
|
|---|
| 400 |
|
|---|
| 401 | // ¥¥ã¥ó¥Ú¡¼¥ó¼õÃí¥Æ¡¼¥Ö¥ë¤ØÅÐÏ¿
|
|---|
| 402 | function lfRegistCampaignOrder($objQuery, $objCampaignSess, $order_id) {
|
|---|
| 403 |
|
|---|
| 404 | // ¼õÃí¥Ç¡¼¥¿¤ò¼èÆÀ
|
|---|
| 405 | $cols = "order_id, campaign_id, customer_id, message, order_name01, order_name02,".
|
|---|
| 406 | "order_kana01, order_kana02, order_email, order_tel01, order_tel02, order_tel03,".
|
|---|
| 407 | "order_fax01, order_fax02, order_fax03, order_zip01, order_zip02, order_pref, order_addr01,".
|
|---|
| 408 | "order_addr02, order_sex, order_birth, order_job, deliv_name01, deliv_name02, deliv_kana01,".
|
|---|
| 409 | "deliv_kana02, deliv_tel01, deliv_tel02, deliv_tel03, deliv_fax01, deliv_fax02, deliv_fax03,".
|
|---|
| 410 | "deliv_zip01, deliv_zip02, deliv_pref, deliv_addr01, deliv_addr02, payment_total";
|
|---|
| 411 |
|
|---|
| 412 | $arrOrder = $objQuery->select($cols, "dtb_order", "order_id = ?", array($order_id));
|
|---|
| 413 |
|
|---|
| 414 | $sqlval = $arrOrder[0];
|
|---|
| 415 | $sqlval['create_date'] = 'now()';
|
|---|
| 416 |
|
|---|
| 417 | // INSERT¤Î¼Â¹Ô
|
|---|
| 418 | $objQuery->insert("dtb_campaign_order", $sqlval);
|
|---|
| 419 |
|
|---|
| 420 | // ¿½¤·¹þ¤ß¿ô¤Î¹¹¿·
|
|---|
| 421 | $total_count = $objQuery->get("dtb_campaign", "total_count", "campaign_id = ?", array($sqlval['campaign_id']));
|
|---|
| 422 | $arrCampaign['total_count'] = $total_count += 1;
|
|---|
| 423 | $objQuery->update("dtb_campaign", $arrCampaign, "campaign_id = ?", array($sqlval['campaign_id']));
|
|---|
| 424 |
|
|---|
| 425 | }
|
|---|
| 426 |
|
|---|
| 427 |
|
|---|
| 428 |
|
|---|
| 429 | /* ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Îºï½ü */
|
|---|
| 430 | function lfDeleteTempOrder($objQuery, $uniqid) {
|
|---|
| 431 | $where = "order_temp_id = ?";
|
|---|
| 432 | $sqlval['del_flg'] = 1;
|
|---|
| 433 | $objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
|
|---|
| 434 | // $objQuery->delete("dtb_order_temp", $where, array($uniqid));
|
|---|
| 435 | }
|
|---|
| 436 |
|
|---|
| 437 | // ¼õÃí°ì»þ¥Æ¡¼¥Ö¥ë¤Î½»½ê¤¬ÅÐÏ¿ºÑ¤ß¥Æ¡¼¥Ö¥ë¤È°Û¤Ê¤ë¾ì¹ç¤Ï¡¢Ê̤ΤªÆÏ¤±Àè¤ËÄɲ乤ë
|
|---|
| 438 | function lfSetNewAddr($uniqid, $customer_id) {
|
|---|
| 439 | $objQuery = new SC_Query();
|
|---|
| 440 | $diff = false;
|
|---|
| 441 | $find_same = false;
|
|---|
| 442 |
|
|---|
| 443 | $col = "deliv_name01,deliv_name02,deliv_kana01,deliv_kana02,deliv_tel01,deliv_tel02,deliv_tel03,deliv_zip01,deliv_zip02,deliv_pref,deliv_addr01,deliv_addr02";
|
|---|
| 444 | $where = "order_temp_id = ?";
|
|---|
| 445 | $arrRet = $objQuery->select($col, "dtb_order_temp", $where, array($uniqid));
|
|---|
| 446 |
|
|---|
| 447 | // Í×ÁÇ̾¤Îdeliv_¤òºï½ü¤¹¤ë¡£
|
|---|
| 448 | foreach($arrRet[0] as $key => $val) {
|
|---|
| 449 | $keyname = ereg_replace("^deliv_", "", $key);
|
|---|
| 450 | $arrNew[$keyname] = $val;
|
|---|
| 451 | }
|
|---|
| 452 |
|
|---|
| 453 | // ²ñ°÷¾ðÊ󥯡¼¥Ö¥ë¤È¤ÎÈæ³Ó
|
|---|
| 454 | $col = "name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
|
|---|
| 455 | $where = "customer_id = ?";
|
|---|
| 456 | $arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($customer_id));
|
|---|
| 457 |
|
|---|
| 458 | // ²ñ°÷¾ðÊó¤Î½»½ê¤È°Û¤Ê¤ë¾ì¹ç
|
|---|
| 459 | if($arrNew != $arrCustomerAddr[0]) {
|
|---|
| 460 | // Ê̤ΤªÆÏ¤±Àè¥Æ¡¼¥Ö¥ë¤Î½»½ê¤ÈÈæ³Ó¤¹¤ë
|
|---|
| 461 | $col = "name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
|
|---|
| 462 | $where = "customer_id = ?";
|
|---|
| 463 | $arrOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($customer_id));
|
|---|
| 464 |
|
|---|
| 465 | foreach($arrOtherAddr as $arrval) {
|
|---|
| 466 | if($arrNew == $arrval) {
|
|---|
| 467 | // ¤¹¤Ç¤ËƱ¤¸½»½ê¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë
|
|---|
| 468 | $find_same = true;
|
|---|
| 469 | }
|
|---|
| 470 | }
|
|---|
| 471 |
|
|---|
| 472 | if(!$find_same) {
|
|---|
| 473 | $diff = true;
|
|---|
| 474 | }
|
|---|
| 475 | }
|
|---|
| 476 |
|
|---|
| 477 | // ¿·¤·¤¤¤ªÆÏ¤±À褬ÅÐÏ¿ºÑ¤ß¤Î¤â¤Î¤È°Û¤Ê¤ë¾ì¹ç¤ÏÊ̤ΤªÆÏ¤±Àè¥Æ¡¼¥Ö¥ë¤ËÅÐÏ¿¤¹¤ë
|
|---|
| 478 | if($diff) {
|
|---|
| 479 | $sqlval = $arrNew;
|
|---|
| 480 | $sqlval['customer_id'] = $customer_id;
|
|---|
| 481 | $objQuery->insert("dtb_other_deliv", $sqlval);
|
|---|
| 482 | }
|
|---|
| 483 | }
|
|---|
| 484 |
|
|---|
| 485 | /* ¹ØÆþ¾ðÊó¤ò²ñ°÷¥Æ¡¼¥Ö¥ë¤ËÅÐÏ¿¤¹¤ë */
|
|---|
| 486 | function lfSetCustomerPurchase($customer_id, $arrData, $objQuery) {
|
|---|
| 487 | $col = "first_buy_date, last_buy_date, buy_times, buy_total, point";
|
|---|
| 488 | $where = "customer_id = ?";
|
|---|
| 489 | $arrRet = $objQuery->select($col, "dtb_customer", $where, array($customer_id));
|
|---|
| 490 | $sqlval = $arrRet[0];
|
|---|
| 491 |
|
|---|
| 492 | if($sqlval['first_buy_date'] == "") {
|
|---|
| 493 | $sqlval['first_buy_date'] = "Now()";
|
|---|
| 494 | }
|
|---|
| 495 | $sqlval['last_buy_date'] = "Now()";
|
|---|
| 496 | $sqlval['buy_times']++;
|
|---|
| 497 | $sqlval['buy_total']+= $arrData['total'];
|
|---|
| 498 | $sqlval['point'] = ($sqlval['point'] + $arrData['add_point'] - $arrData['use_point']);
|
|---|
| 499 |
|
|---|
| 500 | // ¥Ý¥¤¥ó¥È¤¬ÉÔ¤·¤Æ¤¤¤ë¾ì¹ç
|
|---|
| 501 | if($sqlval['point'] < 0) {
|
|---|
| 502 | $objQuery->rollback();
|
|---|
| 503 | sfDispSiteError(LACK_POINT);
|
|---|
| 504 | }
|
|---|
| 505 |
|
|---|
| 506 | $objQuery->update("dtb_customer", $sqlval, $where, array($customer_id));
|
|---|
| 507 | }
|
|---|
| 508 |
|
|---|
| 509 | // ºß¸Ë¤ò¸º¤é¤¹½èÍý
|
|---|
| 510 | function lfReduceStock($objQuery, $arrID, $quantity) {
|
|---|
| 511 | $where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?";
|
|---|
| 512 | $arrRet = $objQuery->select("stock, stock_unlimited", "dtb_products_class", $where, $arrID);
|
|---|
| 513 |
|
|---|
| 514 | // Çä¤êÀڤ쥨¥é¡¼
|
|---|
| 515 | if(($arrRet[0]['stock_unlimited'] != '1' && $arrRet[0]['stock'] < $quantity) || $quantity == 0) {
|
|---|
| 516 | $objQuery->rollback();
|
|---|
| 517 | sfDispSiteError(SOLD_OUT, "", true);
|
|---|
| 518 | // ̵À©¸Â¤Î¾ì¹ç¡¢ºß¸Ë¤ÏNULL
|
|---|
| 519 | } elseif($arrRet[0]['stock_unlimited'] == '1') {
|
|---|
| 520 | $sqlval['stock'] = null;
|
|---|
| 521 | $objQuery->update("dtb_products_class", $sqlval, $where, $arrID);
|
|---|
| 522 | // ºß¸Ë¤ò¸º¤é¤¹
|
|---|
| 523 | } else {
|
|---|
| 524 | $sqlval['stock'] = ($arrRet[0]['stock'] - $quantity);
|
|---|
| 525 | if($sqlval['stock'] == "") {
|
|---|
| 526 | $sqlval['stock'] = '0';
|
|---|
| 527 | }
|
|---|
| 528 | $objQuery->update("dtb_products_class", $sqlval, $where, $arrID);
|
|---|
| 529 | }
|
|---|
| 530 | }
|
|---|
| 531 |
|
|---|
| 532 | // GET¤ÎÃͤò¥¤¥ó¥µ¡¼¥ÈÍѤËÀ°¤¨¤ë
|
|---|
| 533 | function lfGetInsParam($sqlVal){
|
|---|
| 534 |
|
|---|
| 535 | foreach($_GET as $key => $val){
|
|---|
| 536 | // ¥«¥é¥à¤Î¸ºß¥Á¥§¥Ã¥¯
|
|---|
| 537 | if(sfColumnExists("dtb_order", $key)) $sqlVal[$key] = $val;
|
|---|
| 538 | }
|
|---|
| 539 |
|
|---|
| 540 | return $sqlVal;
|
|---|
| 541 | }
|
|---|
| 542 |
|
|---|
| 543 | ?> |
|---|