@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * WpShop Customer Account bootstrap file |
4 | 4 | * @author Jérôme ALLEGRE - Eoxia dev team <[email protected]> |
@@ -8,33 +8,33 @@ discard block |
||
8 | 8 | * |
9 | 9 | */ |
10 | 10 | |
11 | -if ( !defined( 'WPSHOP_VERSION' ) ) { |
|
12 | - die( __("You are not allowed to use this service.", 'wpshop') ); |
|
11 | +if (!defined('WPSHOP_VERSION')) { |
|
12 | + die(__("You are not allowed to use this service.", 'wpshop')); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | /** Template Global vars **/ |
16 | 16 | DEFINE('WPS_ACCOUNT_DIR', basename(dirname(__FILE__))); |
17 | - DEFINE('WPS_ACCOUNT_PATH', str_replace( "\\", "/", str_replace( WPS_ACCOUNT_DIR, "", dirname( __FILE__ ) ) ) ); |
|
18 | - DEFINE('WPS_ACCOUNT_URL', str_replace( str_replace( "\\", "/", ABSPATH), site_url() . '/', WPS_ACCOUNT_PATH ) ); |
|
17 | + DEFINE('WPS_ACCOUNT_PATH', str_replace("\\", "/", str_replace(WPS_ACCOUNT_DIR, "", dirname(__FILE__)))); |
|
18 | + DEFINE('WPS_ACCOUNT_URL', str_replace(str_replace("\\", "/", ABSPATH), site_url() . '/', WPS_ACCOUNT_PATH)); |
|
19 | 19 | |
20 | - include( plugin_dir_path( __FILE__ ).'controller/wps_customer_ctr.php' ); |
|
21 | - include( plugin_dir_path( __FILE__ ).'controller/wps_customer_metaboxes.controller.01.php' ); |
|
22 | - include( plugin_dir_path( __FILE__ ).'controller/wps_account_ctr.php' ); |
|
23 | - include( plugin_dir_path( __FILE__ ).'controller/wps_account_dashboard_ctr.php' ); |
|
24 | - include( plugin_dir_path( __FILE__ ).'model/wps_customer_mdl.php' ); |
|
25 | - include( plugin_dir_path( __FILE__ ).'controller/wps_customer_group.php' ); |
|
20 | + include(plugin_dir_path(__FILE__) . 'controller/wps_customer_ctr.php'); |
|
21 | + include(plugin_dir_path(__FILE__) . 'controller/wps_customer_metaboxes.controller.01.php'); |
|
22 | + include(plugin_dir_path(__FILE__) . 'controller/wps_account_ctr.php'); |
|
23 | + include(plugin_dir_path(__FILE__) . 'controller/wps_account_dashboard_ctr.php'); |
|
24 | + include(plugin_dir_path(__FILE__) . 'model/wps_customer_mdl.php'); |
|
25 | + include(plugin_dir_path(__FILE__) . 'controller/wps_customer_group.php'); |
|
26 | 26 | // include( plugin_dir_path( __FILE__ ).'controller/customer_custom_list_table.class.php' ); |
27 | 27 | // include( plugin_dir_path( __FILE__ ).'controller/wp_list_custom_groups.class.php' ); |
28 | - include( plugin_dir_path( __FILE__ ).'controller/wp_list_custom_entities_customers.php' ); |
|
29 | - include( plugin_dir_path( __FILE__ ).'controller/wps_provider_ctr.php' ); |
|
28 | + include(plugin_dir_path(__FILE__) . 'controller/wp_list_custom_entities_customers.php'); |
|
29 | + include(plugin_dir_path(__FILE__) . 'controller/wps_provider_ctr.php'); |
|
30 | 30 | |
31 | 31 | $wps_customer = new wps_customer_ctr(); |
32 | 32 | $wps_account = new wps_account_ctr(); |
33 | 33 | $wps_account_dashboard = new wps_account_dashboard_ctr(); |
34 | 34 | $wps_provider = new wps_provider_ctr(); |
35 | 35 | // Add customer admin |
36 | - if( is_admin() ) { |
|
37 | - include( plugin_dir_path( __FILE__ ).'controller/wps_customer_admin_ctr.php' ); |
|
36 | + if (is_admin()) { |
|
37 | + include(plugin_dir_path(__FILE__) . 'controller/wps_customer_admin_ctr.php'); |
|
38 | 38 | $wps_customer_admin = new wps_customer_admin(); |
39 | 39 | $wps_customer_admin->install_modules(); |
40 | 40 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,18 +1,18 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | if( !empty( $wpshop_cart_option['display_newsletter']['site_subscription'][0] ) && $wpshop_cart_option['display_newsletter']['site_subscription'][0] == 'yes' ) { |
4 | 4 | ?> |
5 | 5 | <div class="wps-form-group"> |
6 | - <input id="newsletters_site" type="checkbox" name="newsletters_site" <?php echo ( (!empty($user_preferences['newsletters_site']) && $user_preferences['newsletters_site']== 1 ) ? ' checked="checked"' : null); ?>> |
|
7 | - <label for="newsletters_site"><?php _e('I want to receive promotional information from the site','wpshop'); ?></label> |
|
6 | + <input id="newsletters_site" type="checkbox" name="newsletters_site" <?php echo ((!empty($user_preferences['newsletters_site']) && $user_preferences['newsletters_site'] == 1) ? ' checked="checked"' : null); ?>> |
|
7 | + <label for="newsletters_site"><?php _e('I want to receive promotional information from the site', 'wpshop'); ?></label> |
|
8 | 8 | </div> |
9 | 9 | <?php |
10 | 10 | } |
11 | - if( !empty( $wpshop_cart_option['display_newsletter']['partner_subscription'][0]) && $wpshop_cart_option['display_newsletter']['partner_subscription'][0] == 'yes' ) { |
|
11 | + if (!empty($wpshop_cart_option['display_newsletter']['partner_subscription'][0]) && $wpshop_cart_option['display_newsletter']['partner_subscription'][0] == 'yes') { |
|
12 | 12 | ?> |
13 | 13 | <div class="wps-form-group"> |
14 | - <input id="newsletters_site_partners" type="checkbox" name="newsletters_site_partners" <?php echo ((!empty($user_preferences['newsletters_site_partners']) && $user_preferences['newsletters_site_partners']==1 ) ? ' checked="checked"' : null); ?>/> |
|
15 | - <label for="newsletters_site_partners"><?php _e('I want to receive promotional information from partner companies','wpshop'); ?></label> |
|
14 | + <input id="newsletters_site_partners" type="checkbox" name="newsletters_site_partners" <?php echo ((!empty($user_preferences['newsletters_site_partners']) && $user_preferences['newsletters_site_partners'] == 1) ? ' checked="checked"' : null); ?>/> |
|
15 | + <label for="newsletters_site_partners"><?php _e('I want to receive promotional information from partner companies', 'wpshop'); ?></label> |
|
16 | 16 | </div> |
17 | 17 | <?php |
18 | 18 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,4 +1,4 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | -<span class="wps-h4"><?php _e( $attributes_section->name, 'wpshop' ); ?></span> |
|
3 | +<span class="wps-h4"><?php _e($attributes_section->name, 'wpshop'); ?></span> |
|
4 | 4 | <div><?php echo $attribute_details; ?></div> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,7 +1,7 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | |
3 | -if( isset( $attribute_def->code ) && $attribute_def->code != 'is_provider' ) { ?> |
|
3 | +if (isset($attribute_def->code) && $attribute_def->code != 'is_provider') { ?> |
|
4 | 4 | <div class="wps-form-group"> |
5 | - <?php echo stripslashes( $attribute_def->frontend_label ); ?> : <?php echo ( !empty($attribute_value) ) ? $attribute_value : ''; ?> |
|
5 | + <?php echo stripslashes($attribute_def->frontend_label); ?> : <?php echo (!empty($attribute_value)) ? $attribute_value : ''; ?> |
|
6 | 6 | </div> |
7 | 7 | <?php } ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | ?> |
3 | 5 | <div class="wps-gridwrapper2-padded"> |
4 | 6 | |
@@ -28,8 +30,11 @@ discard block |
||
28 | 30 | <div> |
29 | 31 | <?php echo $customer_datas; ?> |
30 | 32 | </div> |
31 | - <?php else : ?> |
|
32 | - <div class="wps-alert-info"><span class="dashicons dashicons-info"></span> <?php _e( 'Please choose a customer or create one', 'wpshop'); ?></div> |
|
33 | + <?php else { |
|
34 | + : ?> |
|
35 | + <div class="wps-alert-info"><span class="dashicons dashicons-info"></span> <?php _e( 'Please choose a customer or create one', 'wpshop'); |
|
36 | +} |
|
37 | +?></div> |
|
33 | 38 | <?php endif; ?> |
34 | 39 | </div> |
35 | 40 |
@@ -1,17 +1,17 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="wps-gridwrapper2-padded"> |
4 | 4 | |
5 | 5 | <div> |
6 | - <?php if( empty($order_metadata) || ( !empty($order_metadata) && !empty($order_metadata['order_status']) && $order_metadata['order_status'] == 'awaiting_payment') ) : ?> |
|
6 | + <?php if (empty($order_metadata) || (!empty($order_metadata) && !empty($order_metadata['order_status']) && $order_metadata['order_status'] == 'awaiting_payment')) : ?> |
|
7 | 7 | <div class="wps-boxed"> |
8 | - <div class="wps-h5"><?php _e( 'Customer Managment', 'wpshop'); ?><a href="<?php print wp_nonce_url( admin_url( 'admin-ajax.php?action=wps_load_customer_creation_form_in_admin&width=730&height=690' ), 'wps_load_customer_creation_form_in_admin', '_wpnonce' ); ?>" title="<?php _e( 'Create a customer', 'wpshop'); ?>" class="add-new-h2 alignright thickbox"><i class="wps-icon-plus"></i> <?php _e( 'Create a customer', 'wpshop'); ?></a></div> |
|
8 | + <div class="wps-h5"><?php _e('Customer Managment', 'wpshop'); ?><a href="<?php print wp_nonce_url(admin_url('admin-ajax.php?action=wps_load_customer_creation_form_in_admin&width=730&height=690'), 'wps_load_customer_creation_form_in_admin', '_wpnonce'); ?>" title="<?php _e('Create a customer', 'wpshop'); ?>" class="add-new-h2 alignright thickbox"><i class="wps-icon-plus"></i> <?php _e('Create a customer', 'wpshop'); ?></a></div> |
|
9 | 9 | |
10 | 10 | <div class="wps-gridwrapper2-padded" style="clear : both; "> |
11 | 11 | <div> |
12 | 12 | <div class="wps-form-group"> |
13 | - <label><?php _e( 'Search and choose a customer', 'wpshop'); ?> :</label> |
|
14 | - <div class="wps-form" id="wps_customer_list_container" data-nonce="<?php wp_create_nonce( 'wps_order_refresh_customer_list' ); ?>"> |
|
13 | + <label><?php _e('Search and choose a customer', 'wpshop'); ?> :</label> |
|
14 | + <div class="wps-form" id="wps_customer_list_container" data-nonce="<?php wp_create_nonce('wps_order_refresh_customer_list'); ?>"> |
|
15 | 15 | <?php echo $customer_lists; ?> |
16 | 16 | </div> |
17 | 17 | </div> |
@@ -23,24 +23,24 @@ discard block |
||
23 | 23 | <?php endif; ?> |
24 | 24 | </div> |
25 | 25 | |
26 | - <div id="wps_customer_account_informations" data-nonce="<?php echo wp_create_nonce( 'wps_order_refresh_customer_informations' ); ?>"> |
|
27 | - <?php if( !empty($order_metadata) ) : ?> |
|
26 | + <div id="wps_customer_account_informations" data-nonce="<?php echo wp_create_nonce('wps_order_refresh_customer_informations'); ?>"> |
|
27 | + <?php if (!empty($order_metadata)) : ?> |
|
28 | 28 | <div> |
29 | 29 | <?php echo $customer_datas; ?> |
30 | 30 | </div> |
31 | 31 | <?php else : ?> |
32 | - <div class="wps-alert-info"><span class="dashicons dashicons-info"></span> <?php _e( 'Please choose a customer or create one', 'wpshop'); ?></div> |
|
32 | + <div class="wps-alert-info"><span class="dashicons dashicons-info"></span> <?php _e('Please choose a customer or create one', 'wpshop'); ?></div> |
|
33 | 33 | <?php endif; ?> |
34 | 34 | </div> |
35 | 35 | |
36 | 36 | </div> |
37 | 37 | <!-- Hidden field referrer the selected customer --> |
38 | -<input type="hidden" name="wps_customer_id" id="wps_orders_selected_customer" value="<?php echo ( !empty($order_metadata) && !empty($order_metadata['customer_id']) ) ? $order_metadata['customer_id'] : ''; ?>" /> |
|
38 | +<input type="hidden" name="wps_customer_id" id="wps_orders_selected_customer" value="<?php echo (!empty($order_metadata) && !empty($order_metadata['customer_id'])) ? $order_metadata['customer_id'] : ''; ?>" /> |
|
39 | 39 | |
40 | 40 | <div id="wps_customer_addresses" class="wps-gridwrapper2-padded"> |
41 | - <?php echo ( !empty($addresses) ) ? $addresses : ''; ?> |
|
41 | + <?php echo (!empty($addresses)) ? $addresses : ''; ?> |
|
42 | 42 | </div> |
43 | -<input type="hidden" name="wps_order_selected_address[billing]" id="wps_order_selected_address_billing" value="<?php echo ( !empty($order_infos) && !empty($order_infos['billing']) && !empty($order_infos['billing']['address_id']) ) ? $order_infos['billing']['address_id'] : '' ; ?>" /> |
|
44 | -<?php if( !empty( $shipping_address_option ) && !empty($shipping_address_option['activate']) ) : ?> |
|
45 | - <input type="hidden" name="wps_order_selected_address[shipping]" id="wps_order_selected_address_shipping" value="<?php echo ( !empty($order_infos) && !empty($order_infos['shipping']) && !empty($order_infos['shipping']['address_id']) ) ? $order_infos['shipping']['address_id'] : '' ; ?>" /> |
|
43 | +<input type="hidden" name="wps_order_selected_address[billing]" id="wps_order_selected_address_billing" value="<?php echo (!empty($order_infos) && !empty($order_infos['billing']) && !empty($order_infos['billing']['address_id'])) ? $order_infos['billing']['address_id'] : ''; ?>" /> |
|
44 | +<?php if (!empty($shipping_address_option) && !empty($shipping_address_option['activate'])) : ?> |
|
45 | + <input type="hidden" name="wps_order_selected_address[shipping]" id="wps_order_selected_address_shipping" value="<?php echo (!empty($order_infos) && !empty($order_infos['shipping']) && !empty($order_infos['shipping']['address_id'])) ? $order_infos['shipping']['address_id'] : ''; ?>" /> |
|
46 | 46 | <?php endif; ?> |
@@ -1,20 +1,20 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="wps-boxed"> |
4 | 4 | <div id="wps_signup_error_container"></div> |
5 | 5 | <?php |
6 | - if( !empty($signup_fields) ) : |
|
7 | - foreach( $signup_fields as $fields_section_name => $fields_section ) : ?> |
|
8 | - <span class="wps-h4"><?php _e( $fields_section_name, 'wpshop' ); ?></span> |
|
6 | + if (!empty($signup_fields)) : |
|
7 | + foreach ($signup_fields as $fields_section_name => $fields_section) : ?> |
|
8 | + <span class="wps-h4"><?php _e($fields_section_name, 'wpshop'); ?></span> |
|
9 | 9 | <div><?php |
10 | - foreach( $fields_section as $signup_field ) : |
|
11 | - $query = $wpdb->prepare( 'SELECT value FROM '.WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX.strtolower($signup_field->data_type). ' WHERE entity_type_id = %d AND attribute_id = %d AND entity_id = %d ', $customer_entity_type_id, $signup_field->id, $cid ); |
|
10 | + foreach ($fields_section as $signup_field) : |
|
11 | + $query = $wpdb->prepare('SELECT value FROM ' . WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . strtolower($signup_field->data_type) . ' WHERE entity_type_id = %d AND attribute_id = %d AND entity_id = %d ', $customer_entity_type_id, $signup_field->id, $cid); |
|
12 | 12 | |
13 | - $value = $wpdb->get_var( $query ); |
|
14 | - $attribute_output_def = wpshop_attributes::get_attribute_field_definition( $signup_field, $value, array( 'from' => 'frontend', array( 'options' => array( 'original' => true, ), ) ) ); |
|
13 | + $value = $wpdb->get_var($query); |
|
14 | + $attribute_output_def = wpshop_attributes::get_attribute_field_definition($signup_field, $value, array('from' => 'frontend', array('options' => array('original' => true,),))); |
|
15 | 15 | ?> |
16 | 16 | <div class="wps-form-group"> |
17 | - <label for="<?php echo $signup_field->code; ?>"><?php _e( stripslashes($signup_field->frontend_label), 'wpshop'); ?><?php //echo ( ( !empty($attribute_output_def['required']) && $attribute_output_def['required'] == 'yes' ) ? ' <em>*</em>' : '' ); ?></label> |
|
17 | + <label for="<?php echo $signup_field->code; ?>"><?php _e(stripslashes($signup_field->frontend_label), 'wpshop'); ?><?php //echo ( ( !empty($attribute_output_def['required']) && $attribute_output_def['required'] == 'yes' ) ? ' <em>*</em>' : '' ); ?></label> |
|
18 | 18 | <div id="<?php echo $signup_field->code; ?>" class="wps-form"><?php echo $attribute_output_def['output']; echo $attribute_output_def['options']; ?></div> |
19 | 19 | </div> |
20 | 20 | <?php |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="product" data-id="<?php echo $post->ID; ?>"> |
4 | 4 | <h1 data-id="<?php echo $post->ID; ?>"><a href="#"><?php echo $post->post_title; ?></a></h1><a data-id="<?php echo $post->ID; ?>" class="delete_provider_btn" href="#">delete</a><input type="hidden" data-id="<?php echo $post->ID; ?>" class="special_provider" name="wps_provider_product[<?php echo $post->ID; ?>][special_provider]" value="update"> |
5 | 5 | <div class="values" data-id="<?php echo $post->ID; ?>"> |
6 | 6 | <div class="wps-form-group"> |
7 | - <label><?php _e( 'Product title', 'wpshop'); ?></label> |
|
7 | + <label><?php _e('Product title', 'wpshop'); ?></label> |
|
8 | 8 | <div class="wps-form"><input type="text" name="wps_provider_product[<?php echo $post->ID; ?>][post_title]" value="<?php echo $post->post_title; ?>" /></div> |
9 | 9 | </div> |
10 | 10 | <div class="wps-form-group"> |
11 | - <label><?php _e( 'Product description', 'wpshop'); ?> :</label> |
|
12 | - <div class="wps-form"><textarea id="wps_product_description_<?php echo $post->ID; ?>" name="wps_provider_product[<?php echo $post->ID; ?>][post_content]"><?php echo nl2br( $post->post_content );?></textarea></div> |
|
11 | + <label><?php _e('Product description', 'wpshop'); ?> :</label> |
|
12 | + <div class="wps-form"><textarea id="wps_product_description_<?php echo $post->ID; ?>" name="wps_provider_product[<?php echo $post->ID; ?>][post_content]"><?php echo nl2br($post->post_content); ?></textarea></div> |
|
13 | 13 | </div> |
14 | 14 | <?php echo $attributes_display; ?> |
15 | 15 | </div> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,6 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="wps-form-group"> |
4 | - <label><?php _e( $att['field_definition']['label'], 'wpshop' ); ?></label> |
|
5 | - <div class="wps-form"><?php echo str_replace( 'name="wpshop_product_attribute', 'name="wps_provider_product[' .$post->ID. '][' . WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT . '_attribute]', $att['field_definition']['output'] ); ?></div> |
|
4 | + <label><?php _e($att['field_definition']['label'], 'wpshop'); ?></label> |
|
5 | + <div class="wps-form"><?php echo str_replace('name="wpshop_product_attribute', 'name="wps_provider_product[' . $post->ID . '][' . WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT . '_attribute]', $att['field_definition']['output']); ?></div> |
|
6 | 6 | </div> |
7 | 7 | \ No newline at end of file |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,44 +1,44 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | |
3 | 3 | /** Get customer orders list for statistic displaying */ |
4 | 4 | $wps_orders_mdl = new wps_orders_mdl(); |
5 | - $orders = $wps_orders_mdl->get_customer_orders( $current_user_id_in_list ); |
|
6 | - $color_label = array( 'awaiting_payment' => 'jaune', 'canceled' => 'rouge', 'partially_paid' => 'orange', 'incorrect_amount' => 'orange', 'denied' => 'rouge', 'shipped' => 'bleu', 'pos' => 'bleu', 'payment_refused' => 'rouge', 'completed' => 'vert', 'refunded' => 'rouge'); |
|
5 | + $orders = $wps_orders_mdl->get_customer_orders($current_user_id_in_list); |
|
6 | + $color_label = array('awaiting_payment' => 'jaune', 'canceled' => 'rouge', 'partially_paid' => 'orange', 'incorrect_amount' => 'orange', 'denied' => 'rouge', 'shipped' => 'bleu', 'pos' => 'bleu', 'payment_refused' => 'rouge', 'completed' => 'vert', 'refunded' => 'rouge'); |
|
7 | 7 | |
8 | -if ( !empty( $orders ) ) : |
|
9 | - $currency = wpshop_tools::wpshop_get_currency( false ); |
|
10 | - $orders_status = unserialize( WPSHOP_ORDER_STATUS ); |
|
8 | +if (!empty($orders)) : |
|
9 | + $currency = wpshop_tools::wpshop_get_currency(false); |
|
10 | + $orders_status = unserialize(WPSHOP_ORDER_STATUS); |
|
11 | 11 | |
12 | 12 | $customer_order_total_amount = $customer_order_real_total_amount = 0; |
13 | 13 | $order_statuses = array(); |
14 | 14 | $ordered_products = array(); |
15 | - foreach( $orders as $order ) : |
|
16 | - $order_meta = get_post_meta( $order->ID, '_order_postmeta', true ); |
|
15 | + foreach ($orders as $order) : |
|
16 | + $order_meta = get_post_meta($order->ID, '_order_postmeta', true); |
|
17 | 17 | |
18 | - if ( empty( $order_statuses[ $order_meta['order_status'] ] ) ) { |
|
19 | - $order_statuses[ $order_meta['order_status'] ] = 1; |
|
18 | + if (empty($order_statuses[$order_meta['order_status']])) { |
|
19 | + $order_statuses[$order_meta['order_status']] = 1; |
|
20 | 20 | } |
21 | 21 | else { |
22 | - $order_statuses[ $order_meta['order_status'] ] += 1; |
|
22 | + $order_statuses[$order_meta['order_status']] += 1; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | $customer_order_total_amount += $order_meta['order_grand_total']; |
26 | - if ( 'completed' == $order_meta['order_status'] ) { |
|
26 | + if ('completed' == $order_meta['order_status']) { |
|
27 | 27 | $customer_order_real_total_amount += $order_meta['order_grand_total']; |
28 | 28 | } |
29 | 29 | |
30 | - if ( !empty( $order_meta ) && !empty( $order_meta[ 'order_items' ] ) ) { |
|
31 | - foreach ( $order_meta[ 'order_items' ] as $order_item ) : |
|
32 | - $ordered_products[ $order_item[ 'item_id' ] ] = $order_item[ 'item_name' ]; |
|
30 | + if (!empty($order_meta) && !empty($order_meta['order_items'])) { |
|
31 | + foreach ($order_meta['order_items'] as $order_item) : |
|
32 | + $ordered_products[$order_item['item_id']] = $order_item['item_name']; |
|
33 | 33 | endforeach; |
34 | 34 | } |
35 | 35 | endforeach; |
36 | 36 | |
37 | 37 | $order_list = ' '; |
38 | - foreach ( $order_statuses as $order_status => $nb_of_order_with_status ) : |
|
38 | + foreach ($order_statuses as $order_status => $nb_of_order_with_status) : |
|
39 | 39 | ob_start(); |
40 | 40 | ?> |
41 | - <span class="wps-label-<?php echo $color_label[ strtolower($order_status) ]; ?>"><?php printf( __( '%2$s %1$s', 'wpshop' ), __( $orders_status[ strtolower($order_status) ], 'wpshop' ), $nb_of_order_with_status ); ?></span> |
|
41 | + <span class="wps-label-<?php echo $color_label[strtolower($order_status)]; ?>"><?php printf(__('%2$s %1$s', 'wpshop'), __($orders_status[strtolower($order_status)], 'wpshop'), $nb_of_order_with_status); ?></span> |
|
42 | 42 | <?php |
43 | 43 | $order_list .= ob_get_contents(); |
44 | 44 | ob_end_clean(); |
@@ -47,17 +47,17 @@ discard block |
||
47 | 47 | ?> |
48 | 48 | <ul class="wp-shop-customers-list-orders-stats" > |
49 | 49 | <li> |
50 | - <?php printf( __( 'Orders total number : %d', 'wpshop' ), count( $orders ) ); ?> <?php echo mb_substr( $order_list, 0, -2, 'UTF-8' ); ?> |
|
50 | + <?php printf(__('Orders total number : %d', 'wpshop'), count($orders)); ?> <?php echo mb_substr($order_list, 0, -2, 'UTF-8'); ?> |
|
51 | 51 | </li> |
52 | 52 | <li> |
53 | - <?php printf( __( 'Orders total amount : %s', 'wpshop' ), wpshop_tools::formate_number( $customer_order_real_total_amount ).' '.$currency ); ?> |
|
54 | - <?php if ( !empty( $customer_order_total_amount ) && ( $customer_order_total_amount != $customer_order_real_total_amount ) ) : ?>( <?php printf( __( 'If all orders were paid : %s', 'wpshop' ), wpshop_tools::formate_number( $customer_order_total_amount ).' '.$currency ); ?> )<?php endif; ?> |
|
53 | + <?php printf(__('Orders total amount : %s', 'wpshop'), wpshop_tools::formate_number($customer_order_real_total_amount) . ' ' . $currency); ?> |
|
54 | + <?php if (!empty($customer_order_total_amount) && ($customer_order_total_amount != $customer_order_real_total_amount)) : ?>( <?php printf(__('If all orders were paid : %s', 'wpshop'), wpshop_tools::formate_number($customer_order_total_amount) . ' ' . $currency); ?> )<?php endif; ?> |
|
55 | 55 | </li> |
56 | 56 | </ul> |
57 | 57 | <div class="wp-shop-customers-list-ordered-product" > |
58 | - <p><?php _e( 'List of ordered product', 'wpshop' ); ?></p> |
|
59 | - <?php echo implode( ', ', $ordered_products ); ?> |
|
58 | + <p><?php _e('List of ordered product', 'wpshop'); ?></p> |
|
59 | + <?php echo implode(', ', $ordered_products); ?> |
|
60 | 60 | </div> |
61 | 61 | <?php else: ?> |
62 | - <div class="wps-alert-info"><?php _e( 'No order have been created for the moment', 'wpshop'); ?></div> |
|
62 | + <div class="wps-alert-info"><?php _e('No order have been created for the moment', 'wpshop'); ?></div> |
|
63 | 63 | <?php endif; ?> |
64 | 64 | \ No newline at end of file |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /** Get customer orders list for statistic displaying */ |
4 | 6 | $wps_orders_mdl = new wps_orders_mdl(); |
@@ -17,8 +19,7 @@ discard block |
||
17 | 19 | |
18 | 20 | if ( empty( $order_statuses[ $order_meta['order_status'] ] ) ) { |
19 | 21 | $order_statuses[ $order_meta['order_status'] ] = 1; |
20 | - } |
|
21 | - else { |
|
22 | + } else { |
|
22 | 23 | $order_statuses[ $order_meta['order_status'] ] += 1; |
23 | 24 | } |
24 | 25 | |
@@ -58,6 +59,9 @@ discard block |
||
58 | 59 | <p><?php _e( 'List of ordered product', 'wpshop' ); ?></p> |
59 | 60 | <?php echo implode( ', ', $ordered_products ); ?> |
60 | 61 | </div> |
61 | -<?php else: ?> |
|
62 | - <div class="wps-alert-info"><?php _e( 'No order have been created for the moment', 'wpshop'); ?></div> |
|
62 | +<?php else { |
|
63 | + : ?> |
|
64 | + <div class="wps-alert-info"><?php _e( 'No order have been created for the moment', 'wpshop'); |
|
65 | +} |
|
66 | +?></div> |
|
63 | 67 | <?php endif; ?> |
64 | 68 | \ No newline at end of file |