/**
  * Handle memberships
  *
  * @param 	object 		$cartInfo
  * @param	object		$cartCoupons
  * @return 	object		membership info
  */
 public function getMembershipInfo()
 {
     $cartInfo = $this->getCartInfo();
     $cartItems = $cartInfo->items;
     // init membership info
     $memberships = array();
     require_once PATH_CORE . DS . 'components' . DS . 'com_storefront' . DS . 'models' . DS . 'Memberships.php';
     $ms = new \Components\Storefront\Models\Memberships();
     // Get membership types
     $membershipTypes = $ms->getMembershipTypes();
     // Go through each product and see if the type is membership
     foreach ($cartItems as $sId => $item) {
         if (in_array($item['info']->ptId, $membershipTypes) && !empty($item['meta']['ttl'])) {
             $itemInfo = $item['info'];
             // Get product type
             $warehouse = $this->warehouse;
             $pType = $warehouse->getProductTypeInfo($itemInfo->ptId);
             $type = $pType['ptName'];
             // Get user
             $jUser = User::getInstance();
             // Get the correct membership Object
             $subscription = \Components\Storefront\Models\Memberships::getSubscriptionObject($type, $itemInfo->pId, $jUser->id);
             // Get the expiration for the current subscription (if any)
             $currentExpiration = $subscription->getExpiration();
             // Calculate new expiration
             $newExpires = \Components\Storefront\Models\Memberships::calculateNewExpiration($currentExpiration, $item);
             $membershipSIdInfo = new \stdClass();
             $membershipSIdInfo->newExpires = strtotime($newExpires);
             if ($currentExpiration && $currentExpiration['crtmActive']) {
                 $membershipSIdInfo->existingExpires = strtotime($currentExpiration['crtmExpires']);
             }
             $memberships[$sId] = $membershipSIdInfo;
             unset($membershipSIdInfo);
         }
     }
     return $memberships;
 }