Plugin Directory

Changeset 356911

Timestamp:
03/07/2011 08:56:45 PM (13 years ago)
Author:
jghazally
Message:

Fix product importer for issue 399 and issue 400

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-e-commerce/branches/3.8-development/wpsc-admin/includes/settings-pages/import.php

    r354003 r356911  
    112112        $value_data = $_POST['value_name'];
    113113       
    114         if ($_POST['post_status'] == 'publish')
    115             $status = '1';
    116                
     114        $status = esc_attr($_POST['post_status']);
     115       
    117116        $name = array( );
    118117        foreach ( $value_data as $key => $value ) {
     
    140139                'display_frontpage' => null,
    141140                'notax' => null,
    142                 'publish' => esc_attr( $status ),
    143141                'active' => null,
    144142                'donation' => null,
     
    146144                'thumbnail_image' => null,
    147145                'thumbnail_state' => null,
    148                 'category' => array(
    149                     esc_html__( $_POST['category'] )
    150                
    151                 ),
    152146                'meta' => array(
    153147                    '_wpsc_price' => esc_attr( str_replace( '$', '', $cvs_data2['price'][$i] ) ),
     
    162156            );
    163157            $product_columns = wpsc_sanitise_product_forms( $product_columns );
    164             wpsc_insert_product( $product_columns );
     158            // status needs to be set here because wpsc_sanitise_product_forms overwrites it :/
     159            $product_columns['post_status'] = $status;
     160            $product_id = wpsc_insert_product( $product_columns );
     161            wp_set_object_terms( $product_id , array( (int)$_POST['category'] ) , 'wpsc_product_category' );
    165162        }
    166163        echo "<br /><br />". sprintf(__("Success, your <a href='%s'>products</a> have been upload.", "wpsc"), admin_url('edit.php?post_type=wpsc-product'));
Note: See TracChangeset for help on using the changeset viewer.