function previewCurrentCart() { global $messages; $subscribePreview = new Subscribe_Preview(); $subscribePreview = SubscriptionManager::previewCart($_SESSION['cart']); $messages = $subscribePreview; return; }
function test_SubscriptionManager_previewCurrentCart() { printResultStart(__FUNCTION__); $messages = array(); //Retrieve a productRatePlanId from the catalog $prpid; try { $catalog = Catalog::readCache(); $prp = $catalog[0]->products[0]->ratePlans[0]; echo "Using Product Rate Plan '" . $prp->Name . "' on Product '" . $prp->productName . "' <br>"; $prpid = $prp->Id; } catch (Exception $e) { array_push($messages, $e->getMessage()); printResultEnd($messages); return; } //Create a cart with one item $newCart = new Cart(); $newCart->addCartItem($prpid, null); //Test try { //Get Active Rate Plans $subRes = SubscriptionManager::previewCart($newCart); //Report print_r_html($subRes); } catch (Exception $e) { array_push($messages, "Exception: " . $e->getMessage()); } //Report printResultEnd($messages); }