if ($bundle->isValid()) { $accessGranted .= MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_BUNDLE); $accessGranted .= " <a href='" . MM_ModuleUtils::getUrl(MM_MODULE_PRODUCT_SETTINGS, MM_MODULE_BUNDLES) . "&autoload=" . $bundle->getId() . "'>" . $bundle->getName() . "</a>"; } } if (empty($accessGranted)) { $accessGranted = MM_NO_DATA; } // Attributes $attributes = ""; if ($product->hasTrial()) { $attributes .= MM_Utils::getIcon('clock-o', 'beige', '1.3em', '0px', 'Has Trial', 'margin-right:5px;'); } else { $attributes .= "<img title='No Trial' style='margin-right:5px;' src='" . MM_Utils::getImageUrl("clear") . "' />"; } if ($product->isRecurring()) { if ($product->doLimitPayments()) { $attributes .= MM_Utils::getIcon('calendar-o', 'beige', '1.3em', '0px', 'Payment Plan', 'margin-right:5px;'); } else { $attributes .= MM_Utils::getIcon('refresh', 'beige', '1.3em', '0px', 'Subscription', 'margin-right:5px;'); } } else { $attributes .= "<img title='No Recurring' style='margin-right:5px;' src='" . MM_Utils::getImageUrl("clear") . "' />"; } if ($product->isShippable()) { $attributes .= MM_Utils::getIcon('truck', 'beige', '1.3em', '0px', 'Requires Shipping', 'margin-right:5px;'); } else { $attributes .= "<img title='No Shipping Required' style='margin-right:5px;' src='" . MM_Utils::getImageUrl("clear") . "' />"; } if ($product->getSku() != "") { $attributes .= MM_Utils::getIcon('barcode', 'beige', '1.3em', '0px', "SKU [" . $product->getSku() . "]", 'margin-right:5px;');
<div id="mm_alt_product_description" style="margin-top:10px;"></div> </div> </p> </div> </td> </tr> <tr> <td colspan="2"> <div style="width: 540px; margin-top: 5px; margin-bottom:4px;" class="mm-divider"></div> </td> </tr> <tr> <td>Subscription</td> <td> <input type='checkbox' onchange="mmjs.toggleRecurring();" id='mm-is_recurring' <?php echo $product->isRecurring() ? 'checked' : ''; ?> <?php echo $hasBeenPurchased ? "disabled" : ""; ?> /> <input type='hidden' id='mm-is_recurring_val' value='<?php echo $product->isRecurring() ? '1' : '0'; ?> ' /> </td> </tr> <tr> <td></td> <td> <div id='mm_rebill_row' style='display:none;'>
public static function getNextPaymentDate($startDate, $productId) { $product = new MM_Product($productId); $start = strtotime($startDate); if ($product->isRecurring(false)) { $period = $product->getRebillPeriod(); $freq = $product->getRebillFrequency(); $newdate = null; switch ($freq) { case "months": $months = floor((mktime() - $start) / 2628000); $newStart = strtotime($months . ' month', strtotime($start)); $newdate = strtotime($period . ' month', strtotime($newStart)); break; case "days": $days = self::countDays(Date("Y-m-d h:i:s"), $startDate); $diff = $days > $period ? intval($days / $period) : 1; $newStart = strtotime($diff . ' day', strtotime($start)); $newdate = strtotime($period . ' day', strtotime($newStart)); break; case "weeks": $days = self::countDays(Date("Y-m-d h:i:s"), $startDate); $weeks = $days > 7 ? intval($days / 7) : 1; $diff = $weeks > $period ? intval($weeks / $period) : 1; $newStart = strtotime($diff . ' week', strtotime($start)); $newdate = strtotime($period . ' week', strtotime($newStart)); break; case "years": $days = self::countDays(Date("Y-m-d h:i:s"), $startDate); $years = $days > 365 ? intval($days / 365) : 1; $diff = $years > $period ? intval($years / $period) : 1; $newStart = strtotime($diff . ' year', strtotime($start)); $newdate = strtotime($period . ' year', strtotime($newStart)); break; } if (!is_null($newdate)) { return $newdate; } } return false; }