Skip to content
Permalink
Browse files

fix decimal display

  • Loading branch information...
kilbot committed Jun 9, 2015
1 parent 76e430c commit 358d95fabac41d7206d6aea2617280fa5ac810a9
@@ -208,7 +208,7 @@ public function enqueue_admin_scripts() {
);
$scripts = apply_filters( 'woocommerce_pos_admin_enqueue_scripts', array() );
if( $scripts['locale'] ) {
if( isset( $scripts['locale'] ) ) {
wp_enqueue_script(
WC_POS_PLUGIN_NAME . '-js-locale',
$scripts['locale'],
@@ -18,6 +18,12 @@ class WC_POS_API_Products extends WC_POS_API_Abstract {
public function __construct() {
add_filter( 'woocommerce_api_product_response', array( $this, 'product_response' ), 10, 4 );
add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
$general_settings = new WC_POS_Admin_Settings_General();
if( $general_settings->get_data('decimal_qty') ){
remove_filter('woocommerce_stock_amount', 'intval');
add_filter( 'woocommerce_stock_amount', 'floatval' );
}
}
/**
@@ -32,7 +38,6 @@ public function __construct() {
* @return array modified data array $product_data
*/
public function product_response( $product_data, $product, $fields, $server ) {
// remove some unnecessary keys
// - saves storage space in IndexedDB
// - saves bandwidth transferring the data
@@ -64,6 +69,9 @@ public function product_response( $product_data, $product, $fields, $server ) {
unset($product_data[$key]);
}
// allow decimal stock quantities
$product_data['stock_quantity'] = $product->get_stock_quantity();
// use thumbnails for images
if( $thumb_id = get_post_thumbnail_id( $product_data['id'] ) ) {
$image = wp_get_attachment_image_src( $thumb_id, 'shop_thumbnail' );
@@ -164,6 +164,9 @@ public function email_receipt() {
'result' => 'success',
'message' => __( 'Email sent', 'woocommerce-pos')
);
// hook for third party plugins
do_action( 'woocommerce_pos_email_receipt', $email, $order_id, $order );
} else {
$response = array(
'result' => 'error',
@@ -177,7 +180,6 @@ public function email_receipt() {
*
*/
public function send_support_email() {
$headers[] = 'From: '. $_POST['name'] .' <'. $_POST['email'] .'>';
$message = $_POST['message'] . "\n\n" . $_POST['status'];
$support = apply_filters( 'woocommerce_pos_support_email', 'support@woopos.com.au' );
@@ -54,7 +54,7 @@
</dl>
{{/is}}
{{#if managing_stock}}
<small><?php /* translators: woocommerce */ printf( __( '%s in stock', 'woocommerce' ), '{{stock_quantity}}' ); ?></small>
<small><?php /* translators: woocommerce */ printf( __( '%s in stock', 'woocommerce' ), '{{number stock_quantity precision="auto"}}' ); ?></small>
{{/if}}
</div>
<div class="price">
@@ -20,7 +20,7 @@
<script type="text/x-handlebars-template" id="tmpl-receipt-items">
{{#each line_items}}
<li>
<div class="qty">{{quantity}}</div>
<div class="qty">{{number quantity precision="auto"}}</div>
<div class="title">
{{name}}
{{#with meta}}
@@ -160,7 +160,7 @@
</dl>
{{/with}}
</td>
<td class="qty">{{quantity}}</td>
<td class="qty">{{number quantity precision="auto"}}</td>
<td class="price">
{{#if on_sale}}
<del>{{{money subtotal}}}</del>
@@ -77,6 +77,15 @@ Bugs can be reported on the [WooCommerce POS GitHub repository](https://github.c

== Changelog ==

= 0.4.1 =
* New: added woocommerce_pos_email_receipt hook
* Improve: editing a product title in cart
* Improve: css tweaks for Firefox
* Fix: create_order error for WC version 2.2.x
* Fix: Internal Server Error for PHP 5.2.x
* Fix: parse $HTTP_RAW_POST_DATA global to array
* Fix: decimal quantity display

= 0.4 =
* Note: this is a major code refactor, almost every line of code has been rewritten
* Please check your POS admin after upgrade as many settings have changed

0 comments on commit 358d95f

Please sign in to comment.
You can’t perform that action at this time.