1
0
mirror of synced 2025-01-18 08:51:41 +03:00

Corrects directory path when customizing base file (#341)

This commit is contained in:
Kocmonavtik 2024-09-02 15:58:26 +03:00 committed by GitHub
parent 8b01b9844b
commit 78fd206c0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 29 additions and 11 deletions

View File

@ -1,3 +1,7 @@
## 2024-08-26 4.8.2
* Fixed base file customization issue
* Added a hook to update the list of meta fields
## 2024-08-06 4.8.1 ## 2024-08-06 4.8.1
* Fix filtering of api query results * Fix filtering of api query results

View File

@ -1 +1 @@
4.8.1 4.8.2

View File

@ -46,6 +46,8 @@
> retailcrm_order_update_after - позволяет проверить изменение заказа и произвести дополнительные действия > retailcrm_order_update_after - позволяет проверить изменение заказа и произвести дополнительные действия
> retailcrm_change_default_meta_fields - позволяет изменить список получаемых по умолчанию мета-полей
**Пример использования:** **Пример использования:**
```php ```php
<?php <?php

View File

@ -18,6 +18,8 @@ if (!class_exists('WC_Retailcrm_Base')) {
*/ */
class WC_Retailcrm_Base extends WC_Retailcrm_Abstracts_Settings class WC_Retailcrm_Base extends WC_Retailcrm_Abstracts_Settings
{ {
const ASSETS_DIR = '/woo-retailcrm/assets';
/** @var WC_Retailcrm_Proxy|WC_Retailcrm_Client_V5|bool */ /** @var WC_Retailcrm_Proxy|WC_Retailcrm_Client_V5|bool */
protected $apiClient; protected $apiClient;
@ -808,7 +810,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
*/ */
private function include_css_files_for_admin() private function include_css_files_for_admin()
{ {
$path = plugins_url() . '/woo-retailcrm/assets/css/'; $path = plugins_url() . self::ASSETS_DIR . '/css/';
// Include style for export // Include style for export
wp_register_style('retailcrm-export-style', $path . 'progress-bar.min.css', false, '0.1'); wp_register_style('retailcrm-export-style', $path . 'progress-bar.min.css', false, '0.1');
@ -841,7 +843,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
]; ];
$wpAdminUrl = ['url' => get_admin_url()]; $wpAdminUrl = ['url' => get_admin_url()];
$jsScriptsPath = plugins_url() . '/woo-retailcrm/assets/js/'; $jsScriptsPath = plugins_url() . self::ASSETS_DIR . '/js/';
foreach ($jsScripts as $scriptName) { foreach ($jsScripts as $scriptName) {
wp_register_script($scriptName, $jsScriptsPath . $scriptName . '.js', false, '0.1'); wp_register_script($scriptName, $jsScriptsPath . $scriptName . '.js', false, '0.1');
@ -861,7 +863,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
*/ */
public function include_whatsapp_icon_style() public function include_whatsapp_icon_style()
{ {
wp_register_style('whatsapp_icon_style', plugins_url() . '/woo-retailcrm/assets/css/whatsapp-icon.min.css', false, '0.1'); wp_register_style('whatsapp_icon_style', plugins_url() . self::ASSETS_DIR . '/css/whatsapp-icon.min.css', false, '0.1');
wp_enqueue_style('whatsapp_icon_style'); wp_enqueue_style('whatsapp_icon_style');
} }
@ -1018,8 +1020,8 @@ if (!class_exists('WC_Retailcrm_Base')) {
$jsScript = 'retailcrm-loyalty-actions'; $jsScript = 'retailcrm-loyalty-actions';
$loyaltyUrl = ['url' => get_admin_url()]; $loyaltyUrl = ['url' => get_admin_url()];
$jsScriptsPath = plugins_url() . '/woo-retailcrm/assets/js/'; $jsScriptsPath = plugins_url() . self::ASSETS_DIR . '/js/';
$cssPath = plugins_url() . '/woo-retailcrm/assets/css/'; $cssPath = plugins_url() . self::ASSETS_DIR . '/css/';
$messagePhone = __('Enter the correct phone number', 'retailcrm'); $messagePhone = __('Enter the correct phone number', 'retailcrm');
wp_register_script($jsScript, $jsScriptsPath . $jsScript . '.js', false, '0.1'); wp_register_script($jsScript, $jsScriptsPath . $jsScript . '.js', false, '0.1');
@ -1082,7 +1084,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
$metaData = ['default_retailcrm' => __('Select value', 'retailcrm')]; $metaData = ['default_retailcrm' => __('Select value', 'retailcrm')];
$sqlQuery = "SELECT DISTINCT `meta_key` FROM $table ORDER BY `meta_key`"; $sqlQuery = "SELECT DISTINCT `meta_key` FROM $table ORDER BY `meta_key`";
$defaultMetaFields = file( $defaultMetaFields = file(
__DIR__ . '/../assets/default/default_meta_fields.txt', WP_PLUGIN_DIR . self::ASSETS_DIR . '/default/default_meta_fields.txt',
FILE_IGNORE_NEW_LINES FILE_IGNORE_NEW_LINES
); );
@ -1090,6 +1092,8 @@ if (!class_exists('WC_Retailcrm_Base')) {
$metaData[$metaValue->meta_key] = $metaValue->meta_key; $metaData[$metaValue->meta_key] = $metaValue->meta_key;
} }
$defaultMetaFields = apply_filters('retailcrm_change_default_meta_fields', $defaultMetaFields);
return array_diff($metaData, $defaultMetaFields); return array_diff($metaData, $defaultMetaFields);
} }

View File

@ -5,7 +5,7 @@ Tags: Интеграция, Simla.com, simla
Requires PHP: 7.0 Requires PHP: 7.0
Requires at least: 5.3 Requires at least: 5.3
Tested up to: 6.5 Tested up to: 6.5
Stable tag: 4.8.1 Stable tag: 4.8.2
License: GPLv1 or later License: GPLv1 or later
License URI: http://www.gnu.org/licenses/gpl-1.0.html License URI: http://www.gnu.org/licenses/gpl-1.0.html
@ -82,6 +82,10 @@ Asegúrate de tener una clave API específica para cada tienda. Las siguientes i
== Changelog == == Changelog ==
= 4.8.2 =
* Fixed base file customization issue
* Added a hook to update the list of meta fields
= 4.8.1 = = 4.8.1 =
* Fix filtering of api query results * Fix filtering of api query results

View File

@ -5,7 +5,7 @@
* Description: Integration plugin for WooCommerce & Simla.com * Description: Integration plugin for WooCommerce & Simla.com
* Author: RetailDriver LLC * Author: RetailDriver LLC
* Author URI: http://retailcrm.pro/ * Author URI: http://retailcrm.pro/
* Version: 4.8.1 * Version: 4.8.2
* Tested up to: 6.5 * Tested up to: 6.5
* Requires Plugins: woocommerce * Requires Plugins: woocommerce
* WC requires at least: 5.4 * WC requires at least: 5.4

View File

@ -16,7 +16,7 @@
* *
* @link https://wordpress.org/plugins/woo-retailcrm/ * @link https://wordpress.org/plugins/woo-retailcrm/
* *
* @version 4.8.1 * @version 4.8.2
* *
* @package RetailCRM * @package RetailCRM
*/ */

View File

@ -39,6 +39,8 @@ download() {
install_wp() { install_wp() {
if [ -d $WP_CORE_DIR ]; then if [ -d $WP_CORE_DIR ]; then
mkdir -p $WP_CORE_DIR/wp-content/plugins/woo-retailcrm/assets/default
cp -n $PWD/src/assets/default/default_meta_fields.txt $WP_CORE_DIR/wp-content/plugins/woo-retailcrm/assets/default/
return; return;
fi fi
@ -47,6 +49,8 @@ install_wp() {
download https://wordpress.org/${ARCHIVE_NAME}.tar.gz /tmp/wordpress.tar.gz download https://wordpress.org/${ARCHIVE_NAME}.tar.gz /tmp/wordpress.tar.gz
tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR
download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php
mkdir -p $WP_CORE_DIR/wp-content/plugins/woo-retailcrm/assets/default
cp -n $PWD/src/assets/default/default_meta_fields.txt $WP_CORE_DIR/wp-content/plugins/woo-retailcrm/assets/default/
} }
install_woocommerce() { install_woocommerce() {
@ -105,4 +109,4 @@ install_db() {
install_wp install_wp
install_test_suite install_test_suite
install_woocommerce install_woocommerce
install_db install_db