| 1 |
<?php namespace TierPricingTable\Settings\Sections\ProductAddons; |
| 2 |
|
| 3 |
use TierPricingTable\Settings\Sections\PluginPairingSectionAbstract; |
| 4 |
|
| 5 |
/** |
| 6 |
* "Product Addons" pairing section — see PluginPairingSectionAbstract for the shared behaviour. |
| 7 |
*/ |
| 8 |
class ProductAddonsSection extends PluginPairingSectionAbstract { |
| 9 |
|
| 10 |
public function getName(): string { |
| 11 |
return __( 'Product Addons', 'tier-pricing-table' ); |
| 12 |
} |
| 13 |
|
| 14 |
public function getSlug(): string { |
| 15 |
return 'product-addons'; |
| 16 |
} |
| 17 |
|
| 18 |
public function getSupportedPlugins(): array { |
| 19 |
return array( |
| 20 |
'product-add-ons' => array( |
| 21 |
'name' => 'Product Add-ons (by WooCommerce)', |
| 22 |
'active' => class_exists( '\\WC_Product_Addons' ) |
| 23 |
|| ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'woocommerce-product-addons/woocommerce-product-addons.php' ) ), |
| 24 |
), |
| 25 |
'wcpa' => array( |
| 26 |
'name' => 'WooCommerce Custom Product Addons (WCPA) by Acowebs', |
| 27 |
'active' => class_exists( '\\WCPA' ) || defined( 'WCPA_VERSION' ) || class_exists( '\\Acowebs\\WCPA\\WCPA' ), |
| 28 |
), |
| 29 |
'wombat_product_addons' => array( |
| 30 |
'name' => 'Advanced Product Fields (StudioWombat)', |
| 31 |
'active' => class_exists( '\\SW_WAPF\\Includes\\Classes\\Fields' ), |
| 32 |
), |
| 33 |
); |
| 34 |
} |
| 35 |
|
| 36 |
public function isOwnPluginActive(): bool { |
| 37 |
// Free build (SimpleProductAddons) or premium build (U2Code\ProductAddons) |
| 38 |
return class_exists( '\\SimpleProductAddons\\Plugin' ) || class_exists( '\\U2Code\\ProductAddons\\Plugin' ); |
| 39 |
} |
| 40 |
|
| 41 |
public function getOwnPluginName(): string { |
| 42 |
return 'U2Code Product Addons'; |
| 43 |
} |
| 44 |
|
| 45 |
public function getOwnPluginIconAsset(): string { |
| 46 |
return 'admin/integrations/u2code-product-addons-icon.svg'; |
| 47 |
} |
| 48 |
|
| 49 |
public function getOwnPluginBannerAsset(): string { |
| 50 |
return 'admin/integrations/u2code-product-addons-banner.png'; |
| 51 |
} |
| 52 |
|
| 53 |
public function getOwnPluginPills(): array { |
| 54 |
return array( |
| 55 |
__( '11+ field types', 'tier-pricing-table' ), |
| 56 |
__( 'Per-option pricing', 'tier-pricing-table' ), |
| 57 |
__( 'Conditional logic', 'tier-pricing-table' ), |
| 58 |
__( 'Live totals', 'tier-pricing-table' ), |
| 59 |
); |
| 60 |
} |
| 61 |
|
| 62 |
public function getOwnPluginWporgURL(): string { |
| 63 |
return 'https://wordpress.org/plugins/u2code-product-addons-for-woocommerce/'; |
| 64 |
} |
| 65 |
|
| 66 |
public function getOwnPluginSiteURL(): string { |
| 67 |
return 'https://product-addons.com/'; |
| 68 |
} |
| 69 |
|
| 70 |
public function getUtmCampaignBase(): string { |
| 71 |
return 'product-addons'; |
| 72 |
} |
| 73 |
|
| 74 |
public function getIntroHeading(): string { |
| 75 |
return __( 'Charge for product options alongside tiered pricing', 'tier-pricing-table' ); |
| 76 |
} |
| 77 |
|
| 78 |
public function getIntroText(): string { |
| 79 |
return __( 'Product addons — options, extra fields, services like engraving or gift wrap — work together with tiered pricing: addon prices are added on top of the tiered price in the cart and totals.', 'tier-pricing-table' ); |
| 80 |
} |
| 81 |
|
| 82 |
public function getPromoText(): string { |
| 83 |
return __( 'U2Code Product Addons is built by the makers of Tiered Pricing Table — a native pairing: addon prices follow the tier price, percentage options are based on the actual tier price, and one support team for both plugins.', 'tier-pricing-table' ); |
| 84 |
} |
| 85 |
|
| 86 |
public function getPairedBannerText(): string { |
| 87 |
return '<strong>' . esc_html__( 'U2Code Product Addons is active — the native pairing.', 'tier-pricing-table' ) . '</strong> ' |
| 88 |
. esc_html__( 'Addon prices follow the tier price on the product page, in the live totals and in the cart.', 'tier-pricing-table' ); |
| 89 |
} |
| 90 |
|
| 91 |
public function getIntegrationEnabledText(): string { |
| 92 |
return __( 'The Tiered Pricing integration for it is enabled — addon prices are included in tiered price calculations in the cart.', 'tier-pricing-table' ); |
| 93 |
} |
| 94 |
|
| 95 |
public function getIntegrationDisabledText(): string { |
| 96 |
return __( 'The Tiered Pricing integration for it is disabled — addon prices may be lost when tiered pricing applies.', 'tier-pricing-table' ); |
| 97 |
} |
| 98 |
|
| 99 |
public function getConflictText( string $competitorNames ): string { |
| 100 |
return '<strong>' . esc_html__( 'Multiple product addons plugins are active.', 'tier-pricing-table' ) . '</strong> ' |
| 101 |
. sprintf( |
| 102 |
/* translators: %s: competitor plugin name(s) */ |
| 103 |
esc_html__( 'U2Code Product Addons and %s are both adding fields to your products, which usually duplicates options on the product page. Consider consolidating on one — we recommend U2Code Product Addons for the native pairing with tiered pricing.', 'tier-pricing-table' ), |
| 104 |
esc_html( $competitorNames ) |
| 105 |
); |
| 106 |
} |
| 107 |
|
| 108 |
public function getConflictBannerClass(): string { |
| 109 |
return 'tpt-pairing__banner--warning'; |
| 110 |
} |
| 111 |
} |
| 112 |
|