Esempio n. 1
0
function upcoming_transaction_dashboard_widget()
{
    $args = array('meta_key' => 'is_expired', 'meta_value' => '0', 'post_status' => 'publish', 'post_type' => CUSTOM_POST_TYPE1, 'orderby' => 'DESC');
    $live_posts = get_posts($args);
    if ($live_posts) {
        echo '<link href="' . get_template_directory_uri() . '/monetize/admin.css" rel="stylesheet" type="text/css" />';
        echo '<table class="widefat"  width="100%" >
			<thead>	
			<tr>
				<th valign="top" align="left">ID</th>
				<th valign="top" align="left">Deal Title</th>
				<th valign="top" align="left">Total Transaction</th>
				<th valign="top" align="left">Original Price</th>
				<th valign="top" align="left">Discounted Price</th>
				<th valign="top" align="left">Status</th>
			</tr>';
        foreach ($live_posts as $post) {
            if (get_post_meta($post->ID, 'status', true) == '1' || get_post_meta($post->ID, 'status', true) == '2') {
                $status = ifetch_status(get_post_meta($post->ID, 'status', true), get_post_meta($post->ID, 'is_expired', true));
                if ($status == 'Pending') {
                    $status_dis = "<span class='color_pending'>Pending</span>";
                } else {
                    if ($status == 'Expired') {
                        $status_dis = "<span class='color_expire'>Expired</span>";
                    } else {
                        if ($status == 'Accepted') {
                            $status_dis = "<span class='color_active'>Accepted</span>";
                        } else {
                            if ($status == 'Active') {
                                $status_dis = "<span class='color_active'>Active</span>";
                            } else {
                                if ($status == 'Rejected') {
                                    $status_dis = "<span class='color_reject'><strong>Rejected</strong></span>";
                                } else {
                                    $status_dis = "<span class='color_terminate'><strong>Terminated</strong></span>";
                                }
                            }
                        }
                    }
                }
                echo '<tr>
				<td valign="top" align="left">' . $post->ID . '</td>
				<td valign="top" align="left"><a href="' . site_url() . '/wp-admin/admin.php?page=report&deal_id=' . $post->ID . '#option_deal_report">' . $post->post_title . '</a></td>
				<td valign="top" align="left">' . deal_transaction($post->ID) . '</td>
				<td valign="top" align="left">' . get_currency_sym() . get_post_meta($post->ID, 'current_price', true) . '</td>
				<td valign="top" align="left">' . get_currency_sym() . get_post_meta($post->ID, 'our_price', true) . '</td>
				<td valign="top" align="left">' . $status_dis . '</td>';
            }
        }
        echo '</thead>	</table>';
    }
}
Esempio n. 2
0
function templatic_manage_seller_columns($column, $post_id)
{
    echo '<link href="' . get_template_directory_uri() . '/monetize/admin.css" rel="stylesheet" type="text/css" />';
    global $post;
    switch ($column) {
        /* If displaying the 'status' column. */
        case 'status':
            /* Get the post meta. */
            $status = fetch_status(get_post_meta($post_id, 'status', true), get_post_meta($post_id, 'is_expired', true));
            /* If no status is found, output a default message. */
            _e($status, 'templatic');
            break;
            /* If displaying the 'coupon_start_date_time' column. */
        /* If displaying the 'coupon_start_date_time' column. */
        case 'coupon_start_date_time':
            /* Get the coupon_start_date_time for the post. */
            $coupon_start_date_time = get_post_meta($post_id, 'coupon_start_date_time', true);
            /* If coupon_start_date_time were found. */
            if ($coupon_start_date_time != '') {
                echo date('Y-m-d H:i:s', $coupon_start_date_time);
            } else {
                _e('Unknown');
            }
            break;
        case 'coupon_end_date_time':
            /* Get the coupon_end_date_time for the post. */
            $coupon_end_date_time = get_post_meta($post_id, 'coupon_end_date_time', true);
            /* If coupon_end_date_time were found. */
            if (!empty($coupon_end_date_time)) {
                echo date('Y-m-d H:i:s', $coupon_end_date_time);
            } else {
                _e('Continue deal');
            }
            break;
        case 'deal_sold':
            /* Get the deal_sold for the post. */
            $deal_sold = deal_transaction($post_id);
            /* If deal_sold were found. */
            if (!empty($deal_sold)) {
                echo $deal_sold;
            } else {
                _e('0');
            }
            break;
        case 'post_category':
            /* Get the post_category for the post. */
            if (templ_is_show_post_category()) {
                $category = get_the_taxonomies($post);
                $category_display = str_replace(CUSTOM_MENU_CAT_TITLE . ':', '', $category['seller_category']);
                $category_display = str_replace(' and ', ', ', $category_display);
                echo $category_display = str_replace(',,', ', ', $category_display);
            } else {
                _e('Uncategorized');
            }
            break;
        case 'post_tags':
            /* Get the post_tags for the post. */
            $tags = get_the_taxonomies($post);
            $tags_display = str_replace(CUSTOM_MENU_TAG_TITLE . ':', '', $tags['seller_tags']);
            $tags_display = str_replace(' and ', ', ', $tags_display);
            echo $tags_display = str_replace(',,', ', ', $tags_display);
            break;
        case 'total_item':
            /* Get the total_item for the post. */
            $total_item = get_post_meta($post_id, 'no_of_coupon', true);
            /* If terms were found. */
            if (!empty($total_item)) {
                echo $total_item;
            } else {
                _e('0');
            }
            break;
            /* Just break out of the switch statement for everything else. */
        /* Just break out of the switch statement for everything else. */
        default:
            break;
    }
}
Esempio n. 3
0
                    }
                }
            }
        }
        ?>
    <tr>
      <td><?php 
        echo $priceinfoObj->ID;
        ?>
</td>
      <td><?php 
        echo $priceinfoObj->post_title;
        ?>
</td>
      <td><?php 
        echo deal_transaction($priceinfoObj->ID);
        ?>
</td>
      <td><?php 
        echo $status_dis;
        ?>
</td>
      <td><a href="javascript:void(0);dealshowdetail('<?php 
        echo $priceinfoObj->ID;
        ?>
');"><?php 
        _e('Details', 'templatic');
        ?>
</a> | <a href="<?php 
        echo get_template_directory_uri() . '/monetize/report/export_dealreport.php?deal_id=' . $priceinfoObj->ID;
        ?>
Esempio n. 4
0
$trans_table = $wpdb->prefix . "deal_transaction";
$post_table = $wpdb->prefix . "posts";
$ordersql_select = "select t.*,p.ID ";
$ordersql_from = " from {$trans_table} t,{$post_table} p ";
$ordersql_conditions = " where p.ID = t.post_id and t.status = '1'";
if ($_REQUEST['deal_id'] != '') {
    $id = $_REQUEST['deal_id'];
    $ordersql_conditions .= " and t.post_id = {$id}";
}
$ordersql_conditions .= " group by p.ID";
$priceinfo_count = $wpdb->get_results($ordersql_select . $ordersql_from . $ordersql_conditions);
if ($priceinfo_count > 0) {
    foreach ($priceinfo_count as $priceinfoObj) {
        $post_title = str_replace(',', ' ', $priceinfoObj->post_title);
        echo "ID,Title,Total Transaction,Status\r ";
        echo "{$priceinfoObj->ID},{$post_title}," . deal_transaction($priceinfoObj->ID) . "," . ($status = ifetch_status(get_post_meta($post->ID, 'status', true), get_post_meta($post->ID, 'is_expired', true)) . " \r\n \r\n");
        $deal_cnt = $wpdb->get_results("select * from {$trans_table} where post_id = '" . $priceinfoObj->ID . "' and status = '1'");
        if (count($deal_cnt) > 0) {
            echo "Title,Deal Coupon,Pay Date,Billing name,Billing address,Shipping name, Shipping address,Pay Method,Amount\r\n";
            $trans_table = $wpdb->prefix . "deal_transaction";
            foreach ($deal_cnt as $postObj) {
                $sub_post_title = str_replace(',', ' ', $postObj->post_title);
                $billing_add = str_replace(array(',', '<br />'), ' ', $postObj->billing_add);
                $shipping_add = str_replace(array(',', '<br />'), ' ', $postObj->shipping_add);
                echo "{$sub_post_title},{$postObj->deal_coupon}," . date('d/m/Y', strtotime($postObj->payment_date)) . ",{$postObj->billing_name},{$billing_add},{$postObj->shipping_name},{$shipping_add},{$postObj->payment_method}," . get_currency_sym() . number_format($postObj->payable_amt, 2) . " \r";
            }
        }
        echo "\r\n";
    }
} else {
    echo "No record available";