Skip to content

Commit

Permalink
Released 2.8.1
Browse files Browse the repository at this point in the history
Fixed : Selling / Regular shown from base product price if any one is
empty
[#14]
Updated : Persian Language
  • Loading branch information
varunsridharan committed Dec 1, 2015
1 parent 8368dce commit baf5dab
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 52 deletions.
2 changes: 1 addition & 1 deletion admin/class-admin-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function edit_bulk(){


public function add_bulk_edit(){
echo '<option id="BulkEditVariables" value="variable_role_based_price_bulk_edit" >Custom Bulk Edit</option>';
echo '<option id="BulkEditVariables" value="variable_role_based_price_bulk_edit" >'.__('Role Based Price Bulk Edit').'</option>';
}
public function get_selectbox_user_role(){
$user_roles = WC_RBP()->get_registered_roles();
Expand Down
14 changes: 9 additions & 5 deletions admin/includes/class-simple-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function wc_rbp_popup_div(){
}
}

private function save_db_price($post_id,$status,$prices){
private function save_db_price($post_id,$status,$prices){
update_post_meta($post_id,'_enable_role_based_price', $status);
update_post_meta($post_id,'_role_based_price', $prices);
do_action('woocommerce_role_based_price_data_save',$post_id);
Expand All @@ -110,7 +110,7 @@ public function save_price(){
$post_id = $_POST['wc_rbp_post_id'];
$status = false;
$prices = '';
if(isset($_POST['enable_role_based_price'])){ $status = true; }
if(isset($_POST['enable_role_based_price'])){ $status = 'true'; }
if(isset($_POST['role_based_price']) && is_array($_POST['role_based_price'])){
$prices = $_POST['role_based_price'];
}
Expand All @@ -124,16 +124,20 @@ public function save_price(){


public function save_bulk_price(){


$msg = '<div class="wc_rbp_alert wc_rbp_alert-error">
<a class="wc_rbp_close wc_rbp_pop_up_close" data-dismiss="alert">×</a> <strong>Oh Snap!</strong> '.__('Unable To Save Product Role Price. Please Try Again.',WC_RBP_TXT).' </div>';
if(check_ajax_referer(WC_RBP_SLUG.'-product-bulk-edit-nounce' , 'security' )){
if(isset($_POST['wc_rbp_bulk_variation_id'])){
$status = '';
$status = 'false';
$prices = '';
if(isset($_POST['enable_role_based_price'])){ $status = true; }

if(isset($_POST['enable_role_based_price'])){ $status = 'true'; }
if(isset($_POST['role_based_price']) && is_array($_POST['role_based_price'])){
$prices = $_POST['role_based_price'];
}

$ids = $_POST['wc_rbp_bulk_variation_id'];
foreach($ids as $id){
$this->save_db_price($id,$status,$prices);
Expand Down Expand Up @@ -175,7 +179,7 @@ public function simple_price_form($post_id,$type="simple"){
$selling_price = WC_RBP()->get_allowed_price('sale');
WC_RBP()->sp_function()->get_db_price($post_id);
$this->status = WC_RBP()->sp_function()->get_status($post_id);

$wc_rbp_enable_status = '';
$display = 'hidden';

Expand Down
1 change: 1 addition & 0 deletions includes/class-product-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public function get_base_product_price($id,$price){

public function get_status($id){
$status = get_post_meta($id,'_enable_role_based_price',true );

if($status == true && $status == 'true'){
return true;
}
Expand Down
19 changes: 12 additions & 7 deletions includes/class-product-pricing-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ public function get_regular_price ( $price, $product, $price_meta_key = 'regular
if(defined('WC_RBP_SHORTCODE_PRODUCT_BASE_PRICING')){
return $price;
}

$opposit_key = 'regular_price';
if($price_meta_key == 'regular_price'){$opposit_key = 'selling_price';}
if($price_meta_key == 'selling_price'){$opposit_key = 'regular_price';}
$wcrbp_price = $price;
$cRole = $this->get_current_role();
if ( get_class( $product ) == 'WC_Product_Variation' ) {
Expand All @@ -107,13 +109,16 @@ public function get_regular_price ( $price, $product, $price_meta_key = 'regular
if($this->get_status($post_id)){
$wcrbp_price_new = get_post_meta( $post_id, $meta_key, true );

if(isset($wcrbp_price_new[$cRole])) {
if(!empty($wcrbp_price_new[$cRole][$price_meta_key])){
$wcrbp_price = $wcrbp_price_new[$cRole][$price_meta_key];
} else {
$wcrbp_price = '';
if(isset($wcrbp_price_new[$cRole])) {
if(empty($wcrbp_price_new[$cRole][$opposit_key]) && empty($wcrbp_price_new[$cRole][$price_meta_key])){
$wcrbp_price = $price;
} else if(! empty($wcrbp_price_new[$cRole][$price_meta_key]) && empty($wcrbp_price_new[$cRole][$opposit_key])){
$wcrbp_price = $wcrbp_price_new[$cRole][$price_meta_key];
} else if(empty($wcrbp_price_new[$cRole][$price_meta_key]) && ! empty($wcrbp_price_new[$cRole][$opposit_key])){
$wcrbp_price = $wcrbp_price_new[$cRole][$price_meta_key];
} else {
$wcrbp_price = $price;
}

}

}
Expand Down
Binary file modified lang/fa_IR.mo
Binary file not shown.
83 changes: 48 additions & 35 deletions lang/po/woocommerce-role-based-price-fa_IR.po
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce Role Based Price\n"
"POT-Creation-Date: 2015-11-04 18:53+0330\n"
"PO-Revision-Date: 2015-11-04 18:59+0330\n"
"POT-Creation-Date: 2015-11-08 17:12+0330\n"
"PO-Revision-Date: 2015-11-08 17:13+0330\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fa\n"
Expand All @@ -19,74 +19,76 @@ msgstr ""
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.js\n"

#: admin/class-admin-init.php:173
#: admin/class-admin-init.php:183
msgid "Settings"
msgstr "تنظیمات"

#: admin/class-admin-init.php:179
#: admin/class-admin-init.php:189
msgid "F.A.Q"
msgstr "سؤالات متداول"

#: admin/class-admin-init.php:190
#: admin/class-admin-init.php:200
msgid "Report Issue"
msgstr "نمایش جزئیات"

#: admin/class-admin-init.php:196
#: admin/class-admin-init.php:206
msgid "Donate"
msgstr "کمک کردن"

#: admin/class-admin-init.php:201
#: admin/class-admin-init.php:211
msgid "Contact Author"
msgstr "تماس با نویسنده"

#: admin/class-admin-settings.php:39
#: admin/class-admin-settings.php:41
#: plugins/class-wp-all-import-pro-Integration.php:23
msgid "WooCommerce Role Based Pricing"
msgstr "قیمت گذاری در ووکامرس بر اساس نقش"

#: admin/class-admin-settings.php:51
#: admin/class-admin-settings.php:53
msgid "General"
msgstr "اصلی"

#: admin/class-admin-settings.php:52
#: admin/class-admin-settings.php:54
msgid "User Role Rename"
msgstr "تغییر نام نقش کاربر"

#: admin/class-admin-settings.php:53
#: admin/class-admin-settings.php:55
msgid "Price Visibility"
msgstr "قیمت دید"

#: admin/class-admin-settings.php:54
#: admin/class-admin-settings.php:56
msgid "Newsletter"
msgstr "خبرنامه"

#: admin/class-admin-settings.php:59
#: admin/class-admin-settings.php:61
msgid "Plugins"
msgstr "پلاگین ها"

#: admin/includes/class-simple-product.php:41
#: admin/includes/class-simple-product.php:71
#: admin/includes/class-simple-product.php:42
#: admin/includes/class-simple-product.php:72
msgid ""
"<span class=\"wc_rbp_error\"> <strong> Please Save Or Publish This Product "
"To Add Role Based Price </strong> </span>"
msgstr ""
"<span class=\"wc_rbp_error\"><strong>لطفا ذخیره یا انتشار این محصول برای "
"افزودن نقش بر اساس قیمت</strong></span>"

#: admin/includes/class-simple-product.php:44
#: admin/includes/class-simple-product.php:45
msgid "Role Based Price"
msgstr " قیمت بر اساس نقش"

#: admin/includes/class-simple-product.php:48
#: admin/includes/class-simple-product.php:78
#: admin/includes/class-simple-product.php:49
#: admin/includes/class-simple-product.php:79
msgid "Add / Edit Role Pricing"
msgstr "افزودن / ویرایش قیمت گذاری نقش"

#: admin/includes/class-simple-product.php:101
#: admin/includes/class-simple-product.php:106
#: admin/includes/class-simple-product.php:128
msgid "Unable To Save Product Role Price. Please Try Again."
msgstr "قادر به ذخیره محصول نقش قیمت. لطفا دوباره سعی کنید."

#: admin/includes/class-simple-product.php:124
#: admin/includes/class-simple-product.php:119
#: admin/includes/class-simple-product.php:143
msgid "Product's Role Based Pricing Updated"
msgstr "محصول قیمت گذاری مبتنی بر نقش بروز"

Expand Down Expand Up @@ -118,27 +120,27 @@ msgstr "قیمت اصلی"
msgid "Sale Price"
msgstr "قیمت فروش ویژه"

#: admin/includes/settings-newsletter.php:8
#: admin/includes/settings-newsletter.php:8 includes/page-html.php:73
msgid "Subscribe to our mailing list"
msgstr "مشترک شدن در لیست پستی ما"

#: admin/includes/settings-newsletter.php:15
#: admin/includes/settings-newsletter.php:15 includes/page-html.php:86
msgid "Email Address"
msgstr "آدرس ایمیل"

#: admin/includes/settings-newsletter.php:20
#: admin/includes/settings-newsletter.php:20 includes/page-html.php:94
msgid "First Name"
msgstr "نام"

#: admin/includes/settings-newsletter.php:25
#: admin/includes/settings-newsletter.php:25 includes/page-html.php:100
msgid "Last Name"
msgstr "نام خانوادگی"

#: admin/includes/settings-newsletter.php:29
#: admin/includes/settings-newsletter.php:29 includes/page-html.php:106
msgid "Website"
msgstr "وب سایت"

#: admin/includes/settings-newsletter.php:34
#: admin/includes/settings-newsletter.php:34 includes/page-html.php:115
msgid "Country"
msgstr "کشور"

Expand Down Expand Up @@ -214,6 +216,7 @@ msgid "Selling Price"
msgstr "قیمت فروش"

#: admin/includes/views/popup_rbform_footer.php:11
#: admin/includes/views/popup_rbpform_bulkedit_footer.php:14
msgid "Save Price"
msgstr "صرفه جویی در قیمت"

Expand All @@ -229,26 +232,36 @@ msgstr "فعال"
msgid "off"
msgstr "غیرفعال"

#: includes/class-product-functions.php:44
#: includes/class-activation.php:117
msgid "Change Log"
msgstr "مشاهده ی تغییرات"

#: includes/class-activation.php:128
msgid " Download's so far. help use reach more audience by sharing"
msgstr ""
"تا به حال دانلود شده.برای کمک به ما با مخاطبان بیشتری این افزونه را به "
"اشتراک بگذارید"

#: includes/class-product-functions.php:47
msgid "Invalid Product ID Given"
msgstr "شناسه محصول داده نامعتبر"

#: includes/class-product-functions.php:45
#: includes/class-product-functions.php:51
msgid "Invalid User Role Given"
msgstr "نقش کاربر نامعتبر داده"

#: includes/class-product-functions.php:53
#: includes/class-product-functions.php:58
msgid "Invalid Price Type Given"
msgstr "نوع نامعتبر قيمت داده"

#: includes/class-product-pricing-frontend.php:230
#: includes/class-product-pricing-frontend.php:235
#: includes/class-product-pricing-frontend.php:233
#: includes/class-product-pricing-frontend.php:238
#, php-format
msgctxt "Price range: from-to"
msgid "%1$s&ndash;%2$s"
msgstr "%1$sنوع %2$s"

#: includes/class-product-pricing-frontend.php:242
#: includes/class-product-pricing-frontend.php:245
msgid "Free!"
msgstr "رایگان!"

Expand Down Expand Up @@ -277,14 +290,14 @@ msgstr "ادغام سیستمهای ارز Aelia"
msgid " { "
msgstr "{"

#: woocommerce-role-based-price.php:357
#: woocommerce-role-based-price.php:380
msgid "<strong> <i> WooCommerce Role Based Pricing </i> </strong> Requires"
msgstr "<i><strong>قیمت گذاری بر اساس نقش WooCommerce</strong></i> نیاز"

#: woocommerce-role-based-price.php:357
#: woocommerce-role-based-price.php:380
msgid " <u>Woocommerce</u>"
msgstr "ووکامرس"

#: woocommerce-role-based-price.php:357
#: woocommerce-role-based-price.php:380
msgid " To Be Installed And Activated"
msgstr "برای نصب و فعال"
11 changes: 9 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Requires at least: 3.0
Tested up to: 4.5
WC requires at least: 2.0
WC tested up to: 2.5
Stable tag: 2.8
Stable tag: 2.8.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -29,6 +29,8 @@ For example, Subscribers or Contributors get different prices than new customers
* Shortcode to get product price
* Bulk Edit Variable Role Basede Price

= Bulk Edit Option =
> Product Edit View => Variation Tab => Bulk Product Edit {Select Box}

= Plugin Addons =
* Integration To <a href="http://www.wpallimport.com/" > WP All Import Plugin </a>
Expand Down Expand Up @@ -57,6 +59,7 @@ For example, Subscribers or Contributors get different prices than new customers
* <a href="https://profiles.wordpress.org/miladjef/">miladjef</a> {Persian translation}

= Plugin Contributors / Testers =
* <a href="https://profiles.wordpress.org/raj5harma">Raj sharma</a>
* <a href="https://wordpress.org/support/profile/nick6352683" >nick6352683 </a>
* <a href="https://profiles.wordpress.org/arnisarbidans">arnis.arbidans</a>
* <a href="https://profiles.wordpress.org/cuppy90">Cuppy</a>
Expand Down Expand Up @@ -141,8 +144,12 @@ Please open an issue at <a href="https://github.com/technofreaky/WooCommerce-Rol


== Changelog ==
= 2.8.1 [08-11-2015] =
* Fixed : Selling / Regular shown from base product price if any one is empty [https://github.com/technofreaky/WooCommerce-Role-Based-Price/issues/14]
* Updated : Persian Language

= 2.8 [08-11-2015] =
* Fixed [https://github.com/technofreaky/WooCommerce-Role-Based-Price/issues/14]
* Fixed : Selling / Regular shown from base product price if any one is empty [https://github.com/technofreaky/WooCommerce-Role-Based-Price/issues/14]
* Fixed [https://github.com/technofreaky/WooCommerce-Role-Based-Price/issues/12]
* Bulk Variable Price Edit In Product Edit View
[https://github.com/technofreaky/WooCommerce-Role-Based-Price/issues/11]
Expand Down
Binary file modified screenshot-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions woocommerce-role-based-price.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Role Based Price
* Plugin URI: https://wordpress.org/plugins/woocommerce-role-based-price/
* Description: Set WooCommerce Product Price Based On User Role
* Version: 2.8
* Version: 2.8.1
* Author: Varun Sridharan
* Author URI: http://varunsridharan.in
* Text Domain: woocommerce-role-based-price
Expand All @@ -16,7 +16,7 @@

define('WC_RBP_NAME','WC Role Based Price',true); # Plugin Name
define('WC_RBP_SLUG','wc-role-based-price',true); # Plugin Slug
define('WC_RBP_VERSION','2.8',true); # Plugin Version
define('WC_RBP_VERSION','2.8.1',true); # Plugin Version
define('WC_RBP_PATH',plugin_dir_path( __FILE__ ),true); # Plugin DIR
define('WC_RBP_ADMIN_PATH',WC_RBP_PATH.'admin/',true); # Plugin DIR
define('WC_RBP_ADMIN_CSS',WC_RBP_PATH.'admini/css/'); # Plugin DIR
Expand Down

0 comments on commit baf5dab

Please sign in to comment.