| 1 |
<?php |
| 2 |
|
| 3 |
namespace Sellkit\Contact_Segmentation\Conditions; |
| 4 |
|
| 5 |
use Sellkit\Contact_Segmentation\Conditions\Condition_Base; |
| 6 |
use Sellkit\Contact_Segmentation\Contact_Data; |
| 7 |
|
| 8 |
defined( 'ABSPATH' ) || die(); |
| 9 |
|
| 10 |
/** |
| 11 |
* Class Cart Category. |
| 12 |
* |
| 13 |
* @package Sellkit\Contact_Segmentation\Conditions |
| 14 |
* @since 1.1.0 |
| 15 |
*/ |
| 16 |
class Cart_Category extends Condition_Base { |
| 17 |
|
| 18 |
/** |
| 19 |
* Condition name. |
| 20 |
* |
| 21 |
* @since 1.1.0 |
| 22 |
*/ |
| 23 |
public function get_name() { |
| 24 |
return 'cart-category'; |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Condition title. |
| 29 |
* |
| 30 |
* @since 1.1.0 |
| 31 |
*/ |
| 32 |
public function get_title() { |
| 33 |
return __( 'Cart Categories', 'sellkit' ); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Condition type. |
| 38 |
* |
| 39 |
* @since 1.1.0 |
| 40 |
*/ |
| 41 |
public function get_type() { |
| 42 |
return self::SELLKIT_MULTISELECT_CONDITION_VALUE; |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* Gets value. |
| 47 |
* |
| 48 |
* @since 1.1.0 |
| 49 |
*/ |
| 50 |
public function get_value() { |
| 51 |
return Contact_Data::get_cart_terms(); |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* Get the options |
| 56 |
* |
| 57 |
* @since 1.1.0 |
| 58 |
* @return array |
| 59 |
*/ |
| 60 |
public function get_options() { |
| 61 |
$input_value = filter_input( INPUT_GET, 'input_value', FILTER_SANITIZE_STRING ); |
| 62 |
|
| 63 |
return sellkit_get_terms( 'product_cat', sanitize_text_field( $input_value ) ); |
| 64 |
} |
| 65 |
|
| 66 |
/** |
| 67 |
* It is pro feature or not. |
| 68 |
* |
| 69 |
* @since 1.1.0 |
| 70 |
*/ |
| 71 |
public function is_pro() { |
| 72 |
return true; |
| 73 |
} |
| 74 |
|
| 75 |
/** |
| 76 |
* All the conditions are not searchable by default. |
| 77 |
* |
| 78 |
* @return false |
| 79 |
* @since 1.1.0 |
| 80 |
*/ |
| 81 |
public function is_searchable() { |
| 82 |
return true; |
| 83 |
} |
| 84 |
} |
| 85 |
|