diff --git a/includes/hivepress/adapters/class-tmdo-hivepress-marketplace-adapter.php b/includes/hivepress/adapters/class-tmdo-hivepress-marketplace-adapter.php index 776219f..f5042b2 100644 --- a/includes/hivepress/adapters/class-tmdo-hivepress-marketplace-adapter.php +++ b/includes/hivepress/adapters/class-tmdo-hivepress-marketplace-adapter.php @@ -3,16 +3,12 @@ * Marketplace adapter — `hivepress-marketplace` (DETECT-ONLY in v3.0.0). * * The marketplace addon turns listings into purchasable items, integrating - * with WooCommerce. It adds: + * with WooCommerce. Its filterable, sortable listing attribute `price` is + * stored as `hp_price` → decimal(10,2), used in price-range filters (HOT). * - * hp_purchase_price → decimal(10,2), used in price-range filters (HOT) - * hp_purchase_count → counter (WARM zone, low-criticality) - * - * Note: `hp_purchase_price` is also conditionally registered by the existing - * legacy hivepress integration (Sprint 1 left that path) — the dedup in - * Schema_Registry is provider+key based, so registering again under the - * `hivepress-marketplace` provider is safe and lets `wp wpdo doctor` show - * the right ownership. + * Its other listing attributes (price tiers / extras / discounts, quantity, + * subscription period, …) are not search filters, and it keeps no per-listing + * sales counter. * * Detect-only: not installed in dev environment. Schema reserved for the * day the addon ships. @@ -72,18 +68,12 @@ if ( ! class_exists( 'TMDO_HivePress_Marketplace_Adapter' ) ) { array( array( 'post_type' => 'hp_listing', - 'meta_key' => 'hp_purchase_price', + 'meta_key' => 'hp_price', 'zone' => 'hot', 'data_type' => 'decimal(10,2) DEFAULT NULL', - 'column' => 'hp_purchase_price', + 'column' => 'hp_price', 'indexed' => true, ), - array( - 'post_type' => 'hp_listing', - 'meta_key' => 'hp_purchase_count', - 'zone' => 'warm', - 'ttl' => null, - ), ) ); } diff --git a/tests/unit/MarketplaceAdapterTest.php b/tests/unit/MarketplaceAdapterTest.php index e1d592c..55e93de 100644 --- a/tests/unit/MarketplaceAdapterTest.php +++ b/tests/unit/MarketplaceAdapterTest.php @@ -33,17 +33,19 @@ class HivePressMarketplaceAdapterTest extends TestCase { $this->assertSame( 'HivePress\\Marketplace\\Plugin', $this->adapter->detection_class() ); } - public function test_on_register_fields_registers_hot_price_and_warm_counter(): void { + public function test_on_register_fields_registers_hot_hp_price(): void { $registry = WPDO_Schema_Registry::instance(); $this->adapter->on_register_fields( $registry ); - $price = $registry->get_field( 'hp_listing', 'hp_purchase_price' ); + // Marketplace's filterable, sortable listing "price" attribute is stored as hp_price. + $price = $registry->get_field( 'hp_listing', 'hp_price' ); $this->assertSame( 'hot', $price['zone'] ); $this->assertTrue( (bool) $price['indexed'] ); $this->assertStringContainsString( 'decimal', $price['data_type'] ); - $count = $registry->get_field( 'hp_listing', 'hp_purchase_count' ); - $this->assertSame( 'warm', $count['zone'] ); + // Neither key exists in hivepress-marketplace. + $this->assertNull( $registry->get_field( 'hp_listing', 'hp_purchase_price' ) ); + $this->assertNull( $registry->get_field( 'hp_listing', 'hp_purchase_count' ) ); } public function test_score_aggregates_to_nine_eight_eight(): void {