| 1 |
<?php |
| 2 |
/** |
| 3 |
* Product tab view |
| 4 |
* |
| 5 |
* @package |
| 6 |
*/ |
| 7 |
|
| 8 |
$product_module = \WPFunnels\Wpfnl::$instance->module_manager->get_admin_modules('product'); |
| 9 |
$products = $this->get_internal_metas_by_key('_wpfnl_checkout_products'); |
| 10 |
$product_module->set_products($products); |
| 11 |
$step_id = 0; |
| 12 |
if (isset($_GET['step_id'])) { |
| 13 |
$step_id = filter_input( INPUT_GET, 'step_id', FILTER_VALIDATE_INT ); |
| 14 |
} |
| 15 |
|
| 16 |
// Check if this is a Store Checkout |
| 17 |
$funnel_id = get_post_meta($step_id, '_funnel_id', true); |
| 18 |
$is_store_checkout = get_post_meta($funnel_id, '_wpfnl_funnel_type', true) === 'store_checkout'; |
| 19 |
|
| 20 |
$coupon_enable = get_post_meta($step_id, '_wpfnl_checkout_coupon', true); |
| 21 |
$coupon_enable_check = ''; |
| 22 |
if($coupon_enable != 'no') { |
| 23 |
$coupon_enable_check = 'checked'; |
| 24 |
} |
| 25 |
|
| 26 |
$collapsible_coupon_enable = get_post_meta($step_id, '_wpfnl_checkout_collapsible_coupon', true); |
| 27 |
$collapsible_coupon_check = ''; |
| 28 |
if($collapsible_coupon_enable == 'yes') { |
| 29 |
$collapsible_coupon_check = 'checked'; |
| 30 |
} |
| 31 |
?> |
| 32 |
|
| 33 |
<div class="product-area"> |
| 34 |
<div class="product-head"> |
| 35 |
<h4 class="title"><?php echo __('Funnel Products', 'wpfnl'); ?></h4> |
| 36 |
|
| 37 |
<div class="product-search"> |
| 38 |
<?php $product_module->get_view(); ?> |
| 39 |
</div> |
| 40 |
|
| 41 |
<!-- Conditional Add product --> |
| 42 |
<?php |
| 43 |
if (isset($products[0]['id']) && $products[0]['id'] != '') { |
| 44 |
?> |
| 45 |
<div class="add-product-btn"> |
| 46 |
<button class="btn-default" id="wpfnl-add-product" |
| 47 |
data-id="<?php echo $step_id; ?>"><?php echo __('Add product', 'wpfnl'); ?></button> |
| 48 |
</div> |
| 49 |
<?php |
| 50 |
} |
| 51 |
else { |
| 52 |
?> |
| 53 |
<div class="add-product-btn"> |
| 54 |
<button class="btn-default" id="wpfnl-add-product" |
| 55 |
data-id="<?php echo $step_id; ?>"><?php echo __('Add Your First Product', 'wpfnl'); ?></button> |
| 56 |
</div> |
| 57 |
<?php |
| 58 |
} |
| 59 |
?> |
| 60 |
<!-- Conditional Add product --> |
| 61 |
</div> |
| 62 |
|
| 63 |
<div class="product-accordion__wrapper"> |
| 64 |
<?php |
| 65 |
if (is_array($products)) { |
| 66 |
if ($products) { ?> |
| 67 |
<div class="accordion-head"> |
| 68 |
<div class="accordion-col expand-action"></div> |
| 69 |
<div class="accordion-col product-name"><?php echo __('Product', 'wpfnl'); ?></div> |
| 70 |
<div class="accordion-col product-price"><?php echo __('Price', 'wpfnl'); ?></div> |
| 71 |
<div class="accordion-col product-quantity"><?php echo __('Quantity', 'wpfnl'); ?></div> |
| 72 |
<!-- <div class="accordion-col product-discount">--> |
| 73 |
<?php //echo __('Discount', 'wpfnl'); ?><!--</div>--> |
| 74 |
<div class="accordion-col product-action"><?php echo __('Actions', 'wpfnl'); ?></div> |
| 75 |
</div> |
| 76 |
|
| 77 |
<div class="product-single-accordion__sortable-wrapper"> |
| 78 |
<?php foreach ($products as $key => $_product) { |
| 79 |
$product = wc_get_product($_product['id']); |
| 80 |
if (!empty($product)) { |
| 81 |
$text_highlight_enabler = ''; |
| 82 |
$text_highlight = ''; |
| 83 |
$subtext = ''; |
| 84 |
|
| 85 |
$title = $product->get_title(); |
| 86 |
$price = $product->get_price(); |
| 87 |
$qty = $_product['quantity']; |
| 88 |
if (isset($_product['subtext']) && $_product['subtext'] != '') { |
| 89 |
$subtext = $_product['subtext']; |
| 90 |
} |
| 91 |
|
| 92 |
if (isset($_product['text_highlight']) && $_product['text_highlight'] != '') { |
| 93 |
$text_highlight = $_product['text_highlight']; |
| 94 |
} |
| 95 |
|
| 96 |
if (isset($_product['enable_highlight']) && $_product['enable_highlight'] != '') { |
| 97 |
$text_highlight_enabler = $_product['enable_highlight']; |
| 98 |
} |
| 99 |
|
| 100 |
$enabler = ''; |
| 101 |
if( isset($_product['enable_highlight']) && $_product['enable_highlight'] == 'on') { |
| 102 |
$enabler = 'checked'; |
| 103 |
} |
| 104 |
$pr_image = wp_get_attachment_image_src($product->get_image_id(), 'single-post-thumbnail'); |
| 105 |
$description = substr($product->get_description(), 0, 20); |
| 106 |
require WPFNL_DIR . '/admin/modules/steps/checkout/views/products.php'; |
| 107 |
} |
| 108 |
} |
| 109 |
?> |
| 110 |
|
| 111 |
</div> |
| 112 |
|
| 113 |
<?php } else { ?> |
| 114 |
<div class="accordion-head" style="display: none;"> |
| 115 |
<div class="accordion-col expand-action"></div> |
| 116 |
<div class="accordion-col product-name"><?php echo __('Product', 'wpfnl'); ?></div> |
| 117 |
<div class="accordion-col product-price"><?php echo __('Price', 'wpfnl'); ?></div> |
| 118 |
<div class="accordion-col product-quantity"><?php echo __('Quantity', 'wpfnl'); ?></div> |
| 119 |
<div class="accordion-col product-action"><?php echo __('Actions', 'wpfnl'); ?></div> |
| 120 |
</div> |
| 121 |
<div class="product-single-accordion__sortable-wrapper"> |
| 122 |
</div> |
| 123 |
<?php |
| 124 |
} |
| 125 |
} elseif (empty($products)) {?> |
| 126 |
<div class="accordion-head" style="display: none;"> |
| 127 |
<div class="accordion-col expand-action"></div> |
| 128 |
<div class="accordion-col product-name"><?php echo __('Product', 'wpfnl'); ?></div> |
| 129 |
<div class="accordion-col product-price"><?php echo __('Price', 'wpfnl'); ?></div> |
| 130 |
<div class="accordion-col product-quantity"><?php echo __('Quantity', 'wpfnl'); ?></div> |
| 131 |
<div class="accordion-col product-action"><?php echo __('Actions', 'wpfnl'); ?></div> |
| 132 |
</div> |
| 133 |
|
| 134 |
<div class="product-single-accordion__sortable-wrapper"> |
| 135 |
</div> |
| 136 |
<?php |
| 137 |
if (!$is_store_checkout) { |
| 138 |
echo '<h4 class="no-product-notice">' . __('No product added', 'wpfnl') . '</h4>'; |
| 139 |
} |
| 140 |
?> |
| 141 |
} else { |
| 142 |
?> |
| 143 |
<div class="product-single-accordion__sortable-wrapper"> |
| 144 |
</div> |
| 145 |
<?php |
| 146 |
if (!$is_store_checkout) { |
| 147 |
echo '<h4 class="no-product-notice">' . __('No product added', 'wpfnl') . '</h4>'; |
| 148 |
} |
| 149 |
} ?> |
| 150 |
|
| 151 |
</div> |
| 152 |
|
| 153 |
</div> |
| 154 |
|
| 155 |
<div class="checkout-product-options wpfnl-box"> |
| 156 |
<!-- <div class="additional-options"> |
| 157 |
<h4 class="option-title"><?php echo __('Additional Options', 'wpfnl'); ?></h4> |
| 158 |
|
| 159 |
<ul class="options-wrapper"> |
| 160 |
<li class="single-option"> |
| 161 |
<span class="wpfnl-radiobtn"> |
| 162 |
<input type="radio" name="additional-options" id="restrict-user" value=""/> |
| 163 |
<label |
| 164 |
for="restrict-user"><?php echo __('Restrict user to purchase all products', 'wpfnl'); ?></label> |
| 165 |
</span> |
| 166 |
</li> |
| 167 |
<li class="single-option"> |
| 168 |
<span class="wpfnl-radiobtn"> |
| 169 |
<input type="radio" name="additional-options" id="user-select-one-product" value=""/> |
| 170 |
<label |
| 171 |
for="user-select-one-product"><?php echo __('Let user select one product from all options', 'wpfnl'); ?></label> |
| 172 |
</span> |
| 173 |
</li> |
| 174 |
<li class="single-option"> |
| 175 |
<span class="wpfnl-radiobtn"> |
| 176 |
<input type="radio" name="additional-options" id="user-select-multiple-product" value=""/> |
| 177 |
<label |
| 178 |
for="user-select-multiple-product"><?php echo __('Let user select multiple products from all options', 'wpfnl'); ?></label> |
| 179 |
</span> |
| 180 |
</li> |
| 181 |
</ul> |
| 182 |
</div> --> |
| 183 |
|
| 184 |
<div class="variation-options"> |
| 185 |
<h4 class="option-title"><?php echo __('Additional Options', 'wpfnl'); ?></h4> |
| 186 |
|
| 187 |
<div class="options-wrapper"> |
| 188 |
<div class="wpfnl-field-wrapper"> |
| 189 |
<label> |
| 190 |
<?php echo __('Allow Use Of Coupon', 'wpfnl'); ?> |
| 191 |
<span class="wpfnl-tooltip"> |
| 192 |
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 193 |
<path d="M6 0C2.68388 0 0 2.68352 0 6C0 9.31612 2.68352 12 6 12C9.31612 12 12 9.31648 12 6C12 2.68388 9.31648 0 6 0Z" fill="#6E42D3" /> |
| 194 |
<path d="M6.18136 8.25C5.66666 8.25 5.25 8.60793 5.25 9.0375C5.25 9.4568 5.65439 9.825 6.18136 9.825C6.70834 9.825 7.125 9.4568 7.125 9.0375C7.125 8.60793 6.69607 8.25 6.18136 8.25Z" fill="white" /> |
| 195 |
<path |
| 196 |
d="M6.10214 3C4.66162 3 4 3.73543 4 4.23179C4 4.59032 4.35218 4.75578 4.64025 4.75578C5.21647 4.75578 4.98175 4.04796 6.07016 4.04796C6.60371 4.04796 7.03054 4.25017 7.03054 4.67306C7.03054 5.16943 6.43298 5.45445 6.08084 5.71179C5.77136 5.94161 5.36587 6.31851 5.36587 7.1091C5.36587 7.58706 5.51527 7.725 5.95274 7.725C6.47565 7.725 6.58234 7.52276 6.58234 7.3481C6.58234 6.87014 6.59299 6.59433 7.17986 6.19905C7.46801 6.00601 8.375 5.38091 8.375 4.51681C8.375 3.65271 7.46801 3 6.10214 3Z" |
| 197 |
fill="white" /> |
| 198 |
</svg> |
| 199 |
|
| 200 |
<p><?php echo __('Enable this option if you want to allow buyers to implement coupon codes during checkout.', 'wpfnl'); ?></p> |
| 201 |
</span> |
| 202 |
</label> |
| 203 |
|
| 204 |
<div class="wpfnl-fields"> |
| 205 |
<span class="wpfnl-checkbox no-title"> |
| 206 |
<input type="checkbox" name="enable-checkout-coupon" id="enable-checkout-coupon" <?php echo $coupon_enable_check; ?> /> |
| 207 |
<label for="enable-checkout-coupon"></label> |
| 208 |
</span> |
| 209 |
</div> |
| 210 |
</div> |
| 211 |
<!-- /field-wrapper --> |
| 212 |
|
| 213 |
<div class="wpfnl-field-wrapper"> |
| 214 |
<label> |
| 215 |
<?php echo __('Collapsible Coupon Field', 'wpfnl'); ?> |
| 216 |
<span class="wpfnl-tooltip"> |
| 217 |
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 218 |
<path d="M6 0C2.68388 0 0 2.68352 0 6C0 9.31612 2.68352 12 6 12C9.31612 12 12 9.31648 12 6C12 2.68388 9.31648 0 6 0Z" fill="#6E42D3" /> |
| 219 |
<path d="M6.18136 8.25C5.66666 8.25 5.25 8.60793 5.25 9.0375C5.25 9.4568 5.65439 9.825 6.18136 9.825C6.70834 9.825 7.125 9.4568 7.125 9.0375C7.125 8.60793 6.69607 8.25 6.18136 8.25Z" fill="white" /> |
| 220 |
<path d="M6.10214 3C4.66162 3 4 3.73543 4 4.23179C4 4.59032 4.35218 4.75578 4.64025 4.75578C5.21647 4.75578 4.98175 4.04796 6.07016 4.04796C6.60371 4.04796 7.03054 4.25017 7.03054 4.67306C7.03054 5.16943 6.43298 5.45445 6.08084 5.71179C5.77136 5.94161 5.36587 6.31851 5.36587 7.1091C5.36587 7.58706 5.51527 7.725 5.95274 7.725C6.47565 7.725 6.58234 7.52276 6.58234 7.3481C6.58234 6.87014 6.59299 6.59433 7.17986 6.19905C7.46801 6.00601 8.375 5.38091 8.375 4.51681C8.375 3.65271 7.46801 3 6.10214 3Z" fill="white" /> |
| 221 |
</svg> |
| 222 |
|
| 223 |
<p><?php echo __('Enable this to show the coupon field in a collapsible section on the checkout page.', 'wpfnl'); ?></p> |
| 224 |
</span> |
| 225 |
</label> |
| 226 |
|
| 227 |
<div class="wpfnl-fields"> |
| 228 |
<span class="wpfnl-checkbox no-title"> |
| 229 |
<input type="checkbox" name="enable-collapsible-coupon" id="enable-collapsible-coupon" <?php echo esc_attr( $collapsible_coupon_check ); ?> /> |
| 230 |
<label for="enable-collapsible-coupon"></label> |
| 231 |
</span> |
| 232 |
</div> |
| 233 |
</div> |
| 234 |
<!-- /field-wrapper --> |
| 235 |
</div> |
| 236 |
</div> |
| 237 |
</div> |
| 238 |
|