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>&nbsp;&nbsp;<a class="button" href="' . wp_logout_url() . '" title="Logout">Logout</a><br /></div></form>';
    echo '</section>';
}
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");
    ?>
Example #3
0
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> : &nbsp;&nbsp;' . $current_user->user_login . '</div>';
            echo '<div class="wk_profiledata"><label>E-mail </label> : &nbsp;&nbsp;' . $current_user->user_email . '</div>';
            echo '<div class="wk_profiledata"><label>Name </label> : &nbsp;&nbsp;' . $current_user->user_firstname . '&nbsp;' . $current_user->user_lastname . '</div>';
            echo '<div class="wk_profiledata"><label>Display name </label> : &nbsp;&nbsp;' . $current_user->display_name . '</div>';
            if ($current_user->data->ID && $seller_info > 0) {
                echo '<div class="wk_profiledata"><label>Shop Name </label> : &nbsp;&nbsp;' . $seller_detail['shop_name'][0] . '</div>';
                echo '<div class="wk_profiledata"><label>Address </label> : &nbsp;&nbsp;' . $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>&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="radio" name="selleraccess" value="1" class="wk_userseller"> <?php 
                _e("Yes");
                ?>
 &nbsp;&nbsp
				<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"/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<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" >&nbsp;<?php 
            echo _e('Price');
            ?>
&nbsp;(<?php 
            echo _e('Low To High');
            ?>
)&nbsp;</option>
			<?php 
        } else {
            ?>
			<option value="price_l" >&nbsp;<?php 
            echo _e('Price');
            ?>
&nbsp;(<?php 
            echo _e('Low To High');
            ?>
)&nbsp;</option>
			<?php 
        }
        if ($str == 'price_h') {
            ?>
		<option selected="selected" value="price_h">&nbsp;<?php 
            echo _e('Price');
            ?>
&nbsp;(<?php 
            echo _e('High To Low');
            ?>
)&nbsp;</option>
			<?php 
        } else {
            ?>
			<option value="price_h">&nbsp;<?php 
            echo _e('Price');
            ?>
&nbsp;(<?php 
            echo _e('High To Low');
            ?>
)&nbsp;</option>
			<?php 
        }
        if ($str == 'productname_l') {
            ?>
			<option selected="selected" value="productname_l" >&nbsp;<?php 
            echo _e('Name');
            ?>
&nbsp;(<?php 
            echo _e('Asc To Desc');
            ?>
)&nbsp;</option>
			<?php 
        } else {
            ?>
			<option value="productname_l" >&nbsp;<?php 
            echo _e('NAME');
            ?>
&nbsp;(<?php 
            echo _e('Asc To Desc');
            ?>
)&nbsp;</option>
			<?php 
        }
        if ($str == 'productname_h') {
            ?>
			<option selected="selected" value="productname_h" >&nbsp;<?php 
            echo _e('Name');
            ?>
&nbsp;(<?php 
            echo _e('Desc To Asc');
            ?>
)&nbsp;</option>
			<?php 
        } else {
            ?>
			<option value="productname_h" >&nbsp;<?php 
            echo _e('Name');
            ?>
&nbsp;(<?php 
            echo _e('Desc To Asc');
            ?>
)&nbsp;</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>
											&ndash;
											<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 
    }
}
Example #5
0
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>
														&ndash;
														<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>
														&ndash;
														<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 
}