Beispiel #1
0
} else {
    if ($associatedBundle->isValid()) {
        $lastAccessAssociationType = "bundle";
        $lastAccessAssociationId = $associatedBundle->getId();
    } else {
        $lastAccessAssociationType = "";
        $lastAccessAssociationId = "";
    }
}
$hasBeenPurchased = false;
if ($product->isValid()) {
    $hasBeenPurchased = MM_Product::hasBeenPurchased($product->getId());
}
$periodsArr = array('days' => 'days', 'weeks' => 'weeks', 'months' => 'months', 'years' => 'years');
$trialFrequencyList = MM_HtmlUtils::generateSelectionsList($periodsArr, $product->getTrialFrequency());
$rebillFrequencyList = MM_HtmlUtils::generateSelectionsList($periodsArr, $product->getRebillFrequency());
$membershipList = MM_HtmlUtils::getMemberships($associatedMembership->getId(), false, MM_MembershipLevel::$SUB_TYPE_PAID);
$bundleList = MM_HtmlUtils::getBundles($associatedBundle->getId(), false, MM_Bundle::$SUB_TYPE_PAID);
$commissionProfileList = MM_HtmlUtils::getCommissionProfilesList($product->getCommissionProfileId());
function renderFieldOption($optionId, $affiliateId, $profileId)
{
    ?>
	<div id="mm-partner-container-<?php 
    echo $optionId;
    ?>
">
	<input id="mm-partner-<?php 
    echo $optionId;
    ?>
" type="text" size="15" class="field-option" value="<?php 
    echo $affiliateId;
Beispiel #2
0
 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;
 }