Added product dimension fields
This commit is contained in:
parent
d84ffb141d
commit
992fe1849b
|
@ -274,6 +274,14 @@ $woocommerce_settings['catalog'] = apply_filters('woocommerce_catalog_settings',
|
|||
'id' => 'woocommerce_enable_weight',
|
||||
'std' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => ''
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __( 'Enable the dimension fields for products', 'woothemes' ),
|
||||
'id' => 'woocommerce_enable_dimensions',
|
||||
'std' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'end'
|
||||
),
|
||||
|
||||
|
@ -290,6 +298,19 @@ $woocommerce_settings['catalog'] = apply_filters('woocommerce_catalog_settings',
|
|||
)
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => __( 'Dimensions Unit', 'woothemes' ),
|
||||
'desc' => __( 'This controls what unit you will define lengths in.', 'woothemes' ),
|
||||
'id' => 'woocommerce_dimension_unit',
|
||||
'css' => 'min-width:175px;',
|
||||
'std' => 'GBP',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'cm' => __( 'cm', 'woothemes' ),
|
||||
'in' => __( 'in', 'woothemes' )
|
||||
)
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => __( 'Cart redirect', 'woothemes' ),
|
||||
'desc' => __( 'Redirect to cart after adding a product to the cart (on single product pages)', 'woothemes' ),
|
||||
|
|
|
@ -125,7 +125,21 @@ function woocommerce_product_data_box() {
|
|||
echo '<input type="hidden" name="weight" value="'.get_post_meta($thepostid, 'weight', true).'" />';
|
||||
endif;
|
||||
|
||||
do_action('woocommerce_product_options_weight');
|
||||
// Size fields
|
||||
if( get_option('woocommerce_enable_dimensions', true) !== 'no' ) :
|
||||
?><p class="form-field dimensions_field">
|
||||
<label for"product_length"><?php echo __('Dimensions', 'woothemes') . ' ('.get_option('woocommerce_dimension_unit').')'; ?></label>
|
||||
<input id="product_length" placeholder="<?php _e('Length', 'woothemes'); ?>" class="input-text sized" size="6" type="text" name="length" value="<?php echo get_post_meta( $thepostid, 'length', true ); ?>" />
|
||||
<input placeholder="<?php _e('Width', 'woothemes'); ?>" class="input-text sized" size="6" type="text" name="width" value="<?php echo get_post_meta( $thepostid, 'width', true ); ?>" />
|
||||
<input placeholder="<?php _e('Height', 'woothemes'); ?>" class="input-text sized" size="6" type="text" name="height" value="<?php echo get_post_meta( $thepostid, 'height', true ); ?>" />
|
||||
</p><?php
|
||||
else:
|
||||
echo '<input type="hidden" name="length" value="'.get_post_meta($thepostid, 'length', true).'" />';
|
||||
echo '<input type="hidden" name="width" value="'.get_post_meta($thepostid, 'width', true).'" />';
|
||||
echo '<input type="hidden" name="height" value="'.get_post_meta($thepostid, 'height', true).'" />';
|
||||
endif;
|
||||
|
||||
do_action('woocommerce_product_options_dimensions');
|
||||
|
||||
echo '</div>';
|
||||
|
||||
|
@ -369,6 +383,9 @@ function woocommerce_process_product_meta( $post_id, $post ) {
|
|||
update_post_meta( $post_id, 'regular_price', stripslashes( $_POST['regular_price'] ) );
|
||||
update_post_meta( $post_id, 'sale_price', stripslashes( $_POST['sale_price'] ) );
|
||||
update_post_meta( $post_id, 'weight', stripslashes( $_POST['weight'] ) );
|
||||
update_post_meta( $post_id, 'length', stripslashes( $_POST['length'] ) );
|
||||
update_post_meta( $post_id, 'width', stripslashes( $_POST['width'] ) );
|
||||
update_post_meta( $post_id, 'height', stripslashes( $_POST['height'] ) );
|
||||
update_post_meta( $post_id, 'tax_status', stripslashes( $_POST['tax_status'] ) );
|
||||
update_post_meta( $post_id, 'tax_class', stripslashes( $_POST['tax_class'] ) );
|
||||
update_post_meta( $post_id, 'stock_status', stripslashes( $_POST['stock_status'] ) );
|
||||
|
|
|
@ -125,6 +125,7 @@ div.taxrows .taxrow label.checkbox{line-height:1.5em;margin:0 8px;}div.taxrows .
|
|||
.woocommerce_options_panel .checkbox,table.woocommerce_variable_attributes .checkbox{vertical-align:middle;margin:7px 0;width:auto;}
|
||||
.woocommerce_options_panel select{float:left;}
|
||||
.woocommerce_options_panel .short{width:20%;}
|
||||
.woocommerce_options_panel .sized{width:auto !important;margin-right:6px;}
|
||||
.woocommerce_options_panel .options_group{border-top:1px solid white;border-bottom:1px solid #DFDFDF;}
|
||||
#woocommerce_attributes{padding:12px;}
|
||||
.woocommerce_attributes_wrapper,.woocommerce_variable_attributes_wrapper{margin-bottom:7px;border:1px solid #ececec;}
|
||||
|
|
|
@ -687,6 +687,10 @@ div.taxrows {
|
|||
.woocommerce_options_panel .short {
|
||||
width: 20%;
|
||||
}
|
||||
.woocommerce_options_panel .sized {
|
||||
width: auto !important;
|
||||
margin-right: 6px;
|
||||
}
|
||||
.woocommerce_options_panel .options_group {
|
||||
border-top: 1px solid white;
|
||||
border-bottom: 1px solid #DFDFDF;
|
||||
|
|
|
@ -26,6 +26,9 @@ class woocommerce_product {
|
|||
var $sale_price;
|
||||
var $regular_price;
|
||||
var $weight;
|
||||
var $length;
|
||||
var $width;
|
||||
var $height;
|
||||
var $tax_status;
|
||||
var $tax_class;
|
||||
var $upsell_ids;
|
||||
|
@ -60,6 +63,9 @@ class woocommerce_product {
|
|||
'sale_price' => '',
|
||||
'regular_price' => '',
|
||||
'weight' => '',
|
||||
'length' => '',
|
||||
'width' => '',
|
||||
'height' => '',
|
||||
'tax_status' => 'taxable',
|
||||
'tax_class' => '',
|
||||
'upsell_ids' => array(),
|
||||
|
|
Loading…
Reference in New Issue