feat: Affiliate program enrichment (Link Builder, Curated Collections, Smart Links)

This commit is contained in:
Dwindi Ramadhana
2026-06-03 14:04:17 +07:00
parent fd8eb38512
commit f8c733832e
22 changed files with 1348 additions and 10 deletions

View File

@@ -17,6 +17,7 @@ class AffiliateManager
private static $affiliates_table = 'woonoow_affiliates';
private static $referrals_table = 'woonoow_referrals';
private static $payouts_table = 'woonoow_affiliate_payouts';
private static $collections_table = 'woonoow_affiliate_collections';
/**
* Initialize
@@ -37,6 +38,7 @@ class AffiliateManager
$affiliates_table = $wpdb->prefix . self::$affiliates_table;
$referrals_table = $wpdb->prefix . self::$referrals_table;
$payouts_table = $wpdb->prefix . self::$payouts_table;
$collections_table = $wpdb->prefix . self::$collections_table;
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
@@ -135,6 +137,23 @@ class AffiliateManager
}
}
// Collections Table
$sql_collections = "CREATE TABLE $collections_table (
id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
affiliate_id bigint(20) UNSIGNED NOT NULL,
title varchar(255) NOT NULL,
slug varchar(255) NOT NULL,
description text DEFAULT NULL,
product_ids longtext DEFAULT NULL,
created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id),
UNIQUE KEY affiliate_slug (affiliate_id, slug),
KEY affiliate_id (affiliate_id)
) $charset_collate;";
dbDelta($sql_collections);
// Payouts Table
$sql_payouts = "CREATE TABLE $payouts_table (
id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,