Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule Builder Adjustments : PFWMA-42 #4

Merged
merged 3 commits into from
Jun 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function angelleye_display_multi_account_list() {
$option_fourteen .= '<select id="store_countries" name="store_countries" style="width: 78%;" class="wc-enhanced-select" data-placeholder="' . __("All countries", "woocommerce") . '">';
if ($countries) {
$store_countries = !empty($store_countries) ? $store_countries : '';
$option_fourteen .= '<option value="">All countries</option>';
$option_fourteen .= '<option value="0">All countries</option>';
foreach ($countries as $country_key => $country_full_name) {
$option_fourteen .= '<option value="' . esc_attr($country_key) . '"' . wc_selected($country_key, $store_countries) . '>' . esc_html($country_full_name) . '</option>';
}
Expand Down Expand Up @@ -333,7 +333,7 @@ public function angelleye_display_multi_account_list() {
$option_twelve = '';
}
$option_six .= '</select><p class="description"></p>';
echo sprintf('<tr><th scope="row" class="titledesc"><label for="woocommerce_paypal_express_api_trigger_conditions">%1$s</label></th><td class="forminp"><fieldset>%5$s %6$s %8$s %13$s %9$s %10$s %7$s <select class="smart_forwarding_field" name="woocommerce_paypal_express_api_condition_field">%2$s</select><select class="smart_forwarding_field" name="woocommerce_paypal_express_api_condition_sign">%3$s</select><input class="input-text regular-input" name="woocommerce_paypal_express_api_condition_value" id="woocommerce_paypal_express_api_condition_value" type="number" min="1" max="1000" step="0.01" value="%4$s">%11$s %12$s</fieldset></td></tr>', $option_one, $option_two, $option_three, $option_four, $option_ten, $option_five, $option_six, $option_seven, $option_eight, $option_nine, $option_twelve, $option_thirteen, $option_fourteen);
echo sprintf('<tr><th scope="row" class="titledesc"><label for="woocommerce_paypal_express_api_trigger_conditions">%1$s</label></th><td class="forminp"><fieldset>%5$s %6$s %8$s %13$s %9$s %10$s %7$s <select class="smart_forwarding_field" name="woocommerce_paypal_express_api_condition_field">%2$s</select><select class="smart_forwarding_field" name="woocommerce_paypal_express_api_condition_sign">%3$s</select><input class="input-text regular-input" name="woocommerce_paypal_express_api_condition_value" id="woocommerce_paypal_express_api_condition_value" type="number" min="0" max="1000" step="0.01" value="%4$s">%11$s %12$s</fieldset></td></tr>', $option_one, $option_two, $option_three, $option_four, $option_ten, $option_five, $option_six, $option_seven, $option_eight, $option_nine, $option_twelve, $option_thirteen, $option_fourteen);
echo sprintf('<tr style="display: table-row;" valign="top">
<th scope="row" class="titledesc">
<input name="is_edit" class="button-primary woocommerce-save-button" type="hidden" value="%1$s" />
Expand Down Expand Up @@ -546,7 +546,12 @@ public function angelleye_save_multi_account_data() {
if (!empty($_POST[$microprocessing_key])) {
update_post_meta($post_id, $microprocessing_key, is_array($_POST[$microprocessing_key]) ? $_POST[$microprocessing_key] : trim($_POST[$microprocessing_key]));
} else {
update_post_meta($post_id, $microprocessing_key, '');
if($microprocessing_key == 'woocommerce_paypal_express_api_condition_value') {
update_post_meta($post_id, $microprocessing_key, trim($_POST[$microprocessing_key]));
} else {
update_post_meta($post_id, $microprocessing_key, '');
}

}
}
}
Expand Down Expand Up @@ -748,7 +753,11 @@ public function angelleye_save_multi_account_data_paypal_pro_payflow() {
if (!empty($_POST[$microprocessing_key])) {
update_post_meta($post_id, $microprocessing_key, is_array($_POST[$microprocessing_key]) ? $_POST[$microprocessing_key] : trim($_POST[$microprocessing_key]));
} else {
update_post_meta($post_id, $microprocessing_key, '');
if($microprocessing_key == 'woocommerce_paypal_express_api_condition_value') {
update_post_meta($post_id, $microprocessing_key, trim($_POST[$microprocessing_key]));
} else {
update_post_meta($post_id, $microprocessing_key, '');
}
}
}
}
Expand Down Expand Up @@ -1784,7 +1793,7 @@ public function angelleye_multi_account_condition_ui() {
<?php
$category_ids = array();
$countries = WC()->countries->get_countries();
echo '<option value="">All countries</option>';
echo '<option value="0">All countries</option>';
if ($countries) {
foreach ($countries as $country_key => $country_full_name) {
echo '<option value="' . esc_attr($country_key) . '"' . wc_selected($country_key, $category_ids) . '>' . esc_html($country_full_name) . '</option>';
Expand Down Expand Up @@ -1837,8 +1846,8 @@ public function angelleye_multi_account_condition_ui() {
</select>
<p class="description"><?php _e('Transaction', 'paypal-for-woocommerce-multi-account-management'); ?></p>
<select class="smart_forwarding_field" name="woocommerce_paypal_express_api_condition_field"><option value="transaction_amount"><?php echo __('Transaction Amount', 'paypal-for-woocommerce-multi-account-management'); ?></option></select>
<select class="smart_forwarding_field" name="woocommerce_paypal_express_api_condition_sign"><option value="equalto"><?php echo __('Equal to', 'paypal-for-woocommerce-multi-account-management'); ?></option><option value="lessthan"><?php echo __('Less than', 'paypal-for-woocommerce-multi-account-management'); ?></option><option value="greaterthan"><?php echo __('Greater than', 'paypal-for-woocommerce-multi-account-management'); ?></option></select>
<input class="input-text regular-input" name="woocommerce_paypal_express_api_condition_value" id="woocommerce_paypal_express_api_condition_value" type="number" min="1" max="1000" step="0.01">
<select class="smart_forwarding_field" name="woocommerce_paypal_express_api_condition_sign"><option value="greaterthan"><?php echo __('Greater than', 'paypal-for-woocommerce-multi-account-management'); ?></option><option value="lessthan"><?php echo __('Less than', 'paypal-for-woocommerce-multi-account-management'); ?></option><option value="equalto"><?php echo __('Equal to', 'paypal-for-woocommerce-multi-account-management'); ?></option></select>
<input class="input-text regular-input" name="woocommerce_paypal_express_api_condition_value" id="woocommerce_paypal_express_api_condition_value" type="number" min="0" max="1000" step="0.01" value="0">
<div class="angelleye_multi_account_paypal_pro_payflow_field">
<p class="description"><?php _e('Card Type', 'paypal-for-woocommerce-multi-account-management'); ?></p>
<select class="card_type" name="card_type">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,30 @@ function column_default($item, $column_name) {
$product_ids = get_post_meta($item['ID'], 'woocommerce_paypal_express_api_product_ids', true);
$role = '';
if ($condition_role) {
if ($condition_role == 'all') {
$role = '<p class="description">' . sprintf('For %s user roles', $condition_role) . '</p>';
} else {
if ($condition_role != 'all') {
$role = '<p class="description">' . sprintf('When role is %s', $condition_role) . '</p>';
}
}
}
$other_condition = '';
$buyer_countries = get_post_meta($item['ID'], 'buyer_countries', true);
if ($buyer_countries) {
if ($buyer_countries != 'all') {
$other_condition = '<p class="description">' . sprintf('When Buyer country is %s', implode(',', $buyer_countries)) . '</p>';
}
}
$store_countries = get_post_meta($item['ID'], 'store_countries', true);
if ($store_countries) {
if ($store_countries != 'all') {
$other_condition .= '<p class="description">' . sprintf('When Store country is %s', $store_countries) . '</p>';
}
}
$currency_code = get_post_meta($item['ID'], 'currency_code', true);
if ($currency_code) {
if ($currency_code != 'all') {
$other_condition .= '<p class="description">' . sprintf('When Currency Code is %s', $currency_code) . '</p>';
}
}

if ($condition_field == 'transaction_amount') {
$field = __('Transaction Amount', 'paypal-for-woocommerce-multi-account-management');
} else {
Expand Down Expand Up @@ -64,7 +82,7 @@ function column_default($item, $column_name) {
}
$product_text .= "</div>";
}
return "{$field} {$sign} " . wc_price($condition_value) . " {$role} {$product_text}";
return "{$field} {$sign} " . wc_price($condition_value) . " {$role} {$other_condition} {$product_text}";
case 'status':
$status = get_post_meta($item['ID'], 'woocommerce_paypal_express_enable', true);
$status_pf = get_post_meta($item['ID'], 'woocommerce_paypal_pro_payflow_enable', true);
Expand Down