| 1 |
<?php |
| 2 |
/** |
| 3 |
* WooCommerce Extension |
| 4 |
* |
| 5 |
* @package NotificationX\Extensions |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace NotificationX\Extensions\WooCommerce; |
| 9 |
|
| 10 |
/** |
| 11 |
* WooCommerce Extension Class |
| 12 |
* @method static WooCommerce get_instance($args = null) |
| 13 |
*/ |
| 14 |
class WooCommerceSalesInline extends WooInline { |
| 15 |
|
| 16 |
/** |
| 17 |
* Instance of WooInline |
| 18 |
* |
| 19 |
* @var WooInline |
| 20 |
*/ |
| 21 |
protected static $instance = null; |
| 22 |
public $priority = 15; |
| 23 |
public $id = 'woocommerce_sales_inline'; |
| 24 |
public $img = ''; |
| 25 |
public $doc_link = 'https://notificationx.com/docs/woocommerce-growth-alerts/'; |
| 26 |
public $types = 'woocommerce_sales'; |
| 27 |
public $module = 'modules_woocommerce'; |
| 28 |
public $module_priority = 3; |
| 29 |
public $class = '\WooCommerce'; |
| 30 |
public $is_pro = true; |
| 31 |
|
| 32 |
/** |
| 33 |
* Get the instance of called class. |
| 34 |
* |
| 35 |
* @return WooInline |
| 36 |
*/ |
| 37 |
public static function get_instance($args = null){ |
| 38 |
if ( is_null( static::$instance ) || ! static::$instance instanceof self ) { |
| 39 |
$class = __CLASS__; |
| 40 |
if(strpos($class, "NotificationX\\") === 0){ |
| 41 |
$pro_class = str_replace("NotificationX\\", "NotificationXPro\\", $class); |
| 42 |
if(class_exists($pro_class)){ |
| 43 |
$class = $pro_class; |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
if(!empty($args)){ |
| 48 |
static::$instance = new $class($args); |
| 49 |
} |
| 50 |
else{ |
| 51 |
static::$instance = new $class; |
| 52 |
} |
| 53 |
} |
| 54 |
return static::$instance; |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* Initially Invoked when initialized. |
| 59 |
*/ |
| 60 |
public function __construct(){ |
| 61 |
parent::__construct(); |
| 62 |
} |
| 63 |
|
| 64 |
public function init_extension() |
| 65 |
{ |
| 66 |
$this->title = __('Growth Alert', 'notificationx'); |
| 67 |
$this->module_title = __('Growth Alert', 'notificationx'); |
| 68 |
$this->themes = [ |
| 69 |
'conv-theme-seven' => array( |
| 70 |
'is_pro' => true, |
| 71 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/woo-inline.jpg', |
| 72 |
'image_shape' => 'rounded', |
| 73 |
'inline_location' => [ 'woocommerce_before_add_to_cart_form' ], |
| 74 |
'template' => [ |
| 75 |
'first_param' => 'tag_sales_count', |
| 76 |
'custom_first_param' => __( '99', 'notificationx' ), |
| 77 |
'second_param' => __( 'people purchased', 'notificationx' ), |
| 78 |
'third_param' => 'tag_product_title', |
| 79 |
'custom_third_param' => ' ', |
| 80 |
'fourth_param' => 'tag_7days', |
| 81 |
'custom_fourth_param' => __( 'in last {{day:7}}', 'notificationx' ), |
| 82 |
], |
| 83 |
), |
| 84 |
'stock-theme-one' => array( |
| 85 |
'is_pro' => true, |
| 86 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/woo-inline-2.jpg', |
| 87 |
'image_shape' => 'rounded', |
| 88 |
'inline_location' => [ 'woocommerce_before_add_to_cart_form' ], |
| 89 |
'template' => [ |
| 90 |
// 'first_param' => 'tag_sales_count', |
| 91 |
// 'custom_first_param' => __( 'Someone', 'notificationx' ), |
| 92 |
'second_param' => __( 'Only', 'notificationx' ), |
| 93 |
'third_param' => 'tag_stock_count', |
| 94 |
'custom_third_param' => 10, |
| 95 |
'fourth_param' => 'tag_left_in_stock', |
| 96 |
'custom_fourth_param' => __( 'left in stock', 'notificationx' ), |
| 97 |
'fifth_param' => 'tag_order_soon', |
| 98 |
'custom_fifth_param' => __( '- order soon.', 'notificationx' ), |
| 99 |
], |
| 100 |
), |
| 101 |
'stock-theme-two' => array( |
| 102 |
'is_pro' => true, |
| 103 |
'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/woo-inline-3.jpg', |
| 104 |
'image_shape' => 'rounded', |
| 105 |
'inline_location' => [ 'woocommerce_after_cart_item_name' ], |
| 106 |
'template' => [ |
| 107 |
// 'first_param' => 'tag_sales_count', |
| 108 |
// 'custom_first_param' => __( 'Someone', 'notificationx' ), |
| 109 |
'second_param' => __( 'In high demand - only', 'notificationx' ), |
| 110 |
'third_param' => 'tag_stock_count', |
| 111 |
'custom_third_param' => 10, |
| 112 |
'fourth_param' => 'tag_left', |
| 113 |
'custom_fourth_param' => __( 'left', 'notificationx' ), |
| 114 |
'fifth_param' => 'tag_on_our_site', |
| 115 |
'custom_fifth_param' => __( 'on our site!', 'notificationx' ), |
| 116 |
], |
| 117 |
), |
| 118 |
]; |
| 119 |
$this->templates = [ |
| 120 |
'woo_template_sales_count' => [ |
| 121 |
'first_param' => [ |
| 122 |
'tag_sales_count' => __( 'Sales Count', 'notificationx' ), |
| 123 |
], |
| 124 |
'third_param' => [ |
| 125 |
'tag_product_title' => __( 'Product Title', 'notificationx' ), |
| 126 |
], |
| 127 |
'fourth_param' => [ |
| 128 |
'tag_1day' => __( 'In last 1 day', 'notificationx' ), |
| 129 |
'tag_7days' => __( 'In last 7 days', 'notificationx' ), |
| 130 |
'tag_30days' => __( 'In last 30 days', 'notificationx' ), |
| 131 |
], |
| 132 |
'_themes' => [ |
| 133 |
"{$this->id}_conv-theme-seven", |
| 134 |
], |
| 135 |
], |
| 136 |
'inline_stock_template' => [ |
| 137 |
'third_param' => [ |
| 138 |
'tag_stock_count' => __( 'Stock Count', 'notificationx' ), |
| 139 |
], |
| 140 |
'fourth_param' => [ |
| 141 |
'tag_left_in_stock' => __( 'left in stock', 'notificationx' ), |
| 142 |
'tag_left' => __( 'left', 'notificationx' ), |
| 143 |
], |
| 144 |
'fifth_param' => [ |
| 145 |
'tag_order_soon' => __( 'order soon.', 'notificationx' ), |
| 146 |
'tag_on_our_site' => __( 'on our site!', 'notificationx' ), |
| 147 |
], |
| 148 |
'_themes' => [ |
| 149 |
"{$this->id}_stock-theme-one", |
| 150 |
"{$this->id}_stock-theme-two", |
| 151 |
], |
| 152 |
], |
| 153 |
]; |
| 154 |
$this->popup = [ |
| 155 |
"denyButtonText" => __("<a href='https://notificationx.com/growth-alert/' target='_blank'>More Info</a>", "notificationx"), |
| 156 |
"confirmButtonText" => __("<a href='https://notificationx.com/#pricing' target='_blank'>Upgrade to PRO</a>", "notificationx"), |
| 157 |
"html"=> __(' |
| 158 |
<span>Highlight your sales, low stock updates with inline growth alert to boost sales</span> |
| 159 |
<iframe id="email_subscription_video" type="text/html" allowfullscreen width="450" height="235" |
| 160 |
src="https://www.youtube.com/embed/vXMtBPvizDw"> |
| 161 |
</iframe> |
| 162 |
', 'notificationx') |
| 163 |
]; |
| 164 |
} |
| 165 |
|
| 166 |
public function doc(){ |
| 167 |
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> |
| 168 |
<p>🎦 <a href="%3$s" target="_blank">Watch video tutorial</a> to learn quickly</p> |
| 169 |
<p>⭐ NotificationX Integration with WooCommerce</p> |
| 170 |
<p><strong>Recommended Blog:</strong></p> |
| 171 |
<p>🔥 Why NotificationX is The <a target="_blank" href="%4$s">Best FOMO and Social Proof Plugin</a> for WooCommerce?</p> |
| 172 |
<p>🚀 How to <a target="_blank" href="%5$s">boost WooCommerce Sales</a> Using NotificationX</p>', 'notificationx'), |
| 173 |
'https://wordpress.org/plugins/woocommerce/', |
| 174 |
'https://notificationx.com/docs/woocommerce-growth-alerts/', |
| 175 |
'https://www.youtube.com/watch?v=dVthd36hJ-E&t=1s', |
| 176 |
'https://notificationx.com/integrations/woocommerce/', |
| 177 |
'https://notificationx.com/blog/best-fomo-and-social-proof-plugin-for-woocommerce/' |
| 178 |
); |
| 179 |
} |
| 180 |
|
| 181 |
} |
| 182 |
|