}
    if (!isset($row['seller-sku'])) {
        $product_sku = '<span style="color:darkred">Invalid Report - no SKU column found</span>';
    }
    ?>
        <tr>
            <th scope="row" class="check-column"><input type="checkbox" name="row[]" value="<?php 
    echo $row['seller-sku'];
    ?>
"></th>
            <!-- <td><?php 
    echo utf8_encode($row['item-name']);
    ?>
</td> -->
            <td><?php 
    echo WPLA_ListingsModel::convertToUTF8($row['item-name']);
    ?>
</td>
            <td><?php 
    echo $product_sku;
    ?>
</td>
            <td><?php 
    echo $listing_asin;
    ?>
</td>
            <td style="text-align:right;">
                <?php 
    if ($row['quantity']) {
        echo $row['quantity'];
    } elseif (isset($row['fulfillment-channel']) && $row['fulfillment-channel'] != 'DEFAULT') {
 public function updateProductFromItem($item, $report_row)
 {
     global $woocommerce;
     WPLA()->logger->info("==============================================================================");
     //WPLA()->logger->info( "updateProductFromItem() - ID: ".$data['asin'] );
     // some shortcuts
     $asin = $item->asin;
     $product_id = $item->post_id;
     $amazon_name = $item->listing_title;
     $amazon_price = $item->price;
     $amazon_quantity = $item->quantity;
     $report_quantity = $report_row['quantity'];
     $updated = false;
     // get WC product for reference
     $product = $this->getProduct($product_id);
     if (!$product) {
         return;
     }
     // echo "<pre>";print_r($product);echo"</pre>";#die();
     // get options
     $reports_update_woo_stock = get_option('wpla_reports_update_woo_stock', 1) == 1 ? true : false;
     $reports_update_woo_price = get_option('wpla_reports_update_woo_price', 1) == 1 ? true : false;
     $reports_update_woo_condition = get_option('wpla_reports_update_woo_condition', 1) == 1 ? true : false;
     //
     // update item-condition - if enabled
     //
     if ($reports_update_woo_condition) {
         $amazon_condition_type = WPLA_ImportHelper::convertNumericConditionIdToType($report_row['item-condition']);
         update_post_meta($product_id, '_amazon_condition_type', $amazon_condition_type);
         $amazon_condition_note = WPLA_ListingsModel::convertToUTF8($report_row['item-note']);
         update_post_meta($product_id, '_amazon_condition_note', $amazon_condition_note);
         WPLA()->logger->info("updated condition for product {$product_id}: {$amazon_condition_type} / " . $amazon_condition_note);
         // WPLA()->logger->info( "stored condition note: " . get_post_meta( $product_id, '_amazon_condition_note', true ) );
     }
     //
     // update price - if enabled
     //
     if ($reports_update_woo_price) {
         // if this item has a profile, we need to apply the price modifiers to the product price
         $product_price = $product->price;
         $profile = $item->profile_id ? new WPLA_AmazonProfile($item->profile_id) : false;
         if ($profile) {
             $product_price = $profile->processProfilePrice($product_price);
             $amazon_price = $profile->reverseProfilePrice($amazon_price);
         }
         // update price - unless custom amazon price is set
         if ($product_price != $amazon_price) {
             if (!get_post_meta($product_id, '_amazon_price', true)) {
                 update_post_meta($product_id, '_price', $amazon_price);
                 update_post_meta($product_id, '_regular_price', $amazon_price);
                 WPLA()->logger->info("updated price for product {$product_id} - new price: " . $amazon_price);
                 $updated = true;
             }
         }
     }
     // if update price
     //
     // update stock - if enabled and the report quantity column is not empty
     //
     if ($reports_update_woo_stock && $report_quantity !== '' && $report_quantity !== false) {
         if ($product->stock != $amazon_quantity) {
             update_post_meta($product_id, '_stock', $amazon_quantity);
             WPLA()->logger->info("updated stock for product {$product_id} - new stock: " . $amazon_quantity);
             $updated = true;
         }
         // update out of stock attribute
         if ($amazon_quantity > 0) {
             $stock_status = 'instock';
         } elseif ($item->product_type == 'variable') {
             $stock_status = 'instock';
         } else {
             $stock_status = 'outofstock';
         }
         update_post_meta($product_id, '_stock_status', $stock_status);
     }
     if ($updated) {
         // $woocommerce->clear_product_transients( $product_id );
         if (function_exists('wc_delete_product_transients')) {
             wc_delete_product_transients($product_id);
         }
         WPLA()->logger->info("updated product {$product_id} ({$asin}): {$amazon_name} ");
         $this->updated_count++;
     }
     return $product_id;
 }