break; case MM_Coupon::$TYPE_DOLLAR: $description = "<span style='font-family:courier;'>" . $coupon->getCouponValue(true) . "</span> off"; break; case MM_Coupon::$TYPE_FREE: $description = "<span style='font-family:courier;'>FREE</span>"; break; } if ($coupon->getCouponType() != MM_Coupon::$TYPE_FREE) { if ($coupon->getRecurringBillingSetting() == "all") { $description .= " all charges"; } else { $description .= " the first charge"; } } $editActionUrl = 'onclick="mmjs.edit(\'mm-coupons-dialog\', \'' . $coupon->getId() . '\', 620, 615)"'; $deleteActionUrl = 'onclick="mmjs.remove(\'' . $coupon->getId() . '\')"'; $archiveActionUrl = 'onclick="mmjs.archive(\'' . $coupon->getId() . '\')"'; $unarchiveActionUrl = 'onclick="mmjs.unarchive(\'' . $coupon->getId() . '\')"'; $actions = MM_Utils::getEditIcon("Edit Coupon", '', $editActionUrl); $archiveActions = ""; if (!MM_Coupon::isBeingUsed($coupon->getId())) { $actions .= MM_Utils::getDeleteIcon("Delete Coupon", 'margin-left:5px;', $deleteActionUrl); } else { $actions .= MM_Utils::getDeleteIcon("This coupon is currently being used and cannot be deleted.", 'margin-left:5px;', '', true); if (!$coupon->isArchived()) { $archiveMsg = "Archive this coupon to hide it and disable it from being used."; $archiveActions .= MM_Utils::getArchiveIcon($archiveMsg, 'margin-left:5px;', $archiveActionUrl); } else { if ($coupon->isArchived()) { $archiveMsg = "Unarchive this coupon to enable it to be used.";
<?php $prod = new MM_Product(); $selectedProds = array(); $id = 0; if (isset($p->id)) { $id = $p->id; } $coupon = new MM_Coupon($id); $prods = $coupon->getProducts(); if (!$coupon->isValid()) { $coupon->setStartDate(Date("m/d/Y")); } $editable = ""; if (MM_Coupon::isBeingUsed($coupon->getId())) { $editable = "disabled='disabled'"; } $products = MM_HtmlUtils::createCheckboxGroup(MM_Product::getAll(), "mm_products", $prods); ?> <div id="mm-coupons-container"> <table cellspacing="10"> <tr> <td width="140">Name*</td> <td><input type='hidden' id='id' value='<?php echo $coupon->getId(); ?> ' /> <input id="mm_coupon_name" type="text" value='<?php echo $coupon->getCouponName(); ?> ' style='width:300px;' />