Commit adffb08b authored by Varun Sridharan's avatar Varun Sridharan

User Callable Functions Updated

* Renamed All Functions With wcqd as starting
* removed qd_min_amount_project function
* removed qd_max_amount_project function
* added wcqd_project_limit  function to get limit of a project
* added wcqd_get_project_name from order id
* added wcqd_get_project to get project id from order id
parent 8d590436
......@@ -199,7 +199,7 @@ class WC_Quick_Donation_Meta_Box_Order_Data {
<p class="form-field form-field-wide"><label for="order_status"><?php _e( 'Donation status:', WC_QD_TXT ) ?></label>
<select id="order_status" name="order_status" class="wc-enhanced-select">
<?php
$statuses = wc_qd_order_statuses();
$statuses = wc_get_order_statuses();
foreach ( $statuses as $status => $status_name ) {
echo '<option value="' . esc_attr( $status ) . '" ' . selected( $status, 'wc-' . $order->get_status(), false ) . '>' . esc_html( $status_name ) . '</option>';
}
......
<?php
if(! function_exists('qd_get_message')){
function get_message($id,$search_replace = array()){
if(! function_exists('wcqd_get_message')){
function wcqd_get_message($id,$search_replace = array()){
$message = WC_QD()->db()->get_message($id,$search_replace);
return $message;
}
}
if(! function_exists('wcqd_project_limit')){
function wcqd_project_limit($project_id = 0, $type = 'max'){
if(empty($project_id)){return false; }
if($type !== 'min' && $type !== 'max'){return false;}
$function_toCal = $type.'_project';
$limit = WC_QD()->db()->{$function_toCal}($project_id);
return $limit;
}
}
if(! function_exists('qd_min_amount_project')){
function qd_min_amount_project($id = ''){
$min = WC_QD()->db()->min_project($id);
return $min;
if(! function_exists('wcqd_get_project')){
function wcqd_get_project($order_id = ''){
$is_donation = WC_QD()->db()->_is_donation($order_id);
if($is_donation){
$project = WC_QD()->db()->get_project_id($order_id);
return $project;
}
return false;
}
}
if(! function_exists('qd_max_amount_project')){
function qd_max_amount_project($id = ''){
$max = WC_QD()->db()->max_project($id);
return $max;
if(! function_exists('wcqd_get_project_name')){
function wcqd_get_project_name($order_id = ''){
$title = false;
$project_id = wcqd_get_project($order_id);
wcqd_project_limit($project_id);
$title = get_the_title($project_id);
return $title;
}
}
/**
* Get all order statuses
*
* @since 2.2
* @return array
*/
function wc_qd_order_statuses() {
$wc_status = wc_get_order_statuses();
$order_statuses = array();
$order_statuses['donation-completed'] = _x( 'Donation Completed', 'Donation Completed', WC_QD_TXT );
$order_statuses['donation-refunded'] = _x( 'Donation Refunded', 'Order status', WC_QD_TXT);
$order_statuses['donation-on-hold'] = _x( 'Donation On Hold', 'Order status', WC_QD_TXT);
$order_statuses = array_merge($order_statuses,$wc_status);
return $order_statuses;
}
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment