本文整理汇总了PHP中wpshop_tools::wpshop_get_currency方法的典型用法代码示例。如果您正苦于以下问题:PHP wpshop_tools::wpshop_get_currency方法的具体用法?PHP wpshop_tools::wpshop_get_currency怎么用?PHP wpshop_tools::wpshop_get_currency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpshop_tools
的用法示例。
在下文中一共展示了wpshop_tools::wpshop_get_currency方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: generate_received_payment_part
/**
* Return the payment list part
* @param integer $order_id
* @return string
*/
public static function generate_received_payment_part($order_id)
{
$date_ouput_format = get_option('date_format') . ' ' . get_option('time_format');
$output = '';
$tpl_component = array();
$tpl_component['ORDER_RECEIVED_PAYMENT_ROWS'] = '';
if (!empty($order_id)) {
$order_postmeta = get_post_meta($order_id, '_order_postmeta', true);
if (!empty($order_postmeta['order_payment']) && !empty($order_postmeta['order_payment']['received'])) {
$wps_payment_option = get_option('wps_payment_mode');
foreach ($order_postmeta['order_payment']['received'] as $payment) {
if (!empty($payment)) {
$sub_tpl_component = array();
$sub_tpl_component['INVOICE_RECEIVED_PAYMENT_RECEIVED_AMOUNT'] = !empty($payment['received_amount']) ? number_format($payment['received_amount'], 2, ',', '') . ' ' . wpshop_tools::wpshop_get_currency() : 0;
$sub_tpl_component['INVOICE_RECEIVED_PAYMENT_DATE'] = !empty($payment['date']) ? mysql2date($date_ouput_format, $payment['date'], true) : '';
$sub_tpl_component['INVOICE_RECEIVED_PAYMENT_METHOD'] = !empty($payment['method']) && is_array($wps_payment_option) && array_key_exists(strtolower($payment['method']), $wps_payment_option['mode']) && !empty($wps_payment_option['mode'][strtolower($payment['method'])]['name']) ? $wps_payment_option['mode'][strtolower($payment['method'])]['name'] : (!empty($payment['method']) ? __($payment['method'], 'wpshop') : '');
$sub_tpl_component['INVOICE_RECEIVED_PAYMENT_PAYMENT_REFERENCE'] = !empty($payment['payment_reference']) ? $payment['payment_reference'] : '';
$sub_tpl_component['INVOICE_RECEIVED_PAYMENT_INVOICE_REF'] = !empty($payment['invoice_ref']) ? $payment['invoice_ref'] : '';
$tpl_component['ORDER_RECEIVED_PAYMENT_ROWS'] .= wpshop_display::display_template_element('received_payment_row', $sub_tpl_component, array('type' => 'invoice_line', 'id' => 'partial_payment'), 'common');
}
}
}
$output = wpshop_display::display_template_element('received_payment', $tpl_component, array('type' => 'invoice_line', 'id' => 'partial_payment'), 'common');
unset($tpl_component);
}
return $output;
}
示例3: ajax_wpshop_add_to_cart
/**
* Add product to the end user cart
*/
function ajax_wpshop_add_to_cart()
{
global $wpdb;
$wpshop_cart = new wps_cart();
$product_id = isset($_POST['wpshop_pdt']) ? intval(wpshop_tools::varSanitizer($_POST['wpshop_pdt'])) : null;
$product_qty = isset($_POST['wpshop_pdt_qty']) ? intval(wpshop_tools::varSanitizer($_POST['wpshop_pdt_qty'])) : 1;
$cart_option = get_option('wpshop_cart_option', array());
$wpshop_variation_selected = !empty($_POST['wps_pdt_variations']) ? $_POST['wps_pdt_variations'] : array();
$from_administration = !empty($_POST['from_admin']) ? true : false;
$order_id = !empty($_POST['wps_orders_order_id']) ? wpshop_tools::varSanitizer($_POST['wps_orders_order_id']) : null;
// Check Cart Animation
$cart_animation_choice = !empty($cart_option) && !empty($cart_option['animation_cart_type']) ? $cart_option['animation_cart_type'] : null;
if (!empty($cart_option['total_nb_of_item_allowed']) && $cart_option['total_nb_of_item_allowed'][0] == 'yes') {
$wpshop_cart->empty_cart();
}
// Prepare Product to be added to cart
$formatted_product = $wpshop_cart->prepare_product_to_add_to_cart($product_id, $product_qty, $wpshop_variation_selected);
$product_to_add_to_cart = $formatted_product[0];
$new_pid = $formatted_product[1];
// Check cart Type
$cart_type_for_adding = 'normal';
if (!empty($_POST['wpshop_cart_type'])) {
switch (wpshop_tools::varSanitizer($_POST['wpshop_cart_type'])) {
case 'quotation':
$wpshop_cart_type = 'quotation';
break;
default:
$wpshop_cart_type = 'normal';
break;
}
}
// Check Product image
$product = get_post($product_id);
$product_img = '<img src="' . WPSHOP_DEFAULT_PRODUCT_PICTURE . '" alt="no picture" />';
if (!empty($product_id)) {
if ($product->post_type == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) {
$parent_def = wpshop_products::get_parent_variation($product_id);
$parent_post = !empty($parent_def['parent_post']) ? $parent_def['parent_post'] : array();
$product_title = !empty($parent_post) && !empty($parent_post->post_title) ? $parent_post->post_title : '';
$product_description = !empty($parent_post) && !empty($parent_post->post_content) ? $parent_post->post_content : '';
$product_img = !empty($parent_post->ID) ? get_the_post_thumbnail($parent_post->ID, 'thumbnail') : '';
} else {
$product_title = $product->post_title;
$product_description = $product->post_content;
$product_img = get_the_post_thumbnail($product_id, 'thumbnail');
}
}
if (!empty($_POST['wps_orders_from_admin']) && $_POST['wps_orders_from_admin'] == true) {
$order_meta = get_post_meta($order_id, '_order_postmeta', true);
$return = $wpshop_cart->add_to_cart($product_to_add_to_cart, array($new_pid => $product_qty), $wpshop_cart_type, array(), true, $order_meta, $order_id);
echo json_encode(array(true));
die;
} else {
$return = $wpshop_cart->add_to_cart($product_to_add_to_cart, array($new_pid => $product_qty), $wpshop_cart_type);
}
if ($return == 'success') {
$cart_page_url = get_permalink(wpshop_tools::get_page_id(get_option('wpshop_cart_page_id')));
/** Template parameters */
$template_part = 'product_added_to_cart_message';
/** Build template */
$tpl_way_to_take = wpshop_display::check_way_for_template($template_part);
if ($tpl_way_to_take[0] && !empty($tpl_way_to_take[1])) {
/* Include the old way template part */
ob_start();
require_once wpshop_display::get_template_file($tpl_way_to_take[1]);
$succes_message_box = ob_get_contents();
ob_end_clean();
} else {
$succes_message_box = wpshop_display::display_template_element($template_part, array('PRODUCT_ID' => $product_id));
}
unset($tpl_component);
$action_after_add = $cart_option['product_added_to_cart'][0] == 'cart_page' ? true : false;
if ($wpshop_cart_type == 'quotation') {
$action_after_add = $cart_option['product_added_to_quotation'][0] == 'cart_page' ? true : false;
}
/** Product Price **/
$product_price = '';
if (!empty($_SESSION['cart']) && !empty($_SESSION['cart']['order_items']) && !empty($product_to_add_to_cart)) {
$idp = '';
if (!empty($product_to_add_to_cart[$new_pid]['variations']) && count($product_to_add_to_cart[$new_pid]['variations']) < 2) {
$idp = $product_to_add_to_cart[$new_pid]['variations'][0];
} else {
if (strstr($new_pid, '__')) {
$idp = $new_pid;
} else {
$idp = $product_to_add_to_cart[$new_pid]['id'];
}
}
if (!empty($idp)) {
$default_currency = wpshop_tools::wpshop_get_currency(false);
$price_piloting_option = get_option('wpshop_shop_price_piloting');
$pr = !empty($price_piloting_option) && $price_piloting_option == 'HT' ? $_SESSION['cart']['order_items'][$new_pid]['item_pu_ht'] * $product_qty : $_SESSION['cart']['order_items'][$new_pid]['item_pu_ttc'] * $product_qty;
$product_price = wpshop_tools::formate_number($pr) . $default_currency;
}
}
/** Check if there are linked products **/
$related_products = get_post_meta($product_id, '_wpshop_product_related_products', true);
//.........这里部分代码省略.........
示例4: save_order_custom_informations
/**
* Save custom Order informations
*/
function save_order_custom_informations()
{
global $wpdb;
// Check if it is an order save action
if (!empty($_REQUEST['post_ID']) && get_post_type($_REQUEST['post_ID']) == WPSHOP_NEWTYPE_IDENTIFIER_ORDER) {
//Define Customer ID
$user_id = !empty($_REQUEST['wps_customer_id']) ? $_REQUEST['wps_customer_id'] : get_current_user_id();
// Order MetaData
$order_meta = get_post_meta(intval($_REQUEST['post_ID']), '_order_postmeta', true);
// Save General information of order's attached customer
$wpdb->update($wpdb->posts, array('post_parent' => $user_id, 'post_status' => 'publish'), array('ID' => $_REQUEST['post_ID']));
update_post_meta($_REQUEST['post_ID'], '_wpshop_order_customer_id', $user_id);
$order_meta['customer_id'] = $user_id;
if (empty($order_meta['order_key'])) {
$order_meta['order_key'] = !empty($order_meta['order_key']) ? $order_meta['order_key'] : (!empty($order_meta['order_status']) && $order_meta['order_status'] != 'awaiting_payment' ? wpshop_orders::get_new_order_reference() : '');
$order_meta['order_temporary_key'] = isset($order_meta['order_temporary_key']) && $order_meta['order_temporary_key'] != '' ? $order_meta['order_temporary_key'] : wpshop_orders::get_new_pre_order_reference();
}
$order_meta['order_status'] = isset($order_meta['order_status']) && $order_meta['order_status'] != '' ? $order_meta['order_status'] : 'awaiting_payment';
$order_meta['order_date'] = isset($order_meta['order_date']) && $order_meta['order_date'] != '' ? $order_meta['order_date'] : current_time('mysql', 0);
$order_meta['order_currency'] = wpshop_tools::wpshop_get_currency(true);
// Order Attached Addresses save
if (!empty($_REQUEST['wps_order_selected_address']['billing'])) {
// Informations
$order_informations = get_post_meta($_REQUEST['post_ID'], '_order_info', true);
$order_informations = !empty($order_informations) ? $order_informations : array();
$billing_address_option = get_option('wpshop_billing_address');
$billing_address_option = !empty($billing_address_option) && !empty($billing_address_option['choice']) ? $billing_address_option['choice'] : '';
// Billing datas
$order_informations['billing'] = array('id' => $billing_address_option, 'address_id' => $_REQUEST['wps_order_selected_address']['billing'], 'address' => get_post_meta($_REQUEST['wps_order_selected_address']['billing'], '_wpshop_address_metadata', true));
// Shipping datas
if (!empty($_REQUEST['wps_order_selected_address']['shipping'])) {
$shipping_address_option = get_option('wpshop_shipping_address_choice');
$shipping_address_option = !empty($shipping_address_option) && !empty($shipping_address_option['choice']) ? $shipping_address_option['choice'] : '';
$order_informations['shipping'] = array('id' => $shipping_address_option, 'address_id' => $_REQUEST['wps_order_selected_address']['shipping'], 'address' => get_post_meta($_REQUEST['wps_order_selected_address']['shipping'], '_wpshop_address_metadata', true));
}
update_post_meta($_REQUEST['post_ID'], '_order_info', $order_informations);
}
// Add a Payment to Order MetaData
if (!empty($_REQUEST['wpshop_admin_order_payment_received']) && !empty($_REQUEST['wpshop_admin_order_payment_received']['method']) && !empty($_REQUEST['wpshop_admin_order_payment_received']['date']) && !empty($_REQUEST['wpshop_admin_order_payment_received']['received_amount']) && ($_REQUEST['action_triggered_from'] == 'add_payment' || !empty($_REQUEST['wpshop_admin_order_payment_reference']))) {
$received_payment_amount = $_REQUEST['wpshop_admin_order_payment_received']['received_amount'];
// Payment Params
$params_array = array('method' => $_REQUEST['wpshop_admin_order_payment_received']['method'], 'waited_amount' => $received_payment_amount, 'status' => 'payment_received', 'author' => $user_id, 'payment_reference' => $_REQUEST['wpshop_admin_order_payment_received']['payment_reference'], 'date' => current_time('mysql', 0), 'received_amount' => $received_payment_amount);
$order_meta = wpshop_payment::check_order_payment_total_amount($_REQUEST['post_ID'], $params_array, 'completed', $order_meta, false);
}
//Round final amount
$order_meta['order_grand_total'] = number_format(round($order_meta['order_grand_total'], 2), 2, '.', '');
$order_meta['order_total_ttc'] = number_format(round($order_meta['order_total_ttc'], 2), 2, '.', '');
$order_meta['order_amount_to_pay_now'] = number_format(round($order_meta['order_amount_to_pay_now'], 2), 2, '.', '');
// Payment Pre-Fill
if (empty($order_meta['order_payment'])) {
$order_meta['order_payment']['customer_choice']['method'] = '';
$order_meta['order_payment']['received'][] = array('waited_amount' => !empty($order_meta) && !empty($order_meta['order_grand_total']) ? number_format($order_meta['order_grand_total'], 2, '.', '') : 0);
}
// Apply a filter to make credit, notificate the customer and generate billing actions
$order_meta = apply_filters('wps_order_saving_admin_extra_action', $order_meta, $_REQUEST);
// Save Shipping informations & Order status
update_post_meta($_REQUEST['post_ID'], '_wpshop_order_shipping_date', $order_meta['order_shipping_date']);
update_post_meta($_REQUEST['post_ID'], '_wpshop_order_status', $order_meta['order_status']);
// Save Metadata
update_post_meta($_REQUEST['post_ID'], '_order_postmeta', $order_meta);
}
}
示例5: sprintf
} 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 {
示例6: custom_columns_content
/**
* Define custom columns content display in post_type page for wpshop entities
*
* @param string $columns The default column for the post_type given in second parameter
* @param integer $post_id The current post identifier to get information for display
*/
public static function custom_columns_content($column, $post_id)
{
$post_type = get_post_type($post_id);
switch ($post_type) {
case WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT:
$column_content = '<strong>-</strong>';
$product = wpshop_products::get_product_data($post_id);
switch ($column) {
case 'picture':
$column_content = get_the_post_thumbnail($post_id, 'thumbnail');
break;
case "product_stock":
if (!empty($product['product_stock'])) {
$column_content = (int) $product['product_stock'] . ' ' . __('unit(s)', 'wpshop');
}
break;
case "product_price":
if (!empty($product['product_price'])) {
$column_content = wpshop_prices::get_product_price($product, 'price_display', 'complete_sheet');
}
break;
case "tx_tva":
if (!empty($product['product_price'])) {
$column_content = number_format($product[$column], 2, '.', ' ') . ' %';
}
break;
default:
if (!empty($product[$column])) {
$attribute_prices = unserialize(WPSHOP_ATTRIBUTE_PRICES);
if (in_array($column, $attribute_prices)) {
$column_content = number_format($product[$column], 2, '.', ' ') . ' ' . wpshop_tools::wpshop_get_currency();
} else {
$column_content = $product[$column];
}
}
break;
}
break;
default:
$column_content = '';
break;
}
echo $column_content;
}
示例7: resume_cart_content
/** Resume cart Content **/
public static function resume_cart_content()
{
$output = '';
$currency = wpshop_tools::wpshop_get_currency(false);
$cart_content = !empty($_SESSION) && !empty($_SESSION['cart']) ? $_SESSION['cart'] : array();
if (!empty($cart_content)) {
$cart_items = !empty($cart_content['order_items']) ? $cart_content['order_items'] : array();
if (!empty($cart_items)) {
if (!empty($cart_content['coupon_id'])) {
$coupon_title = get_the_title($cart_content['coupon_id']);
$coupon_value = wpshop_tools::formate_number($cart_content['order_discount_amount_total_cart']);
}
$order_total_before_discount = !empty($cart_content['order_grand_total_before_discount']) ? $cart_content['order_grand_total_before_discount'] : 0;
$shipping_cost_ati = !empty($cart_content['order_shipping_cost']) ? $cart_content['order_shipping_cost'] : 0;
$total_ati = $total_cart = !empty($cart_content['order_amount_to_pay_now']) ? $cart_content['order_amount_to_pay_now'] : 0;
ob_start();
require_once wpshop_tools::get_template_part(WPS_CART_DIR, WPS_CART_TPL_DIR, "frontend", "resume-cart/resume-cart", "content");
$output = ob_get_contents();
ob_end_clean();
} else {
$resume_cart_body = '<div class="wps-alert-info">' . __('Your cart is empty', 'wpshop') . '</div>';
}
} else {
$resume_cart_body = '<div class="wps-alert-info">' . __('Your cart is empty', 'wpshop') . '</div>';
}
return $output;
}
示例8: display_free_shipping_cost_alert
/**
* Display a free Shipping cost alert in cart and shop
*/
function display_free_shipping_cost_alert()
{
global $wpdb;
$output = '';
$cart = !empty($_SESSION['cart']) && is_array($_SESSION['cart']) ? $_SESSION['cart'] : null;
$cart_option = get_option('wpshop_cart_option');
$price_piloting_option = get_option('wpshop_shop_price_piloting');
// Get a shipping mode, in order : selected, else default, else first, else shipping_rules.
$shipping_modes = get_option('wps_shipping_mode');
if (!empty($shipping_modes) && !empty($shipping_modes['modes'])) {
if (!empty($shipping_modes['default_choice']) && !empty($shipping_modes['modes'][$shipping_modes['default_choice']])) {
$shipping_rules_option = $shipping_modes['modes'][$shipping_modes['default_choice']];
} elseif (!empty($shipping_modes['modes']['default_shipping_mode'])) {
$shipping_rules_option = $shipping_modes['modes']['default_shipping_mode'];
} else {
$shipping_rules_option = reset($shipping_modes['modes']);
}
} else {
$shipping_rules_option = get_option('wpshop_shipping_rules');
}
if (!empty($shipping_rules_option) && !empty($shipping_rules_option['free_from']) && $shipping_rules_option['free_from'] > 0) {
$free_shipping_cost_limit = $shipping_rules_option['free_from'];
}
if (!empty($cart_option) && !empty($cart_option['free_shipping_cost_alert'])) {
if (!empty($cart['order_items']) && !empty($cart['order_grand_total'])) {
$order_amount = !empty($price_piloting_option) && $price_piloting_option == 'HT' ? number_format((double) $cart['order_total_ht'], 2, '.', '') : number_format((double) $cart['order_total_ttc'], 2, '.', '');
if ($order_amount < $free_shipping_cost_limit) {
$free_in = number_format((double) ($free_shipping_cost_limit - $order_amount), 2, '.', '');
$currency = wpshop_tools::wpshop_get_currency();
$output = sprintf(__('Free shipping cost in %s', 'wpshop'), $free_in . ' ' . $currency);
} else {
$output = __('Free shipping cost', 'wpshop');
}
}
}
echo $output;
}
示例9: generate_image
/**
* Generate barcode image
* @param object $barcode Instance of wps_barcodegen
* @param string $meta Numerical code of barcode
* @param string $type Texte for complete message
* @param string $price Price of product
* @param string $title Title of product
*/
public function generate_image(&$barcode, $meta, $type, $price, $title, $post_ID = 0)
{
if (!empty($meta)) {
$barcode->setGenerateCode($meta);
$binCode = $barcode->getBinCode();
$px = 3.779528;
$x = round(66 * $px);
//249.449 px
$y = round(50 * $px);
//188.976 px
$bar_size = round(63.393 / 72);
//0.880 px
$len = 0;
$test = '';
while ($len !== strlen($binCode)) {
$test .= substr($binCode, $len, 7) . ' ';
$len = $len + 7;
}
$im = imagecreate($x, $y);
$background_color = imagecolorallocate($im, 255, 255, 255);
$start = round(5.79 * $px);
//21.883
/*Write First left guard*/
$this->imgNormalGuard($im, $start, $start + $bar_size, imagecolorallocate($im, 0, 0, 0));
$this->imgNormalGuard($im, $start + $bar_size * 2, $start + $bar_size * 3, imagecolorallocate($im, 255, 255, 255));
$this->imgNormalGuard($im, $start + $bar_size * 4, $start + $bar_size * 5, imagecolorallocate($im, 0, 0, 0));
$pos = $start + $bar_size * 7;
$newPos = $pos + $bar_size;
/*Write left barcode*/
for ($i = 0; $i < 42; $i++) {
if (substr($binCode, $i, 1) === '0') {
$color = imagecolorallocate($im, 255, 255, 255);
} else {
$color = imagecolorallocate($im, 0, 0, 0);
}
$this->imgSymbole($im, $pos, $newPos, $color);
$newPos = $pos + $bar_size;
$pos = $newPos + $bar_size;
}
/*Writer center guard*/
$pos = $newPos;
$this->imgNormalGuard($im, $pos, $newPos + $bar_size, imagecolorallocate($im, 255, 255, 255));
$this->imgNormalGuard($im, $pos + $bar_size * 2, $newPos + $bar_size * 3, imagecolorallocate($im, 0, 0, 0));
$this->imgNormalGuard($im, $pos + $bar_size * 4, $newPos + $bar_size * 5, imagecolorallocate($im, 255, 255, 255));
$this->imgNormalGuard($im, $pos + $bar_size * 6, $newPos + $bar_size * 7, imagecolorallocate($im, 0, 0, 0));
$this->imgNormalGuard($im, $pos + $bar_size * 8, $newPos + $bar_size * 9, imagecolorallocate($im, 255, 255, 255));
$pos = $newPos + $bar_size * 10;
/*Write right barcode*/
for ($i = 42; $i < 84; $i++) {
if (substr($binCode, $i, 1) === '0') {
$color = imagecolorallocate($im, 255, 255, 255);
} else {
$color = imagecolorallocate($im, 0, 0, 0);
}
$newPos = $pos + $bar_size;
$this->imgSymbole($im, $pos, $newPos, $color);
$pos = $newPos + $bar_size;
}
/*Write right guard*/
$pos = $newPos + $bar_size;
$this->imgNormalGuard($im, $pos, $pos + $bar_size, imagecolorallocate($im, 0, 0, 0));
$this->imgNormalGuard($im, $pos + $bar_size * 2, $pos + $bar_size * 3, imagecolorallocate($im, 255, 255, 255));
$this->imgNormalGuard($im, $pos + $bar_size * 4, $pos + $bar_size * 5, imagecolorallocate($im, 0, 0, 0));
$textSize = 16;
$font = WPS_BARCODE_PATH . '/arialbd.ttf';
imagettftext($im, $textSize, 0, 8, $y - $start - 5, imagecolorallocate($im, 0, 0, 0), $font, substr($meta, 0, 1));
$continue = true;
$i = 28;
$j = 0;
/*Write left number code*/
while ($j < 5) {
$j = $j + 1;
imagettftext($im, $textSize, 0, $i, $y - $start - 5, imagecolorallocate($im, 0, 0, 0), $font, substr($meta, $j, 1));
$i = $i + 14;
}
/*Write right number code*/
while ($j < 11) {
$j = $j + 1;
imagettftext($im, $textSize, 0, $i + 6, $y - $start - 5, imagecolorallocate($im, 0, 0, 0), $font, substr($meta, $j, 1));
$i = $i + 15;
}
imagettftext($im, $textSize, 0, $i + 4, $y - $start - 5, imagecolorallocate($im, 0, 0, 0), $font, substr($meta, $j + 1, 1));
/*Write ref product and price*/
$textSize = 12;
$currency = wpshop_tools::wpshop_get_currency() === '€' ? "€" : wpshop_tools::wpshop_get_currency();
if ($type === __('coupon', 'wps_barcode')) {
$coupon_postmeta = get_post_meta($post_ID, 'wpshop_coupon_discount_type');
if ($coupon_postmeta[0] === 'percent') {
$price = $price . ' %';
} else {
$price = sprintf(number_format($price, 2) . ' ' . $currency);
}
//.........这里部分代码省略.........
示例10: 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;
}
示例11: pre_footer
function pre_footer($order_id)
{
// On r�cup�re les infos du magasin
$store = get_option('wpshop_company_info', array());
$store_name = $store['company_name'];
$society_type = $store['company_legal_statut'];
$society_capital = $store['company_capital'];
$siret = $store['company_siret'];
$tva_intra = $store['company_tva_intra'];
$currency = wpshop_tools::wpshop_get_currency(true);
$this->SetFont('', '', 10);
$this->SetXY(10, -50);
if (isset($store['company_member_of_a_approved_management_center']) && $store['company_member_of_a_approved_management_center']) {
$this->MultiCell(190, 4, utf8_decode(__('Member of an approved management center, accepting as such payments by check.', 'wpshop')), 0, 'L', FALSE);
$this->Ln();
}
$this->MultiCell(190, 4, utf8_decode(__('Law 83-629 of 07.12.83, Art. 8: "The administrative authorization does not confer any official character to the company or persons who benefit. It is in no way the responsibility of government."', 'wpshop')), 0, 'L', FALSE);
$this->Ln();
$this->MultiCell(190, 4, utf8_decode($store_name . ', ' . $society_type . __(' capital of ', 'wpshop') . $society_capital . ' ' . $currency . '. SIRET : ' . $siret . '. TVA Intracommunautaire : ' . $tva_intra), 0, 'L', FALSE);
}
示例12:
<?php
if (!empty($discount_data['type']) && ($discount_data['type'] == 'discount_amount' || $discount_data['type'] == 'discount_rate')) {
?>
<span class="wps-badge-big-bottomLeft-rouge">
-<?php
echo wpshop_tools::formate_number($discount_data['value']);
echo $discount_data['type'] == 'discount_amount' ? wpshop_tools::wpshop_get_currency(false) : '<span>%</span>';
?>
</span>
<?php
}
示例13: partial_payment
/**
* Partial payment configuration area display
*/
public static function partial_payment()
{
$output = '';
$partial_payment_current_config = get_option('wpshop_payment_partial', array('for_all' => array()));
$partial_for_all_is_activate = false;
if (!empty($partial_payment_current_config) && !empty($partial_payment_current_config['for_all']) && !empty($partial_payment_current_config['for_all']['activate'])) {
$partial_for_all_is_activate = true;
}
$output .= '
<input type="checkbox" name="wpshop_payment_partial[for_all][activate]"' . ($partial_for_all_is_activate ? ' checked="checked"' : '') . ' id="wpshop_payment_partial_on_command_activation_state" /> <label for="wpshop_payment_partial_on_command_activation_state" >' . __('Activate partial command for all order', 'wpshop') . '</label><a href="#" title="' . __('If you want that customer pay a part o f total amount of there order, check this box then fill fields below', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>
<div class="wpshop_partial_payment_config_container' . ($partial_for_all_is_activate ? '' : ' wpshopHide') . '" id="wpshop_partial_payment_config_container" >
<div class="alignleft" >
' . __('Value of partial payment', 'wpshop') . '<br/>
<input type="text" value="' . (!empty($partial_payment_current_config) && !empty($partial_payment_current_config['for_all']) && !empty($partial_payment_current_config['for_all']['value']) ? $partial_payment_current_config['for_all']['value'] : '') . '" name="wpshop_payment_partial[for_all][value]" />
</div>
<div class="" >
' . __('Type of partial payment', 'wpshop') . '<br/>
<select name="wpshop_payment_partial[for_all][type]" >
<option value="percentage"' . (!empty($partial_payment_current_config) && !empty($partial_payment_current_config['for_all']) && (empty($partial_payment_current_config['for_all']['type']) || $partial_payment_current_config['for_all']['type'] == 'percentage') ? ' selected="selected"' : '') . ' >' . __('%', 'wpshop') . '</option>
<option value="amount"' . (!empty($partial_payment_current_config) && !empty($partial_payment_current_config['for_all']) && !empty($partial_payment_current_config['for_all']['type']) && $partial_payment_current_config['for_all']['type'] == 'amount' ? ' selected="selected"' : '') . ' >' . wpshop_tools::wpshop_get_currency() . '</option>
</select>
</div>
</div>';
echo $output;
}
示例14: __
">
<?php
if ($order->_order_postmeta['order_key']) {
if ($order->_order_postmeta['order_invoice_ref']) {
$link = $order->_order_postmeta['order_invoice_ref'];
} else {
$link = $order->_order_postmeta['order_key'];
}
} else {
$link = __('Order summary ', 'wpshop');
}
echo $link;
?>
</a>
<span class="price_order"><?php
echo number_format(round($order->_order_postmeta['order_grand_total'], 2), 2, '.', '') . ' ' . wpshop_tools::wpshop_get_currency(false);
?>
</span>
<span class="date_order"><?php
echo date("d/m/Y | H:i:s", strtotime($order->_order_postmeta['order_date']));
?>
</span>
<?php
if ($order->_order_postmeta['order_invoice_ref']) {
?>
<span class="invoice_order">
<a href="<?php
echo WPSHOP_TEMPLATES_URL;
?>
invoice.php?order_id=<?php
echo $order->ID;
示例15: order_content_template_for_mail
/**
* Order content Template
* @param integer $order_id : Order ID
* @return string
*/
function order_content_template_for_mail($order_id)
{
$message = '';
if (!empty($order_id)) {
$currency_code = wpshop_tools::wpshop_get_currency(false);
$orders_infos = get_post_meta($order_id, '_order_postmeta', true);
ob_start();
require wpshop_tools::get_template_part(WPS_MESSAGE_DIR, $this->template_dir, "backend/mails", "order_content_mail_template");
$message .= ob_get_contents();
ob_end_clean();
}
return $message;
}