Ocultados campos especiales de los productos (stock, peso, proveedor, etc)

git-svn-id: https://192.168.0.254/svn/Proyectos.OriginalHouse_Web/trunk@57 54e8636e-a86c-764f-903d-b964358a1ae2
This commit is contained in:
David Arranz 2011-07-19 19:07:21 +00:00
parent 32dc63b856
commit 18e8376c8a
2 changed files with 56 additions and 45 deletions

View File

@ -53,7 +53,7 @@ class ProductCustomPostType {
'capability_type' => 'post',
'hierarchical' => false, //allways false
'query_var' => true,
'supports' => array( 'title', 'excerpt', 'editor', 'thumbnail'),
'supports' => array( 'title', /*'excerpt',*/ 'editor', 'thumbnail'),
'taxonomies' => array( ProductCustomPostType::$PRODUCT_CATEGORY ), // Permalinks format
'rewrite' => array( 'slug' => isset( $thecartpress->settings['product_rewrite'] ) ? $thecartpress->settings['product_rewrite'] : 'products' ),
'has_archive' => isset( $thecartpress->settings['product_rewrite'] ) && $thecartpress->settings['product_rewrite'] != '' ? $thecartpress->settings['product_rewrite'] : 'products',
@ -84,14 +84,14 @@ class ProductCustomPostType {
'rewrite' => array('slug' => isset( $thecartpress->settings['category_rewrite'] ) ? $thecartpress->settings['category_rewrite'] : 'product_category' ), //false
);
register_taxonomy( ProductCustomPostType::$PRODUCT_CATEGORY, ProductCustomPostType::$PRODUCT, $register );
register_taxonomy( ProductCustomPostType::$PRODUCT_TAG, ProductCustomPostType::$PRODUCT, array(
/*register_taxonomy( ProductCustomPostType::$PRODUCT_TAG, ProductCustomPostType::$PRODUCT, array(
'public' => true,
'hierarchical' => false,
'query_var' => true,
'rewrite' => array('slug' => isset( $thecartpress->settings['tag_rewrite'] ) ? $thecartpress->settings['tag_rewrite'] : 'product_tag' ), //false
'label' => __( 'Products Tags', 'tcp' ),
) );
register_taxonomy( ProductCustomPostType::$SUPPLIER_TAG, ProductCustomPostType::$PRODUCT, array(
) );*/
/*register_taxonomy( ProductCustomPostType::$SUPPLIER_TAG, ProductCustomPostType::$PRODUCT, array(
'hierarchical' => true,
'query_var' => true,
'rewrite' => array('slug' => isset( $thecartpress->settings['supplier_rewrite'] ) ? $thecartpress->settings['supplier_rewrite'] : 'product_supplier' ), //false
@ -105,7 +105,7 @@ class ProductCustomPostType {
'add_new_item' => __( 'Add New Suppliers', 'tcp' ),
'new_item_name' => __( 'New Suppliers Name', 'tcp' ),
),
) );
) );*/
if ( is_admin() ) {
add_action( 'manage_posts_custom_column', array( $this, 'managePostCustomColumns' ) );
@ -114,7 +114,7 @@ class ProductCustomPostType {
add_filter( 'request', array( $this, 'request' ) ); //TODO 3.1
add_filter( 'posts_orderby', array( $this, 'defaultPostOrder' ) );
//for quick edit
add_action('quick_edit_custom_box', array( $this, 'quickEditCustomBox' ), 10, 2 );
//add_action('quick_edit_custom_box', array( $this, 'quickEditCustomBox' ), 10, 2 );
}
}
@ -236,12 +236,14 @@ class ProductCustomPostType {
'show_count' => true,
'hide_empty' => true,
) );?>
<label for="tcp_product_type"><?php _e( 'type:', 'tcp' );?><label>
<?php if (0) { ?>
<label for="tcp_product_type"><?php _e( 'type:', 'tcp' );?><label>
<select name="tcp_product_type" id="tcp_product_type">
<option value="" <?php selected( "", isset( $_REQUEST['tcp_product_type'] ) ? $_REQUEST['tcp_product_type'] : '' );?>><?php _e( 'all', 'tcp' );?></option>
<option value="SIMPLE" <?php selected( "SIMPLE", isset( $_REQUEST['tcp_product_type'] ) ? $_REQUEST['tcp_product_type'] : '' );?>><?php _e( 'Simple', 'tcp' );?></option>
<option value="GROUPED" <?php selected( "GROUPED", isset( $_REQUEST['tcp_product_type'] ) ? $_REQUEST['tcp_product_type'] : '' );?>><?php _e( 'Grouped', 'tcp' );?></option>
</select>
<?php } ?>
<?php
}
}

View File

@ -47,49 +47,52 @@ class ProductCustomFieldsMetabox {
if ( $post_id > 0 )
$tcp_product_parent_id = RelEntities::getParent( $post_id );
}?>
<ul class="subsubsub">
<?php
$admin_path = 'admin.php?page=' . plugin_basename( dirname( dirname( __FILE__ ) ) ) . '/admin/';
$count = RelEntities::count( $post_id );
if ( $count > 0 ) $count = ' (' . $count . ')';
else $count = '';
$product_type = tcp_get_the_product_type( $post_id );
if ( $product_type != '' && $product_type != 'SIMPLE' ) :?>
<li><a href="<?php echo $admin_path;?>AssignedProductsList.php&post_id=<?php echo $post_id;?>&rel_type=GROUPED"><?php _e( 'assigned products', 'tcp' );?><?php echo $count;?></a></li>
<li>|</li>
<li><a href="post-new.php?post_type=<?php echo ProductCustomPostType::$PRODUCT;?>&tcp_product_parent_id=<?php echo $post_id;?>"><?php _e( 'create new assigned product', 'tcp' );?></a></li>
<?php endif;
$count = RelEntities::count( $post_id, 'PROD-PROD' );
if ( $count > 0 ) $count = ' (' . $count . ')';
else $count = '';?>
<?php if ( $product_type != '' && $product_type != 'SIMPLE' ) : ?>
<li>|</li>
<?php endif;?>
<li><a href="<?php echo $admin_path;?>AssignedProductsList.php&post_id=<?php echo $post_id;?>&rel_type=PROD-PROD"><?php _e( 'related products', 'tcp' );?> <?php echo $count;?></a></li>
<?php $count = RelEntities::count( $post_id, 'PROD-POST' );
if ( $count > 0 ) $count = ' (' . $count . ')';
else $count = '';?>
<li>|</li>
<li><a href="<?php echo $admin_path;?>AssignedProductsList.php&post_id=<?php echo $post_id;?>&post_type_to=post&rel_type=PROD-POST"><?php _e( 'related posts', 'tcp' );?> <?php echo $count;?></a></li>
<?php if ( $tcp_product_parent_id > 0 ) :?>
<li>|</li>
<li><a href="<?php echo $admin_path;?>AssignedProductsList.php&post_id=<?php echo $tcp_product_parent_id;?>&rel_type=GROUPED"><?php _e( 'parent assigned products', 'tcp' );?> <?php echo $count;?></a></li>
<li>|</li>
<li><a href="post.php?action=edit&post=<?php echo $tcp_product_parent_id;?>"><?php printf( __( 'edit parent product (%s)', 'tcp' ), get_the_title( $tcp_product_parent_id ) );?></a></li>
<?php endif;?>
<?php if ( tcp_is_downloadable( $post_id ) ) :?>
<li>|</li>
<li><a href="<?php echo $admin_path;?>UploadFiles.php&post_id=<?php echo $post_id;?>"><?php echo __( 'file upload', 'tcp' ), $count;?></a></li>
<?php endif;?>
<?php do_action( 'tcp_product_metabox_toolbar', $post_id );?>
</ul>
<?php if (0) { ?>
<ul class="subsubsub">
<?php
$admin_path = 'admin.php?page=' . plugin_basename( dirname( dirname( __FILE__ ) ) ) . '/admin/';
$count = RelEntities::count( $post_id );
if ( $count > 0 ) $count = ' (' . $count . ')';
else $count = '';
$product_type = tcp_get_the_product_type( $post_id );
if ( $product_type != '' && $product_type != 'SIMPLE' ) :?>
<li><a href="<?php echo $admin_path;?>AssignedProductsList.php&post_id=<?php echo $post_id;?>&rel_type=GROUPED"><?php _e( 'assigned products', 'tcp' );?><?php echo $count;?></a></li>
<li>|</li>
<li><a href="post-new.php?post_type=<?php echo ProductCustomPostType::$PRODUCT;?>&tcp_product_parent_id=<?php echo $post_id;?>"><?php _e( 'create new assigned product', 'tcp' );?></a></li>
<?php endif;
$count = RelEntities::count( $post_id, 'PROD-PROD' );
if ( $count > 0 ) $count = ' (' . $count . ')';
else $count = '';?>
<?php if ( $product_type != '' && $product_type != 'SIMPLE' ) : ?>
<li>|</li>
<?php endif;?>
<li><a href="<?php echo $admin_path;?>AssignedProductsList.php&post_id=<?php echo $post_id;?>&rel_type=PROD-PROD"><?php _e( 'related products', 'tcp' );?> <?php echo $count;?></a></li>
<?php $count = RelEntities::count( $post_id, 'PROD-POST' );
if ( $count > 0 ) $count = ' (' . $count . ')';
else $count = '';?>
<li>|</li>
<li><a href="<?php echo $admin_path;?>AssignedProductsList.php&post_id=<?php echo $post_id;?>&post_type_to=post&rel_type=PROD-POST"><?php _e( 'related posts', 'tcp' );?> <?php echo $count;?></a></li>
<?php if ( $tcp_product_parent_id > 0 ) :?>
<li>|</li>
<li><a href="<?php echo $admin_path;?>AssignedProductsList.php&post_id=<?php echo $tcp_product_parent_id;?>&rel_type=GROUPED"><?php _e( 'parent assigned products', 'tcp' );?> <?php echo $count;?></a></li>
<li>|</li>
<li><a href="post.php?action=edit&post=<?php echo $tcp_product_parent_id;?>"><?php printf( __( 'edit parent product (%s)', 'tcp' ), get_the_title( $tcp_product_parent_id ) );?></a></li>
<?php endif;?>
<?php if ( tcp_is_downloadable( $post_id ) ) :?>
<li>|</li>
<li><a href="<?php echo $admin_path;?>UploadFiles.php&post_id=<?php echo $post_id;?>"><?php echo __( 'file upload', 'tcp' ), $count;?></a></li>
<?php endif;?>
<?php do_action( 'tcp_product_metabox_toolbar', $post_id );?>
</ul>
<?php } ?>
<?php if ( $create_grouped_relation ): ?>
<input type="hidden" name="tcp_product_parent_id" value="<?php echo $tcp_product_parent_id;?>" />
<?php endif;?>
<div class="form-wrap">
<?php wp_nonce_field( 'tcp-product-custom-fields', 'tcp-product-custom-fields_wpnonce', false, true );?>
<table class="form-table"><tbody>
<tr valign="top">
<?php if (0) { ?>
<tr valign="top">
<th scope="row"><label for="tcp_type"><?php _e( 'Type', 'tcp' );?>:</label></th>
<td><select name="tcp_type" id="tcp_type">
<option value="SIMPLE" <?php selected( $product_type, 'SIMPLE' );?>><?php _e( 'Simple', 'tcp' );?></option>
@ -97,10 +100,12 @@ class ProductCustomFieldsMetabox {
</select>
</td>
</tr>
<?php } ?>
<tr valign="top">
<th scope="row"><label for="tcp_price"><?php _e( 'Price', 'tcp' );?>:</label></th>
<td><input name="tcp_price" id="tcp_price" value="<?php echo tcp_number_format( tcp_get_the_price( $post_id ) );?>" class="regular-text" type="text" style="width:12em" />&nbsp;<?php tcp_the_currency();?></td>
</tr>
<?php if (0) { ?>
<tr valign="top">
<th scope="row"><label for="tcp_tax_id"><?php _e( 'Tax', 'tcp' );?>:</label></th>
<td>
@ -122,7 +127,9 @@ class ProductCustomFieldsMetabox {
<th scope="row"><label for="tcp_back_end_label"><?php _e( 'Label', 'tcp' );?>:</label></th>
<td><input name="tcp_back_end_label" id="tcp_back_end_label" value="<?php echo tcp_get_the_meta( 'tcp_back_end_label', $post_id );?>" class="regular-text" type="text" style="width:25em" /></td>
</tr>
<?php } ?>
<?php do_action( 'tcp_product_metabox_custom_fields_after_price', $post_id );?>
<?php if (0) { ?>
<tr valign="top">
<th scope="row"><label for="tcp_is_visible"><?php _e( 'Is visible (in loops/catalogue)', 'tcp' );?>:</label></th>
<td><?php
@ -135,7 +142,8 @@ class ProductCustomFieldsMetabox {
}
?><input type="checkbox" name="tcp_is_visible" id="tcp_is_visible" value="yes" <?php checked( $is_visible, true );?> /></td>
</tr>
<?php } ?>
<?php if (0) { ?>
<tr valign="top">
<th scope="row"><label for="tcp_hide_buy_button"><?php _e( 'Hide buy button', 'tcp' );?>:</label></th>
<?php $tcp_hide_buy_button = get_post_meta( $post_id, 'tcp_hide_buy_button', true );?>
@ -198,6 +206,7 @@ class ProductCustomFieldsMetabox {
<span class="description"><?php _e( 'Days to expire from the buying day. You can use -1 value.', 'tcp' );?></span>
</td>
</tr>
<?php } ?>
<?php do_action( 'tcp_product_metabox_custom_fields', $post_id );?>
</tbody></table>
</div> <!-- form-wrap -->