function widget($args, $instance) { global $wpdb; $user_id = get_current_user_id(); $page_name = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_title ='" . get_option('wkmp_seller_login_page_tile') . "'"); $seller_info = $wpdb->get_var("SELECT user_id FROM " . $wpdb->prefix . "mpsellerinfo WHERE user_id = '" . $user_id . "' and seller_value='1'"); if ($seller_info > 0) { do_action('chat_with_me'); echo '<div class="wk_seller"><h2>' . get_option('wkmp_seller_menu_tile') . '</h2>'; echo '<ul class="wk_sellermenu">'; echo '<li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=mpProfile">My Profile</a></li> <li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=Product">Add Product</a></li> <li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=List">Product List</a></li> <li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=History">Order History</a></li> <li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=Dashboard">Dashboard</a></li> <li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=payment">My Payments</a></li> <li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=epschg">Change Password</a></li> <li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=To">Ask To Admin</a></li> <li class="selleritem"><a href="' . wp_logout_url() . '" title="Logout">Logout</a></li> </ul></div>'; } if ($user_id > 0 && $seller_info == 0) { echo '<div class="wk_seller"><h2>Buyer Menu</h2>'; echo '<ul class="wk_sellermenu">'; echo '<li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=mpProfile">My Profile</a></li> <li class="selleritem"><a href="' . wp_logout_url() . '" title="Logout">Logout</a></li>
function seller_profile($atts) { global $wpdb; $obj_mp20 = new MP_Form_Handler(); $obj_mp20->profile_edit_redirection(); $current_user = wp_get_current_user(); $table_users = $wpdb->prefix . "users"; $table_seller = $wpdb->prefix . "mpsellerinfo"; $myrows = $wpdb->get_results("SELECT u.*,s.* FROM " . $table_users . " u join " . $table_seller . " s on s.user_id=u.ID where u.ID='{$current_user->ID}'"); $user_rows = $wpdb->get_results("select um.meta_key,um.meta_value from {$wpdb->usermeta} um where um.user_id='{$current_user->ID}'"); $user_meta = array(); foreach ($user_rows as $value) { $user_meta[$value->meta_key] = $value->meta_value; } $avatar = $obj_mp20->get_user_avatar($current_user->ID, 'avatar'); echo '<section id="contentForm">'; echo '<form method="post"><h1>Profile</h1>'; echo '<div><img src="' . content_url() . '/uploads/' . $avatar[0]->meta_value . '" width="50" height="50"></div> <br />'; echo '<div>Username: '******'</div><br />'; echo '<div>User email: ' . $current_user->user_email . '</div><br />'; echo '<div>User first name: ' . $current_user->user_firstname . '</div><br />'; echo '<div>User last name: ' . $current_user->user_lastname . '</div><br />'; echo '<div>User display name: ' . $current_user->display_name . '</div><br />'; echo '<div><a class="button" href="' . get_permalink() . '?page=pedit" title="Edit Profile">Edit</a> <a class="button" href="' . wp_logout_url() . '" title="Logout">Logout</a><br /></div></form>'; echo '</section>'; }
function asktoadmin() { ?> <div id="ask-data" style="display:block;"> <div class="modal-header"> <h3><?php echo _e("Ask Question"); ?> </h3> <span class="wk-close">x</span> <span style="clear:both;"></span> </div> <?php /*MP_Form_Handler::mail_toask_admin();*/ $wpmp_obj9 = new MP_Form_Handler(); $wpmp_obj9->mail_toask_admin(); ?> <form id="ask-form" method="post" action=""> <!--<p><span class="label"><?php echo _e("EMAIL"); ?> :</span>
function widget($args, $instance) { global $wpdb; $user_id = get_current_user_id(); $page_name = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_title ='" . get_option('wkmp_seller_login_page_tile') . "'"); $seller_info = $wpdb->get_var("SELECT user_id FROM " . $wpdb->prefix . "mpsellerinfo WHERE user_id = '" . $user_id . "' and seller_value='1'"); if ($seller_info > 0) { do_action('chat_with_me'); echo '<div class="[ wk_seller ]"><div class="[ padding ][ text-center ][ border ]"> <h3 class="[ text-center ][ no-margin ]">' . get_option('wkmp_seller_menu_tile') . '</h3> </div>'; echo '<div class="[ wk_sellermenu ][ padding ][ text-center ]">'; // echo'<a class="[ button button--primary ][ margin-bottom margin-sides--small ]" href="'.home_url("?page_id=".$page_name).'&page=mpProfile">My Profile</a> // <a class="[ button button--primary ][ margin-bottom margin-sides--small ]" href="'.home_url("?page_id=".$page_name).'&page=Product">Add Product</a> // <a class="[ button button--primary ][ margin-bottom margin-sides--small ]" href="'.home_url("?page_id=".$page_name).'&page=List">Product List</a> // <a class="[ button button--primary ][ margin-bottom margin-sides--small ]" href="'.home_url("?page_id=".$page_name).'&page=History">Order History</a> // <a class="[ button button--primary ][ margin-bottom margin-sides--small ]" href="'.home_url("?page_id=".$page_name).'&page=Dashboard">Dashboard</a> // <a class="[ button button--primary ][ margin-bottom margin-sides--small ]" href="'.home_url("?page_id=".$page_name).'&page=payment">My Payments</a> // <a class="[ button button--primary ][ margin-bottom margin-sides--small ]" href="'.home_url("?page_id=".$page_name).'&page=epschg">Change Password</a> // <a class="[ button button--primary ][ margin-bottom margin-sides--small ]" href="'.home_url("?page_id=".$page_name).'&page=To">Ask To Admin</a> // <a class="[ button button--highlight ][ margin-bottom margin-sides--small ]" href="'.wp_logout_url().'" title="Logout">Logout</a> // </div></div>'; echo '<a class="[ button button--primary ][ margin-bottom margin-sides--small ]" href="' . home_url("?page_id=" . $page_name) . '&page=mpProfile">My Profile</a> <a class="[ button button--primary ][ margin-bottom margin-sides--small ]" href="' . home_url("?page_id=" . $page_name) . '&page=Product">Add Product</a> <a class="[ button button--primary ][ margin-bottom margin-sides--small ]" href="' . home_url("?page_id=" . $page_name) . '&page=History">Order History</a> <a class="[ button button--primary ][ margin-bottom margin-sides--small ]" href="' . home_url("?page_id=" . $page_name) . '&page=Dashboard">Dashboard</a> <a class="[ button button--primary ][ margin-bottom margin-sides--small ]" href="' . home_url("?page_id=" . $page_name) . '&page=To">Ask To Admin</a> <div class="[ clear ]"></div> <a class="[ button button--highlight ][ margin-bottom margin-sides--small ]" href="' . wp_logout_url() . '" title="Logout">Logout</a> </div></div>'; } if ($user_id > 0 && $seller_info == 0) { echo '<div class="[ wk_seller ]"><div class="[ padding ][ text-center ][ border ]"> <h3 class="[ text-center ][ no-margin ]">Buyer Menu</h3> </div>'; echo '<div class="[ wk_sellermenu ][ padding ][ text-center ]">';
function edit_profile() { global $current_user, $wpdb; $current_user = wp_get_current_user(); $wpmp_obj12 = new MP_Form_Handler(); if ($current_user->ID) { /*$avatar=MP_Form_Handler::get_user_avatar($current_user->ID,'avatar'); $shop_banner=MP_Form_Handler::get_user_avatar($current_user->ID,'shop_banner'); $com_logo=MP_Form_Handler::get_user_avatar($current_user->ID,'company_logo');*/ $avatar = $wpmp_obj12->get_user_avatar($current_user->ID, 'avatar'); $shop_banner = $wpmp_obj12->get_user_avatar($current_user->ID, 'shop_banner'); $com_logo = $wpmp_obj12->get_user_avatar($current_user->ID, 'company_logo'); $usermeta_row_data = $wpdb->get_results("select * from {$wpdb->usermeta} where user_id=" . $current_user->ID); $user_meta_arr = array(); foreach ($usermeta_row_data as $key => $value) { $user_meta_arr[$value->meta_key] = $value->meta_value; } } ?> <div class="wk_profileupdate"> <h2><?php _e("Profile Information"); ?> </h2> <form action="<?php $params = array('page' => "Profile"); $url = add_query_arg($params, get_permalink()); echo $url; ?> " method="post" enctype="multipart/form-data"> <ul class="wkmp_nav wkmp-nav-tabs"> <li class="wkmp_active" id="wkmp_profile_detial_li"> <a href="#">Profile Details</a> </li> <li id="wkmp_social_detail_li"> <a href="#">Social Details</a> </li> <li id="wkmp_payment_mode_li"> <a href="#">Payment mode</a> </li> </ul> <div id="wkmp_form_profile_edit_tab"> <div class="wkmp-tab-content"> <div class="wkmp-tab-pane wkmp-tab-pane-active" id="wkmp_profile_detial_tab"> <div class="wk_profileimg"> <?php if (isset($avatar[0]->meta_value)) { echo '<div class="editmp_img" id="mp_seller_image"><img src="' . content_url() . '/uploads/' . $avatar[0]->meta_value . '" /></div>'; } else { echo '<div class="editmp_img" id="mp_seller_image"><img src="' . content_url() . '/plugins/marketplace/assets/images/genric-male.png" /></div>'; } ?> <div class="fileUpload up_shop_banner"> <span><?php _e("Upload"); ?> </span> <input type="file" class="upload" name="wk_mp_shop_banner" id="wk_mp_shop_banner"/> </div> <div class="fileUpload btn"> <span><?php _e("Upload"); ?> </span> <input type="file" class="upload mp_seller_profile_img" name="mp_useravatar" id="mp_useravatar" /> </div> </div> <div class="wk_profileinfo"> <!-- shop banner --> <div class="shop_banner"> <div class="fade-banner" id="wkmp_seller_banner"><div class="fade-upload">Upload</div></div> <?php if ($shop_banner) { echo '<div class="wk_banner_img" id="wk_seller_banner"><img src="' . content_url() . '/uploads/' . $shop_banner[0]->meta_value . '" /></div>'; } else { echo '<div class="wk_banner_img" id="wk_seller_banner"><img src="' . content_url() . '/plugins/marketplace/assets/images/woocommerce-marketplace-banner.png" /></div>'; } ?> </div> <!-- shop banner end--> <div class="wk_profile_input"> <label for="wk_username"><?php _e("Username"); ?> </label> <input type="text" name="wk_username" value="<?php echo $current_user->user_login; ?> " id="wk_username" readonly /> <input type="hidden" name="wk_user_nonece" value="<?php echo $current_user->user_login; ?> " id="wk_user_nonece" readonly /> <div id=""></div> </div> <div class="wk_profile_input"> <label for="wk_firstname"><?php _e("First Name"); ?> </label> <input type="text" value="<?php echo isset($user_meta_arr['first_name']) ? $user_meta_arr['first_name'] : ''; ?> " name="wk_firstname" id="wk_firstname" /> <div id="first_name_error" class="error-class"></div> </div> <div class="wk_profile_input"> <label for="wk_lastname"><?php _e("Last Name"); ?> </label> <input type="text" value="<?php echo isset($user_meta_arr['last_name']) ? $user_meta_arr['last_name'] : ''; ?> " name="wk_lastname" id="wk_lastname" /> <div id="last_name_error" class="error-class"></div> </div> <div class="wk_profile_input"> <label for="wk_useremail"><?php _e("E-mail"); ?> </label> <input type="text" value="<?php echo $current_user->user_email; ?> " name="user_email" id="wk_useremail" readonly /> </div> <div class="wk_profile_input"> <label for="wk_store_name"><?php _e("Shop Name"); ?> </label> <input type="text" placeholder="" value="<?php echo isset($user_meta_arr['shop_name']) ? $user_meta_arr['shop_name'] : ''; ?> " name="wk_storename" id="wk_storename" class="wk_loginput"/> <div class="error-class" id="seller_storename"></div> </div> <div class="wk_profile_input"> <label for="wk_user_address"><?php _e("Address"); ?> </label> <textarea type="text" placeholder="" name="wk_user_address" id="wk_user_address" class="wk_loginput"><?php echo isset($user_meta_arr['shop_address']) ? $user_meta_arr['shop_address'] : ''; ?> </textarea> <div class="error-class" id="seller_user_address"></div> </div> <div class="wk_profile_input"> <div class="fileUpload btn" style="margin:0;"> <span><?php _e("Shop Logo"); ?> </span> <input type="file" class="upload Company_Logo" name="mp_company_logo" id="mp_company_logo" /> </div> <?php if ($com_logo) { echo '<div class="seller_logo_img" id="seller_com_logo_img"><img src="' . content_url() . '/uploads/' . $com_logo[0]->meta_value . '" /></div>'; } else { echo '<div class="seller_logo_img" id="seller_com_logo_img"><img src="' . content_url() . '/plugins/marketplace/assets/images/shop-logo.png" /></div>'; } ?> </div> <div class="wk_profile_input"> <label for="wk_marketplace_about_shop"><?php _e("About Shop"); ?> </label> <textarea name="wk_marketplace_about_shop" id="wk_marketplace_about_shop" class="wk_loginput"><?php echo isset($user_meta_arr['about_shop']) ? $user_meta_arr['about_shop'] : ''; ?> </textarea> </div> </div> </div> <div class="wkmp-tab-pane" id="wkmp_social_detail_tab"> <div class="wk_profile_input"> <label for="settings[social][fb]"><?php _e("Social Profile"); ?>
function displayForm($atts) { $user_status = is_user_logged_in(); if (!$user_status && !isset($_GET['action'])) { ?> <div id="WK_ContentLoginForm"> <?php wc_print_notices(); ?> <form method="post" class="login"> <fieldset class="[ margin-bottom ]"> <label for="username"><?php _e('Username or email address', 'marketplace'); ?> <span class="required">*</span></label> <input type="text" class="[ input-text ][ xmall-12 ]" name="wkmp_username" id="username" value="<?php echo isset($_GET['email']) ? $_GET['email'] : ''; ?> " placeholder="enter your email id or username"/> </fieldset> <fieldset class="[ margin-bottom ]"> <label for="password"><?php _e('Password', 'marketplace'); ?> <span class="required">*</span></label> <input class="[ input-text ][ xmall-12 ]" type="password" name="password" id="password" value="" placeholder="enter your password" /> </fieldset> <fieldset> <input type="hidden" value="<?php echo wp_get_referer(); ?> " name="_wp_http_referer1"> </fieldset> <fieldset class="[ margin-bottom ]"> <label for="rememberme"> <input name="rememberme" type="checkbox" id="rememberme" value="forever" /> <?php _e('Remember me', 'marketplace'); ?> </label> </fieldset> <fieldset class="[ text-center ][ margin-bottom "> <?php wp_nonce_field('marketplace-username'); ?> <input type="submit" class="[ button button--primary ]" name="login" value="<?php _e('Login', 'marketplace'); ?> " /> <a href="<?php echo wp_registration_url(); ?> "><input type="button" class="[ button button--primary ]" value="<?php _e("Register"); ?> "></a> </fieldset> <fieldset class="[ text-center ]"> <a href="<?php echo esc_url(wc_lostpassword_url()); ?> "><?php _e('Lost your password?', 'marketplace'); ?> </a> </fieldset> </form> </div> <!-- content div --> <?php } else { if ($user_status) { global $wpdb; $wpmp_obj1 = new MP_Form_Handler(); $current_user = wp_get_current_user(); // MP_Form_Handler::profile_edit_redirection(); $wpmp_obj1->profile_edit_redirection(); // $avatar=MP_Form_Handler::get_user_avatar($current_user->ID,'avatar'); $avatar = $wpmp_obj1->get_user_avatar($current_user->ID, 'avatar'); // $seller_detail=MP_Form_Handler::seller_details($current_user->ID); $seller_detail = $wpmp_obj1->seller_details($current_user->ID); $seller_info = $wpdb->get_var("SELECT user_id FROM {$wpdb->prefix}mpsellerinfo WHERE user_id = '" . $current_user->data->ID . "' and seller_value=1"); echo '<h3 class="[ text-center ]"><small>Profile</small></h3>'; echo '<div class="wk_profileclass">'; echo '<form method="post">'; if ($current_user->data->ID && $seller_info > 0) { if (isset($avatar[0]->meta_value)) { echo '<div class="wk_profileimg"><img src="' . content_url() . '/uploads/' . $avatar[0]->meta_value . '" /></div>'; } else { echo '<div class="wk_profileimg"><img src="' . content_url() . '/plugins/marketplace/assets/images/genric-male.png" /></div>'; } } echo '<div class="wk_profileinfo"><div class="wk_profiledata"><label>Username </label> : ' . $current_user->user_login . '</div>'; echo '<div class="wk_profiledata"><label>E-mail </label> : ' . $current_user->user_email . '</div>'; echo '<div class="wk_profiledata"><label>Name </label> : ' . $current_user->user_firstname . ' ' . $current_user->user_lastname . '</div>'; echo '<div class="wk_profiledata"><label>Display name </label> : ' . $current_user->display_name . '</div>'; if ($current_user->data->ID && $seller_info > 0) { echo '<div class="wk_profiledata"><label>Shop Name </label> : ' . $seller_detail['shop_name'][0] . '</div>'; echo '<div class="wk_profiledata"><label>Address </label> : ' . $seller_detail['shop_address'][0] . '</div>'; if (strchr(get_permalink(), '?')) { $icon = '&'; } else { $icon = '?'; } echo '<div class="wk_profile_btn"><a href="' . get_permalink() . $icon . 'page=pedit" title="Edit Profile" class="[ button button--highlight ]">Edit</a></div>'; } //echo '<a href="'.wp_logout_url().'" title="Logout" class="button">Logout</a><br /></div>'; echo '</form></div> </div>'; } else { if (isset($_GET['action']) && !$user_status && $_GET['action'] == 'mp_register') { ?> <div id="WK_ContentRegisterForm"> <?php wc_print_notices(); ?> <h3 class="[ text-center ][ margin-bottom ]"><small>Registrate</h3></small> <form action="<?php echo get_permalink(); ?> " method="post" id="registration_form"> <div class="[ wk_login_input ][ ]"> <label for="wk_username"><?php _e("Username"); ?> </label><span class="required">*</span> <input type="text" name="wk_username" placeholder="" id="wk_username" class="[ wk_loginput ][ xmall-12 ]"/> <div class="error-class" id="seller_user_name"></div> </div> <div class="[ wk_login_input ][ ]"> <label for="wk_firstname">Nombre</label><span class="required">*</span> <input type="text" placeholder="" name="wk_firstname" id="wk_firstname" class="[ wk_loginput ][ xmall-12 ]"/> <div class="error-class" id="seller_first_name"></div> </div> <div class="[ wk_login_input ][ ]"> <label for="wk_lastname">Apellido</label><span class="required">*</span> <input type="text" placeholder="" name="wk_lastname" id="wk_lastname" class="[ wk_loginput ][ xmall-12 ]"/> <div class="error-class" id="seller_last_name"></div> </div> <div class="[ wk_login_input ][ ]"> <label for="wk_useremail"><?php _e("E-mail"); ?> </label><span class="required">*</span> <input type="text" placeholder="" name="wk_useremail" id="wk_useremail" class="[ wk_loginput ][ xmall-12 ]"/> <div class="error-class" id="seller_email"></div> </div> <div id="add_sller_shop"></div> <div class="[ wk_login_input ][ ]"> <label for="wk_userseller" name="user_email" class="wk_regis"><?php _e("Want To Become A Seller"); ?> </label><span class="required">*</span> <input type="radio" name="selleraccess" value="1" class="wk_userseller"> <?php _e("Yes"); ?>   <input type="radio" name="selleraccess" value="0" class="wk_userseller"> <?php _e("No"); ?> <div class="error-class" id="select-seller_access"></div> </div> <?php apply_filters('register_url', 'seller registration'); ?> <div class="[ wk_login_input ][ ]"> <div><img src="<?php echo plugins_url(); ?> /marketplace/includes/front/my-image.php" id="wk_captcha_image"></div> <label for="wk_captcha">Escribe el texto del captcha:</label> <input class="[ xmall-12 ]" type="text" name="wk_captcha" id="wk_captcha"> <input type="hidden" id="wk_captcha_result" name="wk_captcha_result" value="0"> <div class="error-class" id="wk_captcha_error"></div> <div class="correct-class" id="wk_captcha_correct"></div> </div> <div class="[ text-center ]"> <input type="submit" value="Register" class="[ button button--primary ][ ]" name="register_submit" id="register_submit"/> <a style="text-decoration: none;" href="<?php echo get_permalink(); ?> "> <input class="[ button button--primary ][ ]" type="button" value="<?php _e("Login"); ?> "> </a> </div> </form> </div> <?php } else { if (isset($_GET['action']) && !$user_status && $_GET['action'] == 'lostpassword') { ?> <section id="contentForm"> <form name="lostpasswordform" id="lostpasswordform" action="" method="post"> <!--<h1>Reset</h1>--> <div> <input type="text" name="user_login" id="user_login" placeholder="Username or E-mail" value="" required="" size="20" tabindex="10"> </div> <div> <input type="hidden" name="redirect_to" value="<?php echo get_permalink(); ?> "> <input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="Get Password" tabindex="100"> <a href="<?php echo get_permalink(); ?> ">Login Now</a> </div> </form> </section> <?php } } } } }
function seller_all_product() { $str = ''; if (isset($_REQUEST['str'])) { $str = $_REQUEST['str']; } if (isset($_GET['sid'])) { $sellerid = $_GET['sid']; } else { $sellerid = ''; } $wpmp_obj11 = new MP_Form_Handler(); ?> <style type="text/css"> header h1 { display:none; } aside { display:none; } #main { width:100%; } </style> <div id="productlist"> <h1 class="seller-collection"><?php echo _e('Collection'); ?> </h1> <div id="seller_product_list_left"> <div class="Advertisement" style="border-style:none;"> <?php /*$shop_logo=MP_Form_Handler::get_user_avatar($sellerid,'company_logo'); */ $shop_logo = $wpmp_obj11->get_user_avatar($sellerid, 'company_logo'); if (isset($shop_logo[0]->meta_value)) { echo '<img src="' . content_url() . '/uploads/' . $shop_logo[0]->meta_value . '">'; } else { echo '<img src="' . content_url() . '/plugins/marketplace/assets/images/shop-logo.png" />'; } ?> </div> <div class="Advertisement" style="display:none;"> <div id='mp_left_details_first'><?php echo _e('Seller Category List'); ?> </div> <?php echo product_categories(''); $seller_id = $_GET['sid']; ?> </div> <div class="Advertisement"> <div id='mp_left_details_first'><?php echo _e('View Collection'); ?> </div> <div class="mp_left_details"> <a href='#'><?php echo _e('View Collection'); ?> </a> </div> <?php $varsid = get_query_var('sid'); if (empty($varsid)) { $varsid = $_GET['sid']; } ?> <?php if (strchr(get_permalink(), '?')) { $icon = '&'; } else { $icon = '?'; } ?> <div class="mp_left_details"><a href='<?php echo get_permalink() . $icon; ?> page=Spreview&sid=<?php echo $varsid; ?> ' ><?php echo _e('View Profile'); ?> </a></div> </div> </div> <?php if ($seller_id) { ?> <div id="seller_product_list_right"> <div id='wk_banner'> <?php $banner = $wpmp_obj11->get_user_avatar($seller_id, 'shop_banner'); if (!isset($banner[0]->meta_value)) { ?> <img src="<?php echo content_url() . '/plugins/marketplace/assets/images/woocommerce-marketplace-banner.png'; ?> " /> <?php } else { ?> <img src="<?php echo content_url() . '/uploads/' . $banner[0]->meta_value; ?> " class="collection-banner"/> <?php } ?> <div class='seller_grid'><?php echo _e('Sort By'); ?> <select class='mp_value_asc'> <?php if ($str == 'price_l') { ?> <option selected="selected" value="price_l" > <?php echo _e('Price'); ?> (<?php echo _e('Low To High'); ?> ) </option> <?php } else { ?> <option value="price_l" > <?php echo _e('Price'); ?> (<?php echo _e('Low To High'); ?> ) </option> <?php } if ($str == 'price_h') { ?> <option selected="selected" value="price_h"> <?php echo _e('Price'); ?> (<?php echo _e('High To Low'); ?> ) </option> <?php } else { ?> <option value="price_h"> <?php echo _e('Price'); ?> (<?php echo _e('High To Low'); ?> ) </option> <?php } if ($str == 'productname_l') { ?> <option selected="selected" value="productname_l" > <?php echo _e('Name'); ?> (<?php echo _e('Asc To Desc'); ?> ) </option> <?php } else { ?> <option value="productname_l" > <?php echo _e('NAME'); ?> (<?php echo _e('Asc To Desc'); ?> ) </option> <?php } if ($str == 'productname_h') { ?> <option selected="selected" value="productname_h" > <?php echo _e('Name'); ?> (<?php echo _e('Desc To Asc'); ?> ) </option> <?php } else { ?> <option value="productname_h" > <?php echo _e('Name'); ?> (<?php echo _e('Desc To Asc'); ?> ) </option> <?php } ?> </select> </div> </div> <div class="box-content"> <?php /*$products = MP_Form_Handler::produt_by_seller_ID($seller_id,$str); $banner=MP_Form_Handler::get_user_avatar($seller_id,'shop_banner');*/ $products = $wpmp_obj11->produt_by_seller_ID($seller_id, $str); $banner = $wpmp_obj11->get_user_avatar($seller_id, 'shop_banner'); foreach ($products as $product) { $currency = get_woocommerce_currency_symbol(get_option('woocommerce_currency')); /*$product_image=MP_Form_Handler::get_product_image($product->ID,'_thumbnail_id');*/ $product_image = $wpmp_obj11->get_product_image($product->ID, '_thumbnail_id'); $product_object = get_product($product->ID); /*echo "<pre>"; print_r($product_object->product_type); echo "</pre>";*/ /* if($product_object->post_status=='publish'){ } */ $link = get_permalink($product->ID); ?> <div class="seller_product_row"> <li> <a class="product_img_link" title="<?php echo $product->post_title; ?> " href="<?php echo $link; ?> "> <div class="wk-slider-product-img"><?php if ($product_image != '') { ?> <img class="product_image" alt="<?php echo $product->post_title; ?> " src="<?php echo content_url() . '/uploads/' . $product_image; ?> "> <?php } else { ?> <img class="product_image" alt="<?php echo $product->post_title; ?> " src="<?php echo plugins_url('marketplace/assets/images/placeholder.png'); ?> "> <?php } ?> </div> <div class="wk-slider-product-info"> <h3><div style="margin-bottom:5px;"><?php echo $product->post_title; ?> </div></h3> <!-- <div style="font-weight:bold;"><?php /*echo woocommerce_price($product->regular_price);*/ ?> </div> --> <!-- <span><?php /*echo 'product_type= '.$product_object->product_type;*/ ?> </span><br> --> <?php if ($product_object->is_type('simple')) { ?> <span class="amount"><?php echo woocommerce_price($product_object->price); ?> </span> <?php } else { if ($product_object->is_type('variable')) { ?> <span class="price"> <span class="amount"><?php echo woocommerce_price($product_object->min_variation_price); ?> </span> – <span class="amount"><?php echo woocommerce_price($product_object->max_variation_price); ?> </span> </span> <?php } else { if ($product_object->is_type('external')) { ?> <span class="amount"><?php echo woocommerce_price($product_object->price); ?> </span> <?php } else { if ($product_object->is_type('grouped')) { ?> <span class="amount"><?php echo ''; ?> </span> <?php } } } } ?> </div> </a> <!-- <div style="text-align:center;"> --> <!-- <form class="cart" enctype="multipart/form-data" method="post"> <input type="hidden" value="<?php /*echo $product->ID;*/ ?> " name="add-to-cart"> <button class="single_add_to_cart_button button alt" type="submit">Add to cart</button> </form> --> <!-- </div> --> </li> </div> <?php } ?> </div> </div> <?php } }
function efeedback() { $wpmp_obj13 = new MP_Form_Handler(); if (isset($_POST) && !empty($_POST)) { /*mp_form_handler::wk_wp_mp_reviews();*/ $wpmp_obj13->wk_wp_mp_reviews(); unset($_POST); } $current_time = date('Y-m-d H:i:s'); $seller_id = $_GET['sid']; $user_id = get_current_user_id(); /*$Result=mp_form_handler::original_review($seller_id);*/ $Result = $wpmp_obj13->original_review($seller_id); ?> <div class="Give_feedback login_to_feedback"><?php echo _e("GIVE FEEDBACK"); ?> </div> <div id="Mp_feedback" style="display:none;"> <h1><?php echo _e("Write Your Own FEEDBACK"); ?> </h1> <div><h2><?php echo _e("How do you rate this Store? *"); ?> </h2></div> <form action="" method="post" enctype="multipart/form-data"> <div class="mp_feedback_main"> <div class="mp_feedback"> <div class="mp_feedback_header mp_filter_tag"><strong><?php echo _e("NAME"); ?> </strong></div> <div class="mp_feedback_header"><strong><?php echo _e("1STAR"); ?> </strong></div> <div class="mp_feedback_header"><strong><?php echo _e("2STAR"); ?> </strong></div> <div class="mp_feedback_header"><strong><?php echo _e("3STAR"); ?> </strong></div> <div class="mp_feedback_header"><strong><?php echo _e("4STAR"); ?> </strong></div> <div class="mp_feedback_header"><strong><?php echo _e("5STAR"); ?> </strong></div> </div> <div class="mp_feedback"> <div class="mp_feedback_price mp_filter_tag_value"><strong><?php echo _e("PRICE"); ?> </strong></div> <div class="mp_feedback_price"><input type="radio" name="feed_price" value="1" required></div> <div class="mp_feedback_price"><input type="radio" name="feed_price" value="2" required></div> <div class="mp_feedback_price"><input type="radio" name="feed_price" value="3" required></div> <div class="mp_feedback_price"><input type="radio" name="feed_price" value="4" required></div> <div class="mp_feedback_price"><input type="radio" name="feed_price" value="5" required></div> </div> <div class="mp_feedback "> <div class="mp_feedback_price mp_filter_tag_value" ><strong><?php echo _e("VALUE"); ?> </strong></div> <div class="mp_feedback_price"><input type="radio" name="feed_value" value="1" required></div> <div class="mp_feedback_price"><input type="radio" name="feed_value" value="2" required></div> <div class="mp_feedback_price"><input type="radio" name="feed_value" value="3" required></div> <div class="mp_feedback_price"><input type="radio" name="feed_value" value="4" required></div> <div class="mp_feedback_price"><input type="radio" name="feed_value" value="5" required></div> </div> <div class="mp_feedback"> <div class="mp_feedback_price mp_filter_tag_value"><strong><?php echo _e("QUALITY"); ?> </strong></div> <div class="mp_feedback_price"><input type="radio" name="feed_quality" value="1" required></div> <div class="mp_feedback_price"><input type="radio" name="feed_quality" value="2" required></div> <div class="mp_feedback_price"><input type="radio" name="feed_quality" value="3" required></div> <div class="mp_feedback_price"><input type="radio" name="feed_quality" value="4" required></div> <div class="mp_feedback_price"><input type="radio" name="feed_quality" value="5" required></div> </div> <div class="mp_feedback_fields"> <div class="mp_feedback_fields"><?php echo _e("Nickname"); ?> <span class="wkmp_required">*</span></div> <div class=""><input type="text" id="wkmp_feed_nickname" name="feed_nickname" size="35" required></div> <div class="error-class" id="wkmp_feed_nickname_error"></div> </div> <div class="mp_feedback_fields"> <div class="mp_feedback_fields"><?php echo _e("summary Review"); ?> <span class="wkmp_required">*</span></div> <div class=""><input type="text" name="feed_summary" id="wkmp_feed_summary" size="35" required></div> <div class="error-class" id="wkmp_feed_summary_error"></div> </div> <div class="mp_feedback_fields"> <div class="mp_feedback_fields"><?php echo _e("Review"); ?> <span class="wkmp_required">*</span></div> <div class=""><textarea rows='4' cols='50' name='feed_review' id="wkmp_feed_review" required></textarea></div> <div class="error-class" id="wkmp_feed_review_error"></div> </div> <input type="submit" id="wk_mp_reviews_user" value="<?php echo _e("Submit Review"); ?> " style="width:120px" class="btn btn-primary"> </div> <input type="hidden" name="create_date" value="<?php echo $current_time; ?> " /> <input type="hidden" name="mp_wk_seller" value="<?php echo $seller_id; ?> " /> <input type="hidden" name="mp_wk_user" value="<?php echo $user_id; ?> " /> </form> </div> <div class="mp_paging"> <?php foreach ($Result as $item) { ?> <div class="wk_feedback_main"> <div class='wk_feedback_price'> <div class="wk_feedback"><strong><?php echo _e("Price"); ?> : </strong></div> <?php for ($i = 0; $i < $item->price_r; $i++) { ?> <div class="wk_ystar"></div> <?php } ?> <?php for ($i = 0; $i < 5 - $item->price_r; $i++) { ?> <div class="wk_gstar"></div> <?php } ?> </div> <div class='wk_feedback_price'> <div class="wk_feedback"><strong><?php echo _e("VALUE"); ?> : </strong></div> <?php for ($i = 0; $i < $item->value_r; $i++) { ?> <div class="wk_ystar"></div> <?php } for ($i = 0; $i < 5 - $item->value_r; $i++) { ?> <div class="wk_gstar"></div> <?php } ?> </div> <div class='wk_feedback_price'> <div class="wk_feedback"><strong><?php echo _e("QUALITY"); ?> :</strong></div> <?php for ($i = 0; $i < $item->quality_r; $i++) { ?> <div class="wk_ystar"></div> <?php } for ($i = 0; $i < 5 - $item->quality_r; $i++) { ?> <div class="wk_gstar"></div> <?php } ?> </div> <div class="wk_feedback_con"> <div class="wk_feedback_name"><strong><?php echo _e('Review Description'); ?> :</strong></div> <div class="wk_feedback_value"><?php echo $item->review_desc; ?> </div> </div> <div class="wk_feedback_con"> <div class="wk_feedback_name"><strong><?php echo _e('Review Summary'); ?> :</strong></div> <div class="wk_feedback_value"><?php echo $item->review_summary; ?> </div> </div> <div class="wk_feedback_con"> <div class="wk_feedback_name"><strong><?php echo _e("Feed Back By"); ?> :</strong></div> <div class="wk_feedback_value"><?php echo $item->nickname; ?> </div> </div> <div class="wk_feedback_con"> <div class="wk_feedback_name"><strong><?php echo _e("DATE"); ?> :</strong></div> <div class="wk_feedback_value"><?php echo $item->review_time; ?> </div> </div> </div> <?php } ?> </div> <?php }
function add_product() { global $wpdb; $wpmp_obj4 = new MP_Form_Handler(); /*MP_Form_Handler::marketplace_media_fix($post_id);*/ $wpmp_obj4->marketplace_media_fix(); ?> <h2><?php echo _e("Add Product"); ?> </h2> <div class="form"> <form action="<?php $params = array('page' => "eProduct"); $url = add_query_arg($params, get_permalink()); echo $url; ?> " method="post" enctype="multipart/form-data" id="product-form"> <fieldset> <table> <tbody> <tr> <td><label for="product_name"><?php echo _e("Product Name"); ?> <span class="required">*</span> :</label></td> <td><input class="product_input" type="text" name="product_name" id="product_name" size="54" value="<?php /*if(isset($post_row_data[0]->post_title)) echo $post_row_data[0]->post_title;*/ ?> " /> <div id="pro_name_error" class="error-class"><div> </td> </tr> <tr> <td><label for="product_desc"><?php echo _e("About Product"); ?> :</label></td> <td><?php $settings = array('media_buttons' => true, 'textarea_name' => 'product_desc', 'textarea_rows' => get_option('default_post_edit_rows', 10), 'tabindex' => '', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => false); if (isset($post_row_data[0]->post_content)) { $content = $post_row_data[0]->post_content; } if (isset($content)) { echo wp_editor($content, 'product_desc', $settings); } else { echo wp_editor('', 'product_desc', $settings); } ?> <div id="long_desc_error" class="error-class"><div> </td> </tr> <!--<tr> <td><label for="product_type"><?php echo _e("Product Type"); ?> <span class="required">*</span> :</label></td> <td><select size="1" name="product_type" id="product_type"> <option value="no"><?php echo _e("Select Product Type"); ?> </option> <option value="_downloadable"><?php echo _e("Downloadable"); ?> </option> <option value="_virtual"><?php echo _e("Virtual"); ?> </option> </select> </td> </tr>--> <tr> <td style="vertical-align: top;"><label for="product_category"><?php echo _e("Product Category"); ?> :</label> </td> <td><select multiple="true" name="product_cate[]" id="product_cate"> <?php /*MP_Form_Handler::mp_product_categories1(0,0);*/ ?> <?php $wpmp_obj4->mp_product_categories1(0, 0); ?> </select> </td> </tr> <tr> <td><label for="fileUpload"><?php echo _e("Product Thumbnail"); ?> :</label></td> <td> <div id="product_image"> </div> <input type="hidden" id="product_thumb_image_mp" name="product_thumb_image_mp" /> <a class="upload mp_product_thumb_image btn" href="javascript:void(0);" /><?php _e('Upload Thumb'); ?> </a> </td> </tr> <tr> <td> <label for="product_sku"><?php echo _e("Product SKU"); ?> <span class="required">*</span>: <span class="help"> <div class="help-tip-sol"><?php echo _e("SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased."); ?> </div> <span class="help-tip">[?]</span> </span> </label> </td> <td><input class="product_input" type="text" name="product_sku" id="product_sku" value="" /> <div id="pro_sku_error" class="error-class"><div></td> </tr> <tr> <td><label for="regu_price"><?php echo _e("Regular Price"); ?> <span class="required">*</span> :</label></td> <td><input class="product_input" type="text" name="regu_price" id="regu_price" value="" /> <div id="regl_pr_error" class="error-class"><div></td> </tr> <tr> <td><label for="sale_price"><?php echo _e("Sale Price"); ?> :</label></td> <td><input class="product_input" type="text" name="sale_price" id="sale_price" value="" /> <div id="sale_pr_error" class="error-class"><div></td> </tr> <tr> <td><label for="short_desc"><?php echo _e("Product Short Desc"); ?> :</label></td> <td><?php $settings = array('media_buttons' => true, 'textarea_name' => 'short_desc', 'textarea_rows' => get_option('default_post_edit_rows', 10), 'tabindex' => '', 'editor_class' => 'frontend', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => false, 'drag_drop_upload' => true); if (isset($post_row_data[0]->post_excerpt)) { $short_content = $post_row_data[0]->post_excerpt; } if (isset($short_content)) { echo wp_editor($short_content, 'short_desc', $settings); } else { echo wp_editor("", 'short_desc', $settings); } ?> <div id="short_desc_error" class="error-class"></div></td> </tr> <tr><td></td> <td> <input type="submit" name="add_product_sub" id="add_product_sub" value="Save" class="button"/></td> </tr> </tbody> </table> <?php apply_filters('mp_user_redirect', 'redirect user'); ?> </fieldset> </form> </div> <?php }
function widget($args, $instance) { extract($args); global $wpdb; $usermeta = $wpdb->prefix . 'usermeta'; $users = $wpdb->prefix . 'users'; $sellerInfo = $wpdb->prefix . 'mpsellerinfo'; $userNo = intval($instance['noOfUsers'], 10); $no = 0; $check_value = $instance['check_value']; $value1 = $instance['value']; $sellers = "SELECT user_id FROM {$sellerInfo} WHERE seller_value=1"; $wpmp_obj7 = new MP_Form_Handler(); $page_id = $wpmp_obj7->get_page_id(get_option('wkmp_seller_login_page_tile')); $current_user = get_current_user_id(); $id = $wpdb->get_results($sellers); $a = 0; foreach ($id as $value) { $user_id = $value->user_id; $user_exist = get_user_by('id', $user_id); if ($user_exist) { $a++; } } if ($a != 0 && $id) { echo "<div class='[ wk_seller ]'><div class='[ padding ][ text-center ][ border ]'>\n\t\t\t\t\t<h3 class='[ text-center ][ no-margin ]'>" . $value1 . "</h3>\n\t\t\t\t</div>"; echo "<div class='[ wk_sellermenu ][ padding ][ text-center ]'>"; foreach ($id as $row) { $no++; $user_id = $row->user_id; if ($user_id == $current_user && $check_value != 'on') { continue; } if ($user_id == 0 || $user_id == 1) { continue; } $user_exist = get_user_by('id', $user_id); if (!$user_exist) { continue; } if ($instance['option'] == 'Nick Name') { $username = "******"; $name = $wpdb->get_var($username); } else { $user_data = get_user_by('id', $user_id); $fname = get_user_meta($user_id, 'first_name', true); $lname = get_user_meta($user_id, 'last_name', true); $name = $fname . ' ' . $lname; } $name = trim($name); if ($name != '') { ?> <a class="[ selleritem ][ button button--primary ]" href="<?php echo home_url() . '?page_id=' . $page_id . '&page=Spreview&sid=' . $user_id; ?> "> <?php echo $name; ?> </a> <?php } else { ?> <a class="[ selleritem ][ button button--primary ]" href="<?php echo home_url() . '?page_id=' . $page_id . '&page=Spreview&sid=' . $user_id; ?> "> <?php echo $user_data->user_nicename; ?> </a> <?php } if ($no > $userNo) { break; } } echo "</div>"; } }
function product_list() { ?> <div id="main_container"> <h2><?php echo _e("Products List"); ?> </h2> <?php global $wpdb; $user_id = get_current_user_id(); $wpmp_pid = ''; if (isset($_GET['pid'])) { $wpmp_pid = $_GET['pid']; } $product_auth = $wpdb->get_var("select post_author from {$wpdb->posts} where ID='" . $wpmp_pid . "'"); if (isset($_GET['page']) && isset($_GET['action'])) { if ($_GET['page'] = 'List' && $_GET['action'] == 'del' && $product_auth == $user_id) { if (delete_post_meta($wpmp_pid, '_sku')) { delete_post_meta($wpmp_pid, '_regular_price'); delete_post_meta($wpmp_pid, '_sale_price'); delete_post_meta($wpmp_pid, '_price'); delete_post_meta($wpmp_pid, '_sale_price_dates_from'); delete_post_meta($wpmp_pid, '_sale_price_dates_to'); delete_post_meta($wpmp_pid, '_downloadable'); delete_post_meta($wpmp_pid, '_virtual'); wp_delete_post($wpmp_pid); } } } $product = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_type = 'product' and post_author='" . $user_id . "'"); ?> <table class="productlist"> <thead> <tr> <th><?php echo _e("Product Name"); ?> </th> <th><?php echo _e("Details"); ?> </th> <th><?php echo _e("Stock"); ?> </th> <th><?php echo _e("Product Status"); ?> </th> <th><?php echo _e("Price"); ?> </th> <th><?php echo _e("Image"); ?> </th> <th><?php echo _e("Action"); ?> </th> </tr> </thead> <tbody> <?php //echo "SELECT ID FROM $wpdb->posts WHERE post_title = '".get_option('wkmp_seller_login_page_tile')."' and post_type='page'" $page_name = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_title = '" . get_option('wkmp_seller_login_page_tile') . "' and post_type='page'"); $wpmp_obj2 = new MP_Form_Handler(); foreach ($product as $pro) { $product_price = get_post_meta($pro->ID, '_price', true); $product_stock = get_post_meta($pro->ID, '_stock_status', true); $stock_remain = get_post_meta($pro->ID, '_stock', true); /*$product_image=MP_Form_Handler::get_product_image($pro->ID,'_thumbnail_id');*/ $product_image = $wpmp_obj2->get_product_image($pro->ID, '_thumbnail_id'); ?> <tr> <td><?php echo $pro->post_title; ?> </td> <td style="word-break:break-all;"><?php echo $pro->post_excerpt; ?> </td> <td><?php echo isset($product_stock) ? $product_stock : ''; ?> </td> <td><?php echo $pro->post_status; ?> </td> <td><?php echo mp_price($product_price); ?> </td>
public function product_add_update() { global $wpdb, $current_user; $variation_att_id = isset($_POST['mp_attribute_variation_name']) ? $_POST['mp_attribute_variation_name'] : ''; if (isset($_POST['sale_price'])) { if ($_POST['sale_price'] == '') { unset($_POST['sale_price']); } } $att_val = isset($_POST['pro_att']) ? $_POST['pro_att'] : ''; $upload_dir = wp_upload_dir(); $product_type = isset($_POST['product_type']) ? $_POST['product_type'] : 'simple'; /*echo "==============="; print_r( $att_val); echo "===============";*/ if (isset($_POST['product_type']) && $product_type == 'variable' && isset($_POST['mp_attribute_variation_name']) && is_array($_POST['mp_attribute_variation_name'])) { $this->mp_save_variation($_POST['sell_pr_id'], $_POST['mp_attribute_variation_name']); } if (!empty($variation_att_id) && !empty($att_val) && false) { $variation_data = array(); foreach ($variation_att_id as $var_id) { foreach ($_POST['mp_attribute_name'][$var_id] as $variation_type) { $variation_data['attribute_' . $variation_type][] = $_POST['attribute_' . $variation_type][$var_id]; } if (isset($_POST['wkmp_variable_is_downloadable'])) { $downloadable_vari = $_POST['wkmp_variable_is_downloadable'][$var_id] == 'yes' ? 'yes' : 'no'; } else { $downloadable_vari = 'no'; } if (isset($_POST['wkmp_variable_is_virtual']) && isset($_POST['wkmp_variable_is_virtual'][$var_id])) { $virtual_vari = $_POST['wkmp_variable_is_virtual'][$var_id] == 'yes' ? 'yes' : 'no'; } else { $virtual_vari = 'no'; } $down_expiry = $downloadable_vari == 'yes' ? $_POST['wkmp_variable_download_expiry'][$var_id] : ''; $down_limit = $downloadable_vari == 'yes' ? $_POST['wkmp_variable_download_limit'][$var_id] : ''; $variation_data['_download_expiry'][] = $_POST['wkmp_variable_download_expiry'][$var_id]; $variation_data['_download_limit'][] = $_POST['wkmp_variable_download_limit'][$var_id]; $variation_data['_sale_price'][] = $_POST['wkmp_variable_sale_price'][$var_id]; if ($_POST['wkmp_variable_sale_price'][$var_id] == '') { $variation_data['_price'][] = $_POST['wkmp_variable_regular_price'][$var_id]; } else { $variation_data['_price'][] = $_POST['wkmp_variable_sale_price'][$var_id]; } $variation_data['_regular_price'][] = $_POST['wkmp_variable_regular_price'][$var_id]; if (isset($_POST['wkmp_variable_sale_price_dates_to'])) { $variation_data['_sale_price_dates_to'][] = $_POST['wkmp_variable_sale_price_dates_to'][$var_id]; } if (isset($_POST['wkmp_variable_sale_price_dates_from'])) { $variation_data['_sale_price_dates_from'][] = $_POST['wkmp_variable_sale_price_dates_from'][$var_id]; } $variation_data['_backorders'][] = $_POST['wkmp_variable_backorders'][$var_id]; if (isset($_POST['wkmp_variable_manage_stock']) && isset($_POST['wkmp_variable_manage_stock'][$var_id])) { $manage_stock = $_POST['wkmp_variable_manage_stock'][$var_id] == 'yes' ? 'yes' : 'no'; } else { $manage_stock = 'no'; } $variation_data['_manage_stock'][] = $manage_stock; if ($manage_stock == 'yes') { $variation_data['_stock'][] = $_POST['wkmp_variable_stock'][$var_id]; } else { $variation_data['_stock'][] = ''; } $variation_data['_stock_status'][] = $_POST['wkmp_variable_stock_status'][$var_id]; // $variation_data['_sku'][]=$_POST['wkmp_variable_sku'][$var_id]; $variation_data['_width'][] = $_POST['wkmp_variable_width'][$var_id]; $variation_data['_height'][] = $_POST['wkmp_variable_height'][$var_id]; $variation_data['_length'][] = $_POST['wkmp_variable_length'][$var_id]; $variation_data['_virtual'][] = $virtual_vari; $variation_data['_downloadable'][] = $downloadable_vari; $thumbnail_id = $_POST['upload_var_img'][$var_id]; if ($thumbnail_id != '') { $variation_data['_thumbnail_id'][] = $thumbnail_id; } else { $variation_data['_thumbnail_id'][] = 0; } $variation_data['_weight'][] = $_POST['wkmp_variable_weight'][$var_id]; $variation_data['_menu_order'][] = $_POST['wkmp_variation_menu_order'][$var_id]; /* variation for download able product */ if ($downloadable_vari == 'yes') { $variation_files = $_POST['_mp_variation_downloads_files_url'][$var_id]; $variation_names = $_POST['_mp_variation_downloads_files_name'][$var_id]; $var_downloadable = array(); $var_down_name = array(); if (isset($_POST['_mp_variation_downloads_files_url'][$var_id]) && count($_POST['_mp_variation_downloads_files_url'][$var_id]) > 0) { $files = array(); /*$file_url_size = count( $variation_files );*/ /*foreach ($variation_files as $key => $value) {*/ if (!empty($variation_files)) { for ($i = 0; $i < count($variation_files); $i++) { $file_url = wc_clean($variation_files[$i]); if ($file_url != '') { $files[md5($file_url)] = array('name' => $variation_names[$i], 'file' => $file_url); } } } update_post_meta($var_id, '_downloadable_files', $files); } } } $variation_data_key = array_keys($variation_data); $variations_values = array_values($variation_data); for ($i = 0; $i < count($variation_data); $i++) { for ($x = 0; $x < count($variation_att_id); $x++) { update_post_meta($variation_att_id[$x], $variation_data_key[$i], $variations_values[$i][$x]); if ($variation_data_key[$i] == '_sale_price' && $variations_values[$i][$x] == '') { delete_post_meta($variation_att_id[$x], '_sale_price'); } } } } if (isset($_POST['pro_att'])) { $attrib = $_POST['pro_att']; } else { $attrib = array(); } $att = array(); if (!empty($attrib)) { foreach ($attrib as $attribute) { if (empty($attribute['name']) || empty($attribute['value'])) { continue; } $rep_str = $attribute['value']; $rep_str = preg_replace('/\\s+/', ' ', $rep_str); $attribute['name'] = str_replace(' ', '-', $attribute['name']); $attribute['value'] = str_replace("|", "|", $rep_str); if (isset($attribute['is_visible'])) { $attribute['is_visible'] = (int) $attribute['is_visible']; } else { $attribute['is_visible'] = 0; } if (isset($attribute['is_variation'])) { $attribute['is_variation'] = (int) $attribute['is_variation']; } else { $attribute['is_variation'] = 0; } $attribute['is_taxonomy'] = (int) $attribute['is_taxonomy']; $att[str_replace(' ', '-', $attribute['name'])] = $attribute; } } $user_id = get_current_user_id(); if (isset($_POST['sell_pr_id'])) { $product_auth = $wpdb->get_var("select post_author from {$wpdb->posts} where ID='" . $_POST['sell_pr_id'] . "'"); } if (!empty($_POST['product_name']) && isset($_POST['product_name']) && isset($_POST['product_sku'])) { $product_name = $_POST['product_name']; $product_dsc = $_POST['product_desc']; $downloadable = isset($_POST['_ckdownloadable']) ? $_POST['_ckdownloadable'] : ''; $virtual = $product_type == 'virtual' ? 'yes' : 'no'; $simple = $product_type == 'simple' ? 'yes' : 'no'; if (isset($_POST['product_type'])) { $protype = $_POST['product_type']; } $backorder = isset($_POST['_backorders']) ? $_POST['_backorders'] : 'no'; $stock = isset($_POST['_stock_status']) ? $_POST['_stock_status'] : 'instock'; $SKU = $_POST['product_sku']; $price = isset($_POST['regu_price']) ? $_POST['regu_price'] : ''; if (isset($_POST['sale_price'])) { $sales_price = $_POST['sale_price']; } $product_short_desc = $_POST['short_desc']; $limit = isset($_POST['_download_limit']) ? $_POST['_download_limit'] : ''; $expiry = isset($_POST['_download_expiry']) ? $_POST['_download_expiry'] : ''; $mang_stock = isset($_POST['wk_stock_management']) ? $_POST['wk_stock_management'] : 'no'; $stock_qty = $mang_stock == 'yes' ? $_POST['wk-mp-stock-qty'] : ''; $stock_qty = intval($stock_qty); $usere_downloadable_file_name = isset($_POST['user_downloadable_file_name']) ? $_POST['user_downloadable_file_name'] : ''; $seller_downloadable_file_url = isset($_POST['upload_downloadable_file_url']) ? $_POST['upload_downloadable_file_url'] : ''; if (isset($_POST['product_image_Galary_ids'])) { $product_galary_images = implode(',', array_unique(explode(',', $_POST['product_image_Galary_ids']))); } else { $product_galary_images = ''; } //$sale_from=$_POST['sale_from']; $sale_from = isset($_POST['sale_from']) ? $_POST['sale_from'] : ''; //$sale_to=$_POST['sale_to']; $sale_to = isset($_POST['sale_to']) ? $_POST['sale_to'] : ''; $product_status = isset($_POST['mp_product_status']) ? $_POST['mp_product_status'] : ''; $product_data = array('post_author' => get_current_user_id(), 'post_date' => '', 'post_date_gmt' => '', 'post_content' => $product_dsc, 'post_content_filtered' => $product_short_desc, 'post_title' => $product_name, 'post_excerpt' => $product_short_desc, 'post_status' => $product_status, 'post_type' => 'product', 'comment_status' => 'open', 'ping_status' => 'open', 'post_password' => '', 'post_name' => wp_strip_all_tags($product_name), 'to_ping' => '', 'pinged' => '', 'post_modified' => '', 'post_modified_gmt' => '', 'post_parent' => '', 'menu_order' => '', 'guid' => ''); if (isset($_POST['sell_pr_id']) && $product_auth == $user_id && isset($_POST['add_product_sub']) && $_POST['add_product_sub'] == 'Update' && !empty($_POST['_wpnonce'])) { wp_verify_nonce($_POST['_wpnonce'], 'marketplace-edid_product'); $product_data['ID'] = $_POST['sell_pr_id']; if (wp_update_post($product_data)) { $role = $wpdb->prefix . 'capabilities'; $current_user->role = array_keys($current_user->{$role}); $role = $current_user->role[0]; if ($product_status == 'publish' && $role == 'wk_marketplace_seller') { update_post_meta($_POST['sell_pr_id'], '_visibility', 'visible'); } else { update_post_meta($_POST['sell_pr_id'], '_visibility', ''); } update_post_meta($_POST['sell_pr_id'], '_regular_price', $price); if (isset($sales_price)) { update_post_meta($_POST['sell_pr_id'], '_sale_price', $sales_price); update_post_meta($_POST['sell_pr_id'], '_price', $sales_price); } else { update_post_meta($_POST['sell_pr_id'], '_sale_price', ''); update_post_meta($_POST['sell_pr_id'], '_price', $price); } update_post_meta($_POST['sell_pr_id'], '_sku', $SKU); update_post_meta($_POST['sell_pr_id'], '_backorders', $backorder); update_post_meta($_POST['sell_pr_id'], '_stock_status', $stock); update_post_meta($_POST['sell_pr_id'], '_manage_stock', $mang_stock); if ($mang_stock == 'yes') { update_post_meta($_POST['sell_pr_id'], '_downloadable', $downloadable); } else { delete_post_meta($_POST['sell_pr_id'], '_downloadable'); } update_post_meta($_POST['sell_pr_id'], '_virtual', $virtual); update_post_meta($_POST['sell_pr_id'], '_simple', $simple); update_post_meta($_POST['sell_pr_id'], '_downloadable_files', ''); if ($downloadable == 'yes') { $dwnload_url = wc_clean($seller_downloadable_file_url); $upload_file_url[md5($dwnload_url)] = array('name' => $usere_downloadable_file_name, 'file' => $dwnload_url); update_post_meta($_POST['sell_pr_id'], '_downloadable_files', $upload_file_url); } else { update_post_meta($_POST['sell_pr_id'], '_downloadable_files', ''); } if (isset($_FILES['wk_mp_product_downloadable'])) { update_post_meta($_POST['sell_pr_id'], '_downloadable_files', $_FILES['wk_mp_product_downloadable']); } else { update_post_meta($_POST['sell_pr_id'], '_downloadable_files', ''); } if (!empty($att)) { update_post_meta($_POST['sell_pr_id'], '_product_attributes', $att); } else { update_post_meta($_POST['sell_pr_id'], '_product_attributes', array()); } if ($stock_qty != '') { update_post_meta($_POST['sell_pr_id'], '_stock', $stock_qty); } else { delete_post_meta($_POST['sell_pr_id'], '_stock'); } update_post_meta($_POST['sell_pr_id'], '_download_limit', $limit); update_post_meta($_POST['sell_pr_id'], '_download_expiry', $expiry); update_post_meta($_POST['sell_pr_id'], '_product_image_gallery', $product_galary_images); update_post_meta($_POST['sell_pr_id'], '_thumbnail_id', $_POST['product_thumb_image_mp']); } $download_product = $product_image_gal = $_FILES; $p_category = isset($_POST['product_cate']) ? $_POST['product_cate'] : ''; MP_Form_Handler::update_pro_category($p_category, $_POST['sell_pr_id']); $product_id[0] = $_POST['sell_pr_id']; $product_id[1] = wp_set_object_terms($_POST['sell_pr_id'], $protype, 'product_type', false); } else { $postid = wp_insert_post($product_data); add_post_meta($postid, '_thumbnail_id', $_POST['product_thumb_image_mp']); $data = array('ID' => $postid, 'guid' => get_option('siteurl') . '/?post_type=ai1ec_event&p=' . $postid . '&instance_id='); if (wp_update_post($data)) { add_post_meta($postid, '_sku', $SKU); add_post_meta($postid, '_regular_price', $price); if (isset($sales_price)) { add_post_meta($postid, '_sale_price', $sales_price); add_post_meta($postid, '_price', $sales_price); } else { add_post_meta($postid, '_sale_price', ''); add_post_meta($postid, '_price', $price); } add_post_meta($postid, '_sale_price_dates_from', $sale_from); add_post_meta($postid, '_sale_price_dates_to', $sale_to); add_post_meta($postid, '_downloadable', $downloadable); add_post_meta($postid, '_virtual', $virtual); add_post_meta($postid, '_simple', $simple); } $p_category = isset($_POST['product_cate']) ? $_POST['product_cate'] : ''; $this->add_pro_category($p_category, $postid); $product_id[0] = $postid; } return $product_id; } }
function add_product() { global $wpdb; $wpmp_obj4 = new MP_Form_Handler(); /*MP_Form_Handler::marketplace_media_fix($post_id);*/ $wpmp_obj4->marketplace_media_fix(); ?> <div class="[ ]"><div class="[ padding ][ text-center ][ border ]"> <h3 class="[ text-center ][ no-margin ]"><?php echo _e("Add Product"); ?> </h3> </div> <div class="[ form ]"> <!-- /*------------------------------------*\ #@Maichomper Esta es la forma que ya estaba maquetada, para que integres esta, abajo está la table bu default \*------------------------------------*/ --> <form action="#"> <section class="[ ]"> <div class="[ padding ]"> <div class="[ text-center ]"> <h3 class="[ no-margin ]">Empieza a vender</h3> </div> </div> <div class="[ wrapper ]"> <h3 class="[ margin-bottom ][ color-primary ]"><small>Describe tu artÃculo</small></h3> </div> <article class="[ screen-1 ]"> <div class="[ row ][ margin-bottom ]"> <a href="#" class="[ span xmall-6 ][ border ][ button button--primary button--ink button--selected ][ padding ]"><i class="[ icon-sillones ]"></i>Sillones</a> <input type="hidden" name="couches" value="selected"> <a href="#" class="[ span xmall-6 ][ border ][ button button--primary button--ink ][ padding ]"><i class="[ icon-sillas ]"></i>Sillas</a> <input type="hidden" name="chairs" value=""> <a href="#" class="[ span xmall-6 ][ border ][ button button--primary button--ink ][ padding ]"><i class="[ icon-mesas ]"></i>Mesas</a> <input type="hidden" name="" value=""> <a href="#" class="[ span xmall-6 ][ border ][ button button--primary button--ink ][ padding ]"><i class="[ icon-recamaras ]"></i>Recámaras</a> <input type="hidden" name="" value=""> <a href="#" class="[ span xmall-6 ][ border ][ button button--primary button--ink ][ padding ]"><i class="[ icon-almacenaje ]"></i>Almacenaje</a> <input type="hidden" name="" value=""> <a href="#" class="[ span xmall-6 ][ border ][ button button--primary button--ink ][ padding ]"><i class="[ icon-iluminación ]"></i>Iluminación</a> <input type="hidden" name="" value=""> <a href="#" class="[ span xmall-6 ][ border ][ button button--primary button--ink ][ padding ]"><i class="[ icon-decoration ]"></i>Decoración</a> <input type="hidden" name="" value=""> <a href="#" class="[ span xmall-6 ][ border ][ button button--primary button--ink ][ padding ]"><i class="[ icon-kids ]"></i>para niños</a> <input type="hidden" name="" value=""> </div><!-- row --> <div class="wrapper"> <fieldset class="[ margin-bottom ]"> <label class="[ block xmall-12 ]" for="email">SubcategorÃa <span class="[ color-primary ]">*</span></label> <select name="subcategories" id=""> <option value="table-lamp">de mesa</option> <option value="table-lamp">de mesa</option> <option value="table-lamp">de mesa</option> </select> </fieldset> <fieldset class="[ margin-bottom ]"> <label class="[ block xmall-12 ]" for="email">Nombre <span class="[ color-primary ]">*</span></label> <input class="[ block ][ xmall-12 ]" type="text" value="ej. lámpara de mesa negra"> </fieldset> <fieldset class="[ margin-bottom ]"> <label class="[ block xmall-12 ]" for="email">Descripción <span class="[ color-primary ]"></span></label> <textarea class="[ block ][ xmall-12 ]"></textarea> </fieldset> </div><!-- wrapper --> </article> <article class="[ images ][ screen-2 ]"> <div class="[ wrapper ]"> <h3 class="[ margin-bottom ][ color-primary ]"><small>Agrega imágenes</small></h3> <p class="[ color-dark ]"><small><span class="[ color-primary ]">*</span> Recuerda incluir acercamientos del material y posibles dañis que pueda tener el artÃculo</small></p> <fieldset class="[ margin-bottom ][ padding--large border-grey ][ text-center ]"> <i class="[ block xmall-12 ][ icon-menu icon-camera icon--large ][ color-grey ]"></i> <p class="[ color-grey ]"><small>vista frontal</small></p> <a href="" class="[ button button--primary button--hollow ]">agregar</a> </fieldset> <fieldset class="[ margin-bottom ][ padding--large border-grey ][ text-center ]"> <i class="[ block xmall-12 ][ icon-menu icon-camera icon--large ][ color-grey ]"></i> <p class="[ color-grey ]"><small>vista derecha</small></p> <a href="" class="[ button button--primary button--hollow ]">agregar</a> </fieldset> <fieldset class="[ margin-bottom ][ padding--large border-grey ][ text-center ]"> <i class="[ block xmall-12 ][ icon-menu icon-camera icon--large ][ color-grey ]"></i> <p class="[ color-grey ]"><small>vista izquierda</small></p> <a href="" class="[ button button--primary button--hollow ]">agregar</a> </fieldset> <fieldset class="[ margin-bottom ][ padding--large border-grey ][ text-center ]"> <i class="[ block xmall-12 ][ icon-menu icon-camera icon--large ][ color-grey ]"></i> <p class="[ color-grey ]"><small>vista trasera</small></p> <a href="" class="[ button button--primary button--hollow ]">agregar</a> </fieldset> <fieldset class="[ margin-bottom ][ padding--large border-grey ][ text-center ]"> <i class="[ block xmall-12 ][ icon-menu icon-camera icon--large ][ color-grey ]"></i> <p class="[ color-grey ]"><small>detalles</small></p> <a href="" class="[ button button--primary button--hollow ]">agregar</a> </fieldset> <fieldset class="[ margin-bottom ][ padding--large border-grey ][ text-center ]"> <i class="[ block xmall-12 ][ icon-menu icon-camera icon--large ][ color-grey ]"></i> <p class="[ color-grey ]"><small>agregar foto</small></p> <a href="" class="[ button button--primary button--hollow ]">agregar</a> </fieldset> </div> </article> <article class="[ ][ screen-3 ]"> <div class="[ wrapper ]"> <fieldset class="[ margin-bottom ]"> <label class="[ block xmall-12 ]" for="email">Dimenciones <span class="[ color-primary ]">*</span> (en cms)</label> <div class="[ row ]"> <div class="[ columna xmall-4 ]"> <input class="[ block xmall-12 ]" name="width" type="text" placeholder="ancho"> </div> <div class="[ columna xmall-4 ]"> <input class="[ block xmall-12 ]" name="height" type="text" placeholder="alto"> </div> <div class="[ columna xmall-4 ]"> <input class="[ block xmall-12 ]" name="depth" type="text" placeholder="profundo"> </div> </div> </fieldset> <fieldset class="[ state ][ margin-bottom ]"> <label class="[ block xmall-12 ]" for="">Estado</label> <select class="[ padding ][ text-center ]"> <option href="#" value="nuevo" >nuevo</option> <option href="#" value="bueno" >bueno</option> <option href="#" value="satisfactorio" >satisfactorio</option> <option href="#" value="gastado" >gastado</option> </select> <p class="[ no-margin ]"><small><span class="[ color-primary ]">*</span></small></p> <p class="[ no-margin ]"><small>Nuevo - el producto se encuentra dentro de su caja </small></p> <p class="[ no-margin ]"><small>Bueno - el producto se encuentra dentro de su caja </small></p> <p class="[ no-margin ]"><small>Satisfactorio - el producto se encuentra dentro de su caja </small></p> <p class="[ no-margin ]"><small>Gastado - el producto se encuentra dentro de su caja </small></p> </fieldset> <fieldset class="[ margin-bottom ]"> <label class="[ block xmall-12 ]" for="">Marca</label> <select class="[ padding ][ text-center ]"> <option href="#" value="nuevo" >nuevo</option> <option href="#" value="bueno" >bueno</option> <option href="#" value="satisfactorio" >satisfactorio</option> <option href="#" value="gastado" >gastado</option> </select> </fieldset> <fieldset class="[ margin-bottom ]"> <label class="[ block xmall-12 ]" for="">Material<span class="[ color-primary ]">*</span></label> <select class="[ padding ][ text-center ]"> <option href="#" value="nuevo" >nuevo</option> <option href="#" value="bueno" >bueno</option> <option href="#" value="satisfactorio" >satisfactorio</option> <option href="#" value="gastado" >gastado</option> </select> </fieldset> <fieldset class="[ margin-bottom ]"> <label class="[ block xmall-12 ]" for="">Edad<span class="[ color-primary ]">*</span></label> <select class="[ padding ][ text-center ]"> <option href="#" value="nuevo" >nuevo</option> <option href="#" value="bueno" >bueno</option> <option href="#" value="satisfactorio" >satisfactorio</option> <option href="#" value="gastado" >gastado</option> </select> </fieldset> <fieldset class="[ margin-bottom ]"> <label class="[ block xmall-12 ]" for="">Color<span class="[ color-primary ]">*</span></label> <div class="[ row ]"> <div class="[ columna xmall-2 ][ margin-bottom--small ]"> <div class="[ bg-black ][ color-chip chip-selected ]"> </div> </div> <div class="[ columna xmall-2 ][ margin-bottom--small ]"> <div class="[ bg-grey ][ color-chip ]"> </div> </div> <div class="[ columna xmall-2 ][ margin-bottom--small ]"> <div class="[ bg-brown ][ color-chip ]"> </div> </div> <div class="[ columna xmall-2 ][ margin-bottom--small ]"> <div class="[ bg-purple ][ color-chip ]"> </div> </div> <div class="[ columna xmall-2 ][ margin-bottom--small ]"> <div class="[ bg-blue ][ color-chip ]"> </div> </div> <div class="[ columna xmall-2 ][ margin-bottom--small ]"> <div class="[ bg-green ][ color-chip ]"> </div> </div> <div class="[ columna xmall-2 ][ margin-bottom--small ]"> <div class="[ bg-yellow ][ color-chip ]"> </div> </div> <div class="[ columna xmall-2 ][ margin-bottom--small ]"> <div class="[ bg-orange ][ color-chip ]"> </div> </div> <div class="[ columna xmall-2 ][ margin-bottom--small ]"> <div class="[ bg-red ][ color-chip ]"> </div> </div> <div class="[ columna xmall-2 ][ margin-bottom--small ]"> <div class="[ bg-wheat ][ color-chip ]"> </div> </div> <div class="[ columna xmall-2 ][ margin-bottom--small ]"> <div class="[ bg-silver ][ color-chip ]"> </div> </div> </div> </fieldset> <fieldset class="[ margin-bottom ]"> <label class="[ block xmall-12 ]" for="">Textura<span class="[ color-primary ]">*</span></label> <div class="[ row ]"> <div class="[ columna xmall-2 ][ margin-bottom--small ]"> <div class="[ bg-black ][ color-chip chip-selected ]"> </div> </div> <div class="[ columna xmall-2 ][ margin-bottom--small ]"> <div class="[ bg-grey ][ color-chip ]"> </div> </div> </div> </fieldset> <fieldset class="[ margin-bottom ]"> <label class="[ block xmall-12 ]" for="">Este producto se vende como:<span class="[ color-primary ]">*</span></label> <input type="radio" name="tipo" value="individual"> ArtÃculo individual <br /> <input type="radio" name="tipo" value="conjunto"> En conjunto </fieldset> <fieldset class="[ margin-bottom ]"> <label class="[ block xmall-12 ]" for="">Haz click en las caracterÃsticas que tu producto cumpla:</label> <input type="checkbox" name="characteristics" value="antiquity"> Antigüedad<br /> <input type="checkbox" name="characteristics" value="kids"> Mueble para niños<br /> <input type="checkbox" name="characteristics" value="less-than-5"> Pesa menos de 5 kilos<br /> <input type="checkbox" name="characteristics" value="scratches"> Tiene golpes o rayones de más de 2 cms. </fieldset> <fieldset class="[ margin-bottom ]"> <label class="[ block xmall-12 ]" for="">Este artÃculo a estado expuesto a:</label> <input type="checkbox" name="exposed-to" value="dog"> Perro<br /> <input type="checkbox" name="exposed-to" value="cat"> Gato<br /> <input type="checkbox" name="exposed-to" value="cigarrette"> Cigarro </fieldset> <fieldset class="[ margin-bottom ]"> <label class="[ block xmall-12 ]" for="">Cantidad<span class="[ color-primary ]">*</span></label> <input class="[ block ][ xmall-12 ]" type="number" name="cuantity"> </fieldset> <fieldset class="[ margin-bottom ]"> <label class="[ block xmall-12 ]" for="">Precio original<span class="[ color-primary ]">*</span></label> <input class="[ block ][ xmall-12 ]" type="number" name="original-price" value="$"> </fieldset> <fieldset class="[ margin-bottom ]"> <label class="[ block xmall-12 ]" for="">Precio final<span class="[ color-primary ]">*</span></label> <input class="[ block ][ xmall-12 ]" type="number" name="final-price" value="$"> </fieldset> <fieldset class="[ margin-bottom ]"> <input type="checkbox" name="exposed-to" value="cat"> <span class="[ color-primary ]">Solicitar sello cxm</span><br /> <span class="[ color-primary ]">*</span> Actualmente sólo validamos en las zonas de: Polanco, Roma y Condesa. </fieldset> </div><!-- wrapper --> </article> </section> </form> <!-- /*------------------------------------*\ #acaba forma maquetada \*------------------------------------*/ --> <form action="<?php $params = array('page' => "eProduct"); $url = add_query_arg($params, get_permalink()); echo $url; ?> " method="post" enctype="multipart/form-data" id="product-form"> <fieldset> <table> <tbody> <tr> <td><label for="product_name"><?php echo _e("Product Name"); ?> <span class="required">*</span> :</label></td> <td><input class="product_input" type="text" name="product_name" id="product_name" size="54" value="<?php /*if(isset($post_row_data[0]->post_title)) echo $post_row_data[0]->post_title;*/ ?> " /> <div id="pro_name_error" class="error-class"><div> </td> </tr> <tr> <td><label for="product_desc"><?php echo _e("About Product"); ?> :</label></td> <td> <?php $settings = array('media_buttons' => true, 'textarea_name' => 'product_desc', 'textarea_rows' => get_option('default_post_edit_rows', 10), 'tabindex' => '', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => false); if (isset($post_row_data[0]->post_content)) { $content = $post_row_data[0]->post_content; } if (isset($content)) { echo wp_editor($content, 'product_desc', $settings); } else { echo wp_editor('', 'product_desc', $settings); } ?> <div id="long_desc_error" class="error-class"><div> </td> </tr> <!--<tr> <td><label for="product_type"><?php echo _e("Product Type"); ?> <span class="required">*</span> :</label></td> <td><select size="1" name="product_type" id="product_type"> <option value="no"><?php echo _e("Select Product Type"); ?> </option> <option value="_downloadable"><?php echo _e("Downloadable"); ?> </option> <option value="_virtual"><?php echo _e("Virtual"); ?> </option> </select> </td> </tr>--> <tr> <td style="vertical-align: top;"> <label for="product_category"><?php echo _e("Product Category"); ?> :</label> </td> <td> <select multiple="true" name="product_cate[]" id="product_cate"> <?php /*MP_Form_Handler::mp_product_categories1(0,0);*/ ?> <?php $wpmp_obj4->mp_product_categories1(0, 0); ?> </select> </td> </tr> <tr> <td> <label for="fileUpload"><?php echo _e("Product Thumbnail"); ?> :</label> </td> <td> <div id="product_image"> </div> <input type="hidden" id="product_thumb_image_mp" name="product_thumb_image_mp" /> <a class="upload mp_product_thumb_image btn" href="javascript:void(0);" /><?php _e('Upload Thumb'); ?> </a> </td> </tr> <tr> <td> <label for="product_sku"><?php echo _e("Product SKU"); ?> <span class="required">*</span>: <span class="help"> <div class="help-tip-sol"><?php echo _e("SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased."); ?> </div> <span class="help-tip">[?]</span> </span> </label> </td> <td> <input class="product_input" type="text" name="product_sku" id="product_sku" value="" /> <div id="pro_sku_error" class="error-class"><div> </td> </tr> <tr> <td> <label for="regu_price"><?php echo _e("Regular Price"); ?> <span class="required">*</span> :</label> </td> <td> <input class="product_input" type="text" name="regu_price" id="regu_price" value="" /> <div id="regl_pr_error" class="error-class"><div> </td> </tr> <tr> <td> <label for="sale_price"><?php echo _e("Sale Price"); ?> :</label></td> <td> <input class="product_input" type="text" name="sale_price" id="sale_price" value="" /> <div id="sale_pr_error" class="error-class"><div> </td> </tr> <tr> <td> <label for="short_desc"><?php echo _e("Product Short Desc"); ?> :</label> </td> <td> <?php $settings = array('media_buttons' => true, 'textarea_name' => 'short_desc', 'textarea_rows' => get_option('default_post_edit_rows', 10), 'tabindex' => '', 'editor_class' => 'frontend', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => false, 'drag_drop_upload' => true); if (isset($post_row_data[0]->post_excerpt)) { $short_content = $post_row_data[0]->post_excerpt; } if (isset($short_content)) { echo wp_editor($short_content, 'short_desc', $settings); } else { echo wp_editor("", 'short_desc', $settings); } ?> <div id="short_desc_error" class="error-class"></div> </td> </tr> <tr> <td> </td> <td> <input type="submit" name="add_product_sub" id="add_product_sub" value="Save" class="button"/></td> </tr> </tbody> </table> <?php apply_filters('mp_user_redirect', 'redirect user'); ?> </fieldset> </form> </div> <?php }
function edit_product() { global $wpdb; $wpmp_obj3 = new MP_Form_Handler(); global $mp_obj; $wc_currency = get_woocommerce_currency_symbol(get_option('woocommerce_currency')); $user_id = get_current_user_id(); if (isset($_GET['pid'])) { $post_id = $wk_pro_id = $_GET['pid']; if ($_POST) { if (isset($_POST['add_product_sub'])) { /*MP_Form_Handler::product_add_update();*/ $wpmp_obj3->product_add_update(); } } } else { if (isset($_POST['add_product_sub'])) { /*$wk_pro_p=MP_Form_Handler::product_add_update();*/ $wk_pro_p = $wpmp_obj3->product_add_update(); $wk_pro_id = $wk_pro_p[0]; } } /*MP_Form_Handler::marketplace_media_fix($post_id);*/ $wpmp_obj3->marketplace_media_fix(); $product_auth = $wpdb->get_var("select post_author from {$wpdb->posts} where ID='" . $wk_pro_id . "'"); if (isset($wk_pro_id) && $product_auth == $user_id) { $post_row_data = $wpdb->get_results("select * from {$wpdb->posts} where ID=" . $wk_pro_id); $postmeta_row_data = get_post_meta($wk_pro_id); /*$product_images= MP_Form_Handler::get_product_image($wk_pro_id,'_thumbnail_id');*/ $product_images = $wpmp_obj3->get_product_image($wk_pro_id, '_thumbnail_id'); $meta_arr = array(); foreach ($postmeta_row_data as $key => $value) { $meta_arr[$key] = $value[0]; } $product_attributes = get_post_meta($wk_pro_id, '_product_attributes', true); $display_variation = 'no'; if (!empty($product_attributes)) { foreach ($product_attributes as $variation) { if ($variation['is_variation'] == 1) { $display_variation = 'yes'; } } } /*$image_gallary=MP_Form_Handler::get_product_image($wk_pro_id,'_product_image_gallery');*/ $image_gallary = $wpmp_obj3->get_product_image($wk_pro_id, '_product_image_gallery'); } ?> <h2><?php echo _e("Edit Product"); ?> </h2> <input type="hidden" name="var_variation_display" id="var_variation_display" value="<?php echo $display_variation; ?> " /> <ul id='edit_product_tab'> <li><a id='edit_tab'><?php echo _e("Edit"); ?> </a></li> <li><a id='inventorytab'><?php echo _e("Inventory"); ?> </a></li> <li><a id='attributestab'><?php echo _e("Attributes"); ?> </a></li> <li style="display:none;"><a id='avariationtab'><?php echo _e("Variations"); ?> </a></li> <li><a id='pro_statustab'><?php echo _e("Product Status"); ?> </a></li> </ul> <form action="" method="post" enctype="multipart/form-data" id="product-form"> <div class="wk_mp_container form" id="edit_tabwk"> <table> <tbody> <div class="product-type mp-toggle-sidebar"> <label for="product_type">Product Type:</label> <!-- <span class="mp-toggle-type-display"><?php if (isset($meta_arr['_simple']) && $meta_arr['_simple'] == 'yes') { echo 'Simple Product'; } if ($meta_arr['_downloadable'] == 'yes') { echo 'Downloadable Product'; } if ($meta_arr['_virtual'] == 'yes') { echo 'Virtual Product'; } ?> </span> --> <!-- <a class="mp-product-toggle-edit label label-success" href="javascript:void(0);">Edit</a> <div class="mp-toggle-select-type-container mp-hide" style="display:none;"> --> <select name="product_type" id="product_type" class="mp-toggle-select"> <?php $mp_product_type = $wpdb->get_results("select term.term_id,term.name from {$wpdb->prefix}terms as term join {$wpdb->prefix}term_taxonomy as wtt on wtt.term_id=term.term_id where wtt.taxonomy='product_type'"); $pro_term_relation = $wpdb->get_var("select wtr.term_taxonomy_id from {$wpdb->prefix}term_relationships as wtr join {$wpdb->prefix}term_taxonomy wtt on wtr.term_taxonomy_id=wtt.term_taxonomy_id where wtt.taxonomy='product_type' and wtr.object_id={$wk_pro_id}"); foreach ($mp_product_type as $pro_type) { if ($pro_type->name == 'external') { continue; } if ($pro_type->name == 'grouped') { continue; } ?> <option value="<?php echo $pro_type->name; ?> " <?php if ($pro_type->term_id == $pro_term_relation) { echo 'selected="selected"'; } ?> ><?php echo $pro_type->name; ?> </option> <?php } ?> </select> <!-- <a class="mp-toggle-type-save btn btn-default btn-sm" href="javascript:void(0);">OK</a> <a class="mp-toggle-type-cancel btn" href="javascript:void(0);">Cancel</a> </div> --> </div> <tr> <td><label for="product_name"><?php echo _e("Product Name"); ?> <span class="required">*</span> :</label></td> <td><input class="product_input" type="text" name="product_name" id="product_name" size="54" value="<?php if (isset($post_row_data[0]->post_title)) { echo $post_row_data[0]->post_title; } ?> " /> <div id="pro_name_error" class="error-class"></div> </td> </tr> <tr style="display:none;"> <td> <?php if (isset($wk_pro_id) && isset($_GET['page']) && $_GET['page'] == 'eProduct') { ?> <input type="hidden" value="<?php echo $wk_pro_id; ?> " name="sell_pr_id" id="sell_pr_id" /> <?php } ?> <td> </tr> <tr> <td><label for="product_desc"><?php echo _e("About Product"); ?> :</label></td> <td><?php $settings = array('media_buttons' => true, 'textarea_name' => 'product_desc', 'textarea_rows' => get_option('default_post_edit_rows', 10), 'tabindex' => '', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => false); if (isset($post_row_data[0]->post_content)) { $content = $post_row_data[0]->post_content; } if (isset($content)) { echo wp_editor("{$content}", 'product_desc', $settings); } else { echo wp_editor("", 'product_desc', $settings); } ?> <div id="long_desc_error" class="error-class"></div> </td> </tr> <tr> <td><label for="product_category"><?php echo _e("Product Category"); ?> :</label></td> <td> <select multiple="true" name="product_cate[]" id="product_cate"> <?php /*MP_Form_Handler::mp_product_categories1(0,$wk_pro_id);*/ ?> <?php $wpmp_obj3->mp_product_categories1(0, $wk_pro_id); ?> </select> </td> </tr> <tr> <td><label for="fileUpload"><?php echo _e("Product Thumbnail"); ?> :</label></td> <td><?php if (isset($meta_arr['image'])) { ?> <img src="" width="50" height="50"> <?php } ?> <div id="product_image"> </div> <input type="hidden" id="product_thumb_image_mp" name="product_thumb_image_mp" value="<?php if (isset($meta_arr['_thumbnail_id'])) { echo $meta_arr['_thumbnail_id']; } ?> " /> <a class="upload mp_product_thumb_image btn" href="javascript:void(0);" /><?php _e('Upload Thumb'); ?> </a> <?php if (!empty($product_images)) { echo "<img style='display:inline;' src='" . content_url() . "/uploads/" . $product_images . "' width=50 height=50 />"; } ?> </td> </tr> <tr> <!-- <td><label for="product_sku"><?php /*echo _e("Product SKU");*/ ?> <span class="required">*</span> :</label></td> --> <td> <label for="product_sku"><?php echo _e("Product SKU"); ?> <span class="required">*</span>: <span class="help"> <div class="help-tip-sol"><?php echo _e("SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased."); ?> </div> <span class="help-tip">[?]</span> </span> </label> </td> <td><input class="product_input" type="text" name="product_sku" id="product_sku" value="<?php if (isset($meta_arr['_sku'])) { echo $meta_arr['_sku']; } ?> " /> <div id="pro_sku_error" class="error-class"></div></td> </tr> <?php /*if($pro_term_relation[0]->term_taxonomy_id!=4){*/ ?> <tr id="regularPrice"> <td><label for="regu_price"><?php echo _e("Regular Price"); ?> <span class="required">*</span> :</label></td> <td><input class="product_input" type="text" name="regu_price" id="regu_price" value="<?php if (isset($meta_arr['_regular_price'])) { echo $meta_arr['_regular_price']; } ?> " <?php echo $pro_term_relation == 4 ? 'disabled' : ''; ?> /> <div id="regl_pr_error" class="error-class"></div></td> </tr> <tr id="salePrice"> <td> <label for="sale_price"><?php echo _e("Sale Price"); ?> :</label> </td> <td><input class="product_input" type="text" name="sale_price" id="sale_price" value="<?php if (isset($meta_arr['_sale_price'])) { echo $meta_arr['_sale_price']; } ?> " <?php echo $pro_term_relation == 4 ? 'disabled' : ''; ?> /> <div id="sale_pr_error" class="error-class"></div></td> </tr> <?php /*}*/ ?> <tr> <td><label for="short_desc"><?php echo _e("Product Short Desc"); ?> :</label></td> <td><?php $settings = array('media_buttons' => true, 'textarea_name' => 'short_desc', 'textarea_rows' => get_option('default_post_edit_rows', 10), 'tabindex' => '', 'editor_class' => 'backend', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => false, 'drag_drop_upload' => true); if (isset($post_row_data[0]->post_excerpt)) { $short_content = $post_row_data[0]->post_excerpt; } if (isset($short_content)) { echo wp_editor("{$short_content}", 'short_desc', $settings); } else { echo wp_editor("", 'short_desc', $settings); } ?> <div id="short_desc_error" class="error-class"></div></td> </tr> </tbody> </table> </div> <div class="wk_mp_container" id="inventorytabwk"> <table> <tbody> <tr> <td> <label for="wk-mp-stock"><?php echo _e("Manage Stock?"); ?> :</label></td> <td> <label for="wk_stock_management" style="width: 100%;"> <input type="checkbox" class="wk_stock_management" id="wk_stock_management" name="wk_stock_management" value ="yes" <?php if (isset($meta_arr['_manage_stock']) && $meta_arr['_manage_stock'] == 'yes') { echo "checked"; } ?> /><?php _e("Enable stock management at product level"); ?> </label> </td> </tr> <tr> <td><label for="wk-mp-stock"><?php echo _e("Stock Qty"); ?> :</label></td> <td><input type="text" class="product_input" placeholder="0" name="wk-mp-stock-qty" id="wk-mp-stock-qty" value="<?php echo isset($meta_arr['_stock']) ? $meta_arr['_stock'] : ''; ?> " /></td> </tr> <tr> <td><label for="wk-mp-stock"><?php echo _e("Stock Status"); ?> :</label></td> <td> <select name="_stock_status" id="_stock_status" class="form-control"> <option value="instock" <?php if (isset($meta_arr['_stock_status']) && $meta_arr['_stock_status'] == 'instock') { echo 'selected="selected"'; } ?> ><?php _e("In Stock"); ?> </option> <option value="outofstock" <?php if (isset($meta_arr['_stock_status']) && $meta_arr['_stock_status'] == 'outofstock') { echo 'selected="selected"'; } ?> ><?php _e("Out of Stock"); ?> </option> </select> </td> </tr> <tr> <td><label for="wk-mp-backorders"><?php echo _e("Allow Backorders"); ?> :</label></td> <td> <select name="_backorders" id="_backorders" class="form-control"> <option value="no" <?php if (isset($meta_arr['_backorders']) && $meta_arr['_backorders'] == 'no') { echo 'selected="selected"'; } ?> ><?php echo _e("Do not allow"); ?> </option> <option value="notify" <?php if (isset($meta_arr['_backorders']) && $meta_arr['_backorders'] == 'notify') { echo 'selected="selected"'; } ?> ><?php echo _e("Allow but notify customer"); ?> </option> <option value="yes" <?php if (isset($meta_arr['_backorders']) && $meta_arr['_backorders'] == 'yes') { echo 'selected="selected"'; } ?> ><?php _e("Allow"); ?> </option> </select> </td> </tr> </tbody> </table> </div> <div class="wk_mp_container" id="attributestabwk"> <div class="input_fields_toolbar"> <button class="btn btn-success add-variant-attribute"><?php _e("+ Add an attribute"); ?> </button> <!--<button type="button" class="btn btn-default save_attributes" data-id="1347"><?php echo _e("Save attributes"); ?> </button> --> </div> <div class="wk_marketplace_attributes"> <?php if (!empty($product_attributes)) { $i = 0; foreach ($product_attributes as $proatt) { ?> <div class="wk_mp_attributes"> <div class="box-header attribute-remove"> <input type="text" class="mp-attributes-name" placeholder="Attribute name" name="pro_att[<?php echo $i; ?> ][name]" value="<?php echo str_replace('-', ' ', $proatt['name']); ?> "/><input type="text" class="option" title="attribue value by seprating comma eg. a|b|c" placeholder=" Value eg. a|b|c" name="pro_att[<?php echo $i; ?> ][value]" value="<?php echo $proatt['value']; ?> "/> <input type="hidden" name="pro_att[<?php echo $i; ?> ][position]" class="attribute_position" value="<?php echo $proatt['position']; ?> "/> <span class="mp_actions"> <button class="mp_attribute_remove btn btn-danger">Remove</button> </span> </div> <div class="box-inside clearfix"> <div class="wk-mp-attribute-config"> <div class="checkbox-inline"> <input id="wkmp_check1_<?php echo $i; ?> " type="checkbox" class="checkbox" name="pro_att[<?php echo $i; ?> ][is_visible]" value="1" <?php if ($proatt['is_visible'] == '1') { echo "checked"; } ?> /><label for="wkmp_check1_<?php echo $i; ?> " style="width: 185px;">Visible on the product page</label></div> <div class="checkbox-inline"> <input id="product_att_varitioN_<?php echo $i; ?> " type="checkbox" class="checkbox" name="pro_att[<?php echo $i; ?> ][is_variation]" value="1" <?php if ($proatt['is_variation'] == '1') { echo "checked"; } ?> /><label for="product_att_varitioN_<?php echo $i; ?> ">Used for variations</label> </div> <input type="hidden" name="pro_att[<?php echo $i; ?> ][is_taxonomy]" value="<?php echo $proatt['taxonomy']; ?> "/> </div> <div class="attribute-options"></div> </div> </div> <?php $i++; } } ?> </div> </div> <!-- varication attribute of the product --> <div class="wk_mp_container" id="avariationtabwk"> <div id="mp_attribute_variations"> <?php echo $mp_obj->marketplace_attributes_variation($wk_pro_id); ?> </div> <div class="input_fields_toolbar_variation"> <button id="mp_var_attribute_call" class="btn btn-success "><?php _e("+ Add Variation"); ?> </button> <input type="hidden" id="new_added_variation" name="new_added_variation" value="0"> </div> </div> <div class="wk_mp_container" id="pro_statustabwk"> <?php if (get_option('wkmp_seller_allow_publish')) { ?> <div class="mp-sidebar-container"> <div class="mp_wk-post-status mp-toggle-sidebar"> <label for="post_status"><?php echo _e("Product Status:"); ?> </label> <span class="mp-toggle-selected-display"><?php if (isset($post_row_data[0]->post_status) && !empty($post_row_data[0]->post_status) && $post_row_data[0]->post_status == 'publish') { echo 'Online'; } else { echo 'draft'; } ?> </span> <a class="mp-toggle-sider-edit label label-success" href="javascript:void(0);" style="display: inline;">Edit</a> <div class="mp-toggle-select-container mp-hide" style="display: none;"> <select id="product_post_status" class="mp-toggle-select" name="mp_product_status"> <option value="">Select status</option> <option value="publish" <?php if ($post_row_data[0]->post_status == 'publish') { echo 'selected="selected"'; } ?> ><?php echo _e("Online"); ?> </option> <option value="draft" <?php if ($post_row_data[0]->post_status == 'draft') { echo 'selected="selected"'; } ?> ><?php echo _e("Draft"); ?> </option> </select> <a class="mp-toggle-save btn btn-default btn-sm" href="javascript:void(0);">OK</a> <a class="mp-toggle-cancel btn" href="javascript:void(0);">Cancel</a> </div> </div> </div> <?php } ?> <div class="wk-mp-side-head"> <label class="checkbox-inline"> <input type="checkbox" id="_ckdownloadable" name="_ckdownloadable" value="yes" <?php if (isset($meta_arr['_downloadable']) && $meta_arr['_downloadable'] == 'yes') { echo 'checked'; } ?> /> <?php _e("Downloadable Product", "marketplace"); ?> </label> </div> <div class="wk-mp-side-body" style="display:<?php if (isset($meta_arr['_downloadable']) && $meta_arr['_downloadable'] == 'yes') { echo 'block'; } else { echo 'none'; } ?> " > <?php $mp_dwonloadable_file = get_post_meta($wk_pro_id, '_downloadable_files', true); $mp_download = array(); if (!empty($mp_dwonloadable_file)) { foreach ($mp_dwonloadable_file as $key => $value) { $mp_download[] = $value; } } ?> <ul class="list-unstyled " style="list-style:none;"> <li class="form-group"> <table class="table table-condensed"> <tr> <td> <p> <label><?php echo _e('File Name:', 'marketplace'); ?> </label> <input type="text" class="input_text" placeholder="File Name" id='user_downloadable_file_name' name="user_downloadable_file_name" value="<?php if (isset($mp_download[0]['name'])) { echo $mp_download[0]['name']; } ?> "/> </p> <p> <label><?php echo _e('File URL :', 'marketplace'); ?> </label> <input type="text" class="input" placeholder="http://" id="upload_downloadable_file_url" name="upload_downloadable_file_url" value="<?php if (isset($mp_download[0]['file'])) { echo $mp_download[0]['file']; } ?> "/> </p> <p> <!-- <input type="file" class="upload_downloadable_file_type" name="wk_mp_product_downloadable" style="display:none" /> --> <a href="javascript:void(0);" class="btn btn-sm btn-default upload_file_button upload_downloadable_file">Choose file</a> <a href="#" class="btn btn-sm btn-danger delete"> <span>Delete</span> </a> </p> </td> </tr> </tbody> </table> </li> <li class="form-group"> <div class="input-group"> <span class="input-group-addon">Limit</span> <input type="text" name="_download_limit" id="_download_limit" value="<?php if (isset($meta_arr['_download_limit'])) { echo $meta_arr['_download_limit']; } ?> " class="form-control" placeholder="Download Limit. e.g: 4"/> </div> </li> <li> <div class="input-group"> <span class="input-group-addon">Expiry</span> <input type="text" name="_download_expiry" id="_download_expiry" value="<?php if (isset($meta_arr['_download_expiry'])) { echo $meta_arr['_download_expiry']; } ?> " class="form-control" placeholder="Number of days"/> </div> </li> </ul> </div> <div class="wk-mp-side-head">Image Gallery</div> <div id="wk-mp-product-images"> <div id="product_images_container"> <?php if (isset($meta_arr['_product_image_gallery']) && $meta_arr['_product_image_gallery'] != '') { $image_id = explode(',', get_post_meta($wk_pro_id, '_product_image_gallery', true)); for ($i = 0; $i < count($image_id); $i++) { $image_url = wp_get_attachment_image_src($image_id[$i]); echo "<div class='pro_image_gallary'><img src='" . $image_url[0] . "' width=50 height=50 />"; ?> <ul class="actions" style="list-style:none;"> <li> <a href="javascript:void(0);" id="<?php echo $wk_pro_id . 'i_' . $image_id[$i]; ?> " class="mp-img-delete_gal" title="Delete image">Delete</a> </li> </ul> </div> <?php } } ?> </div> <div id="handleFileSelectgalaray"> </div> <input type="hidden" class="product_input" name="product_image_Galary_ids" id="product_image_Galary_ids" value="<?php if (isset($meta_arr['_product_image_gallery'])) { echo $meta_arr['_product_image_gallery']; } ?> " /> </div> <a href="javascript:void(0);" class="add-mp-product-images btn">+ Add product images</a> </p> <?php wp_nonce_field('marketplace-edid_product'); ?> </div> <input type="submit" name="add_product_sub" id="add_product_sub" value="Update" class="button"/></td> </form> <?php unset($_POST); }
function spreview() { ?> <style type="text/css"> header h1 { display:none; } aside { display:none; } #main { width:100%; } </style> <?php global $wpdb; $wpmp_obj10 = new MP_Form_Handler(); include 'facebookv2/src/facebook.php'; /********************************************************faceboook*********************************************************/ if (isset($_GET['checkpoint'])) { $checkpoint = $_GET['checkpoint']; $appid = get_option('wkfb_mp_key_app_ID'); $secretkey = get_option('wkfb_mp_app_secret_key'); if ($checkpoint && $appid && $secretkey) { $key = $_GET['key']; $facebook = new Facebook(array('appId' => $appid, 'secret' => $secretkey, 'cookie' => true)); $req_perms = "user_likes,public_profile,publish_stream,offline_access,user_status,email,read_stream"; $session = $facebook->getUser(); $loginUrl = $facebook->getLoginUrl(array('canvas' => 1, 'fbconnect' => 0, 'req_perms' => $req_perms)); $user_info = null; if (!$session) { echo "<script type='text/javascript'>top.location.href ='" . $loginUrl . "';</script>"; } else { try { $fbemail = $facebook->api('/me?fields=email&access_token=' . $key); $user_info = $facebook->api('/me'); } catch (FacebookApiException $e) { //echo "<script type='text/javascript'>top.location.href = '".$loginUrl."';</script>"; } } $wk_user_name = $user_info['name']; $registerDate = date('Y-m-d H:i:s'); $first_name = $user_info['first_name']; $last_name = $user_info['last_name']; $wk_email = $fbemail['email']; $login_name = explode('@', $fbemail['email']); $user_url = $user_info['link']; $wk_random_password = wp_generate_password(); if (!email_exists($wk_email)) { $user_id = wp_create_user($wk_email, $wk_random_password, $wk_email); update_user_meta($newuser_id, 'first_name', $first_name); update_user_meta($newuser_id, 'last_name', $last_name); /*MP_Form_Handler::mp_user_welcome($user_id,$wk_random_password);*/ $wpmp_obj10->mp_user_welcome($user_id, $wk_random_password); if (!is_wp_error($user_id)) { wp_set_current_user($user_id); // set the current wp user wp_set_auth_cookie($user_id); /*$page_id=MP_Form_Handler::get_page_id(get_option('wkmp_seller_login_page_tile'));*/ $page_id = $wpmp_obj10->get_page_id(get_option('wkmp_seller_login_page_tile')); wp_redirect(home_url('?page_id=' . $page_id) . '&page=eFeed&sid=' . $_GET['sid']); exit; } } else { $user = get_user_by('email', $wk_email); $user_id = (int) $user->data->ID; $user_id = wp_update_user(array('ID' => $user_id, 'user_pass' => $wk_random_password)); if (!is_wp_error($user_id)) { wp_set_current_user($user_id); // set the current wp user wp_set_auth_cookie($user_id); /*$page_id=MP_Form_Handler::get_page_id(get_option('wkmp_seller_login_page_tile'));*/ $page_id = $wpmp_obj10->get_page_id(get_option('wkmp_seller_login_page_tile')); wp_redirect(home_url('?page_id=' . $page_id) . '&page=eFeed&sid=' . $_GET['sid']); exit; } } } } /********************************************************faceboook*********************************************************/ $sellerid = $_GET['sid']; $currency = get_woocommerce_currency_symbol(get_option('woocommerce_currency')); /*$sell_data=MP_Form_Handler::spreview($sellerid);*/ $sell_data = $wpmp_obj10->spreview($sellerid); /*$seller_product=MP_Form_Handler::seller_product($sellerid);*/ $seller_product = $wpmp_obj10->seller_product($sellerid); $lenghtProduct = count($seller_product); foreach ($sell_data as $key => $value) { $seller_all[$value->meta_key] = $value->meta_value; } /*$selleravatar=MP_Form_Handler::get_user_avatar($sellerid,'avatar');*/ $selleravatar = $wpmp_obj10->get_user_avatar($sellerid, 'avatar'); $user_value = is_user_logged_in(); ?> <div id="seller"> <div class="mp_main_left"> <div style="margin-bottom:10px;"> <?php if (isset($selleravatar[0]->meta_value)) { echo '<img src="' . content_url() . '/uploads/' . $selleravatar[0]->meta_value . '">'; } else { echo '<div class="editmp_img" id="mp_seller_image"><img src="' . content_url() . '/plugins/marketplace/assets/images/genric-male.png" /></div>'; } ?> </div> <div style="float:left;width:100%;"> <?php $varsid = get_query_var('sid'); if (empty($varsid)) { $varsid = $_GET['sid']; } if (strchr(get_permalink(), '?')) { $icon = '&'; } else { $icon = '?'; } ?> <a class="button btn btn-default button-medium" href="<?php echo get_permalink() . $icon; ?> page=sprod&sid=<?php echo $varsid; ?> "> <span>View Collection</span> </a> </div> </div> <div class="mp_main_right"> <div class="page-title"> <div class="sell_head">Seller Profile</div> </div> <div class="box-account"> <div class="box-head"> <h2 class='about'><?php _e('About Shop'); ?> </h2> <p><?php echo isset($seller_all['about_shop']) ? $seller_all['about_shop'] : 'N/A'; ?> </p> <div class="wk_border_line"></div> </div> <div class="box-content" style="background-color:#F6F6F6;border-bottom: 3px solid #D5D3D4;"> <div class="seller_name"><?php echo $seller_all['nickname']; ?> </div> <div class="wk-left-label"> <div class="wk_row"> <label class="wk-mail-icon">Business Email -</label> <span><?php echo isset($seller_all['billing_email']) ? isset($seller_all['billing_email']) ? $seller_all['billing_email'] : 'N/A' : 'N/A'; ?> </span> </div> <div class="wk_row"> <label class="wk-phone-icon">Phone -</label> <span><?php echo isset($seller_all['billing_phone']) ? isset($seller_all['billing_phone']) ? $seller_all['billing_phone'] : 'N/A' : 'N/A'; ?> </span> </div> <div class="wk_row"> <label class="wk-address-icon">Address -</label> <span><?php echo isset($seller_all['shop_address']) ? isset($seller_all['shop_address']) ? $seller_all['shop_address'] : 'N/A' : 'N/A'; ?> </span> </div> <div class="wk_row"> <label class="wk-share-icon">Social Profile -</label> <span class="wk-social-icon"> <?php if (isset($seller_all['social_facebook'])) { ?> <a id="mp_facebook" href="<?php echo $seller_all['social_facebook']; ?> " target='_blank'></a> <?php } if (isset($seller_all['social_twitter'])) { ?> <a id="mp_twitter" href="<?php echo $seller_all['social_twitter']; ?> " target='_blank'></a> <?php } if (isset($seller_all['social_gplus'])) { ?> <a id="mp_gplus" href="<?php echo $seller_all['social_gplus']; ?> " target='_blank'></a> <?php } if (isset($seller_all['social_linkedin'])) { ?> <a id="mp_linkedin" href="<?php echo $seller_all['social_linkedin']; ?> " target='_blank'></a> <?php } if (isset($seller_all['social_youtube'])) { ?> <a id="mp_youtube" href="<?php echo $seller_all['social_youtube']; ?> " target='_blank'></a> <?php } ?> </span> </div> <div class="wk_row"> <label class="wk-rating-icon">Seller Rating -</label> <span class="avg_rating" title="good" style="width: 100px;"> <?php if ($sell_data[0]->user_id = '1') { /*$Result=MP_Form_Handler::original_review($sellerid);*/ $Result = $wpmp_obj10->original_review($sellerid); //print_r($Result); $num_of_stars = 0; $total_feedback = 0; foreach ($Result as $item) { $num_of_stars = $num_of_stars + $item->price_r; $num_of_stars = $num_of_stars + $item->value_r; $num_of_stars = $num_of_stars + $item->quality_r; $total_feedback++; } if ($num_of_stars != 0) { $review = $num_of_stars / (15 * $total_feedback) * 100; $quality = $review / 100 * 5; } else { $quality = 0; } for ($i = 0; $i <= 4; $i++) { if ($i < $quality) { echo '<div class="wk_ystar"></div>'; } else { echo '<div class="wk_gstar"></div>'; } } } ?> <input type="hidden" name="score" value="<?php echo $quality; ?> " readonly="readonly"> </span> <?php if (get_current_user_id()) { ?> <div class="wk_write_review"> <a class="btn btn-default button button-small open-review-form forloginuser wk_mpsocial_feedback" href="#wk_review_form"> <span>Write a Review !</span> </a> </div> <?php } else { ?> <div class="wk_write_review"> <a class="btn btn-default button button-small open-review-form forloginuser wk_mpsocial_feedback" href="javascript:void(0);"> <span>Write a Review !</span> </a> </div> <?php } ?> </div> </div> </div> </div> <div class="box-account"> <div class="box-head"> <h2>Recent Products</h2> <div class="wk_border_line"></div> </div> <?php if ($lenghtProduct > 0) { ?> <div class="box-content wk_slider_padding"> <div class="wk-product-slider"> <?php if ($lenghtProduct > 3) { ?> <div class="bx-next-slider"></div> <div class="bx-prev-slider"></div> <div class="view-port-mp-slider"> <div class="view-port-mp-slider-absolute"> <?php foreach ($seller_product as $item) { $product_object = get_product($item->ID); $product_price = $wpdb->get_var("select meta_value from {$wpdb->postmeta} where post_id={$item->ID} and meta_key='_price'"); /*$product_image=MP_Form_Handler::get_product_image($item->ID,'_thumbnail_id');*/ $product_image = $wpmp_obj10->get_product_image($item->ID, '_thumbnail_id'); $link = get_permalink($item->ID); ?> <a class="product_img_link" title="<?php echo $item->post_title; ?> " href="<?php echo $link; ?> "> <div class="mp-box-slider"> <div class="mp-box-slider-img-data"> <div class="mp-box-slider-img-hidden"> <?php if ($product_image != '') { ?> <img style="margin:0;padding:0;" class="mp-box-slider-img" alt="<?php echo $item->post_title; ?> " src="<?php echo content_url() . '/uploads/' . $product_image; ?> "> <?php } else { ?> <img style="margin:0;padding:0;" class="mp-box-slider-img" alt="<?php echo $item->post_title; ?> " src="<?php echo plugins_url('marketplace/assets/images/placeholder.png'); ?> "> <?php } ?> </div> <div><?php echo $item->post_title; ?> </div> <div> <?php if ($product_object->is_type('simple')) { ?> <span class="amount"><?php echo woocommerce_price($product_object->price); ?> </span> <?php } else { if ($product_object->is_type('variable')) { ?> <span class="price"> <span class="amount"><?php echo woocommerce_price($product_object->min_variation_price); ?> </span> – <span class="amount"><?php echo woocommerce_price($product_object->max_variation_price); ?> </span> </span> <?php } else { if ($product_object->is_type('external')) { ?> <span class="amount"><?php echo woocommerce_price($product_object->price); ?> </span> <?php } else { if ($product_object->is_type('grouped')) { } } } } ?> </div> </div> </div> </a> <?php } ?> </div> </div> <?php } else { ?> <div class="view-port-mp-slider"> <div class="view-port-mp-slider-absolute"> <?php foreach ($seller_product as $item) { // $product_price=$wpdb->get_var("select meta_value from $wpdb->postmeta where post_id=$item->ID and meta_key='_price'"); $product_object = get_product($item->ID); $product_price = get_post_meta($item->ID, '_price', true); /*$product_image=MP_Form_Handler::get_product_image($item->ID,'_thumbnail_id');*/ $product_image = $wpmp_obj10->get_product_image($item->ID, '_thumbnail_id'); $link = get_permalink($item->ID); ?> <a class="product_img_link" title="<?php echo $item->post_title; ?> " href="<?php echo $link; ?> "> <div class="mp-box-slider"> <div class="mp-box-slider-img-data"> <div class="mp-box-slider-img-hidden"> <?php if ($product_image != '') { ?> <img style="margin:0;padding:0;" class="mp-box-slider-img" alt="<?php echo $item->post_title; ?> " src="<?php echo content_url() . '/uploads/' . $product_image; ?> "> <?php } else { ?> <img style="margin:0;padding:0;" class="mp-box-slider-img" alt="<?php echo $item->post_title; ?> " src="<?php echo plugins_url('marketplace/assets/images/placeholder.png'); ?> "> <?php } ?> </div> <div><?php echo $item->post_title; ?> </div> <div> <?php if ($product_object->is_type('simple')) { ?> <span class="amount"><?php echo woocommerce_price($product_object->price); ?> </span> <?php } else { if ($product_object->is_type('variable')) { ?> <span class="price"> <span class="amount"><?php echo woocommerce_price($product_object->min_variation_price); ?> </span> – <span class="amount"><?php echo woocommerce_price($product_object->max_variation_price); ?> </span> </span> <?php } else { if ($product_object->is_type('external')) { ?> <span class="amount"><?php echo woocommerce_price($product_object->price); ?> </span> <?php } else { if ($product_object->is_type('grouped')) { } } } } ?> </div> </div> </div> </a> <?php } ?> </div> </div> <?php } ?> </div> </div> <?php } else { ?> <div class="box-content wk_slider_padding"> <p> Sorry, No Product Available. </p> </div> <?php } ?> </div> <?php if ($total_feedback > 0) { ?> <div class="box-account"> <?php $seller_review_last = $Result[$total_feedback - 1]; ?> <div class="box-head"> <div class="wk_review_head"> <h2>Reviews about seller</h2> </div> <div class="wk_border_line"></div> </div> <div class="box-content"> <div id="show_single_review_mp"> <div class="wk-reviews"> <div class="wk-writer-info"> <div class="wk-writer-details"> <ul> <li class="wk-person-icon"><?php echo $seller_review_last->nickname; ?> </li> <!-- <li class="wk-mail-icon">dheeraj@webkul.com</li> --> <li class="wk-watch-icon"><?php echo $seller_review_last->review_time; ?> </li> </ul> </div> <div class="wk-seller-rating"> <?php $oneu_of_stars = 0; $oneu_of_stars = $oneu_of_stars + $seller_review_last->price_r; $oneu_of_stars = $oneu_of_stars + $seller_review_last->value_r; $oneu_of_stars = $oneu_of_stars + $seller_review_last->quality_r; $last_user_review = $oneu_of_stars / 3; for ($i = 0; $i < 5; $i++) { if ($i < $last_user_review) { echo '<div class="wk_ystar"></div>'; } else { echo '<div class="wk_gstar"></div>'; } } ?> </div> </div> <div class="wk_review_content"><?php echo $seller_review_last->review_desc; ?> </div> </div></div> <div id="show_all_review" style="display:none;"> <?php foreach ($Result as $seller_review_last) { ?> <div class="wk-reviews"> <div class="wk-writer-info"> <div class="wk-writer-details"> <ul> <li class="wk-person-icon"><?php echo $seller_review_last->nickname; ?> </li> <!-- <li class="wk-mail-icon">dheeraj@webkul.com</li> --> <li class="wk-watch-icon"><?php echo $seller_review_last->review_time; ?> </li> </ul> </div> <div class="wk-seller-rating"> <?php $oneu_of_stars = 0; $oneu_of_stars = $oneu_of_stars + $seller_review_last->price_r; $oneu_of_stars = $oneu_of_stars + $seller_review_last->value_r; $oneu_of_stars = $oneu_of_stars + $seller_review_last->quality_r; $last_user_review = $oneu_of_stars / 3; for ($i = 0; $i < 5; $i++) { if ($i < $last_user_review) { echo '<div class="wk_ystar"></div>'; } else { echo '<div class="wk_gstar"></div>'; } } ?> </div> </div> <div class="wk_review_content"><?php echo $seller_review_last->review_desc; ?> </div> </div> <?php } ?> </div> <div class="wk_border_line"></div> <a href="javascript:void(0);" class="button"><span id="view_all_review_button">View all reviews</span></a> </div> </div> <?php } ?> </div> </div> <div class="wk_feedback_popup"> <input type='hidden' value="<?php echo $user_value; ?> " id="feedbackloged_in_status" /> <div id="fb-root"></div> <div class="wk_cross_login"></div> <?php $feedback_url = ''; ?> <div id='feedback_form'> <?php wc_print_notices(); ?> <form action="<?php $params = array('page' => "eFeed", 'sid' => $_GET['sid']); $url = add_query_arg($params, get_permalink()); echo $url; ?> " method="post" class="login"> <p class="form-row form-row-wide"> <label for="username"><?php _e('Username or email address', 'marketplace'); ?> <span class="required">*</span></label> <input type="text" class="input-text" name="wkmp_username" id="username" value="<?php if (!empty($_POST['username'])) { echo esc_attr($_POST['username']); } ?> " /> </p> <p style="display:none;"> <input type="hidden" name="wkfb_mp_key_app_idID" id="wkfb_mp_key_app_idID" value="<?php echo get_option('wkfb_mp_key_app_ID'); ?> " /> <input type="hidden" name="wkfb_mp_app_secret_kekey" id="wkfb_mp_app_secret_kekey" value="<?php echo get_option('wkfb_mp_app_secret_key'); ?> " /> <input type="hidden" name="wkfacebook_login_page_id" id="wkfacebook_login_page_id" value="<?php echo $wpmp_obj10->get_page_id("'" . get_option('wkmp_seller_login_page_tile') . "'"); ?> " /> </p> <p class="form-row form-row-wide"> <label for="password"><?php _e('Password', 'marketplace'); ?> <span class="required">*</span></label> <input class="input-text" type="password" name="password" id="password" /> </p> <!-- <label for="rememberme" class="inline"> <input name="rememberme" type="checkbox" id="rememberme" value="forever" /> <?php _e('Remember me', 'marketplace'); ?> </label> --> <p class="form-row mp-login-button"> <?php wp_nonce_field('marketplace-user'); ?> <input type="submit" class="button" id='submit-btn-feedback' name="login" value="<?php _e('Login', 'marketplace'); ?> " /> <!--<a href="<?php echo wp_registration_url(); ?> " class="button"><?php _e("Register"); ?> </a> --> <a href="<?php echo esc_url(wc_lostpassword_url()); ?> "><?php _e('Lost your password?', 'marketplace'); ?> </a> <a href="javascript:void(0);"><img border="0" id='mp-fb-login-btn'/></a> <!-- <div class="fb-login-button" data-max-rows="1" data-size="medium" data-show-faces="false" data-auto-logout-link="false"></div> --> </p> <!-- <p class="lost_password"> </p> --> </form> </div> </div> <?php }