예제 #1
0
파일: coupons.php 프로젝트: huynp/Critical
$view = new MM_CouponView();
$dataGrid = new MM_DataGrid($_REQUEST, "id", "desc", 10);
$data = $view->getViewData($dataGrid);
$dataGrid->setTotalRecords($data);
$dataGrid->recordName = "coupon";
$rows = array();
foreach ($data as $key => $item) {
    $coupon = new MM_Coupon($item->id);
    $availableDates = "";
    $endDate = $coupon->getEndDate(true);
    if (!empty($endDate)) {
        $availableDates = $coupon->getStartDate(true) . " - " . $endDate;
    } else {
        $availableDates = "After " . $coupon->getStartDate(true);
    }
    switch ($coupon->getQuantity()) {
        case "-1":
        case "":
            $quantityDescription = number_format($item->quantity_used) . " used";
            break;
        default:
            $quantityDescription = number_format($item->quantity_used) . " of " . number_format($coupon->getQuantity()) . " used ";
            break;
    }
    $description = "";
    switch ($coupon->getCouponType()) {
        case MM_Coupon::$TYPE_PERCENTAGE:
            $description = "<span style='font-family:courier;'>" . $coupon->getCouponValue() . "%</span> off";
            break;
        case MM_Coupon::$TYPE_DOLLAR:
            $description = "<span style='font-family:courier;'>" . $coupon->getCouponValue(true) . "</span> off";
예제 #2
0
						<td>
							<input id="mm_end_date" type="text" value='<?php 
echo $coupon->getEndDate(true);
?>
' style="width:110px;" />
							<a onClick="jQuery('#mm_end_date').focus();"><?php 
echo MM_Utils::getCalendarIcon();
?>
</a>
						</td>
					</tr>
					<tr>
						<td>Limit Quantity</td>
						<td>
							<input id="mm_quantity" type="text" style='width: 80px;' value='<?php 
echo $coupon->getQuantity();
?>
' />
						</td>
					</tr>
					<tr valign='top'>
						<td valign='top'>Valid Products</td>
						<td valign='top'>
							<div style="overflow: auto; height: 165px; width: 250px; border: 1px solid #ccc;">
							<?php 
echo $products;
?>
							</div>
						</td>
					</tr>
				</table>