PluginProbe
Tiered Pricing Table for WooCommerce / 8.0.2
Tiered Pricing Table for WooCommerce v8.0.2
8.0.2 7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 All 91 releases
tier-pricing-table / src / Addons / NonLoggedInUsers / Visibility / PrivateStoreSubsection.php

PrivateStoreSubsection.php in Tiered Pricing Table for WooCommerce 8.0.2, at src/Addons/NonLoggedInUsers/Visibility/PrivateStoreSubsection.php

70 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Addons\NonLoggedInUsers\Visibility;
2
3 use TierPricingTable\Settings\CustomOptions\TPTCheckboxListOption;
4 use TierPricingTable\Settings\CustomOptions\TPTSwitchOption;
5 use TierPricingTable\Settings\Sections\SubsectionAbstract;
6
7 /**
8 * The "Private store" group of the Wholesale tab.
9 */
10 class PrivateStoreSubsection extends SubsectionAbstract {
11
12 public function getTitle(): string {
13 return __( 'Private store', 'tier-pricing-table' );
14 }
15
16 public function getDescription(): string {
17 return __( 'Close the store to visitors, or show parts of the catalog to selected roles only. Both are off by default.', 'tier-pricing-table' );
18 }
19
20 public function getSlug(): string {
21 return 'private-store';
22 }
23
24 public function getSettings(): array {
25 return array(
26 array(
27 'title' => __( 'Closed store', 'tier-pricing-table' ),
28 'id' => VisibilitySettings::optionId( 'closed_store' ),
29 'type' => TPTSwitchOption::FIELD_TYPE,
30 'default' => 'no',
31 'desc' => __( 'Visitors who are not logged in are sent to the login page. My Account, the wholesale registration page and the pages below stay open. Exclude the store from page caching for visitors.', 'tier-pricing-table' ),
32 ),
33 array(
34 'title' => __( 'Pages visitors may open', 'tier-pricing-table' ),
35 'id' => VisibilitySettings::optionId( 'closed_store_pages' ),
36 'type' => TPTCheckboxListOption::FIELD_TYPE,
37 'display' => 'select',
38 'options' => $this->getPageOptions(),
39 'default' => '',
40 'placeholder' => __( 'Select pages…', 'tier-pricing-table' ),
41 'desc' => __( 'For example the home page, About, Contact, Terms and Privacy.', 'tier-pricing-table' ),
42 ),
43 array(
44 'title' => __( 'Catalog visibility by role', 'tier-pricing-table' ),
45 'id' => VisibilitySettings::optionId( 'enabled' ),
46 'type' => TPTSwitchOption::FIELD_TYPE,
47 'default' => 'no',
48 'desc' => __( 'Adds a "Who can see" rule to every product (Tiered Pricing tab, Additional Options) and every product category (category screen): everyone, only the selected roles, or everyone except the selected roles; guests count as a role. Use it for wholesale-only or retail-only products and categories. Hidden products leave the shop, search, related lists, menus, the sitemap and the Store API and cannot be bought. Shop managers always see everything.', 'tier-pricing-table' ),
49 ),
50 array(
51 'title' => __( 'Hidden products and categories', 'tier-pricing-table' ),
52 'id' => VisibilitySettings::optionId( 'hidden_redirect' ),
53 'type' => TPTSwitchOption::FIELD_TYPE,
54 'default' => 'yes',
55 'desc' => __( 'Send a visitor who opens a hidden product or category to the login page. Off: everyone who may not see it gets a not-found page.', 'tier-pricing-table' ),
56 ),
57 );
58 }
59
60 protected function getPageOptions(): array {
61 $options = array();
62
63 foreach ( get_pages( array( 'post_status' => 'publish', 'number' => 500 ) ) as $page ) {
64 $options[ (string) $page->ID ] = $page->post_title ?: '#' . $page->ID;
65 }
66
67 return $options;
68 }
69 }
70