| 1 |
<?php |
| 2 |
|
| 3 |
namespace Hurrytimer; |
| 4 |
|
| 5 |
$coupons = []; |
| 6 |
$coupons_count = 0; |
| 7 |
if (!empty($campaign->actions) && hurryt_is_woocommerce_activated()) { |
| 8 |
$coupons_count = wp_count_posts('shop_coupon')->publish; |
| 9 |
if ($coupons_count <= 30) { |
| 10 |
$coupons = hurryt_get_wc_coupons(); |
| 11 |
} |
| 12 |
} |
| 13 |
?> |
| 14 |
|
| 15 |
<div id="hurrytimer-actions" class="hurrytimer-tabcontent"> |
| 16 |
<?php $i = 0; |
| 17 |
foreach ($campaign->actions as $action) : ?> |
| 18 |
<div class="hurrytimer-action-block"> |
| 19 |
<div> |
| 20 |
<div class="hurrytimer-action-block-choices"> |
| 21 |
<div class="hurrytimer-action-block-label"> |
| 22 |
<label for="active"><?php _e("Action", "hurrytimer") ?></label> |
| 23 |
</div> |
| 24 |
<div class="hurrytimer-action-block-input"> |
| 25 |
<select name="actions[<?php echo $i ?>][id]" class="hurrytimer-action-select"> |
| 26 |
<?php if (hurryt_is_woocommerce_activated()) : ?> |
| 27 |
|
| 28 |
<optgroup label="General"> |
| 29 |
<?php endif; ?> |
| 30 |
<option value="<?php echo C::ACTION_NONE ?>" data-subfields="hurrytimer-action-none-subfields" <?php echo selected($action['id'], C::ACTION_NONE) ?>> |
| 31 |
<?php _e("None", "hurrytimer") ?> |
| 32 |
</option> |
| 33 |
<option value="<?php echo C::ACTION_HIDE ?>" data-subfields="hurrytimer-action-hide-subfields" <?php echo selected($action['id'], C::ACTION_HIDE) ?>> |
| 34 |
<?php _e("Hide countdown timer", "hurrytimer") ?> |
| 35 |
</option> |
| 36 |
<option value="<?php echo C::ACTION_REDIRECT ?>" data-subfields="hurrytimer-action-redirect-subfields" <?php echo selected($action['id'], C::ACTION_REDIRECT) ?>> |
| 37 |
<?php _e("Redirect to...", "hurrytimer") ?> |
| 38 |
<option value="<?php echo C::ACTION_DISPLAY_MESSAGE ?>" data-subfields="hurrytimer-action-display-message-subfields" <?php echo selected( |
| 39 |
$action['id'], |
| 40 |
C::ACTION_DISPLAY_MESSAGE |
| 41 |
) ?>> |
| 42 |
<?php _e("Display message...", "hurrytimer") ?> |
| 43 |
</option> |
| 44 |
<?php if (hurryt_is_woocommerce_activated()) : ?> |
| 45 |
</optgroup> |
| 46 |
<?php endif; ?> |
| 47 |
|
| 48 |
<?php if (hurryt_is_woocommerce_activated()) : ?> |
| 49 |
|
| 50 |
<optgroup label="WooCommerce"> |
| 51 |
<option value="<?php echo C::ACTION_EXPIRE_COUPON ?>" data-pro-feat [PRO] data-subfields="hurrytimer-action-expire-coupon-subfields" <?php echo selected( |
| 52 |
$action['id'], |
| 53 |
C::ACTION_EXPIRE_COUPON |
| 54 |
) ?>> |
| 55 |
<?php _e("Expire Coupon...", "hurrytimer") ?> |
| 56 |
</option> |
| 57 |
<option value="<?php echo C::ACTION_HIDE_ADD_TO_CART_BUTTON ?>" data-subfields="hurrytimer-action-hide-addtocart-subfields" <?php echo selected( |
| 58 |
$action['id'], |
| 59 |
C::ACTION_HIDE_ADD_TO_CART_BUTTON |
| 60 |
) ?>> |
| 61 |
|
| 62 |
Hide "Add to cart" button |
| 63 |
</option> |
| 64 |
<option value="<?php echo C::ACTION_CHANGE_STOCK_STATUS ?>" data-subfields="hurrytimer-action-stockstatus-subfields" <?php echo selected( |
| 65 |
$action['id'], |
| 66 |
C::ACTION_CHANGE_STOCK_STATUS |
| 67 |
) ?>> |
| 68 |
Change stock status |
| 69 |
</option> |
| 70 |
|
| 71 |
</optgroup> |
| 72 |
|
| 73 |
<?php endif; ?> |
| 74 |
</select> |
| 75 |
<?php // removeIf(pro) |
| 76 |
?> |
| 77 |
|
| 78 |
<div class="hurryt-pro-feat hidden description" style="padding-top: 5px"> |
| 79 |
Expire Coupon is a pro feature. <a href="http://hurrytimer.com/#pricing?utm_source=plugin&utm_medium=actions&utm_campaign=expire_coupon">Upgrade |
| 80 |
now</a> |
| 81 |
</div> |
| 82 |
<?php // endRemoveIf(pro) |
| 83 |
?> |
| 84 |
|
| 85 |
<div class="hurryt-compat-info description hidden"> |
| 86 |
"Change stock status" is available in one-time and recurring modes only. |
| 87 |
</div> |
| 88 |
</div> |
| 89 |
</div> |
| 90 |
<div class="hurrytimer-action-block-subfields hurrytimer-action-expire-coupon-subfields hidden"> |
| 91 |
<div class="hurrytimer-action-block-label"> |
| 92 |
<label for=""><?php _e("Coupon code", 'hurrytimer') ?></label> |
| 93 |
</div> |
| 94 |
<div class="hurrytimer-action-block-input"> |
| 95 |
<select name="actions[<?php echo $i ?>][coupon]" <?php echo empty($coupons) && $coupons_count > 0 ? 'class="hurrytimer-action-wc-coupon"' : '' ?>> |
| 96 |
<?php if (!(empty($coupons) && $coupons_count > 0)) : ?> |
| 97 |
<option value="" <?php echo empty($coupons) ? 'selected': '' ?>>Select coupon...</option> |
| 98 |
<?php endif; ?> |
| 99 |
<?php if (!empty($coupons)) : ?> |
| 100 |
<?php |
| 101 |
foreach ($coupons as $coupon) : ?> |
| 102 |
<option value="<?php echo $coupon->post_title ?>" <?php echo selected($action['coupon'], $coupon->post_title) ?>><?php echo $coupon->post_title; ?> |
| 103 |
</option> |
| 104 |
<?php endforeach; |
| 105 |
else : ?> |
| 106 |
<option value="<?php echo $action['coupon'] ?>" selected><?php echo $action['coupon']; ?></option> |
| 107 |
<?php endif; ?> |
| 108 |
|
| 109 |
|
| 110 |
</select> |
| 111 |
<p class="description">Note: To create a coupon navigate to WooCommerce > Coupons or Marketing > Coupons.</p> |
| 112 |
</div> |
| 113 |
</div> |
| 114 |
|
| 115 |
<div class="hurrytimer-action-block-subfields hurrytimer-action-redirect-subfields hidden"> |
| 116 |
<div class="hurrytimer-action-block-label"> |
| 117 |
|
| 118 |
<label for=""><?php _e("Redirect URL", "hurrytimer") ?></label> |
| 119 |
</div> |
| 120 |
<div class="hurrytimer-action-block-input"> |
| 121 |
<input type="text" id="hurrytimer-redirect-url" placeholder="http://" name="actions[<?php echo $i ?>][redirectUrl]" value="<?php echo $action['redirectUrl'] ?>" class="hurrytimer-redirect-url" /> |
| 122 |
</div> |
| 123 |
</div> |
| 124 |
<div class="hurrytimer-action-block-subfields hurrytimer-action-display-message-subfields hidden"> |
| 125 |
<div class="hurrytimer-action-block-label"> |
| 126 |
|
| 127 |
<label for=""><?php _e("Message", "hurrytimer") ?></label> |
| 128 |
</div> |
| 129 |
<div class="hurrytimer-action-block-input"> |
| 130 |
<?php echo wp_editor( |
| 131 |
$action['message'], |
| 132 |
'hurrytimer-action-message-' . $i, |
| 133 |
[ |
| 134 |
'tinymce' => array( |
| 135 |
'toolbar1' => 'fontsizeselect,forecolor,backcolor,bold,italic,numlist,bullist,blockquote,removeformat,alignleft,aligncenter,alignright,link,indent,outdent,hr,undo,redo,fullscreen', |
| 136 |
'fontsize_formats' => '11px 12px 14px 16px 18px 24px 36px 48px' |
| 137 |
), |
| 138 |
'textarea_name' => "actions[" . $i . "][message]", |
| 139 |
] |
| 140 |
) ?> |
| 141 |
<p class="description">Supports shortcodes.</p> |
| 142 |
</div> |
| 143 |
</div> |
| 144 |
<div class="hurrytimer-action-block-subfields hurrytimer-action-stockstatus-subfields hidden"> |
| 145 |
<div class="hurrytimer-action-block-label"> |
| 146 |
<label for=""><?php _e("Stock status", "hurrytimer") ?></label> |
| 147 |
</div> |
| 148 |
<div class="hurrytimer-action-block-input"> |
| 149 |
<select name="actions[<?php echo $i ?>][wcStockStatus]"> |
| 150 |
<option value="<?php echo C::WC_IN_STOCK ?>" <?php echo selected( |
| 151 |
$action['wcStockStatus'], |
| 152 |
C::WC_IN_STOCK |
| 153 |
) ?>>In stock |
| 154 |
</option> |
| 155 |
<option value="<?php echo C::WC_OUT_OF_STOCK ?>" p<?php echo selected( |
| 156 |
$action['wcStockStatus'], |
| 157 |
C::WC_OUT_OF_STOCK |
| 158 |
) ?>>Out of stock |
| 159 |
</option> |
| 160 |
<option value="<?php echo C::WC_ON_BACKORDER ?>" p<?php echo selected( |
| 161 |
$action['wcStockStatus'], |
| 162 |
C::WC_ON_BACKORDER |
| 163 |
) ?>>On backorder |
| 164 |
</option> |
| 165 |
</select> |
| 166 |
</div> |
| 167 |
</div> |
| 168 |
</div> |
| 169 |
<div> |
| 170 |
<button class="button button-default hurrytimer-delete-action <?php echo count($campaign->actions) === 1 ? 'hidden' : '' ?>" type="button"> |
| 171 |
Delete |
| 172 |
</button> |
| 173 |
</div> |
| 174 |
</div> |
| 175 |
|
| 176 |
<?php $i++; |
| 177 |
endforeach; ?> |
| 178 |
<div class="hurryt-add-action"> |
| 179 |
<button <?php //removeIf(pro) |
| 180 |
?> disabled <?php //endRemoveIf(pro) |
| 181 |
?> class="button button-default" type="button" id="hurrytimer-new-action">Add another |
| 182 |
action |
| 183 |
</button> |
| 184 |
<br> |
| 185 |
<?php //removeIf(pro) |
| 186 |
?> |
| 187 |
<p class="description"><span class="dashicons dashicons-lock" style="margin-top:-2px"></span>Adding multiple |
| 188 |
actions is a pro feature. <a href="http://hurrytimer.com/#pricing?utm_source=plugin&utm_medium=actions&utm_campaign=learn_more">Upgrade |
| 189 |
now</a> |
| 190 |
</p> |
| 191 |
<?php //endRemoveIf(pro) |
| 192 |
?> |
| 193 |
</div> |
| 194 |
</div> |