Add Brand and Cost columns to price comparison table

- Brand column (from _brand meta) before SKU
- Cost column (from _cost meta) before Your Price
- Helps evaluate suggested prices against actual product cost

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 08:02:05 +01:00
parent eaff86aad1
commit 0683f794dc
2 changed files with 14 additions and 1 deletions

View File

@@ -300,7 +300,7 @@
// Render table rows
var html = '';
if (pageProducts.length === 0) {
html = '<tr><td colspan="10">No products found.</td></tr>';
html = '<tr><td colspan="12">No products found.</td></tr>';
} else {
pageProducts.forEach(function(product) {
var localPrice = product.local_price ? data.currency + parseFloat(product.local_price).toFixed(2) : '-';
@@ -346,10 +346,14 @@
? '<button type="button" class="button button-small informatiq-sp-update-single" data-product-id="' + product.id + '" data-new-price="' + product.suggested_price + '">Update</button>'
: (product.has_insight ? '<span style="color:#888;">No suggestion</span>' : '-');
var costPrice = product.cost !== null ? data.currency + parseFloat(product.cost).toFixed(2) : '-';
html += '<tr>';
html += '<td>' + checkbox + '</td>';
html += '<td>' + (product.brand || '-') + '</td>';
html += '<td><code style="font-size: 11px;">' + product.sku + '</code></td>';
html += '<td><a href="post.php?post=' + product.id + '&action=edit">' + self.truncate(product.name, 35) + '</a></td>';
html += '<td>' + costPrice + '</td>';
html += '<td>' + localPrice + priceLabel + '</td>';
html += '<td>' + suggestedPrice + '</td>';
html += '<td style="' + percentDiffStyle + '">' + percentDiffHtml + '</td>';