/** * Récupère le pilotage de prix, le nombre de produit avec un prix incohérent, le type de l'entité et la langue de la boutique. * Parcours la tableau de donnée avec la nouvelle valeur des prix par produit incohérent puis met à jour tout les autres prix de * ce produit. Ensuite renvoie le template avec le nombre de prix incohérent qui on été corrigé et le template de la méthode : * ajax_checking_products_values si des produits incohérents sont toujours présent. / Get the price piloting, the number of * product with an inconsistent price, type of the entity and the language of the shop. Browse the given table with the new * new value pricing of the inconsistent product and updates any other price of this product. Then display the template * of the number of corrected product and the template of the method : ajax_checking_products_values if inconsistent product * already present. * * @param array $_POST['product_price'] List of the new price for the product like array( $id_product => $new_price ) * @return JSON Response */ public function ajax_save_product_price() { header('Content-Type: application/json'); $response = array(); $price_piloting_option = get_option('wpshop_shop_price_piloting'); $inconsistent_product_number = !empty($_POST['product_price']) ? count($_POST['product_price']) : 0; $consistent_product_number = 0; $entity_type_id = wpshop_entities::get_entity_identifier_from_code(WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT); $language = WPSHOP_CURRENT_LOCALE; if (!empty($_REQUEST['icl_post_language'])) { $query = $wpdb->prepare("SELECT locale FROM " . $wpdb->prefix . "icl_locale_map WHERE code = %s", $_REQUEST['icl_post_language']); $language = $wpdb->get_var($query); } if (!empty($_POST['product_price'])) { foreach ($_POST['product_price'] as $product_id => $price) { try { if ($price_piloting_option == 'TTC') { wpshop_attributes::saveAttributeForEntity(array('decimal' => array('product_price' => $price)), $entity_type_id, $product_id, $language, 'wpshop_products'); } else { wpshop_attributes::saveAttributeForEntity(array('decimal' => array('price_ht' => $price)), $entity_type_id, $product_id, $language, 'wpshop_product'); } wpshop_products::calculate_price($product_id); $consistent_product_number++; } catch (Exception $e) { } } } $response['template_number'] = __(sprintf('Number of processed product : %d/%d', $consistent_product_number, $inconsistent_product_number), 'wps-product'); $list_product = wps_product_ctr::get_inconsistent_product(); ob_start(); require wpshop_tools::get_template_part(WPS_PRODUCT_DIR, WPS_PRODUCT_TEMPLATES_MAIN_DIR, "backend", "product_check_data"); $response['template'] = ob_get_clean(); wp_die(json_encode($response)); }
function display_account_last_actions() { global $wpdb; $output = ''; $user_id = get_current_user_id(); if (!empty($user_id)) { $query = $wpdb->prepare('SELECT * FROM ' . $wpdb->posts . ' WHERE post_type = %s AND post_author = %d', WPSHOP_NEWTYPE_IDENTIFIER_ORDER, $user_id); $orders = $wpdb->get_results($query); if (!empty($orders)) { $orders_list = ''; foreach ($orders as $order) { $order_meta = get_post_meta($order->ID, '_order_postmeta', true); $order_number = !empty($order_meta) && !empty($order_meta['order_key']) ? $order_meta['order_key'] : ''; $order_date = !empty($order_meta) && !empty($order_meta['order_date']) ? mysql2date(get_option('date_format'), $order_meta['order_date'], true) : ''; $order_amount = !empty($order_meta) && !empty($order_meta['order_key']) ? wpshop_tools::formate_number($order_meta['order_grand_total']) . ' ' . wpshop_tools::wpshop_get_currency(false) : ''; $order_available_status = unserialize(WPSHOP_ORDER_STATUS); $order_status = !empty($order_meta) && !empty($order_meta['order_status']) ? __($order_available_status[$order_meta['order_status']], 'wpshop') : ''; ob_start(); require wpshop_tools::get_template_part(WPS_ACCOUNT_DIR, WPS_ACCOUNT_PATH . WPS_ACCOUNT_DIR . "/templates/", "frontend", "account/account-dashboard-resume-element"); $orders_list .= ob_get_contents(); ob_end_clean(); } ob_start(); require_once wpshop_tools::get_template_part(WPS_ACCOUNT_DIR, WPS_ACCOUNT_PATH . WPS_ACCOUNT_DIR . "/templates/", "frontend", "account/account-dashboard-resume"); $output = ob_get_contents(); ob_end_clean(); } } return $output; }
public function help_tab_content($screen, $tab) { $id = $tab['id']; $title = $tab['callback'][0]->help_tabs[$tab['id']]['title']; $content = $tab['callback'][0]->help_tabs[$tab['id']]['content']; $pages = $tab['callback'][0]->help_tabs[$tab['id']]['pages']; require wpshop_tools::get_template_part(WPS_HELP_DIR, WPS_HELP_TEMPLATES_MAIN_DIR, "backend", "wps_tab_content_tpl"); }
function display_modal() { $output = ''; ob_start(); require_once wpshop_tools::get_template_part(WPS_MODAL_DIR, $this->template_dir, "frontend", "modal"); $output = ob_get_contents(); ob_end_clean(); echo $output; }
/** * AJAX - Charge le fomulaire d'ajout rapide d'un client / Load the form for new customer quick add */ function customer_creation() { check_ajax_referer('wps-customer-quick-nonce', 'wps-nonce'); global $wpdb; $customer_entity_type_id = wpshop_entities::get_entity_identifier_from_code(WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS); $query = $wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_type = %s AND post_author = %d", WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, get_current_user_id()); $cid = $wpdb->get_var($query); $customer_attribute_set = !empty($_GET) && !empty($_GET['customer_set_id']) ? $_GET['customer_set_id'] : null; $customer_attributes = wpshop_attributes_set::getAttributeSetDetails($customer_attribute_set, "'valid'"); require_once wpshop_tools::get_template_part(WPSCLTQUICK_DIR, WPSCLTQUICK_TEMPLATES_MAIN_DIR, "backend", "customer", "creation"); wp_die(); }
/** * DISPLAY / Affichage - Display all letter buttons for element choice / Affiche les lettres de l'alphabet pour lister les éléments existants * * @param string $type The type of element to display alphabet for / Le type d'élément pour lequel on va afficher l'alphabet * * @return string The alphabet letter button / Les bouttons affichant les lettres de l'alphabet */ public static function alphabet_letters($type = 'customer', $available_letters = array(), $chosen_letter = '') { global $wpdb; $alphabet = unserialize(WPSPOS_ALPHABET_LETTERS); $alphabet_interface = ''; foreach ($alphabet as $alpha) { ob_start(); require wpshop_tools::get_template_part(WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend', 'alphabet', 'letters'); $alphabet_interface .= ob_get_contents(); ob_end_clean(); } return $alphabet_interface; }
/** * Display Discount Chip * @param array $args * @return string */ function display_discount_chip($args) { $output = ''; if (!empty($args) && !empty($args['pid'])) { $wps_price = new wpshop_prices(); $discount_data = wpshop_prices::check_discount_for_product($args['pid']); if (!empty($discount_data)) { ob_start(); require wpshop_tools::get_template_part(WPS_PRODUCT_DIR, WPS_PRODUCT_TEMPLATES_MAIN_DIR, "frontend", "product_discount_chip"); $output = ob_get_contents(); ob_end_clean(); } } return $output; }
/** * Delete address in order */ function delete_address_in_order_panel() { $status = false; $address_datas = !empty($_POST['address_id']) ? wpshop_tools::varSanitizer($_POST['address_id']) : null; if (!empty($address_datas)) { $address_datas = explode('-', $address_datas); if (!empty($address_datas) && !empty($address_datas[0])) { wp_delete_post($address_datas[0], true); delete_post_meta($address_datas[0], '_wpshop_address_attribute_set_id'); delete_post_meta($address_datas[0], '_wpshop_address_metadata'); $status = true; } } echo json_encode(array('status' => $status)); wp_die(); }
/** * Define the title of the page * * @return string $title The title of the page looking at the environnement */ function pageTitle() { $action = isset($_REQUEST['action']) ? wpshop_tools::varSanitizer($_REQUEST['action']) : ''; $objectInEdition = isset($_REQUEST['id']) ? wpshop_tools::varSanitizer($_REQUEST['id']) : ''; $title = __(self::pageTitle, 'wpshop'); if ($action != '') { if ($action == 'edit' || $action == 'delete') { $editedItem = self::getElement($objectInEdition); $title = sprintf(__(self::pageEditingTitle, 'wpshop'), str_replace("\\", "", $editedItem->frontend_label) . ' (' . $editedItem->code . ')'); } elseif ($action == 'add') { $title = __(self::pageAddingTitle, 'wpshop'); } } elseif (self::getEditionSlug() != self::getListingSlug() && $_GET['page'] == self::getEditionSlug()) { $title = __(self::pageAddingTitle, 'wpshop'); } return $title; }
/** * AJAX - Display pictures in backend panel */ function wp_ajax_display_pictures_in_backend() { $status = true; $response = ''; $media_indicator = !empty($_POST['media_id']) ? $_POST['media_id'] : null; if (!empty($media_indicator)) { $media_id = explode(',', $media_indicator); if (!empty($media_id)) { ob_start(); require wpshop_tools::get_template_part(WPS_MEDIA_MANAGER_DIR, $this->template_dir, "backend", "media_list"); $response = ob_get_contents(); ob_end_clean(); } } echo json_encode(array('status' => $status, 'response' => $response)); wp_die(); }
/** * Generate product sheet datas * * @param integer $product_id THe product identifier to generate the sheet for * * @return string */ function generate_product_sheet_datas($product_id) { $product = get_post($product_id); $shop_type = get_option('wpshop_shop_type'); $product_price_data = get_post_meta($product_id, '_wps_price_infos', true); // Attributes Def $product_atts_def = $this->get_product_atts_def($product_id); // Attach CSS datas ob_start(); require wpshop_tools::get_template_part(WPS_PRODUCT_DIR, WPS_PRODUCT_TEMPLATES_MAIN_DIR, "backend", "product_sheet_datas_style"); $output = ob_get_contents(); ob_end_clean(); ob_start(); require wpshop_tools::get_template_part(WPS_PRODUCT_DIR, WPS_PRODUCT_TEMPLATES_MAIN_DIR, "backend", "product_sheet"); $output .= ob_get_contents(); ob_end_clean(); return $output; }
<h2><?php _e('Latest products ordered', 'wpshop'); ?> </h2> {WPSHOP_LATEST_PRODUCTS_ORDERED} <?php $tpl_element['latest_products_ordered'] = ob_get_contents(); ob_end_clean(); /** New Modal Add to cart confirmation Footer **/ ob_start(); ?> <a class="wps-bton wps-bton-second-rounded wpsjq-closeModal"><?php _e('Continue shopping', 'wpshop'); ?> </a> <a href="<?php echo wpshop_tools::get_page_id(get_permalink(get_option('wpshop_cart_page_id'))); ?> " type="button" class="wps-bton wps-bton-first-rounded"><?php _e('Order', 'wpshop'); ?> </a> <?php $tpl_element['wps_new_add_to_cart_confirmation_modal_footer'] = ob_get_contents(); ob_end_clean(); /** New Modal Add to cart confirmation Footer **/ ob_start(); ?> <ul class="wps-catalog-listwrapper"> <li> <a href="#" class="product_thumbnail-mini-list" title="{WPSHOP_PRODUCT_TITLE}">{WPSHOP_PRODUCT_PICTURE}</a> <span class="product_information-mini-list" itemprop="offers" itemscope itemtype="http://data-vocabulary.org/Offers">
function wpshop_rss_tutorial_videos() { $ini_get_checking = ini_get('allow_url_fopen'); if ($ini_get_checking != 0) { $content = @file_get_contents('http://www.wpshop.fr/rss_video.xml'); $videos_rss = $content !== false ? new SimpleXmlElement($content) : null; if (!empty($videos_rss) && !empty($videos_rss->channel)) { $videos_items = array(); foreach ($videos_rss->channel->item as $i => $item) { $videos_items[] = $item; } $rand_element = array_rand($videos_items); ob_start(); require_once wpshop_tools::get_template_part(WPS_DASHBOARD_DIR, WPSDASHBOARD_TPL_DIR, "backend", "dashboard", "videos"); $output = ob_get_contents(); ob_end_clean(); } else { $output = __('No tutorial videos can be loaded', 'wpshop'); } } else { $output = __('Your servor doesn\'t allow to open external files', 'wpshop'); } echo $output; }
/** Send a direct payment Link **/ function wps_send_direct_payment_link() { global $wpdb; $status = false; $response = ''; $order_id = !empty($_POST['order_id']) ? intval($_POST['order_id']) : null; if (!empty($_POST['order_id'])) { /** Get the customer **/ $order_metadata = get_post_meta($order_id, '_order_postmeta', true); if (!empty($order_metadata) && !empty($order_metadata['customer_id']) && !empty($order_metadata['order_status']) && $order_metadata['order_status'] == 'awaiting_payment') { $user_infos = get_userdata($order_metadata['customer_id']); $first_name = get_user_meta($user_infos->ID, 'first_name', true); $last_name = get_user_meta($user_infos->ID, 'last_name', true); /** Create an activation key **/ $token = wp_generate_password(20, false); $wpdb->update($wpdb->users, array('user_activation_key' => $token), array('user_login' => $user_infos->user_login)); $permalink_option = get_option('permalink_structure'); $link = '<a href="' . get_permalink(wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'))) . (!empty($permalink_option) ? '?' : '&') . 'action=direct_payment_link&token=' . $token . '&login='******'&order_id=' . $order_id . '">' . __('Click here to pay your order', 'wpshop') . '</a>'; /** Send message **/ $wps_message = new wps_message_ctr(); $wps_message->wpshop_prepared_email($user_infos->user_email, 'WPSHOP_DIRECT_PAYMENT_LINK_MESSAGE', array('customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'direct_payment_link' => $link, 'order_content' => '')); $response = __('Direct payment link has been send', 'wpshop'); $status = true; } else { $response = __('An error was occured', 'wpshop'); } } else { $response = __('An error was occured, no Order ID defined', 'wpshop'); } echo json_encode(array('status' => $status, 'response' => $response)); die; }
/** * Display the content into list table column * * @param string $column THe column identifier to modify output for * @param integer $post_id The current post identifier */ function list_table_column_content($column, $post_id) { global $wpdb; /** Get wp_users idenfifier from customer id */ $query = $wpdb->prepare("SELECT post_author FROM {$wpdb->posts} WHERE ID = %d", $post_id); $current_user_id_in_list = $wpdb->get_var($query); /** Get current post informations */ $customer_post = get_post($post_id); /** Get user data */ $current_user_datas = get_userdata($current_user_id_in_list); /** Switch current column for custom case */ $use_template = true; switch ($column) { case 'customer_identifier': echo $post_id; $use_template = false; break; case 'customer_date_subscription': echo mysql2date(get_option('date_format'), $current_user_datas->user_registered, true); $use_template = false; break; case 'customer_date_lastlogin': $last_login = get_user_meta($current_user_id_in_list, 'last_login_time', true); if (!empty($last_login)) { echo mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $last_login, true); } else { _e('Never logged in', 'wpshop'); } $use_template = false; break; } /** Require the template for displaying the current column */ if ($use_template) { $template = wpshop_tools::get_template_part(WPS_ACCOUNT_DIR, WPS_ACCOUNT_PATH . WPS_ACCOUNT_DIR . '/templates/', 'backend', 'customer_listtable/' . $column); if (is_file($template)) { require $template; } } }
<div class="wps-gridwrapper6-marged"> <?php $step_finished = false; foreach ($steps as $step_id => $step) { $step_id += 1; $step_class = $default_step == $step_id ? 'wps-checkout-step-current' : ($default_step > $step_id ? 'wps-checkout-step-finished' : 'wps-checkout-step'); $step_finished = $default_step > $step_id ? true : false; require wpshop_tools::get_template_part(WPS_CLASSIC_CHECKOUT_DIR, $this->template_dir, "frontend", "checkout_step_indicator/checkout_step_indicator_step"); } ?> </div>
/** * AJAX - Update cart informations */ function wps_orders_update_cart_informations() { $status = false; $order_id = !empty($_POST['order_id']) ? intval($_POST['order_id']) : ''; $shipping_cost = !empty($_POST['shipping_cost']) ? wpshop_tools::varSanitizer($_POST['shipping_cost']) : ''; $discount_value = !empty($_POST['discount_amount']) ? wpshop_tools::varSanitizer($_POST['discount_amount']) : ''; $discount_type = !empty($_POST['discount_type']) ? wpshop_tools::varSanitizer($_POST['discount_type']) : ''; if (!empty($order_id)) { $order_meta = get_post_meta($order_id, '_order_postmeta', true); $order_meta['order_shipping_cost'] = $shipping_cost; //Add discounts if exists if (!empty($discount_value) && !empty($discount_type)) { $order_meta['order_discount_type'] = $discount_type; $order_meta['order_discount_value'] = $discount_value; } $wps_cart = new wps_cart(); $order_meta = $wps_cart->calcul_cart_information(array(), '', $order_meta, true); update_post_meta($order_id, '_order_postmeta', $order_meta); $status = true; } echo json_encode(array('status' => $status)); wp_die(); }
<h2><?php _e('WP-Shop POS Software', 'wps-pos-i18n'); ?> <a class="add-new-h2" href="<?php echo admin_url('admin.php?page=wps-pos&new_order=yes'); ?> "><?php _e('Create a new order', 'wps-pos-i18n'); ?> </a></h2> <!-- <div class="wpspos-main-actions-buttons-container" ><?php require_once wpshop_tools::get_template_part(WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend', 'pos', 'top_button'); ?> </div> --> <?php require_once wpshop_tools::get_template_part(WPSPOS_DIR, WPSPOS_TEMPLATES_MAIN_DIR, 'backend', 'tab_pos'); ?> </div> <div id="wpspos-dashboard-widgetswrap" class="metabox-holder" ><?php /** Create nonce for metabox order saving securisation */ wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); /** Create nonce for metabox order saving securisation */ wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); /** Call the different fonction to add meta boxes on dashboard */ do_meta_boxes('wpspos-dashboard', 'wpspos-dashboard-summary', null); ?> <div class="wpspos-dashboard-contents wpspos-current-step-<?php echo $current_step; ?> " >
/** * WORDPRESS HOOK - FOOTER SCRIPTS - Create the help messages for wpshop. only create them into required pages by loking at current screen */ function wps_dashboard_help() { /** Initialise help messages */ $help_cases = null; /** Get current screen in order to load messages only in required pages */ $current_screen = get_current_screen(); switch ($current_screen->id) { case 'toplevel_page_wpshop_dashboard': $help_cases['download_newsletter_contacts'] = array('edge' => 'left', 'at' => 'left bottom', 'my' => 'left top', 'pointer_id' => '#download_newsletter_contacts'); break; case 'wpshop_product': $help_cases['product_page_categories'] = array('edge' => 'right', 'at' => '', 'my' => '', 'pointer_id' => '#wpshop_product_categorydiv'); $help_cases['product_datas_configuration'] = array('edge' => 'bottom', 'at' => 'center top', 'my' => 'bottom right', 'pointer_id' => '#wpshop_product_fixed_tab'); $help_cases['product_display_configuration'] = array('edge' => 'bottom', 'at' => 'right bottom', 'my' => 'bottom', 'pointer_id' => '.wpshop_product_data_display_tab'); $help_cases['product_variations'] = array('edge' => 'bottom', 'at' => 'right bottom', 'my' => 'bottom', 'pointer_id' => '#wpshop_new_variation_list_button'); $help_cases['product_variations_configuration'] = array('edge' => 'bottom', 'at' => 'right bottom', 'my' => 'bottom', 'pointer_id' => '#wpshop_variation_parameters_button'); $help_cases['add_product_automaticly_to_cart'] = array('edge' => 'right', 'at' => '', 'my' => '', 'pointer_id' => '#wpshop_product_options'); break; case 'edit-wpshop_product_category': $help_cases['category_filterable_attributes'] = array('edge' => 'bottom', 'at' => 'top', 'my' => 'bottom', 'pointer_id' => '.filterable_attributes_container'); $help_cases['category_picture'] = array('edge' => 'bottom', 'at' => '', 'my' => 'bottom', 'pointer_id' => '.category_new_picture_upload'); break; case 'wpshop_shop_order': $help_cases['order_customer_comment'] = array('edge' => 'right', 'at' => '', 'my' => '', 'pointer_id' => '#wpshop_order_customer_comment'); $help_cases['order_notification_message'] = array('edge' => 'bottom', 'at' => '', 'my' => '', 'pointer_id' => '#wpshop_order_private_comments'); $help_cases['order_shipping_box'] = array('edge' => 'right', 'at' => '', 'my' => '', 'pointer_id' => '#wpshop_order_shipping'); break; case 'wpshop_shop_message': $help_cases['message_historic'] = array('edge' => 'bottom', 'at' => '', 'my' => '', 'pointer_id' => '#wpshop_message_histo'); break; case 'settings_page_wpshop_option': $help_cases['options_payment_part'] = array('edge' => 'right', 'at' => '', 'my' => '', 'pointer_id' => '#wps_payment_mode_list_container'); break; } if (!empty($help_cases)) { /** Get help data seen by user **/ $closed_help_window = get_user_meta(get_current_user_id(), '_wps_closed_help', true); /** Read the different help cases */ foreach ($help_cases as $help_id => $help_case) { if (empty($closed_help_window) || !empty($closed_help_window) && !array_key_exists($help_id, $closed_help_window)) { switch ($help_id) { case 'download_newsletter_contacts': $pointer_content = '<h3>' . __('Customers information download', 'wpshop') . '</h3>'; $pointer_content .= '<p>' . __('You can download emails of customers who accept to receive your commercials offers or your partners commercials offers by newsletter', 'wpshop') . '</p>'; break; case 'product_page_categories': $pointer_content = '<h3>' . __('WPShop Categories', 'wpshop') . '</h3>'; $pointer_content .= '<p>' . __('You can classify your products by category.', 'wpshop') . '<br/></p>'; $pointer_content .= '<p><a href="' . admin_url('edit-tags.php?taxonomy=wpshop_product_category&post_type=wpshop_product') . '" class="button-primary" target="_blank">' . __('Create my WPShop categories', 'wpshop') . '</a></p>'; break; case 'product_datas_configuration': $pointer_content = '<h3>' . __('Product configurations', 'wpshop') . '</h3>'; $pointer_content .= '<p>' . __('Here, you can configure your product (Price, weight, reference and all attributes you want to create and affect to products', 'wpshop') . '</p>'; break; case 'product_display_configuration': $pointer_content = '<h3>' . __('Product display configurations', 'wpshop') . '</h3>'; $pointer_content .= '<p>' . __('Here, you can manage what elements you want to display on your product page', 'wpshop') . '</p>'; break; case 'product_variations': $pointer_content = '<h3>' . __('Product variations', 'wpshop') . '</h3>'; $pointer_content .= '<p>' . __('Here, you can generate your product variations.', 'wpshop') . '</p><br/>'; $pointer_content .= '<p><a href="http://www.wpshop.fr/documentations/configurer-un-produit-avec-des-options/" class="button-primary" target="_blank">' . __('Read the tutorial', 'wpshop') . '</a></p>'; break; case 'product_variations_configuration': $pointer_content = '<h3>' . __('Variations configuration', 'wpshop') . '</h3>'; $pointer_content .= '<p>' . __('Here, you can manage your product variations configurations (Display "Price from", variation price priority...).', 'wpshop') . '</p>'; break; case 'add_product_automaticly_to_cart': $pointer_content = '<h3>' . __('Add product to cart', 'wpshop') . '</h3>'; $pointer_content .= '<p>' . __('If you check this checkbox, this produc will be add automaticly to cart. This functionnality is helpful if you want to bill fees for example.', 'wpshop') . '</p>'; break; case 'category_filterable_attributes': $pointer_content = '<h3>' . __('Filterable search', 'wpshop') . '</h3>'; $pointer_content .= '<p>' . __('You can add a filter search to your WPShop, here will be display all available attributes for a filter search in this category', 'wpshop') . '</p><br/>'; $pointer_content .= '<p><a href="http://www.wpshop.fr/documentations/la-recherche-par-filtre/" class="button-primary" target="_blank">' . __('Read the filter search tutorial', 'wpshop') . '</a></p>'; break; case 'category_picture': $pointer_content = '<h3>' . __('Category image', 'wpshop') . '</h3>'; $pointer_content .= '<p>' . __('You can add a picture to illustrate your category', 'wpshop') . '</p>'; break; case 'order_customer_comment': $pointer_content = '<h3>' . __('Order customer comment', 'wpshop') . '</h3>'; $pointer_content .= '<p>' . __('Here is displayed the customer comment wrote during the order', 'wpshop') . '</p>'; break; case 'message_historic': $pointer_content = '<h3>' . __('Message Historic', 'wpshop') . '</h3>'; $pointer_content .= '<p>' . __('This is this message historic. You can check here if an automatic e-mail was send to a customer', 'wpshop') . '</p>'; break; case 'order_notification_message': $pointer_content = '<h3>' . __('Order notification', 'wpshop') . '</h3>'; $pointer_content .= '<p>' . __('You can add a private comment to the order or send an comment to customer about this order', 'wpshop') . '</p>'; break; case 'order_shipping_box': $pointer_content = '<h3>' . __('Shipping actions', 'wpshop') . '</h3>'; $pointer_content .= '<p>' . __('Here, you can manage your shipping actions, download the shipping slip.', 'wpshop') . '</p>'; break; case 'options_payment_part': $pointer_content = '<h3>' . __('Payment configuration', 'wpshop') . '</h3><p>' . __('You can manage your payment methods (Change name, add description, add a logo and apply configurations ). You can add others payment methods', 'wpshop') . '</p><br/><p><a href="http://shop.eoxia.com/boutique/shop/modules-wpshop/modules-de-paiement/" class="button-primary" target="_blank">' . __('See available payment methods', 'wpshop') . '</a></p>'; break; default: $pointer_content = ''; break; } require wpshop_tools::get_template_part(WPS_HELP_DIR, WPS_HELP_TEMPLATES_MAIN_DIR, 'backend', 'help', 'container'); } } } }
)</strong> : </label> <div class="wps-form"><input type="text" name="weight_rule" id="<?php echo $k; ?> _weight_rule" class="shipping_rules_configuration_input"/></div> </div> <div class="wps-form-group"> <label for="<?php echo $k; ?> _shipping_price"><?php _e('Price', 'wpshop'); ?> <strong>(<?php echo wpshop_tools::wpshop_get_currency(); ?> <?php echo WPSHOP_PRODUCT_PRICE_PILOT; ?> )</strong> : </label> <div class="wps-form"><input type="text" name="shipping_price" id="<?php echo $k; ?> _shipping_price" class="shipping_rules_configuration_input"/></div> </div> </div> <div class="wps-row"> <input type="checkbox" id="<?php echo $k;
/** * Get the shipping cost for the current cart * * @param integer $nb_of_items The number of items in cart * @param float $total_cart The amount of the cart * @param float $total_shipping_cost The amount of the shipping cost calculate from the sum of shipping cost for each product in cart * @param float $total_weight The total weight of all product in cart * * @return number|string The sipping cost for the current cart */ function get_shipping_cost($nb_of_items, $total_cart, $total_shipping_cost, $total_weight, $selected_method = '') { global $wpdb; $shipping_mode_option = get_option('wps_shipping_mode'); if (!empty($selected_method)) { $chosen_shipping_mode = $selected_method; } else { $chosen_shipping_mode = !empty($_SESSION['shipping_method']) ? wpshop_tools::varSanitizer($_SESSION['shipping_method']) : 'default_choice'; } $default_weight_unity = get_option('wpshop_shop_default_weight_unity'); if (!empty($default_weight_unity)) { $query = $wpdb->prepare('SELECT unit FROM ' . WPSHOP_DBT_ATTRIBUTE_UNIT . ' WHERE id = %d', $default_weight_unity); $weight_unity = $wpdb->get_var($query); if (!empty($weight_unity) && $weight_unity == 'kg') { $total_weight = $total_weight * 1000; } } if (!empty($_SESSION['shipping_method']) && $_SESSION['shipping_method'] == 'shipping-partners' || !empty($_SESSION['wps-pos-addon'])) { return 0; } /** Take the selected shipping mode **/ $selected_shipping_mode_config = $chosen_shipping_mode == 'default_choice' ? $shipping_mode_option['modes']['default_shipping_mode'] : (!empty($shipping_mode_option['modes'][$chosen_shipping_mode]) ? $shipping_mode_option['modes'][$chosen_shipping_mode] : ''); $shipping_cost = $total_shipping_cost; /** Free Shipping **/ if (!empty($selected_shipping_mode_config) && !empty($selected_shipping_mode_config['free_shipping'])) { $shipping_cost = 0; } elseif (!empty($selected_shipping_mode_config) && !empty($selected_shipping_mode_config['free_from']) && $selected_shipping_mode_config['free_from'] >= 0 && $selected_shipping_mode_config['free_from'] <= number_format($total_cart, 2, '.', '')) { $shipping_cost = 0; } else { /** Check Custom Shipping Cost **/ if (!empty($_SESSION['shipping_address']) && !empty($selected_shipping_mode_config['custom_shipping_rules']) && !empty($selected_shipping_mode_config['custom_shipping_rules']['active'])) { $address_infos = get_post_meta($_SESSION['shipping_address'], '_wpshop_address_metadata', true); $country = !empty($address_infos['country']) ? $address_infos['country'] : ''; /** Check Active Postcode option **/ if (!empty($selected_shipping_mode_config['active_cp'])) { $postcode = $address_infos['postcode']; if (array_key_exists($country . '-' . $postcode, $selected_shipping_mode_config['custom_shipping_rules']['fees'])) { $country = $country . '-' . $postcode; } elseif (array_key_exists($country . '-OTHERS', $selected_shipping_mode_config['custom_shipping_rules']['fees'])) { $country = $country . '-OTHERS'; } } $shipping_cost += $this->calculate_custom_shipping_cost($country, array('weight' => $total_weight, 'price' => $total_cart), $selected_shipping_mode_config['custom_shipping_rules']['fees'], $chosen_shipping_mode); } /** Min- Max config **/ if (!empty($selected_shipping_mode_config['min_max']) && !empty($selected_shipping_mode_config['min_max']['activate'])) { if (!empty($selected_shipping_mode_config['min_max']['min']) && $shipping_cost < $selected_shipping_mode_config['min_max']['min']) { $shipping_cost = $selected_shipping_mode_config['min_max']['min']; } elseif (!empty($selected_shipping_mode_config['min_max']['max']) && $shipping_cost > $selected_shipping_mode_config['min_max']['max']) { $shipping_cost = $selected_shipping_mode_config['min_max']['max']; } } } return $shipping_cost; }
_e('Customer comment', 'wpshop'); ?> : </label> <div class="wps-form"><textarea name="wps-customer-comment" id="wps-customer-comment"></textarea></div> </div> <?php echo do_shortcode('[wps_payment]'); ?> <!-- Terms of sale --> <?php $terms_page_id = get_option('wpshop_terms_of_sale_page_id'); if (0 != $terms_page_id) { ?> <div style="text-align : right"><input type="hidden" name="terms_of_sale_indicator" /><input id="terms_of_sale" type="checkbox" value="Terms of sale" name="terms_of_sale"> <label for="terms_of_sale"><?php printf(__('I have read and I accept the %sterms of sale%s.', 'wpshop'), '<a href="' . get_permalink(wpshop_tools::get_page_id(get_option('wpshop_terms_of_sale_page_id'))) . '" target="_blank">', '</a>'); ?> </label></div> <?php } ?> <div id="wps-checkout-step-errors"></div> <?php if (!empty($_SESSION) && !empty($_SESSION['cart']) && !empty($_SESSION['cart']['cart_type']) && $_SESSION['cart']['cart_type'] == 'quotation') { ?> <div class="wps"><button class="wps-bton-first-alignRight-rounded" id="wps-checkout-valid-step-five"><?php _e('Validate my quotation', 'wpshop'); ?> </button></div> <?php
/** * Display Orders moment in the day Statistics */ function wps_statistics_orders_moment($args = array('choosen_day' => '', 'return' => false)) { $begin_date = !empty($_POST['begin_date']) ? wpshop_tools::varSanitizer($_POST['begin_date']) : date('Y-m-d', strtotime('1 months ago')); $end_date = !empty($_POST['end_date']) ? wpshop_tools::varSanitizer($_POST['end_date']) : date('Y-m-d'); $datadate = $this->wps_stats_mdl->wps_get_orders_by_hours($begin_date, $end_date, !empty($args['choosen_day']) ? $args['choosen_day'] : ''); $days = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); ob_start(); require wpshop_tools::get_template_part(WPS_STATISTICS_DIR, WPS_STATISTICS_TEMPLATES_MAIN_DIR, "backend", "wps_statistics_orders_moment"); $output = ob_get_contents(); ob_end_clean(); if (!empty($args) && !empty($args['return']) && $args['return']) { return $output; } else { echo $output; } }
} else { if (empty($selected_shipping_method) && (!empty($shipping_modes) && !empty($shipping_modes['default_choice']) && $shipping_mode_id == $shipping_modes['default_choice'])) { $checked = 'checked="checked"'; $class = 'wps-activ'; } else { if ($count == 0 && empty($selected_shipping_method)) { $checked = 'checked="checked"'; $class = 'wps-activ'; } else { $checked = $class = ''; } } } $shipping_cost_are_free = false; $free_shipping_cost_alert = ''; $currency = wpshop_tools::wpshop_get_currency(); $cart_items = !empty($_SESSION) && !empty($_SESSION['cart']) && !empty($_SESSION['cart']['order_items']) ? $_SESSION['cart']['order_items'] : ''; $price_piloting = get_option('wpshop_shop_price_piloting'); if (!empty($cart_items)) { $wps_shipping = new wps_shipping(); $cart_weight = $wps_shipping->calcul_cart_weight($cart_items); $total_cart_ht_or_ttc_regarding_config = !empty($price_piloting) && $price_piloting == 'HT' ? $_SESSION['cart']['order_total_ht'] : $_SESSION['cart']['order_total_ttc']; $total_shipping_cost_for_products = $wps_shipping->calcul_cart_items_shipping_cost($cart_items); $shipping_cost = $wps_shipping->get_shipping_cost(count($cart_items), $total_cart_ht_or_ttc_regarding_config, $total_shipping_cost_for_products, $cart_weight, $shipping_mode_id) . ' ' . $currency; } if (!empty($shipping_mode['free_from'])) { $order_amount = !empty($price_piloting_option) && $price_piloting_option == 'HT' ? number_format((double) $_SESSION['cart']['order_total_ht'], 2, '.', '') : number_format((double) $_SESSION['cart']['order_total_ttc'], 2, '.', ''); if ($order_amount < $shipping_mode['free_from']) { $free_in = $shipping_mode['free_from'] - $order_amount; $shipping_cost .= ' ' . sprintf(__('Free in %s', 'wpshop'), $free_in . ' ' . $currency); } else {
<div class="wps-boxed"> <?php echo wpshop_tools::create_custom_hook('wpshop_payment_actions'); // Empty the cart $wps_cart->empty_cart(); ?> </div>
function display_highlightings($args) { $output = $highlightings = ''; if (!empty($args) && !empty($args['hook_name'])) { $datas = $this->get_data_for_hook($args['hook_name']); //Display in Template if (!empty($datas)) { foreach ($datas as $data) { ob_start(); require wpshop_tools::get_template_part(WPS_HIGHLIGHTING_DIR, $this->template_dir, "frontend", "highlighting"); $highlightings .= ob_get_contents(); ob_end_clean(); } } } return $highlightings; }
_e('Welcome on wpshop', 'wpshop'); ?> </h1> <h2><?php _e('Before you start to use WPShop you will need to configure some parameters', 'wpshop'); ?> </h2> <div class="wpshop_admin_box"> <div class="wps-gridwrapper3-marged"> <?php $step_finished = false; foreach ($steps as $step_id => $step) { $step_id += 1; $step_class = $current_step == $step_id ? 'wps-checkout-step-current' : ($current_step > $step_id ? 'wps-checkout-step-finished' : 'wps-checkout-step'); $step_finished = $current_step > $step_id ? true : false; require wpshop_tools::get_template_part(WPS_INSTALLER_DIR, WPSINSTALLER_TPL_DIR, "backend", "step_indicator"); } ?> </div><!-- .wps-gridwrapper4-marged --> <div class="wps-installer-step-container wps-installer-step-container-<?php echo $current_step; ?> " > <?php if ($current_step < count($steps)) { ?> <form action="<?php echo admin_url('admin.php?page=wps-installer&wps-installation-step=' . ($current_step + 1)); ?> " method="post" id="wps_installer_form" enctype="multipart/form-data" >
function display_payment_modes() { $output = ''; $payment_modes = get_option('wps_payment_mode'); if (!empty($payment_modes) && !empty($payment_modes['mode'])) { $default_choice = !empty($payment_modes['default_choice']) ? $payment_modes['default_choice'] : ''; $payment_modes = $payment_modes['mode']; $tmp_array = array(); foreach ($payment_modes as $payment_mode_id => $payment_mode) { if (!empty($payment_mode['active'])) { $tmp_array[$payment_mode_id] = $payment_mode; } } $payment_modes = apply_filters('wps-paymentmode-filter', $tmp_array); ob_start(); require_once wpshop_tools::get_template_part(WPS_PAYMENT_MODE_DIR, $this->template_dir, "frontend", "payment-modes"); $output = ob_get_contents(); ob_end_clean(); } return $output; }
/** * * @param unknown_type $attributeSetId * @param unknown_type $currentPageCode * @param unknown_type $itemToEdit * @param unknown_type $outputType * @return Ambigous <multitype:, string> */ public static function entities_attribute_box($attributeSetId, $currentPageCode, $itemToEdit, $outputType = 'box') { $box = $box['box'] = $box['boxContent'] = $box['generalTabContent'] = array(); /* Get the attribute set details in order to build the product interface */ $productAttributeSetDetails = wpshop_attributes_set::getAttributeSetDetails($attributeSetId, "'valid'"); $attribute_specification = array('page_code' => $currentPageCode, 'element_identifier' => $itemToEdit, 'field_id' => $currentPageCode . '_' . $itemToEdit . '_'); if (count($productAttributeSetDetails) > 0) { /* Read the attribute list in order to output */ $shortcodes_attr = ''; $shortcodes_to_display = false; $attribute_set_id_is_present = false; foreach ($productAttributeSetDetails as $productAttributeSetDetail) { $shortcodes = $currentTabContent = ''; $output_nb = 0; if (count($productAttributeSetDetail['attribut']) >= 1) { foreach ($productAttributeSetDetail['attribut'] as $attribute) { if (!empty($attribute->id)) { if ($attribute->code == 'product_attribute_set_id') { $attribute_set_id_is_present = true; } /** Generic part for attribute field output */ $value = wpshop_attributes::getAttributeValueForEntityInSet($attribute->data_type, $attribute->id, wpshop_entities::get_entity_identifier_from_code($currentPageCode), $itemToEdit, array('intrinsic' => $attribute->is_intrinsic, 'backend_input' => $attribute->backend_input)); $product_meta = get_post_meta($itemToEdit, '_wpshop_product_metadata', true); /** Check if value is empty and get value in meta if not empty */ $value = empty($value) && !empty($product_meta[$attribute->code]) ? $product_meta[$attribute->code] : (!empty($value) ? $value : null); /* Manage specific field as the attribute_set_id in product form */ if ($attribute->code == 'product_attribute_set_id') { $value = empty($value) ? $attributeSetId : $value; } $attribute_specification['current_value'] = $value; $attribute_output_def = wpshop_attributes::display_attribute($attribute->code, 'admin', $attribute_specification); if ($attribute_output_def['field_definition']['type'] != 'hidden' && $attribute->code != 'product_attribute_set_id') { $currentTabContent .= $attribute_output_def['field']; $shortcode_code_def = array(); $shortcode_code_def['attribute_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['main_code'] = 'wpshop_att_val'; $shortcode_code_def['attribute_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['attrs_exemple']['type'] = $attribute->data_type; $shortcode_code_def['attribute_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['attrs_exemple']['attid'] = $attribute->id; $shortcode_code_def['attribute_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label']))]['attrs_exemple']['pid'] = $itemToEdit; ob_start(); wps_shortcodes_ctr::output_shortcode('attribute_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label'])), $shortcode_code_def, 'wpshop_product_shortcode_display wpshop_product_attribute_shortcode_display wpshop_product_attribute_shortcode_display_' . str_replace('-', '_', sanitize_title($attribute_output_def['field_definition']['label'])) . ' wpshop_cls'); $shortcodes .= '<li class="wpshop_cls" >' . sprintf(__('Insertion code for the attribute %s for this product', 'wpshop'), '<span>' . __($attribute_output_def['field_definition']['label'], 'wpshop') . '</span>') . ob_get_contents() . '</li>'; ob_end_clean(); } else { if ($attribute->code == 'product_attribute_set_id') { $attribute_output_def['field_definition']['type'] = 'hidden'; } $currentTabContent .= wpshop_form::check_input_type($attribute_output_def['field_definition'], $attribute_output_def['field_definition']['input_domain']); } $output_nb++; } } $shortcode_code['attributes_set']['main_code'] = 'wpshop_att_group'; $shortcode_code['attributes_set']['attrs_exemple']['pid'] = $itemToEdit; $shortcode_code['attributes_set']['attrs_exemple']['sid'] = $productAttributeSetDetail['id']; ob_start(); wps_shortcodes_ctr::output_shortcode('attributes_set', $shortcode_code, 'wpshop_product_shortcode_display wpshop_product_attribute_group_shortcode_display wpshop_product_attribute_group_shortcode_display_' . str_replace('-', '_', sanitize_title($productAttributeSetDetail['name'])) . ' cls'); $attribute_group_display = sprintf(__('Insertion code for attribute group %s for this product', 'wpshop'), '<span>' . $productAttributeSetDetail['name'] . '</span>') . ob_get_contents() . '<ul class="" >' . $shortcodes . '</ul>'; ob_end_clean(); if (WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE == 'each-box') { $currentTabContent .= '<div class="wpshop_cls" ><strong>' . __('Shortcodes', 'wpshop') . '</strong> - <a href="#" class="show-hide-shortcodes">' . __('Display', 'wpshop') . '</a><div class="wpshop_product_shortcode_display wpshop_product_shortcode_display_container wpshopHide" >' . $attribute_group_display . '</div></div>'; } else { $shortcodes_attr .= $attribute_group_display; } if ($output_nb <= 0) { $currentTabContent = __('Nothing avaiblable here. You can go in attribute management interface in order to add content here.', 'wpshop'); } } if ($output_nb > 0) { $shortcodes_to_display = true; if ($outputType == 'box') { $box['box'][$productAttributeSetDetail['code']] = $productAttributeSetDetail['name']; $box['box'][$productAttributeSetDetail['code'] . '_backend_display_type'] = $productAttributeSetDetail['backend_display_type']; $box['boxContent'][$productAttributeSetDetail['code']] = ' <div id="wpshop_' . $currentPageCode . '_' . wpshop_tools::slugify($productAttributeSetDetail['code'], array('noAccent')) . '_form" >' . $currentTabContent . ' </div><div class="wpshop_cls" ></div>'; } else { if ($outputType == 'column') { $currentTabContent = str_replace('wpshop_form_input_element', 'wpshop_form_input_column', $currentTabContent); $currentTabContent = str_replace('wpshop_form_label', 'wpshop_form_label_column', $currentTabContent); $box['columnTitle'][$productAttributeSetDetail['code']] = __($productAttributeSetDetail['name'], 'wpshop'); $box['columnContent'][$productAttributeSetDetail['code']] = $currentTabContent; } } } } if (!$attribute_set_id_is_present) { /* Get attribute definition */ $attribute_def = wpshop_attributes::getElement('product_attribute_set_id', "'valid'", 'code'); /* Get attribute input definition */ $input = wpshop_attributes::get_attribute_field_definition($attribute_def, $attributeSetId, array_merge($attribute_specification, array('input_class' => ' wpshop_attributes_display', 'from' => 'admin'))); $input['type'] = 'hidden'; $box['boxMore'] = wpshop_form::check_input_type($input, $input['input_domain']); } /* Ajout de la boite permettant d'ajouter des valeurs aux attributs de type liste deroulante a la volee */ $dialog_title = __('New value for attribute', 'wpshop'); $dialog_identifier = 'wpshop_new_attribute_option_value_add'; $dialog_input_identifier = 'wpshop_new_attribute_option_value'; ob_start(); include WPSHOP_TEMPLATES_DIR . 'admin/add_new_element_dialog.tpl.php'; $box['boxMore'] .= ob_get_contents(); ob_end_clean(); $box['boxMore'] .= '<input type="hidden" name="wpshop_attribute_type_select_code" value="" id="wpshop_attribute_type_select_code" />'; if ($shortcodes_to_display) { switch (WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE) { case 'fixed-tab': case 'movable-tab': if ($outputType == 'box') { $box['box']['shortcode'] = __('Product Shortcodes', 'wpshop'); $box['boxContent']['shortcode'] = $shortcodes_attr; $box['box']['shortcode_backend_display_type'] = WPSHOP_PRODUCT_SHORTCODE_DISPLAY_TYPE; } else { $box['columnTitle']['shortcode'] = __('Product Shortcodes', 'wpshop'); $box['columnContent']['shortcode'] = $shortcodes_attr; } break; } } } return $box; }
?> " /></td> </tr> <tr class="wpshop_coupon_definition_table_code_type_line" > <td class="wpshop_coupon_definition_table_label wpshop_coupon_definition_coupon_type_amount_label" ><input type="radio" name="coupon_type" class="wpshop_coupon_type" id="coupon_type_amount" value="amount" <?php echo $wpshop_coupon_discount_type == 'amount' || empty($wpshop_coupon_discount_type) ? 'checked="checked"' : null; ?> /><label for="coupon_type_amount" ><?php _e('Coupon discount amount', 'wpshop'); ?> </label></td> <td class="wpshop_coupon_definition_table_input wpshop_coupon_definition_coupon_type_input" rowspan="2" ><input type="text" name="coupon_discount_amount" value="<?php echo $coupon_discount_amount; ?> " /><span class="wpshop_coupon_type_unit wpshop_coupon_type_unit_amount" > <?php echo !empty($wpshop_coupon_discount_type) && $wpshop_coupon_discount_type == 'percent' ? '%' : wpshop_tools::wpshop_get_currency() . ' ' . __('ATI', 'wpshop'); ?> </span><span class="wpshopHide wpshop_coupon_type_unit wpshop_coupon_type_unit_percent" > % </span></td> </tr> <tr class="wpshop_coupon_definition_table_code_type_line" > <td class="wpshop_coupon_definition_table_label wpshop_coupon_definition_coupon_type_percent_label" ><input type="radio" name="coupon_type" id="coupon_type_percent" class="wpshop_coupon_type" value="percent" <?php echo $wpshop_coupon_discount_type == 'percent' ? 'checked="checked"' : null; ?> /><label for="coupon_type_percent" ><?php _e('Coupon discount percent', 'wpshop'); ?> </label></td> </tr> <tr> <td> <label for="coupon_receiver"><?php