| 1 |
<?php |
| 2 |
/** |
| 3 |
* WooCommerce Extension |
| 4 |
* |
| 5 |
* @package NotificationX\Extensions |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace NotificationX\Extensions\WooCommerce; |
| 9 |
|
| 10 |
use NotificationX\Admin\Entries; |
| 11 |
use NotificationX\Core\Helper; |
| 12 |
use NotificationX\Core\PostType; |
| 13 |
use NotificationX\Core\Rules; |
| 14 |
use NotificationX\GetInstance; |
| 15 |
use NotificationX\Extensions\Extension; |
| 16 |
use NotificationX\Extensions\GlobalFields; |
| 17 |
|
| 18 |
/** |
| 19 |
* WooCommerce Extension Class |
| 20 |
* @method static WooCommerce get_instance($args = null) |
| 21 |
*/ |
| 22 |
class WooCommerceSales extends WooCommerce { |
| 23 |
/** |
| 24 |
* Instance of WooInline |
| 25 |
* |
| 26 |
* @var WooCommerceSales |
| 27 |
*/ |
| 28 |
protected static $instance = null; |
| 29 |
public $priority = 5; |
| 30 |
public $id = 'woocommerce_sales'; |
| 31 |
public $img = ''; |
| 32 |
public $doc_link = 'https://notificationx.com/docs/woocommerce-notification-in-notificationx/'; |
| 33 |
public $types = 'woocommerce_sales'; |
| 34 |
public $module = 'modules_woocommerce'; |
| 35 |
public $module_priority = 3; |
| 36 |
public $class = '\WooCommerce'; |
| 37 |
public $default_theme = 'woocommerce_sales_theme-one'; |
| 38 |
public $wpml_included = [ |
| 39 |
'sales_count', 'donation_count' |
| 40 |
]; |
| 41 |
|
| 42 |
/** |
| 43 |
* Get the instance of called class. |
| 44 |
* |
| 45 |
* @return WooCommerce |
| 46 |
*/ |
| 47 |
public static function get_instance($args = null){ |
| 48 |
if ( is_null( static::$instance ) || ! static::$instance instanceof self ) { |
| 49 |
$class = __CLASS__; |
| 50 |
if(strpos($class, "NotificationX\\") === 0){ |
| 51 |
$pro_class = str_replace("NotificationX\\", "NotificationXPro\\", $class); |
| 52 |
if(class_exists($pro_class)){ |
| 53 |
$class = $pro_class; |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
if(!empty($args)){ |
| 58 |
static::$instance = new $class($args); |
| 59 |
} |
| 60 |
else{ |
| 61 |
static::$instance = new $class; |
| 62 |
} |
| 63 |
} |
| 64 |
return static::$instance; |
| 65 |
} |
| 66 |
/** |
| 67 |
* Initially Invoked when initialized. |
| 68 |
*/ |
| 69 |
public function __construct(){ |
| 70 |
parent::__construct(); |
| 71 |
// nx_colored_themes |
| 72 |
// $common_fields = [ |
| 73 |
// 'first_param' => 'tag_name', |
| 74 |
// 'custom_first_param' => __('Someone' , 'notificationx'), |
| 75 |
// 'second_param' => __('just purchased', 'notificationx'), |
| 76 |
// 'third_param' => 'tag_product_title', |
| 77 |
// 'custom_third_param' => __('Anonymous Product', 'notificationx'), |
| 78 |
// 'fourth_param' => 'tag_time', |
| 79 |
// 'custom_fourth_param' => __( 'Some time ago', 'notificationx' ), |
| 80 |
// ]; |
| 81 |
// $this->themes = [ |
| 82 |
// 'theme-one' => [ |
| 83 |
// 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/nx-conv-theme-2.jpg', |
| 84 |
// 'image_shape' => 'square', |
| 85 |
// 'template' => $common_fields, |
| 86 |
// ], |
| 87 |
// 'theme-two' => [ |
| 88 |
// 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/nx-conv-theme-1.jpg', |
| 89 |
// 'image_shape' => 'square', |
| 90 |
// 'template' => $common_fields, |
| 91 |
// ], |
| 92 |
// 'theme-three' => [ |
| 93 |
// 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/nx-conv-theme-3.jpg', |
| 94 |
// 'image_shape' => 'square', |
| 95 |
// 'template' => $common_fields, |
| 96 |
// ], |
| 97 |
// 'theme-four' => array( |
| 98 |
// 'is_pro' => true, |
| 99 |
// 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/nx-conv-theme-four.png', |
| 100 |
// 'image_shape' => 'circle', |
| 101 |
// 'template' => $common_fields, |
| 102 |
// ), |
| 103 |
// 'theme-five' => array( |
| 104 |
// 'is_pro' => true, |
| 105 |
// 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/nx-conv-theme-five.png', |
| 106 |
// 'image_shape' => 'circle', |
| 107 |
// 'template' => $common_fields, |
| 108 |
// ), |
| 109 |
// // @todo pro map theme |
| 110 |
// 'conv-theme-six' => array( |
| 111 |
// 'is_pro' => true, |
| 112 |
// 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/nx-conv-theme-6.jpg', |
| 113 |
// 'image_shape' => 'circle', |
| 114 |
// ), |
| 115 |
// // @todo pro map theme |
| 116 |
// 'maps_theme' => array( |
| 117 |
// 'is_pro' => true, |
| 118 |
// 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/maps-theme.png', |
| 119 |
// 'image_shape' => 'square', |
| 120 |
// 'show_notification_image' => 'maps_image', |
| 121 |
// ), |
| 122 |
// 'conv-theme-ten' => array( |
| 123 |
// 'is_pro' => true, |
| 124 |
// 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/nx-conv-theme-4.png', |
| 125 |
// 'image_shape' => 'rounded', |
| 126 |
// 'defaults' => [ |
| 127 |
// 'link_button' => true, |
| 128 |
// 'link_button_text' => __('Buy Now'), |
| 129 |
// ], |
| 130 |
// 'template' => $common_fields, |
| 131 |
// ), |
| 132 |
// 'conv-theme-eleven' => array( |
| 133 |
// 'is_pro' => true, |
| 134 |
// 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/nx-conv-theme-5.png', |
| 135 |
// 'image_shape' => 'rounded', |
| 136 |
// 'defaults' => [ |
| 137 |
// 'link_button' => true, |
| 138 |
// 'link_button_text' => __('Buy Now'), |
| 139 |
// ], |
| 140 |
// 'template' => $common_fields, |
| 141 |
// ), |
| 142 |
// 'conv-theme-seven' => array( |
| 143 |
// 'is_pro' => true, |
| 144 |
// 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/nx-conv-theme-7.png', |
| 145 |
// 'image_shape' => 'rounded', |
| 146 |
// ), |
| 147 |
// 'conv-theme-eight' => array( |
| 148 |
// 'is_pro' => true, |
| 149 |
// 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/nx-conv-theme-8.png', |
| 150 |
// 'image_shape' => 'circle', |
| 151 |
|
| 152 |
// ), |
| 153 |
// 'conv-theme-nine' => array( |
| 154 |
// 'is_pro' => true, |
| 155 |
// 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/nx-conv-theme-9.png', |
| 156 |
// 'image_shape' => 'rounded', |
| 157 |
// ), |
| 158 |
// ]; |
| 159 |
// $this->templates = [ |
| 160 |
// 'woo_template_new' => [ |
| 161 |
// 'first_param' => GlobalFields::get_instance()->common_name_fields(), |
| 162 |
// 'third_param' => [ |
| 163 |
// 'tag_product_title' => __('Product Title', 'notificationx'), |
| 164 |
// ], |
| 165 |
// 'fourth_param' => [ |
| 166 |
// 'tag_time' => __('Definite Time', 'notificationx'), |
| 167 |
// ], |
| 168 |
// '_themes' => [ |
| 169 |
// 'woocommerce_sales_theme-one', |
| 170 |
// 'woocommerce_sales_theme-two', |
| 171 |
// 'woocommerce_sales_theme-three', |
| 172 |
// 'woocommerce_sales_theme-four', |
| 173 |
// 'woocommerce_sales_theme-five', |
| 174 |
// 'woocommerce_sales_conv-theme-ten', |
| 175 |
// 'woocommerce_sales_conv-theme-eleven', |
| 176 |
// ] |
| 177 |
// ], |
| 178 |
// 'woo_sales_template_sales_count' => [ |
| 179 |
// 'first_param' => GlobalFields::get_instance()->common_name_fields(), |
| 180 |
// 'third_param' => [ |
| 181 |
// 'tag_product_title' => __('Product Title', 'notificationx'), |
| 182 |
// ], |
| 183 |
// 'fourth_param' => [ |
| 184 |
// // 'tag_time' => __('Definite Time', 'notificationx'), |
| 185 |
// ], |
| 186 |
// '_themes' => [ |
| 187 |
// 'woocommerce_sales_conv-theme-six', |
| 188 |
// 'woocommerce_sales_conv-theme-seven', |
| 189 |
// 'woocommerce_sales_conv-theme-eight', |
| 190 |
// 'woocommerce_sales_conv-theme-nine', |
| 191 |
// ] |
| 192 |
// ], |
| 193 |
// ]; |
| 194 |
} |
| 195 |
|
| 196 |
public function init_extension() |
| 197 |
{ |
| 198 |
$this->title = __('Sales Notification', 'notificationx'); |
| 199 |
$this->module_title = __('Sales Notification', 'notificationx'); |
| 200 |
} |
| 201 |
|
| 202 |
public function doc(){ |
| 203 |
return sprintf(__('<p>Make sure that you have <a target="_blank" href="%1$s">WooCommerce installed & activated</a> to use this campaign. For further assistance, check out our step by step <a target="_blank" href="%2$s">documentation</a>.</p> |
| 204 |
<p>🎦 <a href="%3$s" target="_blank">Watch video tutorial</a> to learn quickly</p> |
| 205 |
<p>⭐ NotificationX Integration with WooCommerce</p> |
| 206 |
<p><strong>Recommended Blog:</strong></p> |
| 207 |
<p>🔥 Why NotificationX is The <a target="_blank" href="%4$s">Best FOMO and Social Proof Plugin</a> for WooCommerce?</p> |
| 208 |
<p>🚀 How to <a target="_blank" href="%5$s">boost WooCommerce Sales</a> Using NotificationX</p>', 'notificationx'), |
| 209 |
'https://wordpress.org/plugins/woocommerce/', |
| 210 |
'https://notificationx.com/docs/configure-woocommerce-sales-alert/', |
| 211 |
'https://www.youtube.com/watch?v=dVthd36hJ-E&t=1s', |
| 212 |
'https://notificationx.com/integrations/woocommerce/', |
| 213 |
'https://notificationx.com/blog/best-fomo-and-social-proof-plugin-for-woocommerce/' |
| 214 |
); |
| 215 |
} |
| 216 |
|
| 217 |
} |
| 218 |
|