CartLogicで保持する顧客情報
今回はCartLogicのcustomerInformationプロパティを見ます。
Cart02ページで顧客情報を入れるフォームがあります。

このフォームに入力した内容をいきなりデータベースのsoyshop_userテーブルに放り込むと、
注文もしていないのに顧客情報の登録をするのはいろいろと問題です。
そこで、
顧客情報は一旦、CartLogicのcustomerinformationに入れておきます。
入れる際のデータは
object(SOYShop_User)#65 (40) {
["id":"SOYShop_User":private]=>
NULL
["mailAddress":"SOYShop_User":private]=>
string(28) "mamezaburo@omamesyoji.oma.me"
["password":"SOYShop_User":private]=>
string(8) "aaaaaaaa"
["attribute1":"SOYShop_User":private]=>
NULL
["attribute2":"SOYShop_User":private]=>
NULL
["attribute3":"SOYShop_User":private]=>
NULL
["name":"SOYShop_User":private]=>
string(30) "まめくらまめざぶろう"
["nickname":"SOYShop_User":private]=>
NULL
["reading":"SOYShop_User":private]=>
string(30) "マメクラマメザブロウ"
["accountId":"SOYShop_User":private]=>
NULL
["imagePath":"SOYShop_User":private]=>
NULL
["gender":"SOYShop_User":private]=>
string(1) "0"
["birthday":"SOYShop_User":private]=>
string(7) "794-1-1"
["zipCode":"SOYShop_User":private]=>
string(7) "6060816"
["area":"SOYShop_User":private]=>
string(2) "26"
["address1":"SOYShop_User":private]=>
string(18) "京都市左京区"
["address2":"SOYShop_User":private]=>
string(18) "下鴨松ノ木町"
["telephoneNumber":"SOYShop_User":private]=>
string(9) "123456789"
["faxNumber":"SOYShop_User":private]=>
string(0) ""
["url":"SOYShop_User":private]=>
NULL
["cellphoneNumber":"SOYShop_User":private]=>
string(0) ""
["jobName":"SOYShop_User":private]=>
string(12) "お豆商事"
["jobZipCode":"SOYShop_User":private]=>
NULL
["jobArea":"SOYShop_User":private]=>
NULL
["jobAddress1":"SOYShop_User":private]=>
NULL
["jobAddress2":"SOYShop_User":private]=>
NULL
["jobTelephoneNumber":"SOYShop_User":private]=>
NULL
["jobFaxNumber":"SOYShop_User":private]=>
NULL
["memo":"SOYShop_User":private]=>
NULL
["mailErrorCount":"SOYShop_User":private]=>
int(0)
["notSend":"SOYShop_User":private]=>
int(0)
["isError":"SOYShop_User":private]=>
int(0)
["isDisabled":"SOYShop_User":private]=>
int(0)
["isProfileDisplay":"SOYShop_User":private]=>
int(0)
["registerDate":"SOYShop_User":private]=>
NULL
["updateDate":"SOYShop_User":private]=>
NULL
["realRegisterDate":"SOYShop_User":private]=>
NULL
["userType":"SOYShop_User":private]=>
NULL
["addressList":"SOYShop_User":private]=>
string(188) "a:1:{i:0;a:8:{s:4:"name";s:0:"";s:7:"reading";s:0:"";s:6:"office";s:0:"";s:7:"zipCode";s:0:"";s:4:"area";s:0:"";s:8:"address1";s:0:"";s:8:"address2";s:0:"";s:15:"telephoneNumber";s:0:"";}}"
["attributes":"SOYShop_User":private]=>
NULL
}
SOYShop_Userオブジェクトの形にしているので、
カート内で顧客情報の一部を表示したい場合は
/soyshop/webapp/src/domain/user/SOYShop_User.class.phpを参考に、
$cart = CartLogic::getCart(); $user = $cart->getCustomerInformation(); $userName = $user->getName();
上記のように取得できます。
注文完了時にCartLogicの顧客情報は、データベースのsoyshop_userテーブルに格納されます。
二回目以降の注文の場合は

ログイン時にsoyshop_userテーブルからSOYShop_Userオブジェクトの型でデータを取得し、
すぐにCartLogicのcustomerInformationプロパティに入れます。
2014.05.08 | Comments(0) | Trackback(0)
Comments
Trackbacks