こんにちは、kikuです。
今月に入って、EC-CUBEをカスタマイズする案件がありました。
EC-CUBEといえば、言わずもがなですが、オープンソースのEC構築パッケージですね。
現在は、昨年リリースされた、バージョン3系が最新です。
さて、当然ながら?!今回の初めは、このバージョン3系を使ってのカスタマイズを試みました。
バージョン2系は触ったことがありますが、3系を本格的にカスタマイズするのは初めて。
メンバーにインストールからお願いし、カスタマイズした手順はすべて残すよう指示。
ある程度できたところで、社内レビューをしたのですが・・・・・、
これが遅い。。。。。。。。。。。。。。。ローカルでやっていた際には、別段問題なかったようなんですが、サーバ(と言ってもレンタルサーバですが)に乗せてみたら・・・・(><)
まーいろいろとネットなどの情報を見ると、遅い!という情報が出るわ出るわ。
本当のところの原因は、サーバの問題もあるでしょうから、なんとも言えませんが、あげられてるのは、
Silex(Symphonyベースのマイクロフレームワーク)や、テンプレートエンジンのTwigあたりが絡んでるのかなーと・・・・。
ただ、今回、時間もあまり猶予がないため、バージョン2系を試してみることに。サーバにアップしてみたら。。。。、サクサク動く動く😅
2系でやることに決定。
その名で、会員登録の流れがあり、これいらないよねと。あ、それ、昔、やったなーと。
「[EC-CUBE]会員登録系の流れを外してみた」というタイトルで、4年ちょっと前にBlogを書いてました。
(ただ、サーバのお引越しの関係で、そのエントリは、今リンク切れ・・・すみません)
うろ覚えの中、やってみたら、できたので、改めて残しておこうと思います。
・カスタマイズするファイルは、/data/class/pages/shopping/LC_Page_Shopping.php
・function action()内の、case “login”のルートを、”nonmember”と同じ流れに。
これだけ、
いじった部分のソースは以下。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
switch ($this->getMode()) { // 前のページに戻る case 'return': SC_Response_Ex::sendRedirect(CART_URL); SC_Response_Ex::actionExit(); break; // 複数配送ページへ遷移 case 'multiple': // 複数配送先指定が無効な場合はエラー if (USE_MULTIPLE_SHIPPING === false) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true); SC_Response_Ex::actionExit(); } $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $this->arrErr = $this->lfCheckError($objFormParam); if (SC_Utils_Ex::isBlank($this->arrErr)) { $this->lfRegistData($this->tpl_uniqid, $objPurchase, $objCustomer, $objFormParam, true); $objSiteSess->setRegistFlag(); SC_Response_Ex::sendRedirect(MULTIPLE_URLPATH); SC_Response_Ex::actionExit(); } $this->tpl_mainpage = $nonmember_mainpage; $this->tpl_title = $nonmember_title; break; /* 会員登録機能は必要ないので削除 */ // // ログイン実行 case 'login': // $this->lfInitLoginFormParam($objFormParam); // $objFormParam->setParam($_POST); // $objFormParam->trimParam(); // $objFormParam->convParam(); // $objFormParam->toLower('login_email'); // $this->arrErr = $objFormParam->checkError(); // // // ログイン判定 // if (SC_Utils_Ex::isBlank($this->arrErr) // && $objCustomer->doLogin($objFormParam->getValue('login_email'), // $objFormParam->getValue('login_pass'))) { // // クッキー保存判定 // if ($objFormParam->getValue('login_memory') == '1' && strlen($objFormParam->getValue('login_email')) >= 1) { // $objCookie->setCookie('login_email', $objFormParam->getValue('login_email')); // } else { // $objCookie->setCookie('login_email', ''); // } // // // モバイルサイトで携帯アドレスの登録が無い場合、携帯アドレス登録ページへ遷移 // if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { // if (!$objCustomer->hasValue('email_mobile')) { // SC_Response_Ex::sendRedirectFromUrlPath('entry/email_mobile.php'); // SC_Response_Ex::actionExit(); // } // // スマートフォンの場合はログイン成功を返す // } elseif (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { // echo SC_Utils_Ex::jsonEncode(array('success' => // $this->getNextLocation($this->cartKey, $this->tpl_uniqid, // $objCustomer, $objPurchase, // $objSiteSess))); // SC_Response_Ex::actionExit(); // } // // SC_Response_Ex::sendRedirect( // $this->getNextLocation($this->cartKey, $this->tpl_uniqid, // $objCustomer, $objPurchase, // $objSiteSess)); // SC_Response_Ex::actionExit(); // // ログインに失敗した場合 // } else { // // 仮登録の場合 // if (SC_Helper_Customer_Ex::checkTempCustomer($objFormParam->getValue('login_email'))) { // if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { // echo $this->lfGetErrorMessage(TEMP_LOGIN_ERROR); // SC_Response_Ex::actionExit(); // } else { // SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR); // SC_Response_Ex::actionExit(); // } // } else { // if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { // echo $this->lfGetErrorMessage(SITE_LOGIN_ERROR); // SC_Response_Ex::actionExit(); // } else { // SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR); // SC_Response_Ex::actionExit(); // } // } // } // break; // お客様情報登録 case 'nonmember_confirm': $this->tpl_mainpage = $nonmember_mainpage; $this->tpl_title = $nonmember_title; $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $this->arrErr = $this->lfCheckError($objFormParam); if (SC_Utils_Ex::isBlank($this->arrErr)) { $this->lfRegistData($this->tpl_uniqid, $objPurchase, $objCustomer, $objFormParam); $arrParams = $objFormParam->getHashArray(); $shipping_id = $arrParams['deliv_check'] == '1' ? 1 : 0; $objPurchase->setShipmentItemTempForSole($objCartSess, $shipping_id); $objSiteSess->setRegistFlag(); SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URLPATH); SC_Response_Ex::actionExit(); } break; // お客様情報入力ページの表示 case 'nonmember': $this->tpl_mainpage = $nonmember_mainpage; $this->tpl_title = $nonmember_title; $this->lfInitParam($objFormParam); // ※breakなし default: // 前のページから戻ってきた場合は, お客様情報入力ページ if (isset($_GET['from']) && $_GET['from'] == 'nonmember') { $this->tpl_mainpage = $nonmember_mainpage; $this->tpl_title = $nonmember_title; $this->lfInitParam($objFormParam); } else { /* nonmember時と同じ処理にする */ // // 通常はログインページ //$this->lfInitLoginFormParam($objFormParam); $this->tpl_mainpage = $nonmember_mainpage; $this->tpl_title = $nonmember_title; $this->lfInitParam($objFormParam); } $this->setFormParams($objFormParam, $objPurchase, $this->tpl_uniqid); //追加 $objPurchase->unsetShippingTemp(); break; } |
4年前とおそらくほぼ変わってない(笑)。ま、あたりまえといえば、当たり前。
適用して、お買い物を試してみて、無事、購入完了まで成功。
こういうのを(こういうのこそ)きちんと財産として残して、継承していかなきゃだなと、改めて感じました。
引き続き、いじくってみようと思います。