diff --git a/admin/class-informatiq-sp-admin.php b/admin/class-informatiq-sp-admin.php index 2640bcf5..9636a6d9 100644 --- a/admin/class-informatiq-sp-admin.php +++ b/admin/class-informatiq-sp-admin.php @@ -620,8 +620,10 @@ class Informatiq_SP_Admin { + + @@ -882,6 +884,11 @@ class Informatiq_SP_Admin { $product_id = $product->get_id(); + // Get brand and cost from meta. + $brand = $product->get_meta( '_brand', true ); + $cost = $product->get_meta( '_cost', true ); + $cost = $cost !== '' ? round( (float) $cost, 4 ) : null; + // Get local price (tax-inclusive for comparison with Google). $sale_price = $product->get_sale_price(); $regular_price = $product->get_regular_price(); @@ -913,8 +920,10 @@ class Informatiq_SP_Admin { $comparison[] = array( 'id' => $product_id, + 'brand' => $brand ?: '', 'name' => $product->get_name(), 'sku' => $sku, + 'cost' => $cost, 'local_price' => $local_price_incl_tax ? round( $local_price_incl_tax, 2 ) : null, 'price_type' => $price_type, 'google_price' => $insight['google_price'] ?? null, diff --git a/assets/js/admin.js b/assets/js/admin.js index 64b7ce59..c39bc79f 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -300,7 +300,7 @@ // Render table rows var html = ''; if (pageProducts.length === 0) { - html = 'No products found.'; + html = 'No products found.'; } else { pageProducts.forEach(function(product) { var localPrice = product.local_price ? data.currency + parseFloat(product.local_price).toFixed(2) : '-'; @@ -346,10 +346,14 @@ ? '' : (product.has_insight ? 'No suggestion' : '-'); + var costPrice = product.cost !== null ? data.currency + parseFloat(product.cost).toFixed(2) : '-'; + html += ''; html += '' + checkbox + ''; + html += '' + (product.brand || '-') + ''; html += '' + product.sku + ''; html += '' + self.truncate(product.name, 35) + ''; + html += '' + costPrice + ''; html += '' + localPrice + priceLabel + ''; html += '' + suggestedPrice + ''; html += '' + percentDiffHtml + '';