Skip to content

Commit

Permalink
Adding loyalty program coupon entry to form by click (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kocmonavtik authored Sep 12, 2024
1 parent 78fd206 commit dac3c9f
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2024-09-11 4.8.3
* Added loyalty program coupon entry in the form by click

## 2024-08-26 4.8.2
* Fixed base file customization issue
* Added a hook to update the list of meta fields
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.8.2
4.8.3
6 changes: 6 additions & 0 deletions src/assets/js/retailcrm-loyalty-cart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function inputLoyaltyCode() {
let couponInput = document.getElementById('coupon_code');
let couponCode = document.getElementById('input_loyalty_code');

couponInput.value = couponCode.innerText;
}
7 changes: 7 additions & 0 deletions src/include/class-wc-retailcrm-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,13 @@ public function coupon_info()
if ($result) {
echo $result;
}

$jsScriptPath = plugins_url() . self::ASSETS_DIR . '/js/retailcrm-loyalty-cart.js';
$wpAdminUrl = ['url' => get_admin_url()];

wp_register_script('retailcrm-loyalty-cart', $jsScriptPath, false, '0.1');
wp_enqueue_script('retailcrm-loyalty-cart', $jsScriptPath, '', '', true);
wp_localize_script('retailcrm-loyalty-cart', 'AdminUrl', $wpAdminUrl);
} catch (Throwable $exception) {
writeBaseLogs($exception->getMessage());
}
Expand Down
2 changes: 1 addition & 1 deletion src/include/class-wc-retailcrm-loyalty.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public function createLoyaltyCoupon($refreshCoupon = false)
}

$resultString .= ' <div style="text-align: left; line-height: 3"><b>' . __('It is possible to write off', 'retailcrm') . ' ' . $lpDiscountSum . ' ' . __('bonuses', 'retailcrm') . '</b></div>';
return $resultString. '<div style="text-align: left;"><b>' . __('Use coupon:', 'retailcrm') . ' <u><i>' . $coupon->get_code() . '</i></u></i></b></div>';
return $resultString. '<div style="text-align: left;"><b>' . __('Use coupon:', 'retailcrm') . ' <u><i style="cursor: grab" id="input_loyalty_code" onclick="inputLoyaltyCode()">' . $coupon->get_code() . '</i></u></i></b></div>';
}

public function clearLoyaltyCoupon()
Expand Down
5 changes: 4 additions & 1 deletion src/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: Интеграция, Simla.com, simla
Requires PHP: 7.0
Requires at least: 5.3
Tested up to: 6.5
Stable tag: 4.8.2
Stable tag: 4.8.3
License: GPLv1 or later
License URI: http://www.gnu.org/licenses/gpl-1.0.html

Expand Down Expand Up @@ -82,6 +82,9 @@ Asegúrate de tener una clave API específica para cada tienda. Las siguientes i


== Changelog ==
= 4.8.3 =
* Added loyalty program coupon entry in the form by click

= 4.8.2 =
* Fixed base file customization issue
* Added a hook to update the list of meta fields
Expand Down
2 changes: 1 addition & 1 deletion src/retailcrm.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Integration plugin for WooCommerce & Simla.com
* Author: RetailDriver LLC
* Author URI: http://retailcrm.pro/
* Version: 4.8.2
* Version: 4.8.3
* Tested up to: 6.5
* Requires Plugins: woocommerce
* WC requires at least: 5.4
Expand Down
2 changes: 1 addition & 1 deletion src/uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @link https://wordpress.org/plugins/woo-retailcrm/
*
* @version 4.8.2
* @version 4.8.3
*
* @package RetailCRM
*/
Expand Down

0 comments on commit dac3c9f

Please sign in to comment.