File: /home/bt667/www/wp-content/plugins/mvp_upselling/public/mvp-upselling-frontend.php
<?php
/**
* The frontend-specific functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the frontend-specific stylesheet and JavaScript.
*
* @since 1.1.0
* @package MVP Upselling
* @subpackage MVP Upselling/includes
* @author Rohit Sharma
*/
class MVP_Upselling_Frontend
{
private $plugin_name, $version;
public function __construct($WPLI, $version)
{
$this->plugin_name = $WPLI;
$this->version = $version;
$this->helper = new MVP_Upselling_Helper();
add_action('wp_enqueue_scripts', array($this, 'mvp_upselling_frontend_scripts'));
// Shortcode
add_shortcode('MVP_Upselling_Offer', array($this, 'mvp_upselling_onetime_offer'));
add_shortcode('MVP_Upselling_Agency', array($this, 'mvp_upselling_agency'));
add_shortcode('MVP_Upselling_one_license', array($this, 'MVP_Upselling_one_license'));
add_shortcode('MVP_Upselling_three_license', array($this, 'MVP_Upselling_three_license'));
add_shortcode('MVP_Upselling_five_license', array($this, 'MVP_Upselling_five_license'));
add_shortcode('MVP_Upselling_corporate_license', array($this, 'MVP_Upselling_corporate_license'));
add_shortcode('MVP_Upselling_no_corporate_license', array($this, 'MVP_Upselling_no_corporate_license'));
add_shortcode('MVP_Upselling_AWeber_form', array($this, 'MVP_Upselling_AWeber_form'));
add_shortcode('MVP_Upselling_purchase_confirmation_form', array($this, 'MVP_Upselling_purchase_confirmation_form'));
remove_action('woocommerce_proceed_to_checkout', array($this, 'woocommerce_button_proceed_to_checkout'), 20);
add_action('woocommerce_proceed_to_checkout', array($this, 'change_url_to_checkout'), 20);
add_action('wp_ajax_mvp_upseller_addtocart', array($this, 'mvp_upseller_addtocart'));
add_action('wp_ajax_nopriv_mvp_upseller_addtocart', array($this, 'mvp_upseller_addtocart'));
add_action('wp_ajax_mvp_upseller_awberdetail', array($this, 'mvp_upseller_awberdetail'));
add_action('wp_ajax_nopriv_mvp_upseller_awberdetail', array($this, 'mvp_upseller_awberdetail'));
}
public function mvp_upselling_frontend_scripts()
{
wp_enqueue_style('mvp-upselling-custom-css', MVP_UPSELLING_APP_URL . 'public/assets/css/frontend_css.css?ts="' . time() . '"');
wp_enqueue_script('mvp-upselling-frontend-js', MVP_UPSELLING_APP_URL . 'public/assets/js/main.js?ts="' . time() . '"', array('jquery'), false, true);
wp_localize_script('mvp-upselling-frontend-js', 'mvp_upsellinbg_frontend_ajax_object', ['ajax_url' => admin_url('admin-ajax.php')]);
}
public function testing()
{
$current_user_data = json_decode($_SESSION['edd']['edd_purchase']);
$current_user = $current_user_data->post_data;
$user = $current_user->edd_first;
$email = $current_user->edd_email;
$pass = 'admin123';
if (!is_user_logged_in() && !email_exists($email)) {
$user_id = wp_create_user($user, $pass, $email);
// $to = $email;
// $subject = 'New Registration';
// $body = 'User:'.$user;
// $body .= 'Email:'.$email;
// $body .= 'Password:'.$pass;
// $headers = array('Content-Type: text/html; charset=UTF-8','From: Marketers Video player '.get_option('admin_email'));
// echo wp_mail( $to, $subject, $body, $headers );exit;
$user_data = get_userdata($user_id);
$name = $user_data->data->display_name;
$from_name = edd_get_option('from_name', wp_specialchars_decode('Registration', ENT_QUOTES));
$from_email = edd_get_option('from_email', get_bloginfo('admin_email'));
$subject = apply_filters('edd_user_registration_email_subject', __('New Registration your account', 'easy-digital-downloads'), $user_data->ID);
$heading = apply_filters('edd_user_registration_email_heading', __('New Registration your account', 'easy-digital-downloads'), $user_data->ID);
$message = __('Hello ' . $name, 'easy-digital-downloads') . "\n\n";
$message .= __('Thank you for registering with Marketers Video Player.', 'easy-digital-downloads') . "\n\n";
$message .= __("Email:") . "$email" . "\n\n";
$message .= __("Password:") . "$pass" . "\n\n";
//require_once(MARKETING_VIDEO_PATH.'includes/email/class-edd-emails.php');
$emails = EDD()->emails;
$emails->__set('from_name', $from_name);
$emails->__set('from_email', $from_email);
$emails->__set('heading', $heading);
$emails->send($user_data->data->user_email, $subject, $message);
}
}
public function check_current_url()
{
global $wp, $post;
$page_title = strtolower($post->post_title);
if ((!is_user_logged_in()) && ('mvp-dnld' == $page_title)) {
$login_url = wp_login_url(get_permalink());
wp_redirect($login_url);
exit;
}
}
public function MVP_Upselling_purchase_confirmation_form()
{
ob_start();
global $wpdb;
define('SLM_TBL_LICENSE_KEYS', $wpdb->prefix . 'lic_key_tbl');
$tbl_name = SLM_TBL_LICENSE_KEYS;
$tbl_orders = $wpdb->prefix . 'edd_orders';
if (isset($_REQUEST['email'])) {
$email = $_REQUEST['email'];
$order_sql_prep = $wpdb->prepare("SELECT * FROM $tbl_orders WHERE `email` = '$email' AND status = 'complete' Order by id desc Limit 1");
$order_record = $wpdb->get_row($order_sql_prep, OBJECT);
$order_license_sql_prep = $wpdb->prepare("SELECT * from $tbl_name WHERE `email`= '$order_record->email' Order by id desc Limit 1");
$order_license_record = $wpdb->get_row($order_license_sql_prep, OBJECT);
$license_key = $order_license_record->license_key;
$domain = $order_license_record->domain;
$username = $order_license_record->first_name . ' ' . $order_license_record->last_name;
$firstName = $order_license_record->first_name;
$items = edd_get_order($order_record->id);
$order_items = edd_get_order_items(array(
'order_id' => $order_record->id,
'number' => 999,
));
$filekey = 1;
foreach ($order_items as $item) {
$download_files = edd_get_download_files($item->product_id, $item->price_id);
$_items = array(
'download_link' => esc_html(edd_get_download_file_url($order_record->payment_key, $order_record->email, $filekey, $item->product_id, $item->price_id)),
'download_name' => esc_html('Download')
);
}
$order_id = $order_record->id;
$tbl_order_name = $wpdb->prefix . 'edd_order_transactions';
$order_sql_prep = $wpdb->prepare("SELECT * FROM $tbl_order_name WHERE `object_id` = %s", $order_id);
$order_record = $wpdb->get_row($order_sql_prep, OBJECT);
$sql_prep = $wpdb->prepare("SELECT * FROM $tbl_name WHERE email = '" . $email . "' Order By id desc Limit 1");
$record = $wpdb->get_row($sql_prep, OBJECT);
if ((isset($record->license_key)) && (!empty($record->domain))) {
$transaction_id = $order_record->transaction_id;
$edd_action_license_key = $record->license_key;
$domain = $record->domain;
$execute = $wpdb->query("UPDATE $tbl_name SET `txn_id` = '$transaction_id',`order_id`= $order_id, `domain`= '$domain' WHERE `license_key` = '$edd_action_license_key'");
} elseif ((!empty($record->license_key))) {
$transaction_id = $order_record->transaction_id;
$edd_action_license_key = $record->license_key;
$execute = $wpdb->query("UPDATE $tbl_name SET `txn_id` = '$transaction_id',`order_id`= $order_id WHERE `license_key` = '$edd_action_license_key'");
} else {
$edd_action_license_key = '';
}
?>
<table id="edd_purchase_receipt_confirmation" class="edd-table">
<thead>
<th><?php esc_html_e('Order ID', 'easy-digital-downloads');?></th>
<th><?php esc_html_e('Customer email', 'easy-digital-downloads');?></th>
<th><?php esc_html_e('Price', 'easy-digital-downloads');?></th>
<th><?php esc_html_e('Licenses Key', 'easy-digital-downloads');?></th>
<th><?php esc_html_e('Domain Name', 'easy-digital-downloads');?></th>
<th><?php esc_html_e('Payment Method', 'easy-digital-downloads');?></th>
<th><?php esc_html_e('Action', 'easy-digital-downloads');?></th>
<th><?php esc_html_e('Purchase Date', 'easy-digital-downloads');?></th>
</thead>
<tbody>
<tr>
<td>
<div class="edd_purchase_receipt_product_name"><?php echo $items->order_number; ?></div>
</td>
<td>
<div class="customer column-customer edd_purchase_receipt_product_name">
<span style="font-size: .85em;color: #888;"><?php echo $items->email; ?></span>
</div>
</td>
<td>
<?php echo esc_html(edd_display_amount($items->total, $items->currency)) ?></td>
<td>
<div class="clipboard">
<input onclick="copyvideocodelicense_key()" class="copy-input" value="<?php echo $license_key ?>" id="copyClipboardVideolicense_key" readonly="" style="font-size: 18px;width: auto;border: 0px">
<button class="copyButton" id="copyButtonlicense_key" >Copy</button>
</div>
<div id="copied-success" class="copied">
<span>Copied!</span>
</div>
</td>
<td>
<?php
$implode_domain = [];
$domain_strs = explode(",", $domain);
if (!empty($domain_strs)) {
$domain = '';
foreach ($domain_strs as $domain_str) {
$domain .= $domain_str . '<br/>';
}
echo $domain;
}
?>
</td>
<td>
<div class="edd_purchase_receipt_product_name"><?php echo edd_get_gateway_admin_label($order_record->gateway) ?></div>
</td>
<td>
<a href="<?php echo esc_url($download_files[1]['file']); ?>" class="edd_download_file_link" style="color: #0275d8;"><?php echo esc_html($_items['download_name']); ?></a>
</td>
<td class="date column-date">
<time datetime="<?php echo $items->date_created ?>"><?php echo gmdate("M j, Y, g:i O", strtotime($items->date_created)); ?></time>
</td>
</tr>
</tbody>
</table>
<?php
$payment_id = $order_id;
if (is_null($payment)) {
$payment = edd_get_payment($payment_id);
}
$tbl_orders = $wpdb->prefix . 'edd_orders';
$to_email = $_GET['email'];
$order_sql_prep = $wpdb->prepare("SELECT * FROM $tbl_orders WHERE `email` = '$to_email' AND is_email = 0 Order by id desc Limit 1");
$order_record = $wpdb->get_row($order_sql_prep, OBJECT);
if (isset($order_record)) {
$payment_data = $payment->get_meta('_edd_payment_meta', true);
$from_name = edd_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
$from_name = apply_filters('edd_purchase_from_name', $from_name, $payment_id, $payment_data);
$subject = edd_get_option('purchase_subject', __('Purchase Receipt', 'easy-digital-downloads'));
$subject = apply_filters('edd_purchase_subject', wp_strip_all_tags($subject), $payment_id);
$subject = wp_specialchars_decode(edd_do_email_tags($subject, $payment_id));
$heading = edd_get_option('purchase_heading', __('Purchase Receipt', 'easy-digital-downloads'));
$heading = apply_filters('edd_purchase_heading', $heading, $payment_id, $payment_data);
$heading = edd_do_email_tags($heading, $payment_id);
$attachments = apply_filters('edd_receipt_attachments', array(), $payment_id, $payment_data);
$email_body_content = edd_get_email_body_content($payment_id, $payment_data);
$message = edd_do_email_tags($email_body_content, $payment_id);
$emails = EDD()->emails;
$emails->__set('from_name', $from_name);
$emails->__set('from_email', $from_email);
$emails->__set('heading', $heading);
$headers = apply_filters('edd_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
$emails->__set('headers', $headers);
$sent = $emails->send($to_email, $subject, $message, $attachments);
$order_sql_update = $wpdb->query($wpdb->prepare("UPDATE $tbl_orders SET is_email= 1 WHERE `email`='$to_email'"));
}
}
return ob_get_clean();
}
public function MVP_Upselling_AWeber_form()
{
ob_start();
?>
<form method="post" class="af-form-wrapper" id="mvp_aweber_form_upselling" action="" enctype="multipart/form-data">
<div id="af-form-aweber" class="af-form">
<div id="af-body-aweber" class="af-body af-standards">
<div class="af-element">
<label class="previewLabel" for="awf_field-114827845">Name: </label>
<div class="af-textWrap">
<input id="awf_field-114827845" type="text" name="fname" class="awf_field_text" value="" required/>
</div>
<div class="af-clear"></div>
</div>
<div class="af-element">
<label class="previewLabel" for="awf_field-114827846">Email: </label>
<div class="af-textWrap">
<input class="awf_field_email" id="awf_field-114827846" type="text" name="email" value="" required/>
</div>
<div class="af-clear"></div>
</div>
<div class="af-element buttonContainer">
<input name="submit" id="presentation_setting_button_submit" class="submit" type="submit" value="Send Me MVP Download Infromation NOW!" />
</div>
</div>
</div>
</form>
<?php
return ob_get_clean();
}
public function MVP_Upselling_one_license()
{
ob_start();
echo '<a href="' . esc_url(edd_get_checkout_uri()) . '" class="elementor-button elementor-size-sm" role="button"><span class="elementor-button-content-wrapper"><span class="elementor-button-text">' . esc_html('No, ALL I NEED IS ONE SITE') . ' </span></span></a>';
return ob_get_clean();
}
public function MVP_Upselling_no_corporate_license()
{
ob_start();
echo '<a href="' . esc_url(edd_get_checkout_uri()) . '" class="elementor-button elementor-size-sm" role="button"><span class="elementor-button-content-wrapper"><span class="elementor-button-text">' . esc_html('No, 5 Site License is all need and I dont need the %50 Discount fir Agency License') . ' </span></span></a>';
return ob_get_clean();
}
public function MVP_Upselling_three_license()
{
ob_start();
echo '<a href="#" data-nonce="' . wp_create_nonce('edd-add-to-cart-1371 ') . '" class="elementor-button elementor-size-sm edd-add-to-cart button blue edd-submit edd-has-js" data-action="edd_add_to_cart" data-download-id="1371" data-variable-price="no" data-price-mode="single" data-price="67.00" role="button"><span class="elementor-button-content-wrapper"><span class="elementor-button-text">' . esc_html('I want 3 site license') . ' </span></span></a>';
echo '<a href="' . esc_url(edd_get_checkout_uri()) . '" class="elementor-button edd_go_to_checkout button blue edd-submit" style="display:none;">Checkout</a>';
return ob_get_clean();
}
public function MVP_Upselling_five_license()
{
ob_start();
echo '<a href="#" data-nonce="' . wp_create_nonce('edd-add-to-cart-1373 ') . '" class="elementor-button elementor-size-sm edd-add-to-cart button blue edd-submit edd-has-js" data-action="edd_add_to_cart" data-download-id="1373" data-variable-price="no" data-price-mode="single" data-price="97.00" role="button"><span class="elementor-button-content-wrapper"><span class="elementor-button-text">' . esc_html('I want 5 site license') . ' </span></span></a>';
echo '<a href="https://marketersvideoplayer.com/agency-license-2/" class="elementor-button edd_go_to_checkout button blue edd-submit" style="display:none;">Checkout</a>';
return ob_get_clean();
}
public function MVP_Upselling_corporate_license()
{
ob_start();
echo '<a href="#" data-nonce="' . wp_create_nonce('edd-add-to-cart-1727 ') . '" class="elementor-button-link elementor-button elementor-size-xl edd-add-to-cart button blue edd-submit edd-has-js" data-action="edd_add_to_cart" data-download-id="1727" data-variable-price="no" data-price-mode="single" data-price="197.00" role="button"><span class="elementor-button-content-wrapper"><span class="elementor-button-text">' . esc_html('I want the Agency License ') . ' </span></span></a>';
echo '<a href="' . esc_url(edd_get_checkout_uri()) . '" class="elementor-button edd_go_to_checkout button blue edd-submit" style="display:none;">Checkout</a>';
return ob_get_clean();
}
public function mvp_upseller_awberdetail()
{
if (isset($_REQUEST['name']) && (isset($_REQUEST['email']))) {
require_once MARKETING_VIDEO_PATH . 'includes/aweber_api/aweber_api.php';
$Aweber_Setting = json_decode(json_encode(get_option('edd_settings')));
$AWeberListID = $Aweber_Setting->AWeberListID;
$consumerKey = "AzP5OVmPcAke53vScv47jbld";
$consumerSecret = "mddHs2YEupzEdC6GKskckd7DbMNLvE1m0V7NT3TQ";
$accessKey = "AgSrwJFkPoEyCFmCNJ3K3lBr";
$accessSecret = "HK5WTZd6QTaRPNI57fa95meokYweA3a71iA7H1yH";
$aweber = new AWeberAPI($consumerKey, $consumerSecret);
try {
$account = $aweber->getAccount($accessKey, $accessSecret);
$params = array(
'email' => $_REQUEST['email'],
'mvp_name' => $_REQUEST['name'],
'ad_tracking' => 'Wordpress',
);
$account_id = $account->data['id'];
$listURL = "/accounts/{$account_id}/lists/{$AWeberListID}/subscribers";
$subscribers = $account->loadFromUrl($listURL);
$new_subscriber = $subscribers->create($params);
$confirm_purchase = get_option('siteurl') . '/confirm-your-purchase/';
$genre_url = add_query_arg('email', $new_subscriber->data['email'], $confirm_purchase);
$response['autoresponder_message'] = 'Aweber Success';
$response['autoresponder_success'] = 1;
$response['redirect'] = $genre_url;
} catch (Exception $e) {
$confirm_purchase = get_option('siteurl') . '/mvp-dlnld/?email=' . $_REQUEST['email'] . '&from=' . $_REQUEST['email'] . '&mvp_name=' . $_REQUEST['name'] . '&meta_adtracking=wordpress&meta_message=0&unit=awlist6361713';
$headers[] = 'Content-Type: text/html; charset=UTF-8';
$headers[] = 'From: ' . get_bloginfo('name') . ' <' . get_bloginfo('admin_email') . '>';
$message = "<div style='max-width: 500px;margin: auto;border: 1px solid #e1e7ea;border-radius: 3px;padding: 30px;color: #546a78;font-size: 18px;line-height: 24px;'>";
$message.= "<p>Please click the button below to confirm that you have purchased MVP Video Player Plugin. We need to make sure it was you that made this";
$message.= "purchase, and so we can send you the download information and future information on MVP and upcoming products in development.</p>";
$message.= "<a href='" . $confirm_purchase . "' style='margin: 0 auto;width: fit-content;border-collapse: collapse!important;background-color: #0d5586;border: 1px solid #0d5586;border-radius: 5px;color: #ffffff!important;display: block;font-family: Helvetica,Arial,sans-serif;letter-spacing: 1.3px;line-height: 24px;text-align: center;text-decoration: none!important;font-size: 20px;padding: 15px 20px 15px 20px;'>View Order Details</a>";
$message.= "<p>Thank you!</p><p>Bobby.T</p><p><a href='https://marketersvideoplayer.com'>https://marketersvideoplayer.com</a></p></div>";
$subject = "Response Required: Please confirm your purchase of MVP Plugin";
try {
if ( ! wp_mail($_REQUEST['email'], $subject, $message, $headers) ) {
throw new Exception('wp_mail failed');
}
} catch (Exception $e) {
echo "Exception: " . $e->getMessage() . "<br>";
}
$confirm_purchase = get_option('siteurl') . '/confirm-your-purchase/';
$genre_url = add_query_arg('email', $_REQUEST['email'], $confirm_purchase);
if ($e->message == "email: Subscriber already subscribed.") {
$response['autoresponder_message'] = 'Aweber Success';
$response['autoresponder_success'] = 1;
$response['redirect'] = $genre_url;
} else {
$response['autoresponder_message'] = $e->message;
$response['autoresponder_success'] = 0;
}
}
// require_once(MARKETING_VIDEO_PATH.'includes/mailchimp/vendor/autoload.php' );
// $mempremailprd_mailchimp_api = json_decode(json_encode(get_option('edd_settings')));
// $server_prefix = explode('-',$mempremailprd_mailchimp_api->mailchimp_api_key);
// $MAILCHIMPAPIKEY = $mempremailprd_mailchimp_api->mailchimp_api_key;
// $MAILCHIMPPREFIX = $server_prefix[1];
// $list_id = $_POST['list'];
// $apiKey = $MAILCHIMPAPIKEY;
// $username = 'user';
// $memberId = md5(strtolower($_POST['email']));
// $dataCenter = substr($apiKey, strpos($apiKey, '-') + 1);
// $mailchimpurl = 'https://' . $dataCenter . '.api.mailchimp.com/3.0/lists/' . $list_id . '/members/' . $memberId;
// $body = [
// 'email_address' => $_POST['email'],
// 'status' => 'subscribed',
// 'merge_fields' => [
// 'FNAME' => $_POST['name']
// ]
// ];
// $auth = base64_encode( 'user'.':'. $apiKey );
// $headers = ['Content-Type: application/json', 'Authorization' => "Basic $auth"];
// $api_response = wp_remote_post( $mailchimpurl, array(
// 'method' => 'PUT',
// 'headers' => $headers,
// 'httpversion' => '1.0',
// 'sslverify' => false,
// 'body' => json_encode($body))
// );
// $response['autoresponder_message'] = 'Mailchimp Success';
// $response['autoresponder_success'] = 1;
}
echo json_encode($response);exit;
}
public function mvp_upseller_addtocart()
{
$product_id = $_POST['product_id']; //Product ID
$quantity = $_POST['product_quantity']; //Product QTY
$prod_name = $_POST['product_name']; //Product Name
$product_price = $_POST['product_price']; //Product Name
if ($product_id == 2021) {
WC()->cart->empty_cart();
}
if ($product_id != 2013) {
$addtocart = WC()->cart->add_to_cart($product_id, $quantity);
$response['agency_url'] = '/agency-license';
} else {
$response['agency_url'] = wc_get_checkout_url();
}
$response['success'] = 1;
$response['message'] = 'Add ' . $prod_name . ' to your cart';
$response['product_id'] = $product_id;
echo json_encode($response);
exit;
}
public function change_url_to_checkout()
{
$url = 'special-one-time-offer';
?>
<a href="<?php echo $url; ?>" class="button alt wc-forward"><?php _e('Proceed to Checkout', 'woocommerce');?></a>
<?php
}
public function mvp_upselling_agency()
{
ob_start();
$args = array(
'post_type' => 'product',
'post_status' => 'publish',
'post__in' => array(2021, 2013),
);
$the_query = new WP_Query($args);
if ($the_query->have_posts()) {
?>
<div class="price-container">
<div class="d_flex">
<?php
while ($the_query->have_posts()) {
$the_query->the_post();
?>
<div class="plan-box2">
<div class="top-head">
<?php if (get_the_ID() == 2013) {
echo esc_html_e('No Thank you, Single Site is all i need');
} else {
echo get_the_title();
}?>
</div>
<div class="price-main">
<sup>$</sup>
<span class="price-big">
<?php echo get_post_meta(get_the_ID(), '_price', true); ?>
</span>
</div>
<ul class="elementor-price-table__features-list">
<li class="">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 292 291" enable-background="new 0 0 292 291" xml:space="preserve">
<g>
<path fill="#7A7A7A" d="M146.1,4.6C222.9,4.4,285.8,67,286,143.8c0.2,77.1-62.6,140.1-139.6,140.1C69.3,284.1,6.5,221.2,6.5,144.1
C6.6,67.2,69,4.8,146.1,4.6z M264.5,144.1c-0.2-65.5-53-118.2-118.4-118.1C80.7,26.1,27.9,79,28,144.4c0.1,65.4,53,118.1,118.4,118
C211.9,262.3,264.6,209.4,264.5,144.1z"/>
<path fill="#7A7A7A" d="M124.9,201c-16.4-16.4-33.1-33-49.8-49.6c4.6-4.4,9.5-9.1,14.3-13.8c11.2,11.3,22.8,23,34.6,34.9
c26.6-26.7,52.6-52.6,78.6-78.7c5.2,5.5,9.9,10.5,14.3,15.1C186.4,139.5,155.4,170.5,124.9,201z"/>
</g>
</svg>
<span class="elementor-inline-editing" data-elementor-setting-key="features_list.0.item_text">List Item #1</span>
</li>
<li class="">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 292 291" enable-background="new 0 0 292 291" xml:space="preserve">
<g>
<path fill="#7A7A7A" d="M146.1,4.6C222.9,4.4,285.8,67,286,143.8c0.2,77.1-62.6,140.1-139.6,140.1C69.3,284.1,6.5,221.2,6.5,144.1
C6.6,67.2,69,4.8,146.1,4.6z M264.5,144.1c-0.2-65.5-53-118.2-118.4-118.1C80.7,26.1,27.9,79,28,144.4c0.1,65.4,53,118.1,118.4,118
C211.9,262.3,264.6,209.4,264.5,144.1z"/>
<path fill="#7A7A7A" d="M124.9,201c-16.4-16.4-33.1-33-49.8-49.6c4.6-4.4,9.5-9.1,14.3-13.8c11.2,11.3,22.8,23,34.6,34.9
c26.6-26.7,52.6-52.6,78.6-78.7c5.2,5.5,9.9,10.5,14.3,15.1C186.4,139.5,155.4,170.5,124.9,201z"/>
</g>
</svg>
<span class="elementor-inline-editing" data-elementor-setting-key="features_list.0.item_text">List Item #1</span>
</li>
<li class="">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 292 291" enable-background="new 0 0 292 291" xml:space="preserve">
<g>
<path fill="#7A7A7A" d="M146.1,4.6C222.9,4.4,285.8,67,286,143.8c0.2,77.1-62.6,140.1-139.6,140.1C69.3,284.1,6.5,221.2,6.5,144.1
C6.6,67.2,69,4.8,146.1,4.6z M264.5,144.1c-0.2-65.5-53-118.2-118.4-118.1C80.7,26.1,27.9,79,28,144.4c0.1,65.4,53,118.1,118.4,118
C211.9,262.3,264.6,209.4,264.5,144.1z"/>
<path fill="#7A7A7A" d="M124.9,201c-16.4-16.4-33.1-33-49.8-49.6c4.6-4.4,9.5-9.1,14.3-13.8c11.2,11.3,22.8,23,34.6,34.9
c26.6-26.7,52.6-52.6,78.6-78.7c5.2,5.5,9.9,10.5,14.3,15.1C186.4,139.5,155.4,170.5,124.9,201z"/>
</g>
</svg>
<span class="elementor-inline-editing" data-elementor-setting-key="features_list.0.item_text">List Item #1</span>
</li>
<li class="">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 292 291" enable-background="new 0 0 292 291" xml:space="preserve">
<g>
<path fill="#7A7A7A" d="M146.1,4.6C222.9,4.4,285.8,67,286,143.8c0.2,77.1-62.6,140.1-139.6,140.1C69.3,284.1,6.5,221.2,6.5,144.1
C6.6,67.2,69,4.8,146.1,4.6z M264.5,144.1c-0.2-65.5-53-118.2-118.4-118.1C80.7,26.1,27.9,79,28,144.4c0.1,65.4,53,118.1,118.4,118
C211.9,262.3,264.6,209.4,264.5,144.1z"/>
<path fill="#7A7A7A" d="M124.9,201c-16.4-16.4-33.1-33-49.8-49.6c4.6-4.4,9.5-9.1,14.3-13.8c11.2,11.3,22.8,23,34.6,34.9
c26.6-26.7,52.6-52.6,78.6-78.7c5.2,5.5,9.9,10.5,14.3,15.1C186.4,139.5,155.4,170.5,124.9,201z"/>
</g>
</svg>
<span class="elementor-inline-editing" data-elementor-setting-key="features_list.0.item_text">List Item #1</span>
</li>
</ul>
<?php if (get_the_ID() == 2013) {?>
<a href="<?php echo wc_get_checkout_url(); ?>" class="btn-theme">
<?php esc_html_e('Proceed To Checkout');?>
</a>
<?php } else {?>
<a href="#" class="btn-theme mvp_upseller_add_to_cart_button" id="mvp_upseller_add_to_cart_button_<?php echo get_the_ID(); ?>" data-product_id="<?php echo get_the_ID(); ?>" data-product_name="<?php echo get_the_title(); ?>" data-product_price="<?php echo get_post_meta(get_the_ID(), '_price', true); ?>">
<?php esc_html_e('Purchase');?>
</a>
<?php }?>
</div>
<?php
}
?>
</div>
</div>
<div class="success-container hide">
<div class="row">
<div class="modalbox success col-sm-8 col-md-6 col-lg-5 center animate">
<div class="icon">
<img src="<?php echo MVP_UPSELLING_APP_URL . 'public/assets/images/checked.png'; ?>" class="img" style="width: 100px;" />
</div>
<a class="close popup-close">×</a>
<h1><?php esc_html_e('Success!');?></h1>
<p><?php esc_html_e('MVP Five License have been added to cart');?></p>
<a href="<?php echo wc_get_checkout_url(); ?>" class="btn-theme">
<?php esc_html_e('Proceed To Checkout');?>
</a>
</div>
</div>
</div>
<?php
} else {
// no posts found
}
/* Restore original Post Data */
wp_reset_postdata();
return ob_get_clean();
}
public function mvp_upselling_onetime_offer()
{
ob_start();
$args = array(
'post_type' => 'product',
'post_status' => 'publish',
'post__in' => array(2019, 2020, 2013),
);
$the_query = new WP_Query($args);
if ($the_query->have_posts()) {
?>
<div class="price-container">
<div class="d_flex">
<?php
while ($the_query->have_posts()) {
$the_query->the_post();
?>
<div class="plan-box2">
<div class="top-head">
<?php if (get_the_ID() == 2013) {
echo esc_html_e('No Thank you, Single Site is all i need');
} else {
echo get_the_title();
}?>
</div>
<div class="price-main">
<sup>$</sup>
<span class="price-big">
<?php echo get_post_meta(get_the_ID(), '_price', true); ?>
</span>
</div>
<ul class="elementor-price-table__features-list">
<li class="">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 292 291" enable-background="new 0 0 292 291" xml:space="preserve">
<g>
<path fill="#7A7A7A" d="M146.1,4.6C222.9,4.4,285.8,67,286,143.8c0.2,77.1-62.6,140.1-139.6,140.1C69.3,284.1,6.5,221.2,6.5,144.1
C6.6,67.2,69,4.8,146.1,4.6z M264.5,144.1c-0.2-65.5-53-118.2-118.4-118.1C80.7,26.1,27.9,79,28,144.4c0.1,65.4,53,118.1,118.4,118
C211.9,262.3,264.6,209.4,264.5,144.1z"/>
<path fill="#7A7A7A" d="M124.9,201c-16.4-16.4-33.1-33-49.8-49.6c4.6-4.4,9.5-9.1,14.3-13.8c11.2,11.3,22.8,23,34.6,34.9
c26.6-26.7,52.6-52.6,78.6-78.7c5.2,5.5,9.9,10.5,14.3,15.1C186.4,139.5,155.4,170.5,124.9,201z"/>
</g>
</svg>
<span class="elementor-inline-editing" data-elementor-setting-key="features_list.0.item_text">List Item #1</span>
</li>
<li class="">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 292 291" enable-background="new 0 0 292 291" xml:space="preserve">
<g>
<path fill="#7A7A7A" d="M146.1,4.6C222.9,4.4,285.8,67,286,143.8c0.2,77.1-62.6,140.1-139.6,140.1C69.3,284.1,6.5,221.2,6.5,144.1
C6.6,67.2,69,4.8,146.1,4.6z M264.5,144.1c-0.2-65.5-53-118.2-118.4-118.1C80.7,26.1,27.9,79,28,144.4c0.1,65.4,53,118.1,118.4,118
C211.9,262.3,264.6,209.4,264.5,144.1z"/>
<path fill="#7A7A7A" d="M124.9,201c-16.4-16.4-33.1-33-49.8-49.6c4.6-4.4,9.5-9.1,14.3-13.8c11.2,11.3,22.8,23,34.6,34.9
c26.6-26.7,52.6-52.6,78.6-78.7c5.2,5.5,9.9,10.5,14.3,15.1C186.4,139.5,155.4,170.5,124.9,201z"/>
</g>
</svg>
<span class="elementor-inline-editing" data-elementor-setting-key="features_list.0.item_text">List Item #1</span>
</li>
<li class="">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 292 291" enable-background="new 0 0 292 291" xml:space="preserve">
<g>
<path fill="#7A7A7A" d="M146.1,4.6C222.9,4.4,285.8,67,286,143.8c0.2,77.1-62.6,140.1-139.6,140.1C69.3,284.1,6.5,221.2,6.5,144.1
C6.6,67.2,69,4.8,146.1,4.6z M264.5,144.1c-0.2-65.5-53-118.2-118.4-118.1C80.7,26.1,27.9,79,28,144.4c0.1,65.4,53,118.1,118.4,118
C211.9,262.3,264.6,209.4,264.5,144.1z"/>
<path fill="#7A7A7A" d="M124.9,201c-16.4-16.4-33.1-33-49.8-49.6c4.6-4.4,9.5-9.1,14.3-13.8c11.2,11.3,22.8,23,34.6,34.9
c26.6-26.7,52.6-52.6,78.6-78.7c5.2,5.5,9.9,10.5,14.3,15.1C186.4,139.5,155.4,170.5,124.9,201z"/>
</g>
</svg>
<span class="elementor-inline-editing" data-elementor-setting-key="features_list.0.item_text">List Item #1</span>
</li>
<li class="">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 292 291" enable-background="new 0 0 292 291" xml:space="preserve">
<g>
<path fill="#7A7A7A" d="M146.1,4.6C222.9,4.4,285.8,67,286,143.8c0.2,77.1-62.6,140.1-139.6,140.1C69.3,284.1,6.5,221.2,6.5,144.1
C6.6,67.2,69,4.8,146.1,4.6z M264.5,144.1c-0.2-65.5-53-118.2-118.4-118.1C80.7,26.1,27.9,79,28,144.4c0.1,65.4,53,118.1,118.4,118
C211.9,262.3,264.6,209.4,264.5,144.1z"/>
<path fill="#7A7A7A" d="M124.9,201c-16.4-16.4-33.1-33-49.8-49.6c4.6-4.4,9.5-9.1,14.3-13.8c11.2,11.3,22.8,23,34.6,34.9
c26.6-26.7,52.6-52.6,78.6-78.7c5.2,5.5,9.9,10.5,14.3,15.1C186.4,139.5,155.4,170.5,124.9,201z"/>
</g>
</svg>
<span class="elementor-inline-editing" data-elementor-setting-key="features_list.0.item_text">List Item #1</span>
</li>
</ul>
<?php if (get_the_ID() == 2013) {?>
<a href="<?php echo wc_get_checkout_url(); ?>" class="btn-theme">
<?php esc_html_e('Proceed To Checkout');?>
</a>
<?php } else {?>
<a href="#" class="btn-theme mvp_upseller_add_to_cart_button" id="mvp_upseller_add_to_cart_button_<?php echo get_the_ID(); ?>" data-product_id="<?php echo get_the_ID(); ?>" data-product_name="<?php echo get_the_title(); ?>" data-product_price="<?php echo get_post_meta(get_the_ID(), '_price', true); ?>">
<?php esc_html_e('Purchase');?>
</a>
<?php }?>
</div>
<?php
}
?>
</div>
</div>
<div class="success-container hide">
<div class="row">
<div class="modalbox success col-sm-8 col-md-6 col-lg-5 center animate">
<div class="icon">
<img src="<?php echo MVP_UPSELLING_APP_URL . 'public/assets/images/checked.png'; ?>" class="img" style="width: 100px;" />
</div>
<a class="close popup-close">×</a>
<h1><?php esc_html_e('Success!');?></h1>
<p><?php esc_html_e('MVP Five License have been added to cart');?></p>
<a href="<?php echo (get_site_url() . '/agency-license/'); ?>" class="btn-theme">
<?php esc_html_e('Proceed To Checkout');?>
</a>
</div>
</div>
</div>
<?php
} else {
// no posts found
}
/* Restore original Post Data */
wp_reset_postdata();
return ob_get_clean();
}
}
new MVP_Upselling_Frontend('MVP Upselling', '2.0.0');