Skip to content

Instantly share code, notes, and snippets.

@nanasess
Created July 4, 2013 02:09
Show Gist options
  • Save nanasess/5924381 to your computer and use it in GitHub Desktop.
Save nanasess/5924381 to your computer and use it in GitHub Desktop.
カートセッションを入れ替える for EC-CUBE 2.12.x 購入確認ページのアップセル/クロスセルなどで使える。
<?php
/**
* dtb_order_temp を更新する.
*
* @params SC_CartSession_Ex $objCartSess カートセッションインスタンス
* @params SC_SiteSession_Ex $objSiteSess サイトセッションインスタンス
* @params string $pre_uniqid 現在の order_temp_id
* @params integer $cartKey 現在のカートキー
* @return boolean 更新が成功した場合 true
*/
function updateOrderTemp($objCartSess, $objSiteSess, $pre_uniqid, $cartKey) {
$objSiteSess->setRegistFlag();
$objSiteSess->setUniqId();
$uniqid = $objSiteSess->getUniqId();
$sqlval['order_temp_id'] = $uniqid;
$where = 'order_temp_id = ?';
$objQuery =& SC_Query_Ex::getSingletonInstance();
$res = $objQuery->update('dtb_order_temp', $sqlval, $where, array($pre_uniqid));
$objCartSess->registerKey($cartKey);
$objCartSess->saveCurrentCart($uniqid, $cartKey);
if ($res != 1) {
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment