From b504981b899000dc68ce4cc72dab9fb922ba9578 Mon Sep 17 00:00:00 2001 From: Myron Blair Date: Sun, 14 Jun 2026 23:01:53 +0000 Subject: [PATCH] Add Google Merchant Center product feed and GSC meta tag placeholder - merchant-feed.php: RSS 2.0 feed with all active products; includes title, description, image_link, price, availability, brand, shipping, google_product_category for each item; URL to submit in Merchant Center - header.php: placeholder GSC meta tag (replace PASTE_GSC_CODE_HERE with verification content value from Search Console) Co-Authored-By: Claude Sonnet 4.6 --- includes/header.php | 2 ++ merchant-feed.php | 78 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 merchant-feed.php diff --git a/includes/header.php b/includes/header.php index c20f491..0a7e2b4 100644 --- a/includes/header.php +++ b/includes/header.php @@ -31,6 +31,8 @@ $customerUser = $isLoggedIn ? CustomerAuth::getUser() : null; "> "> + + diff --git a/merchant-feed.php b/merchant-feed.php new file mode 100644 index 0000000..7bd07ff --- /dev/null +++ b/merchant-feed.php @@ -0,0 +1,78 @@ +fetchAll( + "SELECT p.*, pt.name AS type_name + FROM products p + LEFT JOIN product_types pt ON p.product_type_id = pt.type_id + WHERE p.is_active = 1 + ORDER BY p.name, p.category" +); + +echo '' . "\n"; +echo '' . "\n"; +echo '' . "\n"; +echo ' Tom\'s Java Jive' . "\n"; +echo ' ' . $base . '' . "\n"; +echo ' Premium artisan flavored coffee beans, freshly roasted in Weatherford, TX.' . "\n"; + +foreach ($products as $p) { + $images = json_decode($p['images'] ?? '[]', true); + $imageUrl = !empty($images) ? $base . $images[0] : $base . '/assets/images/placeholder-product.svg'; + + $categoryLabel = $p['category'] === 'Bean' ? 'Whole Bean' : 'Ground'; + $title = htmlspecialchars($p['name'] . ' ' . $categoryLabel . ' Coffee'); + $desc = htmlspecialchars( + $p['name'] . ' flavored artisan coffee — ' . strtolower($categoryLabel) . '. ' . + 'All natural flavoring. Freshly roasted in Weatherford, TX and shipped to your door. ' . + '12 oz bag.' + ); + $link = htmlspecialchars($base . '/product.php?id=' . $p['product_id']); + $imageLink = htmlspecialchars($imageUrl); + $price = number_format((float)($p['sale_price'] ?? $p['price']), 2, '.', ''); + $salePrice = $p['sale_price'] ? number_format((float)$p['sale_price'], 2, '.', '') : null; + $avail = (int)$p['stock'] > 0 ? 'in stock' : 'out of stock'; + $id = htmlspecialchars($p['product_id']); + $updatedAt = substr($p['updated_at'] ?? date('Y-m-d'), 0, 10); + + // Google product category for flavored coffee + // https://www.google.com/basepages/producttype/taxonomy-with-ids.en-US.txt + // 2273 = Food, Beverages & Tobacco > Beverages > Coffee + $gCategory = 'Food, Beverages & Tobacco > Beverages > Coffee'; + + echo " \n"; + echo " {$id}\n"; + echo " {$title}\n"; + echo " {$desc}\n"; + echo " {$link}\n"; + echo " {$imageLink}\n"; + echo " new\n"; + echo " {$avail}\n"; + echo " {$price} USD\n"; + if ($salePrice) { + echo " {$salePrice} USD\n"; + } + echo " Tom's Java Jive\n"; + echo " {$gCategory}\n"; + echo " Coffee > Flavored Coffee > {$categoryLabel}\n"; + echo " false\n"; + echo " \n"; + echo " US\n"; + echo " Standard\n"; + echo " 5.99 USD\n"; + echo " \n"; + echo " \n"; +} + +echo '' . "\n"; +echo '';