Beispiel #1
0
$noAccessAssociation = !$associatedMembership->isValid() && !$associatedBundle->isValid() ? true : false;
if ($associatedMembership->isValid()) {
    $lastAccessAssociationType = "membership";
    $lastAccessAssociationId = $associatedMembership->getId();
} 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 
					Select Multiple Products: PC <code>ctrl + click</code> 
					Mac <code><img width="9" height="9" src="http://km.support.apple.com/library/APPLE/APPLECARE_ALLGEOS/HT1343/ks_command.gif" alt="Command key icon" data-hires="true">
(Command key) + click</code>
					</span>
					
					<br/><br/>
					<span style="font-size:11px;">
					Default Product<?php 
    echo MM_Utils::getInfoIcon("Customers can purchase any of the products above to sign up for this membership level. It's also possible for customers to sign up for the membership directly in which case they'll end up purchasing the default product. You can specify the default product below.");
    ?>
 
					</span>
					<br/>
						<select id='mm-default-product-id'  >
							<?php 
    if ($product->isValid() && $product->getId() > 0) {
        $products = $membership->getProductIds();
        $productsArr = array();
        if (is_array($products)) {
            foreach ($products as $pid) {
                $p = new MM_Product($pid);
                $productsArr[$pid] = $p->getName();
            }
            $selections = MM_HtmlUtils::generateSelectionsList($productsArr, $product->getId());
            if (empty($selections)) {
                echo "<option value=''>Select a product</option>";
            } else {
                echo $selections;
            }
        } else {
            echo "<option value=''>Select a product</option>";
Beispiel #3
0
/**
 * 
 * MemberMouse(TM) (http://www.membermouse.com)
 * (c) MemberMouse, LLC. All rights reserved.
 */
$view = new MM_ProductView();
$dataGrid = new MM_DataGrid($_REQUEST, "id", "desc", 10);
$data = $view->getViewData($dataGrid);
$dataGrid->setTotalRecords($data);
$dataGrid->recordName = "product";
$rows = array();
foreach ($data as $key => $item) {
    $product = new MM_Product($item->id);
    // Actions
    $editActionUrl = 'onclick="mmjs.edit(\'mm-products-dialog\', \'' . $product->getId() . '\', 580, 600)"';
    $deleteActionUrl = 'onclick="mmjs.remove(\'' . $product->getId() . '\')"';
    $actions = MM_Utils::getEditIcon("Edit Product", '', $editActionUrl);
    if (!MM_Product::isBeingUsed($product->getId()) && !MM_Product::hasBeenPurchased($product->getId())) {
        $actions .= MM_Utils::getDeleteIcon("Delete Product", 'margin-left:5px;', $deleteActionUrl);
    } else {
        $actions .= MM_Utils::getDeleteIcon("This product is currently being used and cannot be deleted", 'margin-left:5px;', '', true);
    }
    $purchaseLinks = '<a title="Get purchase links" onclick="mmjs.showPurchaseLinks(' . $product->getId() . ',\'' . htmlentities(addslashes($product->getName()), ENT_QUOTES) . '\')" class="mm-ui-button" style="margin:0px;">' . MM_Utils::getIcon('money', '', '1.3em', '1px', '', 'margin-right:0px;') . '</a>';
    // Associated Access
    $accessGranted = "";
    $membership = $product->getAssociatedMembership();
    if ($membership->isValid()) {
        $accessGranted .= MM_Utils::getAccessIcon(MM_OrderItemAccess::$ACCESS_TYPE_MEMBERSHIP);
        $accessGranted .= " <a href='" . MM_ModuleUtils::getUrl(MM_MODULE_PRODUCT_SETTINGS, MM_MODULE_MEMBERSHIP_LEVELS) . "&autoload=" . $membership->getId() . "'>" . $membership->getName() . "</a>";
    }
    ?>
		<p>MemberMouse offers two methods for creating purchase links. First, select the product you want to create
		a purchase link for and then use one of the links below to allow customers to purchase access to the 
		'<?php 
    echo $p->accessTypeName;
    ?>
' bundle.</p>
		
		<input id="mm-last-selected-product-id" type="hidden" value="0" /> 
		<select id="mm-product-selector" onchange="mmjs.productChangeHandler();">
		<option value='0'>Select a product</option>
		<?php 
    foreach ($p->productIds as $id) {
        $product = new MM_Product($id);
        if ($product->isValid()) {
            echo "<option value='{$product->getId()}'>{$product->getName()}</option>";
        }
    }
    ?>
		</select>
		
	<?php 
    foreach ($p->productIds as $id) {
        generatePurchaseSection($id);
    }
} else {
    ?>
		<p>Cannot create purchase links for free bundles.</p>
	<?php 
}
?>