public function get_chart_legend()
 {
     $legend = array();
     $order_totals = $this->get_order_report_data(array('data' => array('total_price' => array('type' => 'meta', 'function' => 'SUM', 'name' => 'total_sales')), 'filter_range' => true));
     $total_sales = $order_totals->total_sales;
     $total_orders = absint($this->get_order_report_data(array('data' => array('ID' => array('type' => 'post_data', 'function' => 'COUNT', 'name' => 'total_orders')), 'query_type' => 'get_var', 'filter_range' => true)));
     $this->average_sales = $total_sales / ($this->chart_interval + 1);
     switch ($this->chart_groupby) {
         case 'day':
             $average_sales_title = sprintf(__('%s average daily sales', 'colabsthemes'), '<strong>' . colabs_get_price($this->average_sales) . '</strong>');
             break;
         case 'month':
             $average_sales_title = sprintf(__('%s average monthly sales', 'colabsthemes'), '<strong>' . colabs_get_price($this->average_sales) . '</strong>');
             break;
     }
     $legend[] = array('title' => sprintf(__('%s sales in this period', 'colabsthemes'), '<strong>' . colabs_get_price($total_sales) . '</strong>'), 'color' => $this->chart_colours['sales_amount'], 'highlight_series' => 2);
     $legend[] = array('title' => $average_sales_title, 'color' => $this->chart_colours['average'], 'highlight_series' => 1);
     $legend[] = array('title' => sprintf(__('%s orders placed', 'colabsthemes'), '<strong>' . $total_orders . '</strong>'), 'color' => $this->chart_colours['order_count'], 'highlight_series' => 0);
     return $legend;
 }
function colabs_statistics()
{
    $stats = array();
    $listings = colabs_get_listing_counts();
    $totals[__('Total Properties', 'colabsthemes')] = array('text' => $listings['all'], 'url' => 'edit.php?post_type=' . COLABS_POST_TYPE);
    $stats[__('New Properties (last 7 days)', 'colabsthemes')] = $listings['new'];
    if (isset($listings['publish'])) {
        $stats[__('Total Live Properties', 'colabsthemes')] = array('text' => $listings['publish'], 'url' => 'edit.php?post_type=' . COLABS_POST_TYPE . '&post_status=publish');
    } else {
        $stats[__('Total Live Properties', 'colabsthemes')] = 0;
    }
    if (isset($listings['pending'])) {
        $stats[__('Total Pending Properties', 'colabsthemes')] = array('text' => $listings['pending'], 'url' => 'edit.php?post_type=' . COLABS_POST_TYPE . '&post_status=pending');
    } else {
        $stats[__('Total Pending Properties', 'colabsthemes')] = 0;
    }
    $orders = colabs_get_order_counts();
    $stats[__('Revenue (7 days)', 'colabsthemes')] = colabs_get_price($orders['revenue']);
    ?>
    
		<div id="dashboard_right_now" class="postbox " >
			<h3 class="hndle"><span><?php 
    _e('Info', 'colabsthemes');
    ?>
</span></h3>
			<div class="inside">
				<div class="main">
					<div class="versions">
					<?php 
    colabs_output_list($totals);
    ?>
					<?php 
    colabs_output_list($stats);
    ?>
					</div>
				</div>
			</div>
		</div>
		<?php 
}
示例#3
0
function colabs_bank_transfer_pending_email($post)
{
    $content = '';
    $content .= html('p', __('A new order is waiting to be processed. Once you recieve payment, you should mark the order as completed.', 'colabsthemes'));
    $content .= html('h3', __('Order Summary', 'colabsthemes'));
    $gateway = Colabs_Gateway_Registry::get_gateway($post['colabs_payment_method']);
    $content .= '<ul>';
    $content .= '<li><strong>' . __('Order:', 'colabsthemes') . '</strong> ' . $post['order_id'] . '</li>';
    $content .= '<li><strong>' . __('Property Name:', 'colabsthemes') . '</strong> ' . get_the_title($post['post_id']) . '</li>';
    $content .= '<li><strong>' . __('Amount:', 'colabsthemes') . '</strong> ' . colabs_get_price($post['item_amount']) . '</li>';
    $content .= '<li><strong>' . __('Payment:', 'colabsthemes') . '</strong> ' . $gateway->display_name('dropdown') . '</li>';
    $content .= '</ul>';
    $order_link = html('a', array('href' => get_edit_post_link($post['order_id'])), __('Review this order', 'colabsthemes'));
    $all_orders = html('a', array('href' => admin_url('edit.php?post_status=transaction_pending&post_type=transaction')), __('review all pending orders', 'colabsthemes'));
    // translators: <Single Order Link> or <Link to All Orders>
    $content .= html('p', sprintf(__('%1$s or %2$s', 'colabsthemes'), $order_link, $all_orders));
    $subject = sprintf(__('[%1$s] Pending Order #%2$d', 'colabsthemes'), get_bloginfo('name'), $post['order_id']);
    if (!function_exists('colabs_send_email')) {
        return false;
    }
    $email = array('to' => get_option('admin_email'), 'subject' => $subject, 'message' => $content);
    colabs_send_email($email['to'], $email['subject'], $email['message']);
}
示例#4
0
 protected function row($item)
 {
     $price = 0;
     if ($item['price']) {
         $price = $item['price'];
     }
     $cells = array($item['title'], colabs_get_price($price, $this->currency), html('a', array('href' => $item['post_link']), $item['post_title']));
     return html('tr', array(), $this->cells($cells));
 }
示例#5
0
function colabs_order_add_column_data($column_index, $post_id)
{
    $order = colabs_get_order($post_id);
    switch ($column_index) {
        case 'status':
            $status = $order->get_display_status();
            echo '<strong class="payment-' . strtolower($status) . '">' . ucfirst($status) . '</strong>';
            break;
        case 'order':
            if ($order->get_author()) {
                $user_info = get_userdata($order->get_author());
            }
            if (!empty($user_info)) {
                $username = '******' . absint($user_info->ID) . '">';
                if ($user_info->first_name || $user_info->last_name) {
                    $username .= esc_html(ucfirst($user_info->first_name) . ' ' . ucfirst($user_info->last_name));
                } else {
                    $username .= esc_html(ucfirst($user_info->display_name));
                }
                $username .= '</a>';
            }
            $order_permalink = '<a href="' . get_edit_post_link($post_id) . '"><strong>#' . $post_id . '</strong></a>';
            printf(__('%s by %s', 'colabsthemes'), $order_permalink, $username);
            if ($user_info->user_email) {
                echo '<br>';
                echo '<small class="meta email"><a href="' . esc_url('mailto:' . $user_info->user_email) . '">' . esc_html($user_info->user_email) . '</a></small>';
            }
            if ($order->get_ip_address()) {
                echo '<small class="meta ip">IP ' . $order->get_ip_address() . '</small>';
            }
            break;
        case 'order_author':
            $user = get_userdata($order->get_author());
            echo $user->display_name;
            echo '<br>';
            echo $order->get_ip_address();
            break;
        case 'item':
            $items = array();
            if ($order->get_post_type_id()) {
                $items[] = $order->get_post_type_id();
            }
            $count = count($items);
            $string = _n('%s item', '%s items', $count, 'colabsthems');
            printf($string, $count);
            break;
        case 'type':
            $obj = get_post_type_object(get_post_type($order->get_post_type_id()));
            echo $obj->labels->singular_name;
            break;
        case 'price':
            $currency = $order->get_currency();
            if (!empty($currency)) {
                echo colabs_get_price($order->get_total(), $order->get_currency());
            } else {
                echo colabs_get_price($order->get_total());
            }
            $gateway_id = $order->get_gateway();
            if (!empty($gateway_id)) {
                $gateway = Colabs_Gateway_Registry::get_gateway($gateway_id);
                if ($gateway) {
                    $gateway_title = $gateway->display_name('admin');
                } else {
                    $gateway_title = __('Unknown', 'colabsthemes');
                }
            } else {
                $gateway_title = __('Undecided', 'colabsthemes');
            }
            echo '<small class="meta">' . __('Via ', 'colabsthemes') . $gateway_title . '</small>';
            break;
        case 'payment':
            $gateway_id = $order->get_gateway();
            if (!empty($gateway_id)) {
                echo $gateway_id;
            } else {
                _e('Undecided', 'colabsthemes');
            }
            echo '<br/>';
            $status = $order->get_display_status();
            if ($order->get_status() == COLABS_ORDER_PENDING) {
                echo '<strong>' . ucfirst($status) . '</strong>';
            } else {
                echo ucfirst($status);
            }
            break;
        case 'order_date':
            $order_post = get_post($order->get_ID());
            if ('0000-00-00 00:00:00' == $order_post->post_date) {
                $t_time = $h_time = __('Unpublished', 'colabsthemes');
                $time_diff = 0;
            } else {
                $t_time = get_the_time(_x('Y/m/d g:i:s A', 'Order Date Format', 'colabsthemes'));
                $m_time = $order_post->post_date;
                $time = get_post_time('G', true, $order_post);
                $time_diff = time() - $time;
                if ($time_diff > 0 && $time_diff < 24 * 60 * 60) {
                    $h_time = sprintf(__('%s ago', 'colabsthemes'), human_time_diff($time));
                } else {
                    $h_time = mysql2date(_x('Y/m/d', 'Order Date Format', 'colabsthemes'), $m_time);
                }
            }
            echo '<abbr title="' . $t_time . '">' . $h_time . '</abbr>';
            break;
        case 'order_action':
            $edit_permalink = '<a href="' . get_edit_post_link($post_id) . '">' . __('Edit', 'colabsthemes') . '</a>';
            $delete_permalink = '<a href="' . get_delete_post_link($post_id) . '">' . __('Delete', 'colabsthemes') . '</a>';
            $gateway_id = $order->get_gateway();
            $status = strtolower($order->get_display_status());
            echo '<div class="order-actions">';
            echo '<span class="edit">' . $edit_permalink . '</span>' . ' | ';
            echo '<span class="trash">' . $delete_permalink . '</span>';
            /*if( $gateway_id == 'Bank Transfer' && $status == 'pending' ) {
                echo '<br>';
                echo '<a href="#" data-action="complete-order" data-id="'. $post_id .'" class="approve-order">'. __('Approve Order', 'colabsthemes') .'</a>';
              }*/
            echo '</div>';
            break;
    }
}
function colabs_get_property_price($post_id)
{
    $price = get_post_meta($post_id, 'property_price', true);
    if ($price) {
        $price = colabs_get_price($price, '', get_option('colabs_currency_symbol'));
        $terms = get_the_terms($post_id, COLABS_TAX_STATUS);
        $property_status = !empty($terms) && isset(current($terms)->slug) ? sanitize_title(current($terms)->slug) : 'sell';
        if ('rent' == $property_status) {
            $periode = get_post_meta($post_id, 'property_price_periode', true);
            switch ($periode) {
                case 'day':
                    $price = $price . '/' . __('Day', 'colabsthemes');
                    break;
                case 'year':
                    $price = $price . '/' . __('Year', 'colabsthemes');
                    break;
                default:
                    $price = $price . '/' . __('Month', 'colabsthemes');
                    break;
            }
        }
    } else {
        $price = colabs_get_price(0);
    }
    return $price;
}
示例#7
0
    /**
     * Processes a Order to display
     * instructions to the user
     * @param  Colabs_Order $order   Order to display information for
     * @return void
     */
    public function process($order)
    {
        // if gateway wasn't selected then exit
        if ($order['colabs_payment_method'] != 'authorize_aim') {
            return;
        }
        if (is_array($order)) {
            // is this a test transaction?
            if (get_option('colabs_authorize_sandbox') == true) {
                $process_url = 'https://test.authorize.net/gateway/transact.dll';
            } else {
                $process_url = 'https://secure.authorize.net/gateway/transact.dll';
            }
            $authorizeaim_args = array('x_login' => get_option('colabs_authorize_id'), 'x_tran_key' => get_option('colabs_authorize_key'), 'x_version' => '3.1', 'x_delim_data' => 'TRUE', 'x_delim_char' => '|', 'x_relay_response' => 'FALSE', 'x_type' => 'AUTH_CAPTURE', 'x_method' => 'CC', 'x_card_num' => $_POST['aim_creditcard'], 'x_exp_date' => $_POST['aim_ccexpdate'], 'x_description' => 'Order #' . $order['order_id'], 'x_amount' => $order['item_amount'], 'x_card_code' => $_POST['aim_cvvnumber']);
            $post_response = wp_remote_retrieve_body(wp_remote_post($process_url, array('body' => $authorizeaim_args, 'sslverify' => false)));
            $response_array = explode('|', $post_response);
            $order_class = colabs_get_order($order['order_id']);
            $error = 0;
            if (count($response_array) > 1) {
                if ($response_array[0] == '1') {
                    $payment_details = array('currency' => get_option('colabs_currency_code'), 'timestamp' => current_time('mysql'), 'txn_id' => $response_array[4], 'payment' => 'Authorize AIM', 'note' => $response_array[51]);
                    $order_class->complete($payment_details);
                } else {
                    $payment_details['note'] = $response_array[3];
                    $order_class->pending($payment_details);
                    $error = 1;
                }
                $info_message = $response_array[3];
            } else {
                $order_class->failed();
                $error = 1;
            }
        }
        if ($error == 0) {
            echo '<p class="alert alert-success">' . $info_message . '</p>';
        } else {
            echo '<p class="alert alert-danger">' . $info_message . '</p>';
        }
        ?>
    
    <h4><?php 
        _e('Your Transaction Details', 'colabsthemes');
        ?>
</h4>

    <ul>
      <li><span><?php 
        _e('Transaction ID:', 'colabsthemes');
        ?>
</span><?php 
        echo esc_html($order['order_id']);
        ?>
</li>
      <li><span><?php 
        _e('Reference #:', 'colabsthemes');
        ?>
</span><?php 
        echo esc_attr($order['post_id']);
        ?>
</li>
      <li><span><?php 
        _e('Total Amount:', 'colabsthemes');
        ?>
</span><?php 
        echo colabs_get_price($order['item_amount']);
        ?>
</li>
    </ul>
    <?php 
    }
                $html = html('a', array('href' => get_permalink($post_id)), $title);
                echo $html;
            }
            ?>
              </span>
              <?php 
            if (is_sticky($post_id)) {
                echo '<div>' . __('Featured', 'colabsthemes') . '</div>';
            }
            ?>
            </td>
            <td class="order-history-price center" data-title="<?php 
            _e('Price', 'colabsthemes');
            ?>
"><?php 
            echo colabs_get_price($order->get_total());
            ?>
</td>
            <td class="order-history-payment center" data-title="<?php 
            _e('Payment/Status', 'colabsthemes');
            ?>
"><?php 
            the_orders_history_payment($order);
            ?>
</td>
            <td class="actions center" data-title="<?php 
            _e('Actions', 'colabsthemes');
            ?>
">
            <?php 
            if (!empty($order) && COLABS_ORDER_PENDING == $order->get_status() && !$order->get_gateway()) {
示例#9
0
    /**
     * Processes a Bank Transfer Order to display
     * instructions to the user
     * @param  Colabs_Order $order   Order to display information for
     * @param  array $options     User entered options
     * @return void
     */
    public function process($order)
    {
        // if gateway wasn't selected then exit
        if ($order['colabs_payment_method'] != 'bank') {
            return;
        }
        $sent = get_post_meta($order['order_id'], 'bank-sentemail', true);
        if (empty($sent)) {
            colabs_bank_transfer_pending_email($order);
            update_post_meta($order['order_id'], 'bank-sentemail', true);
        }
        if (!empty($order['post_id'])) {
            $info_message = __('Please include the following details when sending the bank transfer. Once your transfer has been verified, we will then approve your order.', 'colabsthemes');
        }
        ?>
    
    <p class="alert alert-success"><?php 
        echo $info_message;
        ?>
</p>
    
    <h4><?php 
        _e('Your Transaction Details', 'colabsthemes');
        ?>
</h4>

    <ul>
      <li><span><?php 
        _e('Transaction ID:', 'colabsthemes');
        ?>
</span><?php 
        echo esc_html($order['order_id']);
        ?>
</li>
      <li><span><?php 
        _e('Reference #:', 'colabsthemes');
        ?>
</span><?php 
        echo esc_attr($order['post_id']);
        ?>
</li>
      <li><span><?php 
        _e('Total Amount:', 'colabsthemes');
        ?>
</span><?php 
        echo esc_html(colabs_get_price($order['item_amount']));
        ?>
</li>
    </ul>

    <h4><?php 
        _e('Bank Transfer Instructions', 'colabsthemes');
        ?>
</h4>

    <p><?php 
        echo stripslashes(colabsthemes_nl2br(get_option('colabs_bank_instructions')));
        ?>
</p>

    <p><?php 
        _e('For questions or problems, please contact us directly at', 'colabsthemes');
        ?>
 <?php 
        echo get_option('admin_email');
        ?>
</p> 
    
    <?php 
    }
示例#10
0
  <?php 
colabsthemes_metabox_maps_create($property_id);
?>
  

  <?php 
$featured_cost = get_option('colabs_cost_to_feature');
if ($featured_cost && is_numeric($featured_cost) && $featured_cost > 0) {
    $checked = '';
    if ($property) {
        if (is_sticky($property->ID)) {
            $checked = 'checked="checked"';
        }
    }
    // Featuring is an option
    echo '<div class="featured"><h3>' . __('Feature your listing for ', 'colabsthemes') . colabs_get_price($featured_cost) . __('?', 'colabsthemes') . '</h3>';
    echo '<p>' . __('Featured listings are displayed on the homepage and are also listed in all other listing pages.', 'colabsthemes') . '</p>';
    echo '<label class="custom-checkbox"><input type="checkbox" ' . $checked . ' name="featureit" id="featureit" value="true"/> ' . __('Yes please, feature my listing.', 'colabsthemes') . '</label></div>';
}
?>
  
  <div class="form-builder-input input-submit">
    <input type="hidden" name="action" value="<?php 
echo esc_attr($post_action);
?>
" />
    <input type="hidden" name="step" value="<?php 
echo esc_attr($step);
?>
"/>
    <?php