| 1 |
<?php namespace TierPricingTable\Addons\NonLoggedInUsers; |
| 2 |
|
| 3 |
use TierPricingTable\Settings\CustomOptions\TPTSwitchOption; |
| 4 |
use TierPricingTable\Settings\CustomOptions\TPTTextTemplate; |
| 5 |
use TierPricingTable\Settings\Sections\SubsectionAbstract; |
| 6 |
use TierPricingTable\Settings\Settings; |
| 7 |
|
| 8 |
class NonLoggedInUsersSubsection extends SubsectionAbstract { |
| 9 |
|
| 10 |
public function getTitle(): string { |
| 11 |
return __( 'Guest Users', 'tier-pricing-table' ); |
| 12 |
} |
| 13 |
|
| 14 |
public function getDescription(): string { |
| 15 |
return __( 'Manage pricing visibility and purchasing rules for guest (non-logged-in) users.', |
| 16 |
'tier-pricing-table' ); |
| 17 |
} |
| 18 |
|
| 19 |
public function getSlug(): string { |
| 20 |
return 'non-logged-in-users'; |
| 21 |
} |
| 22 |
|
| 23 |
public function getSettings(): array { |
| 24 |
return array( |
| 25 |
array( |
| 26 |
'title' => __( 'Require login to purchase', 'tier-pricing-table' ), |
| 27 |
'id' => Settings::SETTINGS_PREFIX . 'non_logged_in_users_prevent_purchase', |
| 28 |
'type' => TPTSwitchOption::FIELD_TYPE, |
| 29 |
'default' => 'no', |
| 30 |
'desc_tip' => false, |
| 31 |
), |
| 32 |
|
| 33 |
array( |
| 34 |
'title' => __( 'Guest add-to-cart label', 'tier-pricing-table' ), |
| 35 |
'id' => Settings::SETTINGS_PREFIX . 'non_logged_in_users_add_to_cart_label', |
| 36 |
'type' => 'text', |
| 37 |
'default' => '', |
| 38 |
'desc' => __( 'Change the default "Add to cart" button text for guest users.', |
| 39 |
'tier-pricing-table' ), |
| 40 |
'placeholder' => __( 'Leave empty to keep default', 'tier-pricing-table' ), |
| 41 |
'desc_tip' => false, |
| 42 |
), |
| 43 |
|
| 44 |
array( |
| 45 |
'title' => __( 'Guest purchase error message', 'tier-pricing-table' ), |
| 46 |
'id' => Settings::SETTINGS_PREFIX . 'non_logged_in_users_purchase_message', |
| 47 |
'type' => TPTTextTemplate::FIELD_TYPE, |
| 48 |
'placeholders' => array(), |
| 49 |
// translators: %s: login page url |
| 50 |
'default' => sprintf( __( 'Please enter %s to make a purchase.', 'tier-pricing-table' ), |
| 51 |
sprintf( '<a href="%s">%s</a>', wc_get_account_endpoint_url( 'dashboard' ), |
| 52 |
__( 'your account', 'tier-pricing-table' ) ) ), |
| 53 |
), |
| 54 |
|
| 55 |
array( |
| 56 |
'title' => __( 'Hide prices for guests', 'tier-pricing-table' ), |
| 57 |
'id' => Settings::SETTINGS_PREFIX . 'non_logged_in_users_hide_prices', |
| 58 |
'type' => TPTSwitchOption::FIELD_TYPE, |
| 59 |
'default' => 'no', |
| 60 |
'desc_tip' => false, |
| 61 |
), |
| 62 |
array( |
| 63 |
'title' => __( 'Guest price message', 'tier-pricing-table' ), |
| 64 |
'id' => Settings::SETTINGS_PREFIX . 'non_logged_in_users_price_message', |
| 65 |
'type' => TPTTextTemplate::FIELD_TYPE, |
| 66 |
'description' => __( 'This message will be displayed instead of the price for non-logged-in users.', |
| 67 |
'tier-pricing-table' ), |
| 68 |
'placeholders' => array(), |
| 69 |
// translators: %s: login page url |
| 70 |
'default' => sprintf( __( '%s see prices', 'tier-pricing-table' ), |
| 71 |
sprintf( '<a href="%s">%s</a>', wc_get_account_endpoint_url( 'dashboard' ), |
| 72 |
__( 'Login', 'tier-pricing-table' ) ) ), |
| 73 |
), |
| 74 |
); |
| 75 |
} |
| 76 |
} |
| 77 |
|