コード例 #1
0
function price_format($price_value, $clear = 0, $format = 1, $raw = 0)
{
    $set = get_currency_settings();
    $th_symbol = addslashes($set['th_sep']);
    $dec_symbol = addslashes($set['dec_sep']);
    /*  if ( $set[ 'dec_sep' ] != '.' ) {
    	  $raw_price_value = str_replace( array( $th_symbol, $dec_symbol ), array( "", '.' ), $price_value );
    	  } else {
    	  $raw_price_value = str_replace( $th_symbol, "", $price_value );
    	  } */
    $raw_price_value = $price_value;
    $price_value = number_format($raw_price_value, 2, $set['dec_sep'], $set['th_sep']);
    $space = ' ';
    if ($set['price_space'] == 'off') {
        $space = '';
    }
    $formatted = $price_value . $space . product_currency();
    if ($set['price_format'] == 'before') {
        $formatted = product_currency() . $space . $price_value;
    }
    if ($clear == 0) {
        return apply_filters('price_format', $formatted, $price_value);
    } else {
        if ($format == 1) {
            return $formatted;
        } else {
            if ($raw == 1) {
                return $raw_price_value;
            } else {
                return $price_value;
            }
        }
    }
}
コード例 #2
0
function price_format($price_value, $clear = 0, $format = 1, $raw = 0)
{
    $set = get_option('product_currency_settings', unserialize(DEF_CURRENCY_SETTINGS));
    $set['th_sep'] = isset($set['th_sep']) ? $set['th_sep'] : ',';
    $set['dec_sep'] = isset($set['dec_sep']) ? $set['dec_sep'] : '.';
    $th_symbol = addslashes($set['th_sep']);
    $raw_price_value = str_replace($th_symbol, "", $price_value);
    $price_value = number_format($raw_price_value, 2, $set['dec_sep'], $set['th_sep']);
    $space = ' ';
    if ($set['price_space'] == 'off') {
        $space = '';
    }
    $formatted = $price_value . $space . product_currency();
    if ($set['price_format'] == 'before') {
        $formatted = product_currency() . $space . $price_value;
    }
    if ($clear == 0) {
        return apply_filters('price_format', $formatted, $price_value);
    } else {
        if ($format == 1) {
            return $formatted;
        } else {
            if ($raw == 1) {
                return $raw_price_value;
            } else {
                return $price_value;
            }
        }
    }
}
コード例 #3
0
ファイル: shipping.php プロジェクト: RA2WP/RA2WP
function shipping_settings_content()
{
    $submenu = $_GET['submenu'];
    ?>
	<div class="shipping-product-settings settings-wrapper" style="clear:both;">
		<div class="settings-submenu">
			<h3>
				<a id="shipping-settings" class="element current" href="<?php 
    echo admin_url('edit.php?post_type=al_product&page=product-settings.php&tab=shipping-settings&submenu=shipping');
    ?>
"><?php 
    _e('Shipping Settings', 'ecommerce-product-catalog');
    ?>
</a>
				<?php 
    do_action('shipping_submenu');
    ?>
			</h3>
		</div><?php 
    if ($submenu == 'shipping') {
        ?>
			<div class="setting-content submenu">
				<script>
					jQuery( '.settings-submenu a' ).removeClass( 'current' );
					jQuery( '.settings-submenu a#shipping-settings' ).addClass( 'current' );
				</script>
				<h2><?php 
        _e('Shipping Settings', 'ecommerce-product-catalog');
        ?>
</h2>
				<form method="post" action="options.php">
					<?php 
        settings_fields('product_shipping');
        $shipping_count = get_shipping_options_number();
        ?>
					<h3><?php 
        _e('Product shipping options', 'ecommerce-product-catalog');
        ?>
</h3>
					<table>
						<tr>
							<td colspan="2"><?php 
        _e('Number of shipping options', 'ecommerce-product-catalog');
        ?>
 <input size="30" type="number" step="1" min="0" name="product_shipping_options_number" id="admin-number-field" value="<?php 
        echo $shipping_count;
        ?>
" /><input type="submit" class="button" value="<?php 
        _e('Update', 'ecommerce-product-catalog');
        ?>
" /></td>
						</tr>
					</table>
					<?php 
        if ($shipping_count > 0) {
            ?>
						<div class="al-box info"><p><?php 
            _e("If you fill out the fields below, system will automatically pre-fill the fields on product pages so you doesn't have to fill them every time you add product.</p><p>When every product in your catalogue has different shipping options you can leave all or just a part of these fields empty.", 'ecommerce-product-catalog');
            ?>
</p><p><?php 
            _e('You can change these default values on every product page.', 'ecommerce-product-catalog');
            ?>
</p></div>

						<table class="wp-list-table widefat product-settings-table dragable">
							<thead><tr><th></th><th class="title"><b><?php 
            _e('Shipping default name', 'ecommerce-product-catalog');
            ?>
</b></th><th></th><th class="title"><b><?php 
            _e('Shipping default cost', 'ecommerce-product-catalog');
            ?>
</b></th><th class="dragger"></th></tr></thead><tbody>
								<?php 
            $shipping_cost = get_option('product_shipping_cost', DEF_VALUE);
            $shipping_label = get_option('product_shipping_label');
            for ($i = 1; $i <= $shipping_count; $i++) {
                $shipping_label[$i] = isset($shipping_label[$i]) ? $shipping_label[$i] : '';
                $shipping_cost[$i] = isset($shipping_cost[$i]) ? $shipping_cost[$i] : '';
                // Echo out the field
                echo '<tr><td class="lp-column">' . $i . '.</td><td class="product-shipping-label-column"><input class="product-shipping-label" type="text" name="product_shipping_label[' . $i . ']" value="' . esc_html($shipping_label[$i]) . '" /></td><td class="lp-column">:</td><td><input id="admin-number-field" class="product-shipping-cost" type="number" min="0" name="product_shipping_cost[' . $i . ']" value="' . floatval($shipping_cost[$i]) . '" /> ' . product_currency() . '</td><td class="dragger"></td></tr>';
            }
            ?>
							</tbody></table>
			<?php 
            //do_action('product-attributes');
            ?>
						<p class="submit">
							<input type="submit" class="button-primary" value="<?php 
            _e('Save changes', 'ecommerce-product-catalog');
            ?>
" />
						</p>
		<?php 
        } else {
            ?>
						<tr><td colspan="2">
								<div class="al-box warning"><?php 
            _e('Shipping disabled. To enable set minimum 1 shipping option.', 'ecommerce-product-catalog');
            ?>
</div>
							</td></tr>
						</table>
		<?php 
        }
        ?>

				</form>
			</div>
			<div class="helpers"><div class="wrapper"><?php 
        main_helper();
        ?>
				</div></div>

	<?php 
    }
    do_action('product-shipping');
    ?>
	</div><?php 
}
コード例 #4
0
ファイル: filter-widgets.php プロジェクト: RA2WP/RA2WP
    function widget($args, $instance)
    {
        if (get_integration_type() != 'simple') {
            $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
            echo $args['before_widget'];
            if ($title) {
                echo $args['before_title'] . $title . $args['after_title'];
            }
            // Use current theme search form if it exists
            $min_price = isset($_GET['min-price']) ? floatval($_GET['min-price']) : '';
            $max_price = isset($_GET['max-price']) ? floatval($_GET['max-price']) : '';
            $currency = product_currency();
            ?>
			<div class="price-filter">
				<span class="filter-label"><?php 
            _e('Price', 'ecommerce-product-catalog');
            ?>
:</span>
				<form class="price-filter-form">
					<?php 
            foreach ($_GET as $key => $value) {
                if ($key != 'min-price' && $key != 'max-price') {
                    echo '<input type="hidden" name="' . esc_attr($key) . '" value="' . esc_attr($value) . '" />';
                }
            }
            ?>
					<input class="number-box" placeholder="<?php 
            echo $currency;
            ?>
" type="number" min="0" step="0.01" name="min-price" value="<?php 
            echo $min_price;
            ?>
"> - <input placeholder="<?php 
            echo $currency;
            ?>
" min="0" step="0.01" type="number" class="number-box" name="max-price" value="<?php 
            echo $max_price;
            ?>
">
					<input class="price-filter-submit" type="submit" value="OK">
				</form>
			</div>
			<?php 
            echo $args['after_widget'];
        }
    }
コード例 #5
0
function al_product_shipping()
{
    global $post;
    echo '<input type="hidden" name="shippingmeta_noncename" id="shippingmeta_noncename" value="' . wp_create_nonce(plugin_basename(__FILE__)) . '" />';
    $currency = product_currency();
    echo '<table class="sort-settings shipping"><tbody>';
    for ($i = 1; $i <= get_option('product_shipping_options_number', DEF_SHIPPING_OPTIONS_NUMBER); $i++) {
        $shipping_option = get_option('product_shipping_cost');
        $shipping_label_option = get_option('product_shipping_label');
        $shipping_option_field = get_post_meta($post->ID, '_shipping' . $i, true);
        $shipping_label_field = get_post_meta($post->ID, '_shipping-label' . $i, true);
        if ($shipping_option_field != null) {
            $shipping = $shipping_option_field;
        } else {
            $shipping = isset($shipping_option[$i]) ? $shipping_option[$i] : '';
        }
        if (!empty($shipping_label_field)) {
            $shipping_label = $shipping_label_field;
        } else {
            $shipping_label = isset($shipping_label_option[$i]) ? $shipping_label_option[$i] : '';
        }
        echo '<tr><td class="dragger"></td><td class="shipping-label-column"><input class="shipping-label" type="text" name="_shipping-label' . $i . '" value="' . $shipping_label . '" /></td><td><input class="shipping-value" type="number" min="0" name="_shipping' . $i . '" value="' . $shipping . '" />' . $currency . '</td></tr>';
    }
    echo '</tbody></table>';
}
コード例 #6
0
/**
 * Adds quick edit support for product fields
 *
 * @staticvar boolean $product_quick_edit_nonce
 * @param str $column_name
 */
function display_custom_quickedit_product($column_name)
{
    static $product_quick_edit_nonce = TRUE;
    if ($product_quick_edit_nonce) {
        $product_quick_edit_nonce = FALSE;
        wp_nonce_field(plugin_basename(__FILE__), 'al_product_quick_edit_nonce');
    }
    ?>
	<fieldset class="inline-edit-col-right inline-edit-product">
		<div class="inline-edit-col column-<?php 
    echo $column_name;
    ?>
">
			<label class="inline-edit-group">
				<?php 
    if ($column_name == 'price') {
        ?>
<span class="title"><?php 
        _e('Price', 'ecommerce-product-catalog');
        ?>
</span><input type="number" min="0" step="0.01" name="_price" value="" class="widefat" /><?php 
        echo product_currency();
    } else {
        do_action('product_quickedit', $column_name);
    }
    ?>
			</label>
		</div>
	</fieldset>
	<?php 
}