ID, 'editproduct'); $variations_processor = new nzshpcrt_variations; $wpsc_product_defaults =array ( 'id' => '0', 'name' => '', 'description' => '', 'additional_description' => '', 'price' => '0.00', 'weight' => '0', 'weight_unit' => 'pound', 'pnp' => '0.00', 'international_pnp' => '0.00', 'file' => '0', 'image' => '', 'category' => '0', 'brand' => '0', 'quantity_limited' => '0', 'quantity' => '0', 'special' => '0', 'special_price' => '', 'display_frontpage' => '0', 'notax' => '0', 'publish' => '1', 'active' => '1', 'donation' => '0', 'no_shipping' => '0', 'thumbnail_image' => '', 'thumbnail_state' => '1', 'meta' => array ( 'external_link' => NULL, 'merchant_notes' => NULL, 'sku' => NULL, 'engrave' => '0', 'can_have_uploaded_image' => '0', 'table_rate_price' => array ( 'quantity' => array ( 0 => '', ), 'table_price' => array ( 0 => '', ), ), ), ); function wpsc_display_product_form ($product_id = 0) { global $wpdb, $wpsc_product_defaults; $product_id = absint($product_id); //$variations_processor = new nzshpcrt_variations; if($product_id > 0) { $product_data = $wpdb->get_row("SELECT * FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `id`='{$product_id}' LIMIT 1",ARRAY_A); $product_data['meta']['dimensions'] = get_product_meta($product_id, 'dimensions',true); $product_data['meta']['external_link'] = get_product_meta($product_id,'external_link',true); $product_data['meta']['merchant_notes'] = get_product_meta($product_id,'merchant_notes',true); $product_data['meta']['sku'] = get_product_meta($product_id,'sku',true); $product_data['meta']['engrave'] = get_product_meta($product_id,'engraved',true); $product_data['meta']['can_have_uploaded_image'] = get_product_meta($product_id,'can_have_uploaded_image',true); $product_data['meta']['table_rate_price'] = get_product_meta($product_id,'table_rate_price',true); $sql ="SELECT `meta_key`, `meta_value` FROM ".WPSC_TABLE_PRODUCTMETA." WHERE `meta_key` LIKE 'currency%' AND `product_id`=".$product_id; $product_data['newCurr']= $wpdb->get_results($sql, ARRAY_A); //echo "
".print_r($product_data,true).""; if(function_exists('wp_insert_term')) { $term_relationships = $wpdb->get_results("SELECT * FROM `{$wpdb->term_relationships}` WHERE object_id = '{$product_id}'", ARRAY_A); foreach ((array)$term_relationships as $term_relationship) { $tt_ids[] = $term_relationship['term_taxonomy_id']; } foreach ((array)$tt_ids as $tt_id) { $term_ids[] = $wpdb->get_var("SELECT `term_id` FROM `{$wpdb->term_taxonomy}` WHERE `term_taxonomy_id` = '{$tt_id}' AND `taxonomy` = 'product_tag' LIMIT 1"); } foreach ((array)$term_ids as $term_id ) { if ($term_id != NULL){ $tags[] = $wpdb->get_var("SELECT `name` FROM `{$wpdb->terms}` WHERE `term_id`='{$term_id}' LIMIT 1"); } } if ($tags != NULL){ $imtags = implode(',', $tags); } } //exit('got called
'.print_r($imtags,true).''); $check_variation_value_count = $wpdb->get_var("SELECT COUNT(*) as `count` FROM `".WPSC_TABLE_VARIATION_VALUES_ASSOC."` WHERE `product_id` = '{$product_id}'"); } else { if(isset($_SESSION['wpsc_failed_product_post_data']) && (count($_SESSION['wpsc_failed_product_post_data']) > 0 )) { $product_data = array_merge($wpsc_product_defaults, $_SESSION['wpsc_failed_product_post_data']); $_SESSION['wpsc_failed_product_post_data'] = null; } else { $product_data = $wpsc_product_defaults; } } $product_data = apply_filters('wpsc_display_product_form_get', $product_data); $current_user = wp_get_current_user(); // we put the closed postboxes array into the product data to propagate it to each form without having it global. $product_data['closed_postboxes'] = (array)get_usermeta( $current_user->ID, 'closedpostboxes_store_page_wpsc-edit-products'); $product_data['hidden_postboxes'] = (array)get_usermeta( $current_user->ID, 'metaboxhidden_store_page_wpsc-edit-products'); if(count($product_data) > 0) { wpsc_product_basic_details_form($product_data); } } function wpsc_product_basic_details_form(&$product_data) { global $wpdb,$nzshpcrt_imagesize_info; /*
:
' />
:
' /> ' id='add_special'>
|
||
+ | ||
|
: |
|
|
Price : ' /> |
|
|
||
: |
'.print_r($term_relationships,true).''); foreach ((array)$term_relationships as $term_relationship) { $tt_ids[] = $term_relationship['term_taxonomy_id']; } foreach ((array)$tt_ids as $tt_id) { $term_ids[] = $wpdb->get_var("SELECT `term_id` FROM `{$wpdb->term_taxonomy}` WHERE `term_taxonomy_id` = '{$tt_id}' AND `taxonomy` = 'product_tag' LIMIT 1"); } foreach ((array)$term_ids as $term_id ) { if ($term_id != NULL){ $tags[] = $wpdb->get_var("SELECT `name` FROM `{$wpdb->terms}` WHERE `term_id`='{$term_id}' LIMIT 1"); } } $imtags = ''; if ($tags != NULL){ $imtags = implode(',', $tags); } //exit('HERE
'.print_r($imtags,true).''); } } $output .= "
".__('Categories', 'wpsc')."
";
$search_sql = apply_filters('wpsc_product_category_and_tag_forms_group_search_sql', '');
$categorisation_groups = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CATEGORISATION_GROUPS."` WHERE `active` IN ('1')".$search_sql, ARRAY_A);
//exit('
'.print_r($categorisation_groups, true).''); foreach((array)$categorisation_groups as $categorisation_group){ $category_count = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `group_id` IN ('{$categorisation_group['id']}')"); if($category_count > 0) { $output .= " ";
$category_group_name = str_replace("[categorisation]", $categorisation_group['name'], __('Select "[categorisation]"', 'wpsc'));
$output .= "".$category_group_name.": |
".__('Product Tags', 'wpsc')." ".__('Separate tags with commas')." |
0) ? 'checked=\'checked\'' : ''); ?> />
;' id='table_rate'>
+ Add level
|
|||||||
0) ? 'checked=\'checked\'' : ''); ?> />
;' id='custom_tax'>
|
"; //onclick='hideelement(\"add_stock\")'
echo " ";
if ($product_data['id'] > 0){
$variations_output = $variations_processor->variations_grid_view($product_data['id']);
if(wpsc_product_has_variations($product_data['id'])) {
switch($product_data['quantity_limited']) {
case 1:
echo " \n\r";
break;
default:
echo " \n\r";
} else {
switch($product_data['quantity_limited']) {
case 1:
echo " \n\r";
break;
default:
echo " \n\r";
}
} else {
echo "
";
}
echo "
|
";
echo "
".__('Weight', 'wpsc')." | |
".__('Height', 'wpsc')." | |
".__('Width', 'wpsc')." | |
".__('Length', 'wpsc')." | |
".__('Flat Rate Settings', 'wpsc')." | |
".__('Local Shipping Fee', 'wpsc')." | |
".__('International Shipping Fee', 'wpsc')." | |
|
'.print_r($product_data, true).''); $merchant_note = $product_data['meta']['merchant_notes']; $engraved_text = $product_data['meta']['engrave']; $can_have_uploaded_image = $product_data['meta']['can_have_uploaded_image']; $external_link = $product_data['meta']['external_link']; $enable_comments = $product_data['meta']['enable_comments']; $output =''; $custom_fields = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_PRODUCTMETA."` WHERE `product_id` IN('{$product_data['id']}') AND `custom` IN('1') ",ARRAY_A); if ($product_data == 'empty') { $display = "style='display:none;'"; } $output .= "
".__('Custom Meta', 'wpsc').": + ".__('Add Custom Meta', 'wpsc')." "; foreach((array)$custom_fields as $custom_field) { $i = $custom_field['id']; $custom_meta_value = stripslashes($custom_field['meta_value']); $output .= " "; } $output .= " | |
". __('Merchant Notes', 'wpsc') .": ".__('These notes are only available here.', 'wpsc')." |
|
'.__("Publish").': |
|
". __('Personalisation Options', 'wpsc') .": |
|
|
|
|
|
".__('Off Site Product Link', 'wpsc').": ".__('If this product is for sale on another website enter the link here. For instance if your product is an MP3 file for sale on itunes you could put the link here. This option over rides the buy now and add to cart links and takes you to the site linked here.', 'wpsc')." : |
|
".__('Enable IntenseDebate Comments', 'wpsc').": ".__('Allow users to comment on this product.', 'wpsc')." |
".print_r($product_data,true).""; //As in WordPress, If Mac and mod_security, no Flash $flash = true; if ( (false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac')) && apache_mod_loaded('mod_security') ) { $flash = false; } $flash_action_url = admin_url('async-upload.php'); $flash = apply_filters('flash_uploader', $flash); ?>
Browser uploader instead.', 'wpsc'); ?>
install the premium upgrade'); ?>
Flash uploader instead.', 'wpsc'); ?>
>
".print_r($values,true).""; if($values != null) { foreach($values as $image) { if(function_exists("getimagesize")) { if($image['image'] != '') { $num++; $imagepath = WPSC_IMAGE_DIR . $image['image']; $image_data = @getimagesize(WPSC_IMAGE_DIR.$image['image']); ?>
".print_r($category_assoc,true).""; if(is_numeric($category_assoc['id']) && ($category_assoc['id'] > 0)) { $selected = "checked='checked'"; } } $output .= "