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 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 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>
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 }