fix(2meet-data-optimizer-hivepress-addon): map marketplace hot field to hp_price

- hivepress-marketplace stores its filterable, sortable listing price as
  hp_price; hp_purchase_price never existed (dev34: 588 hp_price rows)
- Drop hp_purchase_count: the addon keeps no per-listing sales counter
- Remove the stale docblock note about the legacy core registration path

Verify: vendor/bin/phpunit --filter test_on_register_fields_registers_hot_hp_price;
  addon unit 156 OK, integration 57 OK
PR: PR-011
This commit is contained in:
2026-09-25 22:39:57 +08:00
parent d3ddbb8933
commit f089b0934b
2 changed files with 13 additions and 21 deletions
@@ -3,16 +3,12 @@
* Marketplace adapter — `hivepress-marketplace` (DETECT-ONLY in v3.0.0). * Marketplace adapter — `hivepress-marketplace` (DETECT-ONLY in v3.0.0).
* *
* The marketplace addon turns listings into purchasable items, integrating * 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) * Its other listing attributes (price tiers / extras / discounts, quantity,
* hp_purchase_count → counter (WARM zone, low-criticality) * subscription period, …) are not search filters, and it keeps no per-listing
* * sales counter.
* 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.
* *
* Detect-only: not installed in dev environment. Schema reserved for the * Detect-only: not installed in dev environment. Schema reserved for the
* day the addon ships. * day the addon ships.
@@ -72,18 +68,12 @@ if ( ! class_exists( 'TMDO_HivePress_Marketplace_Adapter' ) ) {
array( array(
array( array(
'post_type' => 'hp_listing', 'post_type' => 'hp_listing',
'meta_key' => 'hp_purchase_price', 'meta_key' => 'hp_price',
'zone' => 'hot', 'zone' => 'hot',
'data_type' => 'decimal(10,2) DEFAULT NULL', 'data_type' => 'decimal(10,2) DEFAULT NULL',
'column' => 'hp_purchase_price', 'column' => 'hp_price',
'indexed' => true, 'indexed' => true,
), ),
array(
'post_type' => 'hp_listing',
'meta_key' => 'hp_purchase_count',
'zone' => 'warm',
'ttl' => null,
),
) )
); );
} }
+6 -4
View File
@@ -33,17 +33,19 @@ class HivePressMarketplaceAdapterTest extends TestCase {
$this->assertSame( 'HivePress\\Marketplace\\Plugin', $this->adapter->detection_class() ); $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(); $registry = WPDO_Schema_Registry::instance();
$this->adapter->on_register_fields( $registry ); $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->assertSame( 'hot', $price['zone'] );
$this->assertTrue( (bool) $price['indexed'] ); $this->assertTrue( (bool) $price['indexed'] );
$this->assertStringContainsString( 'decimal', $price['data_type'] ); $this->assertStringContainsString( 'decimal', $price['data_type'] );
$count = $registry->get_field( 'hp_listing', 'hp_purchase_count' ); // Neither key exists in hivepress-marketplace.
$this->assertSame( 'warm', $count['zone'] ); $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 { public function test_score_aggregates_to_nine_eight_eight(): void {