本文整理汇总了PHP中wpshop_tools::get_page_id方法的典型用法代码示例。如果您正苦于以下问题:PHP wpshop_tools::get_page_id方法的具体用法?PHP wpshop_tools::get_page_id怎么用?PHP wpshop_tools::get_page_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpshop_tools
的用法示例。
在下文中一共展示了wpshop_tools::get_page_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: _e
_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
示例3: _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">
示例4: get_option
<?php
$permalink_option = get_option('permalink_structure');
$account_page_id = wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'));
?>
<?php
if (0 !== get_current_user_id()) {
?>
<div><a href="<?php
echo wp_logout_url(site_url());
?>
" class="wps-bton-third-mini-rounded alignRight"><?php
_e('Log out', 'wpshop');
?>
</a></div>
<?php
}
?>
<section>
<div class="wps-section-taskbar">
<ul>
<li class="<?php
echo empty($_GET['account_dashboard_part']) || !empty($_GET['account_dashboard_part']) && $_GET['account_dashboard_part'] == 'account' ? 'wps-activ' : '';
?>
">
<a data-target="menu1" href="<?php
echo get_permalink($account_page_id) . ((!empty($permalink_option) ? '?' : '&') . 'account_dashboard_part=account');
?>
" title="" class="">
示例5: direct_payment_link
public static function direct_payment_link($token, $order_id, $login)
{
global $wpdb;
if (!empty($token) && !empty($order_id) && !empty($login)) {
/** Verify informations **/
$query = $wpdb->prepare('SELECT * FROM ' . $wpdb->users . ' WHERE user_login = %s AND user_activation_key = %s', $login, $token);
$user_infos = $wpdb->get_row($query);
if (!empty($user_infos)) {
/** Connect the user **/
$secure_cookie = is_ssl() ? true : false;
wp_set_auth_cookie($user_infos->ID, true, $secure_cookie);
/** Add order to SESSION **/
$order_meta = get_post_meta($order_id, '_order_postmeta', true);
$_SESSION['cart'] = array();
$_SESSION['cart']['order_items'] = array();
if (!empty($order_meta) && !empty($order_meta['order_items'])) {
$wpshop_cart_type = 'cart';
foreach ($order_meta['order_items'] as $item) {
$_SESSION['cart']['order_items'][$item['item_id']] = $item;
}
$wps_cart_ctr = new wps_cart();
$order = $wps_cart_ctr->calcul_cart_information(array());
$wps_cart_ctr->store_cart_in_session($order);
}
$_SESSION['order_id'] = $order_id;
$wpdb->update($wpdb->users, array('user_activation_key' => ''), array('user_login' => $login));
wpshop_tools::wpshop_safe_redirect(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'))));
} else {
wpshop_tools::wpshop_safe_redirect(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))));
}
}
}
示例6: wps_save_signup_form
/**
* SIGN UP - Save sign up form
*/
function wps_save_signup_form()
{
global $wpdb, $wpshop;
$user_id = !empty($_POST['wps_sign_up_request_from_admin']) ? 0 : get_current_user_id();
$wps_message = new wps_message_ctr();
$status = $account_creation = false;
$result = '';
$exclude_user_meta = array('user_email', 'user_pass');
$element_id = wpshop_entities::get_entity_identifier_from_code(WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS);
if (!empty($element_id)) {
$query = $wpdb->prepare('SELECT id FROM ' . WPSHOP_DBT_ATTRIBUTE_SET . ' WHERE entity_id = %d', $element_id);
$attribute_set_id = $wpdb->get_var($query);
if (!empty($attribute_set_id)) {
$group = wps_address::get_addresss_form_fields_by_type($attribute_set_id);
foreach ($group as $attribute_sets) {
foreach ($attribute_sets as $attribute_set_field) {
if (!empty($_POST['wps_sign_up_request_from_admin'])) {
foreach ($attribute_set_field['content'] as $attribute_code => $att_def) {
if ($attribute_code != 'account_user_email') {
$attribute_set_field['content'][$attribute_code]['required'] = 'no';
}
}
}
$validate = $wpshop->validateForm($attribute_set_field['content'], $_POST['attribute']);
}
if (empty($wpshop->errors)) {
$user_name = !empty($_POST['attribute']['varchar']['user_login']) ? $_POST['attribute']['varchar']['user_login'] : $_POST['attribute']['varchar']['user_email'];
$user_pass = !empty($_POST['attribute']['varchar']['user_pass']) && !empty($_POST['wps_signup_account_creation']) ? $_POST['attribute']['varchar']['user_pass'] : wp_generate_password(12, false);
if ($user_id == 0) {
$user_id = wp_create_user($user_name, $user_pass, $_POST['attribute']['varchar']['user_email']);
if (!is_object($user_id)) {
$account_creation = true;
/** Update newsletter user preferences **/
$newsletter_preferences = array();
if (!empty($_POST['newsletters_site'])) {
$newsletter_preferences['newsletters_site'] = 1;
}
if (!empty($_POST['newsletters_site_partners'])) {
$newsletter_preferences['newsletters_site_partners'] = 1;
}
update_user_meta($user_id, 'user_preferences', $newsletter_preferences);
}
}
$customer_entity_request = $wpdb->prepare('SELECT ID FROM ' . $wpdb->posts . ' WHERE post_type = %s AND post_author = %d', WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, $user_id);
$customer_entity_id = $wpdb->get_var($customer_entity_request);
//Save attributes
if (!empty($_POST['attribute'])) {
foreach ($_POST['attribute'] as $att_type => $atts) {
foreach ($atts as $att_code => $att_value) {
$q = $wpdb->prepare('SELECT id FROM ' . WPSHOP_DBT_ATTRIBUTE . ' WHERE code = %s', $att_code);
$attribute_id = $wpdb->get_var($q);
if (!empty($attribute_id)) {
$t = $wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . strtolower($att_type), array('entity_type_id' => $element_id, 'attribute_id' => $attribute_id, 'entity_id' => $customer_entity_id, 'user_id' => $user_id, 'creation_date_value' => current_time('mysql', 0), 'language' => 'fr_FR', 'value' => $att_value));
}
}
}
}
foreach ($attribute_set_field['content'] as $attribute) {
if (!in_array($attribute['name'], $exclude_user_meta)) {
update_user_meta($user_id, $attribute['name'], wpshop_tools::varSanitizer($_POST['attribute'][$attribute['data_type']][$attribute['name']]));
} else {
wp_update_user(array('ID' => $user_id, $attribute['name'] => wpshop_tools::varSanitizer($_POST['attribute'][$attribute['data_type']][$attribute['name']])));
}
}
if (!empty($_SESSION) && !empty($_SESSION['cart'])) {
$permalink_option = get_option('permalink_structure');
$checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
$result = get_permalink($checkout_page_id) . (!empty($permalink_option) ? '?' : '&') . 'order_step=3';
} else {
$account_page_id = wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'));
$result = get_permalink($account_page_id);
}
$status = true;
if ($account_creation && empty($_POST['wps_sign_up_request_from_admin'])) {
$secure_cookie = is_ssl() ? true : false;
wp_set_auth_cookie($user_id, true, $secure_cookie);
}
$wps_message->wpshop_prepared_email($_POST['attribute']['varchar']['user_email'], 'WPSHOP_SIGNUP_MESSAGE', array('customer_first_name' => !empty($_POST['attribute']['varchar']['first_name']) ? $_POST['attribute']['varchar']['first_name'] : '', 'customer_last_name' => !empty($_POST['attribute']['varchar']['last_name']) ? $_POST['attribute']['varchar']['last_name'] : '', 'customer_user_email' => !empty($_POST['attribute']['varchar']['user_email']) ? $_POST['attribute']['varchar']['user_email'] : ''));
} else {
$result = '<div class="wps-alert-error">' . __('Some errors have been detected', 'wpshop') . ' : <ul>';
foreach ($wpshop->errors as $error) {
$result .= '<li>' . $error . '</li>';
}
$result .= '</div>';
}
}
}
}
echo json_encode(array($status, $result, $user_id));
die;
}
示例7: get_addresses_by_type
/**
* Get all addresses for current customer for display
*
* @param integer $address_type_id The current identifier of address type -> attribute_set_id
* @param string $address_type A string allowing to display
*
* @return string The complete html output for customer addresses
*/
function get_addresses_by_type($address_type_id, $address_type_title, $args = array())
{
global $wpdb;
/** Get current customer addresses list */
if (is_admin()) {
$post = get_post($_GET['post']);
if (!empty($post->post_parent)) {
$customer_id = $post->post_parent;
} else {
$customer_id = $post->post_author;
}
} else {
$customer_id = get_current_user_id();
}
$query = $wpdb->prepare("\r\n\t\t\t\tSELECT ADDRESSES.ID\r\n\t\t\t\tFROM " . $wpdb->posts . " AS ADDRESSES\r\n\t\t\t\t\tINNER JOIN " . $wpdb->postmeta . " AS ADDRESSES_META ON (ADDRESSES_META.post_id = ADDRESSES.ID)\r\n\t\t\t\tWHERE ADDRESSES.post_type = %s\r\n\t\t\t\t\tAND ADDRESSES.post_parent = %d\r\n\t\t\t\tAND ADDRESSES_META.meta_key = %s\r\n\t\t\t\tAND ADDRESSES_META.meta_value = %d", WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS, $customer_id, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . '_attribute_set_id', $address_type_id);
$addresses = $wpdb->get_results($query);
$addresses_list = '';
/** Initialize */
$tpl_component = array();
$tpl_component['CUSTOMER_ADDRESS_TYPE_TITLE'] = !empty($args) && !empty($args['first']) && $args['first'] ? __('Your address', 'wpshop') : $address_type_title;
$tpl_component['LOADING_ICON'] = WPSHOP_LOADING_ICON;
$tpl_component['ADDRESS_BUTTONS'] = '';
if (count($addresses) > 0) {
$tpl_component['ADD_NEW_ADDRESS_LINK'] = get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))) . (strpos(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))), '?') === false ? '?' : '&') . 'action=add_address&type=' . $address_type_id;
} else {
$tpl_component['ADD_NEW_ADDRESS_LINK'] = get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))) . (strpos(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))), '?') === false ? '?' : '&') . 'action=add_address&type=' . $address_type_id . '&first';
}
$tpl_component['ADDRESS_TYPE'] = !empty($address_type_title) && $address_type_title == __('Shipping address', 'wpshop') ? 'shipping_address' : 'billing_address';
$tpl_component['ADD_NEW_ADDRESS_TITLE'] = sprintf(__('Add a new %s', 'wpshop'), !empty($args) && !empty($args['first']) && $args['first'] ? __('address', 'wpshop') : $address_type_title);
/** Read customer list */
if (count($addresses) > 0) {
/** Get the fields for addresses */
$address_fields = wps_address::get_addresss_form_fields_by_type($address_type_id);
$first = true;
$tpl_component['ADDRESS_COMBOBOX_OPTION'] = '';
$nb_of_addresses = 0;
foreach ($addresses as $address) {
// Display the addresses
/** If there isn't address in SESSION we display the first address of list by default */
if (empty($_SESSION[$tpl_component['ADDRESS_TYPE']]) && $first && !is_admin()) {
$address_id = $address->ID;
if (!is_admin()) {
$_SESSION[$tpl_component['ADDRESS_TYPE']] = $address->ID;
}
} else {
$address_id = !empty($_SESSION[$tpl_component['ADDRESS_TYPE']]) ? $_SESSION[$tpl_component['ADDRESS_TYPE']] : '';
}
$address_selected_infos = get_post_meta($address_id, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . '_metadata', true);
$address_infos = get_post_meta($address->ID, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . '_metadata', true);
if (!empty($address_infos)) {
$tpl_component['ADDRESS_ID'] = $address->ID;
/** If no address was selected, we select the first of the list **/
$tpl_component['CUSTOMER_ADDRESS_CONTENT'] = self::display_an_address($address_fields, $address_selected_infos, $address_id);
$tpl_component['ADDRESS_BUTTONS'] = wpshop_display::display_template_element('addresses_box_actions_button_edit', $tpl_component);
$tpl_component['choosen_address_LINK_EDIT'] = get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))) . (strpos(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))), '?') === false ? '?' : '&') . 'action=editAddress&id=' . $address_id;
$tpl_component['DEFAULT_ADDRESS_ID'] = $address_id;
$tpl_component['ADRESS_CONTAINER_CLASS'] = ' wpshop_customer_adress_container_' . $address->ID;
$tpl_component['CUSTOMER_CHOOSEN_ADDRESS'] = wpshop_display::display_template_element('display_address_container', $tpl_component);
if (empty($tpl_component['CUSTOMER_ADDRESS_CONTENT'])) {
$tpl_component['CUSTOMER_CHOOSEN_ADDRESS'] = '<span style="color:red;">' . __('No data', 'wpshop') . '</span>';
}
$tpl_component['ADDRESS_COMBOBOX_OPTION'] .= '<option value="' . $address->ID . '" ' . (!empty($_SESSION[$tpl_component['ADDRESS_TYPE']]) && $_SESSION[$tpl_component['ADDRESS_TYPE']] == $address->ID ? 'selected="selected"' : null) . '>' . (!empty($address_infos['address_title']) ? $address_infos['address_title'] : $address_type_title) . '</option>';
$nb_of_addresses++;
}
$first = false;
}
$tpl_component['ADDRESS_COMBOBOX'] = '';
if (!is_admin()) {
$tpl_component['ADDRESS_COMBOBOX'] = !empty($tpl_component['ADDRESS_COMBOBOX_OPTION']) && $nb_of_addresses > 1 ? wpshop_display::display_template_element('addresses_type_combobox', $tpl_component) : '';
}
} else {
if (!empty($args) && !empty($args['first']) && $args['first']) {
$tpl_component['ADDRESS_TYPE'] = 'first_address';
}
$tpl_component['ADDRESS_ID'] = 0;
$tpl_component['DEFAULT_ADDRESS_ID'] = 0;
$tpl_component['ADDRESS_COMBOBOX'] = '';
$tpl_component['CUSTOMER_CHOOSEN_ADDRESS'] = sprintf(__('You don\'t have any %s, %splease create a new one%s', 'wpshop'), !empty($args) && !empty($args['first']) && $args['first'] ? __('address', 'wpshop') : strtolower($address_type_title), '<a href="' . $tpl_component['ADD_NEW_ADDRESS_LINK'] . '" >', '</a>');
}
$tpl_component['ADDRESS_BUTTONS'] .= wpshop_display::display_template_element('addresses_box_actions_button_new_address', $tpl_component);
if (!empty($args['only_display']) && $args['only_display'] == 'yes') {
$tpl_component['ADDRESS_BUTTONS'] = '';
}
$addresses_list .= wpshop_display::display_template_element('display_addresses_by_type_container', $tpl_component);
return $addresses_list;
}
示例8: wp_upload_dir
if (get_post_type($downloadable_product_id) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) {
$parent_def = wpshop_products::get_parent_variation($downloadable_product_id);
if (!empty($parent_def) && !empty($parent_def['parent_post'])) {
$parent_post = $parent_def['parent_post'];
$variation_id = $downloadable_product_id;
$downloadable_product_id = $parent_post->ID;
}
}
$link = wpshop_attributes::get_attribute_option_output(array('item_id' => $downloadable_product_id, 'item_is_downloadable_' => 'yes'), 'is_downloadable_', 'file_url', $order);
if ($link !== false) {
$uploads = wp_upload_dir();
$basedir = $uploads['basedir'];
$pos = strpos($link, 'uploads');
$link = $basedir . substr($link, $pos + 7);
/** If plugin is encrypted **/
$encrypted_plugin_path = get_post_meta($_GET['oid'], '_download_file_path_' . $_GET['oid'] . '_' . (!empty($variation_id) && get_post_type($variation_id) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION ? $variation_id : $downloadable_product_id), true);
if (!empty($encrypted_plugin_path)) {
$link = WPSHOP_UPLOAD_DIR . $encrypted_plugin_path;
$is_encrypted = true;
}
wpshop_tools::forceDownload($link, $is_encrypted);
}
}
}
}
}
} else {
wp_redirect(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))));
}
}
echo __('Impossible to download the file you requested', 'wpshop');
示例9: wps_cart_pass_to_step_two
/**
* AJAX - Pass to step two in the Checkout tunnel
*/
public static function wps_cart_pass_to_step_two()
{
$status = false;
$response = '';
$checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
if (!empty($checkout_page_id)) {
$permalink_option = get_option('permalink_structure');
$step = get_current_user_id() != 0 ? 3 : 2;
$response = get_permalink($checkout_page_id) . (!empty($permalink_option) ? '?' : '&') . 'order_step=' . $step;
$response = apply_filters('wps_extra_signup_actions', $response);
$status = true;
} else {
$response = '<div class="wps-alert-error">' . __('An error was occured, please retry later or contact the website administrator', 'wpshop') . '</div>';
}
echo json_encode(array('status' => $status, 'response' => $response));
die;
}
示例10: get_permalink
<div class="wps-gridwrapper2-padded">
<div>
<?php
if ($cart_type != 'admin-panel') {
?>
<?php
if (!empty($cart_type) && $cart_type == 'summary' && !$account_origin) {
?>
<?php
$url_step_one = get_permalink(wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id')));
?>
<?php
printf(__('You have forget an item ? <a href="%s">Modify your cart !</a>', 'wpshop'), $url_step_one);
?>
<?php
} else {
?>
<?php
if (!$account_origin) {
echo do_shortcode('[wps_apply_coupon]');
} else {
?>
<button id="<?php
echo $oid;
?>
" class="wps-bton-first-mini-rounded make_order_again"><?php
_e('Make this order again', 'wpshop');
?>
</button>
<?php
}
示例11: get_cancel_payment_url
public static function get_cancel_payment_url()
{
$url = get_permalink(wpshop_tools::get_page_id(get_option('wpshop_payment_return_nok_page_id')));
return $url;
}
示例12: get_permalink
<div class="wps-header-mini-cart wps-cart-activator">
<div class="wps-mini-cart-header">
<a href="<?php
echo get_permalink(wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id ')));
?>
" class="wps-mini-cart-opener">
<?php
_e('My cart', 'wpshop');
?>
<i class="wps-icon-basket"></i>
<?php
echo do_shortcode('[wps-numeration-cart]');
?>
</a>
<span class="wps-mini-cart-free-shipping-alert"><?php
echo wpshop_tools::create_custom_hook('wpshop_free_shipping_cost_alert');
?>
</span>
</div>
<div class="wps-mini-cart-body">
<?php
echo $mini_cart_body;
?>
</div>
</div>
示例13: feed_template
/**
* Fill a template with given element. Replace some code by content before output the html
*
* @param string $template_to_fill The complete html code we want to display with element to change
* @param array $feed The different element to put in place of the code into the tempalte part
*
* @return string The html code to display
*/
public static function feed_template($template_to_fill, $feed)
{
/* Add general element */
$feed['CURRENCY'] = wpshop_tools::wpshop_get_currency();
$feed['CURRENCY_CHOOSEN'] = wpshop_tools::wpshop_get_currency();
$feed['CURRENCY_SELECTOR'] = wpshop_attributes_unit::wpshop_shop_currency_list_field();
$feed['CART_LINK'] = get_permalink(wpshop_tools::get_page_id(get_option('wpshop_cart_page_id')));
$available_key = array();
foreach ($feed as $element => $value) {
$available_key[] = '{WPSHOP_' . $element . '}';
if (!is_array($value)) {
$template_to_fill = str_replace('{WPSHOP_' . $element . '}', $value, $template_to_fill);
}
}
if (WPSHOP_DISPLAY_AVAILABLE_KEYS_FOR_TEMPLATE) {
$template_to_fill = '<!-- Available keys : ' . implode(' / ', $available_key) . ' -->' . $template_to_fill;
}
return $template_to_fill;
}
示例14: wps_checkout_valid_step_five
/**
* AJAX - Valid Checkout step four
*/
function wps_checkout_valid_step_five()
{
$status = false;
$response = '';
$payment_method = !empty($_POST['wps-payment-method']) ? wpshop_tools::varSanitizer($_POST['wps-payment-method']) : null;
$order_id = !empty($_SESSION['cart']['order_id']) ? wpshop_tools::varSanitizer($_SESSION['cart']['order_id']) : 0;
$customer_comment = !empty($_POST['wps-customer-comment']) ? wpshop_tools::varSanitizer($_POST['wps-customer-comment']) : null;
$terms_of_sale_checking = isset($_POST['terms_of_sale_indicator']) && !empty($_POST['terms_of_sale']) || !empty($_POST['terms_of_sale']) || !isset($_POST['terms_of_sale_indicator']) && empty($_POST['terms_of_sale']) ? true : false;
if ($terms_of_sale_checking) {
if (!empty($payment_method)) {
/** Check if the payment method exist for the shop **/
$payment_option = get_option('wps_payment_mode');
if (!empty($payment_option) && !empty($payment_option['mode']) && array_key_exists($payment_method, $payment_option['mode']) && !empty($payment_option['mode'][$payment_method]['active'])) {
$order_id = wpshop_checkout::process_checkout($payment_method, $order_id, get_current_user_id(), $_SESSION['billing_address'], $_SESSION['shipping_address']);
if (!empty($order_id) && !empty($customer_comment)) {
wp_update_post(array('ID' => $order_id, 'post_excerpt' => $customer_comment));
}
$permalink_option = get_option('permalink_structure');
$checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
$response = get_permalink($checkout_page_id) . (!empty($permalink_option) ? '?' : '&') . 'order_step=6';
$_SESSION['payment_method'] = $payment_method;
$status = true;
//Add an action to extra actions on order save
$args = array('order_id' => $order_id, 'posted_data' => $_REQUEST);
wpshop_tools::create_custom_hook('wps_order_extra_save_action', $args);
} else {
$response = '<div class="wps-alert-error">' . __('This payment method is unavailable', 'wpshop') . '</div>';
}
} else {
$response = '<div class="wps-alert-error">' . __('You must choose a payment method', 'wpshop') . '</div>';
}
} else {
$response = '<div class="wps-alert-error">' . __('You must accept the terms of sale to order', 'wpshop') . '</div>';
}
echo json_encode(array('status' => $status, 'response' => $response));
die;
}
示例15: get_option
<div class="<?php
echo $step_class;
?>
" id="wps-step-indicator-<?php
echo $step_id;
?>
">
<?php
if ($step_finished) {
$permalink_option = get_option('permalink_structure');
$checkout_page_id = wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'));
$url = get_permalink(wpshop_tools::get_page_id($checkout_page_id)) . (!empty($permalink_option) ? '?' : '&') . 'order_step=' . $step_id;
?>
<a href="<?php
echo $url;
?>
"><i class="wps-circlerounded"><?php
echo $step_id;
?>
</i><span><?php
echo $step;
?>
</span></a>
<?php
} else {
?>
<i class="wps-circlerounded"><?php
echo $step_id;
?>
</i><span><?php
echo $step;