In-Portal Issue Tracker - In-Commerce
Viewing Issue Advanced Details
1156 [In-Portal CMS] Data Management feature request always 2011-11-01 22:47 2012-07-25 05:32
Dmitry  
alex  
normal  
closed  
fixed  
 
none 5.2.0-B1  
https://groups.google.com/d/topic/in-portal-dev/l4KtZDvX-pI/discussion
Added ability for keeping Shopping Cart content between Visits
1
0001156: Keeping Shopping Cart between Visits
If a visitor have a cart, wether a registered user or a visitor, we store order id in user's cookie (or maybe in user record in DB for logged in users), until cart is emptied (order completed or cart reset).
related to 0000029closed  (5.0.1)alex For each pending order one more incomplete order is created. 
patch remember_shop_cart_between_visits_feature.patch (2,407) 2011-11-01 22:47
http://tracker.in-portal.org/file_download.php?file_id=1284&type=bug
Issue History
2012-07-25 05:32 alex Note Added: 0005030
2012-07-25 05:32 alex Status resolved => closed
2011-12-08 04:25 alex Note Added: 0004229
2011-12-08 04:25 alex Status reviewed and tested => resolved
2011-12-08 04:25 alex Fixed in Version => 5.2.0-B1
2011-12-08 04:25 alex Resolution open => fixed
2011-12-08 04:25 alex Changeset attached 5.2.x r14846
2011-12-07 22:37 Dmitry Note Added: 0004224
2011-12-07 22:37 Dmitry Assigned To Dmitry => alex
2011-12-07 22:37 Dmitry Status needs testing => reviewed and tested
2011-12-07 22:37 Dmitry Target Version Icebox => 5.2.0
2011-11-02 03:48 alex Assigned To => Dmitry
2011-11-02 03:48 alex Developer => alex
2011-11-02 03:48 alex Status active => needs testing
2011-11-02 03:47 alex Note Added: 0004117
2011-11-02 03:43 alex Relationship added related to 0000029
2011-11-01 22:47 Dmitry New Issue
2011-11-01 22:47 Dmitry File Added: remember_shop_cart_between_visits_feature.patch
2011-11-01 22:47 Dmitry Reference => https://groups.google.com/d/topic/in-portal-dev/l4KtZDvX-pI/discussion
2011-11-01 22:47 Dmitry Change Log Message => Added ability for keeping Shopping Cart content between Visits
2011-11-01 22:47 Dmitry Estimate Points => 1

Notes
(0004117)
alex   
2011-11-02 03:47   
With this version of OnRestoreOrder event order restore happens after user performs a login too (if he left his incomplete order last time).


function OnRestoreOrder(&$event)
{
    if ( $this->Application->isAdmin || $this->Application->RecallVar('ord_id') ) {
        // admin OR there is an active order -> don't restore from cookie
        return;
    }

    $cookies = $this->Application->HttpQuery->Cookie;
    $shop_cart_cookie = array_key_exists('shop_cart_cookie', $cookies) ? $cookies['shop_cart_cookie'] : false;

    if ( !$shop_cart_cookie ) {
        return;
    }

    $user_id = $this->Application->RecallVar('user_id');

    $sql = 'SELECT OrderId
            FROM ' . TABLE_PREFIX . 'Orders
            WHERE (OrderId = ' . (int)$shop_cart_cookie . ') AND (Status = ' . ORDER_STATUS_INCOMPLETE . ') AND (PortalUserId = ' . $user_id . ')';
    $order_id = $this->Conn->GetOne($sql);

    if ( $order_id ) {
        $this->Application->StoreVar('ord_id', $order_id);
    }
}
(0004224)
Dmitry   
2011-12-07 22:37   
Tested on 5.1.3, please convert to 5.2.0 format and commit.
(0004229)
alex   
2011-12-08 04:25   
Fix committed to 5.2.x branch. Commit Message:

Fixes 0001156: Keeping Shopping Cart between Visits
(0005030)
alex   
2012-07-25 05:32   
Since 5.2.0 version was released.