本文整理汇总了PHP中wpshop_tools类的典型用法代码示例。如果您正苦于以下问题:PHP wpshop_tools类的具体用法?PHP wpshop_tools怎么用?PHP wpshop_tools使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wpshop_tools类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajax_save_product_price
/**
* 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));
}
示例2: display_account_last_actions
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;
}
示例3: help_tab_content
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");
}
示例4: display_modal
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;
}
示例5: customer_creation
/**
* 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();
}
示例6: alphabet_letters
/**
* 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;
}
示例7: display_discount_chip
/**
* 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;
}
示例8: delete_address_in_order_panel
/**
* 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();
}
示例9: pageTitle
/**
* 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;
}
示例10: wp_ajax_display_pictures_in_backend
/**
* 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();
}
示例11: generate_product_sheet_datas
/**
* 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;
}
示例12: _e
<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">
示例13: wpshop_rss_tutorial_videos
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;
}
示例14: wps_send_direct_payment_link
/** 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=' . rawurlencode($user_infos->user_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;
}
示例15: list_table_column_content
/**
* 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;
}
}
}