Example #1
2
/**
 * Displays the store lists
 *
 * @since 2.4
 *
 * @param  array $atts
 *
 * @return string
 */
function store_listing($atts)
{
    global $post;
    /**
     * Filter return the number of store listing number per page.
     *
     * @since 2.2
     *
     * @param array
     */
    $attr = shortcode_atts(apply_filters('dokan_store_listing_per_page', array('per_page' => 10)), $atts);
    $paged = max(1, get_query_var('paged'));
    $limit = $attr['per_page'];
    $offset = ($paged - 1) * $limit;
    $sellers = dokan_get_sellers($limit, $offset);
    ob_start();
    if ($sellers['users']) {
        ?>
    <ul class="dokan-seller-wrap">
        <?php 
        foreach ($sellers['users'] as $seller) {
            $store_info = dokan_get_store_info($seller->ID);
            $banner_id = isset($store_info['banner']) ? $store_info['banner'] : 0;
            $store_name = isset($store_info['store_name']) ? esc_html($store_info['store_name']) : __('N/A', 'dokan');
            $store_url = dokan_get_store_url($seller->ID);
            ?>

            <li class="dokan-single-seller">
                <div class="dokan-store-thumbnail">

                    <a href="<?php 
            echo $store_url;
            ?>
">
                        <?php 
            if ($banner_id) {
                $banner_url = wp_get_attachment_image_src($banner_id, 'medium');
                ?>
                            <img class="dokan-store-img" src="<?php 
                echo esc_url($banner_url[0]);
                ?>
" alt="<?php 
                echo esc_attr($store_name);
                ?>
">
                        <?php 
            } else {
                ?>
                            <img class="dokan-store-img" src="<?php 
                echo dokan_get_no_seller_image();
                ?>
" alt="<?php 
                _e('No Image', 'dokan');
                ?>
">
                        <?php 
            }
            ?>
                    </a>

                    <div class="dokan-store-caption">
                        <h3><a href="<?php 
            echo $store_url;
            ?>
"><?php 
            echo $store_name;
            ?>
</a></h3>

                        <address>

                            <?php 
            if (isset($store_info['address']) && !empty($store_info['address'])) {
                echo dokan_get_seller_address($seller->ID);
            }
            ?>

                            <?php 
            if (isset($store_info['phone']) && !empty($store_info['phone'])) {
                ?>
                                <br>
                                <abbr title="<?php 
                _e('Phone Number', 'dokan');
                ?>
"><?php 
                _e('P:', 'dokan');
                ?>
</abbr> <?php 
                echo esc_html($store_info['phone']);
                ?>
                            <?php 
            }
            ?>

                        </address>

                        <p><a class="dokan-btn dokan-btn-theme" href="<?php 
            echo $store_url;
            ?>
"><?php 
            _e('Visit Store', 'dokan');
            ?>
</a></p>

                    </div> <!-- .caption -->
                </div> <!-- .thumbnail -->
            </li> <!-- .single-seller -->
        <?php 
        }
        ?>
    </ul> <!-- .dokan-seller-wrap -->

    <?php 
        $user_count = $sellers['count'];
        $num_of_pages = ceil($user_count / $limit);
        if ($num_of_pages > 1) {
            echo '<div class="pagination-container clearfix">';
            $page_links = paginate_links(array('current' => $paged, 'total' => $num_of_pages, 'base' => str_replace($post->ID, '%#%', esc_url(get_pagenum_link($post->ID))), 'type' => 'array', 'prev_text' => __('&larr; Previous', 'dokan'), 'next_text' => __('Next &rarr;', 'dokan')));
            if ($page_links) {
                $pagination_links = '<div class="pagination-wrap">';
                $pagination_links .= '<ul class="pagination"><li>';
                $pagination_links .= join("</li>\n\t<li>", $page_links);
                $pagination_links .= "</li>\n</ul>\n";
                $pagination_links .= '</div>';
                echo $pagination_links;
            }
            echo '</div>';
        }
        ?>

    <?php 
    } else {
        ?>
        <p class="dokan-error"><?php 
        _e('No seller found!', 'dokan');
        ?>
</p>
    <?php 
    }
    $content = ob_get_clean();
    return apply_filters('dokan_seller_listing', $content, $attr);
}
 function get_portfolio_button()
 {
     $button_text = __('View Portfolio', 'artgorae');
     $button_icon = 'fa fa-pencil-square-o';
     $button_text_html = $this->get_text_with_icon($button_text, $button_icon);
     $button_class = 'button';
     $button_link = dokan_get_store_url(get_the_author_meta('ID')) . 'toc';
     echo $this->get_anchor_button($button_link, $button_class, $button_text_html);
 }
Example #3
0
 /**
  * Generate breadcrumb for store page
  * 
  * @since 2.4.7
  * 
  * @param array $crumbs
  * 
  * @return array $crumbs
  */
 public function store_page_breadcrumb($crumbs)
 {
     if (dokan_is_store_page()) {
         $author = get_query_var($this->custom_store_url);
         $seller_info = get_user_by('slug', $author);
         $crumbs[1] = array(ucwords($this->custom_store_url), site_url() . '/' . $this->custom_store_url);
         $crumbs[2] = array($author, dokan_get_store_url($seller_info->data->ID));
     }
     return $crumbs;
 }
Example #4
0
    /**
     * Outputs the HTML for this widget.
     *
     * @param array  An array of standard parameters for widgets in this theme
     * @param array  An array of settings for this widget instance
     * @return void Echoes it's output
     **/
    function widget($args, $instance)
    {
        global $wpdb;
        extract($args, EXTR_SKIP);
        $title = apply_filters('widget_title', $instance['title']);
        $limit = absint($instance['count']) ? absint($instance['count']) : 10;
        $cache_key = 'dokan-best-seller-' . $limit;
        $seller = wp_cache_get($cache_key, 'widget');
        if (false === $seller) {
            $qry = "SELECT seller_id, display_name,SUM( net_amount ) AS total_sell\r\n                FROM {$wpdb->prefix}dokan_orders AS o,{$wpdb->prefix}users AS u\r\n                WHERE o.seller_id = u.ID\r\n                GROUP BY o.seller_id\r\n                ORDER BY total_sell DESC LIMIT " . $limit;
            $seller = $wpdb->get_results($qry);
            wp_cache_set($cache_key, $seller, 'widget');
        }
        echo $before_widget;
        if (!empty($title)) {
            echo $args['before_title'] . $title . $args['after_title'];
        }
        ?>
            <ul> 
                <?php 
        if ($seller) {
            foreach ($seller as $key => $value) {
                $rating = dokan_get_seller_rating($value->seller_id);
                $display_rating = $rating['rating'];
                if (!$rating['count']) {
                    $display_rating = 'No ratings found yet!';
                }
                ?>
                        <li>
                            <a href="<?php 
                echo dokan_get_store_url($value->seller_id);
                ?>
">
                                <?php 
                echo $value->display_name;
                ?>
                            </a><br />
                            <i class='fa fa-star'></i> 
                            <?php 
                echo $display_rating;
                ?>
                        </li>

                        <?php 
            }
        }
        ?>
            </ul>
        <?php 
        echo $after_widget;
    }
Example #5
0
    /**
     * Outputs the HTML for this widget.
     *
     * @param array  An array of standard parameters for widgets in this theme
     * @param array  An array of settings for this widget instance
     * @return void Echoes it's output
     **/
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $title = apply_filters('widget_title', $instance['title']);
        $limit = absint($instance['count']) ? absint($instance['count']) : 10;
        $sellers = dokan_get_feature_sellers($limit);
        echo $before_widget;
        if (!empty($title)) {
            echo $args['before_title'] . $title . $args['after_title'];
        }
        ?>
        <ul class="dokan-feature-sellers">
            <?php 
        if ($sellers) {
            foreach ($sellers as $key => $seller) {
                $store_info = dokan_get_store_info($seller->ID);
                $rating = dokan_get_seller_rating($seller->ID);
                $display_rating = $rating['rating'];
                if (!$rating['count']) {
                    $display_rating = __('No ratings found yet!', 'dokan');
                }
                ?>
                    <li>
                        <a href="<?php 
                echo dokan_get_store_url($seller->ID);
                ?>
">
                            <?php 
                echo esc_html($store_info['store_name']);
                ?>
                        </a><br />
                        <i class='fa fa-star'></i>
                        <?php 
                echo $display_rating;
                ?>
                    </li>

                    <?php 
            }
        }
        ?>
        </ul>
        <?php 
        echo $after_widget;
    }
Example #6
0
/**
 * Send notification to the users when a product is published by seller
 *
 * @param WP_Post $post
 * @return void
 */
function dokan_send_notification_to_users($post)
{
    $prefix = FARMTOYOU_META_PREFIX;
    if ($post->post_type != 'product') {
        return;
    }
    $seller = get_user_by('id', $post->post_author);
    $product = get_product($post->ID);
    $dokan_email = new Dokan_Email();
    $args = array('post_type' => FARMTOYOU_NEWSLETTER_POST_TYPE, 'post_status' => 'active', 'posts_per_page' => '-1', 'meta_query' => array(array('key' => $prefix . 'post_author', 'value' => $seller->ID)));
    //get newsletter data from database
    $all_newsletter = get_posts($args);
    foreach ($all_newsletter as $value) {
        $category = wp_get_post_terms($product->id, 'product_cat', array('fields' => 'names'));
        $category_name = $category ? reset($category) : 'N/A';
        $user_id = get_post_meta($value->ID, $prefix . 'curr_user_id', true);
        $user_info = get_userdata($user_id);
        $first_name = $user_info->first_name;
        $last_name = $user_info->last_name;
        $param = array('vendor_id' => base64_encode($seller->ID), 'user_id' => base64_encode($user_id), 'status' => base64_encode('pending'));
        $unsubscribe_link = add_query_arg($param, site_url());
        $users_email = get_post_meta($value->ID, $prefix . 'post_title', true);
        $body = "Hello {$first_name} {$last_name}," . "\r\n\n";
        $body .= "A new product has been submitted to site (" . home_url() . ")\r\n\n";
        $body .= "Summary of the product:" . "\r\n";
        $body .= "------------------------" . "\r\n\n";
        $body .= "Title: " . $product->get_title() . "\r\n";
        $body .= "Price: " . $dokan_email->currency_symbol($product->get_price()) . "\r\n";
        $body .= "Seller: " . $seller->display_name . " (" . dokan_get_store_url($seller->ID) . ")\r\n";
        $body .= "Category: " . $category_name . "\r\n\n";
        $body .= "Currently you are active user of site. <a href='" . $unsubscribe_link . "'>Click here to unsubscribe</a>";
        $subject = sprintf(__('[%s] New Product Added', 'dokan'), $dokan_email->get_from_name());
        $headers = array('Content-Type: text/html; charset=UTF-8');
        $dokan_email->send($users_email, $subject, nl2br($body), $headers);
    }
}
Example #7
0
                            <?php 
        echo isset($statuses[$order->post_status]) ? $statuses[$order->post_status] : $order->post_status;
        ?>
                        </td>
                        <td class="order-total">
                            <?php 
        echo sprintf(_n('%s for %s item', '%s for %s items', $item_count, 'dokan'), $order->get_formatted_order_total(), $item_count);
        ?>
                        </td>
                        
                        <td class="order-total">
                            <?php 
        $seller_id = dokan_get_seller_id_by_order($order->id);
        if ($seller_id && $seller_id != 0) {
            $sellershop = dokan_get_store_info($seller_id);
            echo '<a href="' . dokan_get_store_url($seller_id) . '">' . $sellershop['store_name'] . '</a>';
        } else {
            _e('Multiple Seller', 'dokan');
        }
        ?>
                        </td>

                        <td class="order-actions">
                            <?php 
        $actions = array();
        if (in_array($order->status, apply_filters('woocommerce_valid_order_statuses_for_payment', array('pending', 'failed'), $order))) {
            $actions['pay'] = array('url' => $order->get_checkout_payment_url(), 'name' => __('Pay', 'dokan'));
        }
        if (in_array($order->status, apply_filters('woocommerce_valid_order_statuses_for_cancel', array('pending', 'failed'), $order))) {
            $actions['cancel'] = array('url' => $order->get_cancel_order_url(get_permalink(wc_get_page_id('myaccount'))), 'name' => __('Cancel', 'dokan'));
        }
Example #8
0
 /**
  * Review Pagination
  *
  * @since 2.4
  *
  * @param int     $id
  * @param string  $post_type
  * @param int     $limit
  * @param string  $status
  *
  * @return string
  */
 function review_pagination($id, $post_type, $limit, $status)
 {
     global $wpdb;
     // $status = $this->page_status();
     if ($status == '1') {
         $query = "{$wpdb->comments}.comment_approved IN ('1','0') AND";
     } else {
         $query = "{$wpdb->comments}.comment_approved='{$status}' AND";
     }
     $total = $wpdb->get_var("SELECT COUNT(*)\n            FROM {$wpdb->comments}, {$wpdb->posts}\n            WHERE   {$wpdb->posts}.post_author='{$id}' AND\n            {$wpdb->posts}.post_status='publish' AND\n            {$wpdb->comments}.comment_post_ID={$wpdb->posts}.ID AND\n            {$query}\n            {$wpdb->posts}.post_type='{$post_type}'");
     $pagenum = max(get_query_var('paged'), 1);
     $num_of_pages = ceil($total / $limit);
     $page_links = paginate_links(array('base' => dokan_get_store_url($id) . 'reviews/%_%', 'format' => 'page/%#%', 'prev_text' => __('&laquo;', 'aag'), 'next_text' => __('&raquo;', 'aag'), 'total' => $num_of_pages, 'type' => 'array', 'current' => $pagenum));
     if ($page_links) {
         $pagination_links = '<div class="pagination-wrap">';
         $pagination_links .= '<ul class="pagination"><li>';
         $pagination_links .= join("</li>\n\t<li>", $page_links);
         $pagination_links .= "</li>\n</ul>\n";
         $pagination_links .= '</div>';
         return $pagination_links;
     }
 }
Example #9
0
/**
 * Prints seller info in product single page
 *
 * @global WC_Product $product
 * @param type $val
 */
function dokan_product_seller_tab($val)
{
    global $product;
    $author = get_user_by('id', $product->post->post_author);
    $store_info = dokan_get_store_info($author->ID);
    ?>
    <h2><?php 
    _e('Seller Information', 'dokan');
    ?>
</h2>
    <ul class="list-unstyled">

        <?php 
    if (!empty($store_info['store_name'])) {
        ?>
            <li class="store-name">
                <span><?php 
        _e('Store Name:', 'dokan');
        ?>
</span>
                <span class="details">
                    <?php 
        echo esc_html($store_info['store_name']);
        ?>
                </span>
            </li>
        <?php 
    }
    ?>

        <li class="seller-name">
            <span>
                <?php 
    _e('Seller:', 'dokan');
    ?>
            </span>

            <span class="details">
                <?php 
    printf('<a href="%s">%s</a>', dokan_get_store_url($author->ID), $author->display_name);
    ?>
            </span>
        </li>
        <?php 
    if (!empty($store_info['address'])) {
        ?>
            <li class="store-address">
                <span><?php 
        _e('Address:', 'dokan');
        ?>
</span>
                <span class="details">
                    <?php 
        echo esc_html($store_info['address']);
        ?>
                </span>
            </li>
        <?php 
    }
    ?>

        <li class="clearfix">
            <?php 
    dokan_get_readable_seller_rating($author->ID);
    ?>
        </li>
    </ul>

    <?php 
}
Example #10
0
?>

<ul class="dokan-best-sellers">
    <?php 
if ($seller) {
    foreach ($seller as $key => $value) {
        $store_info = dokan_get_store_info($value->seller_id);
        $rating = dokan_get_seller_rating($value->seller_id);
        $display_rating = $rating['rating'];
        if (!$rating['count']) {
            $display_rating = __('No ratings found yet!', 'dokan');
        }
        ?>
            <li>
                <a href="<?php 
        echo dokan_get_store_url($value->seller_id);
        ?>
">
                    <?php 
        echo esc_html($store_info['store_name']);
        ?>
                </a><br />
                <i class='fa fa-star'></i>
                <?php 
        echo $display_rating;
        ?>
            </li>
            <?php 
    }
} else {
    ?>
 function __construct($seller_id)
 {
     $this->store_url = dokan_get_store_url($seller_id);
 }
Example #12
0
    /**
     * User top navigation menu
     *
     * @return void
     */
    function dokan_header_user_menu()
    {
        ?>
    <ul class="nav navbar-nav navbar-right">
        <li>
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php 
        printf(__('Cart %s', 'dokan'), '<span class="dokan-cart-amount-top">(' . WC()->cart->get_cart_total() . ')</span>');
        ?>
 <b class="caret"></b></a>

            <ul class="dropdown-menu">
                <li>
                    <div class="widget_shopping_cart_content"></div>
                </li>
            </ul>
        </li>

        <?php 
        if (is_user_logged_in()) {
            ?>

            <?php 
            global $current_user;
            $user_id = $current_user->ID;
            if (dokan_is_user_seller($user_id)) {
                ?>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php 
                _e('Seller Dashboard', 'dokan');
                ?>
 <b class="caret"></b></a>

                    <ul class="dropdown-menu">
                        <li><a href="<?php 
                echo dokan_get_store_url($user_id);
                ?>
" target="_blank"><?php 
                _e('Visit your store', 'dokan');
                ?>
 <i class="fa fa-external-link"></i></a></li>
                        <li class="divider"></li>
                        <?php 
                $nav_urls = dokan_get_dashboard_nav();
                foreach ($nav_urls as $key => $item) {
                    printf('<li><a href="%s">%s &nbsp;%s</a></li>', $item['url'], $item['icon'], $item['title']);
                }
                ?>
                    </ul>
                </li>
            <?php 
            }
            ?>

            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php 
            echo esc_html($current_user->display_name);
            ?>
 <b class="caret"></b></a>
                <ul class="dropdown-menu">
                    <li><a href="<?php 
            echo dokan_get_page_url('my_orders');
            ?>
"><?php 
            _e('My Orders', 'dokan');
            ?>
</a></li>
                    <li><a href="<?php 
            echo dokan_get_page_url('myaccount', 'woocommerce');
            ?>
"><?php 
            _e('My Account', 'dokan');
            ?>
</a></li>
                    <li><a href="<?php 
            echo wc_customer_edit_account_url();
            ?>
"><?php 
            _e('Edit Account', 'dokan');
            ?>
</a></li>
                    <li class="divider"></li>
                    <li><a href="<?php 
            echo wc_get_endpoint_url('edit-address', 'billing', get_permalink(wc_get_page_id('myaccount')));
            ?>
"><?php 
            _e('Billing Address', 'dokan');
            ?>
</a></li>
                    <li><a href="<?php 
            echo wc_get_endpoint_url('edit-address', 'shipping', get_permalink(wc_get_page_id('myaccount')));
            ?>
"><?php 
            _e('Shipping Address', 'dokan');
            ?>
</a></li>
                </ul>
            </li>

            <li><?php 
            wp_loginout(home_url());
            ?>
</li>

        <?php 
        } else {
            ?>
            <li><a href="<?php 
            echo dokan_get_page_url('myaccount', 'woocommerce');
            ?>
"><?php 
            _e('Log in', 'dokan');
            ?>
</a></li>
            <li><a href="<?php 
            echo dokan_get_page_url('myaccount', 'woocommerce');
            ?>
"><?php 
            _e('Sign Up', 'dokan');
            ?>
</a></li>
        <?php 
        }
        ?>
    </ul>
    <?php 
    }
Example #13
0
/**
 * Call function for seller ratings and reviews
 */
function farmtoyou_seller_rating_review()
{
    if (!empty($_POST['rating']) && !empty($_POST['comment'])) {
        $prefix = FARMTOYOU_META_PREFIX;
        $current_user = wp_get_current_user();
        $seller_id = $_POST['seller_id'];
        $seller_rating = $_POST['rating'];
        $user_comment = $_POST['comment'];
        $seller_post = array('post_type' => FARMTOYOU_SELLER_REVIEW_POST_TYPE, 'post_status' => 'pending');
        $last_id = wp_insert_post($seller_post);
        update_post_meta($last_id, $prefix . 'seller_id', $seller_id);
        update_post_meta($last_id, $prefix . 'seller_rating', $seller_rating);
        update_post_meta($last_id, $prefix . 'user_comment', $user_comment);
        update_post_meta($last_id, $prefix . 'current_user_id', $current_user->ID);
        $store_url = dokan_get_store_url($seller_id);
        wp_redirect($store_url);
        exit;
    }
}
/**
 * Get review page url of a seller
 *
 * @param int $user_id
 * @return string
 */
function dokan_get_review_url($user_id)
{
    $userstore = dokan_get_store_url($user_id);
    return $userstore . "reviews";
}
 * @hooked woocommerce_template_single_sharing - 50
 */
do_action('woocommerce_single_product_summary');
?>

	</div><!-- .summary -->
	<?php 
/*This coustomization was created by TOWHID	*/
global $product;
$author = get_user_by('id', $product->post->post_author);
$store_info = dokan_get_store_info($author->ID);
if (!empty($store_info['store_name'])) {
    ?>
                <span class="seller_name">
                    <p>Seller Name: <?php 
    printf('<a href="%s">%s</a>', dokan_get_store_url($author->ID), $author->display_name);
    ?>
</p>
                	<p>Seller Phone: <?php 
    echo $store_info['phone'];
    ?>
</p>
                </span>
 		<?php 
}
?>
	<?php 
/**
 * woocommerce_after_single_product_summary hook
 *
 * @hooked woocommerce_output_product_data_tabs - 10
Example #16
0
    <?php 
if (is_user_logged_in()) {
    ?>

        <?php 
    if (dokan_is_user_seller($user_id)) {
        ?>
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php 
        _e('Seller Dashboard', 'dokan');
        ?>
 <b class="caret"></b></a>

                <ul class="dropdown-menu">
                    <li><a href="<?php 
        echo dokan_get_store_url($user_id);
        ?>
" target="_blank"><?php 
        _e('Visit your store', 'dokan');
        ?>
 <i class="fa fa-external-link"></i></a></li>
                    <li class="divider"></li>
                    <?php 
        foreach ($nav_urls as $key => $item) {
            printf('<li><a href="%s">%s &nbsp;%s</a></li>', $item['url'], $item['icon'], $item['title']);
        }
        ?>
                </ul>
            </li>
        <?php 
    }
    public function widget($args, $instance)
    {
        $title = apply_filters('widget_title', $instance['title']);
        // before and after widget arguments are defined by themes
        echo $args['before_widget'];
        if (!empty($title)) {
            echo $args['before_title'] . $title . $args['after_title'];
        }
        $sellers = dokan_get_sellers(1);
        foreach ($sellers['users'] as $seller) {
            $args = array('post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => -1, 'author' => $seller->ID, 'fields' => 'ids');
            $product_ids = get_posts($args);
            $seller_products = !empty($product_ids) ? count($product_ids) : 0;
            $store_info = dokan_get_store_info($seller->ID);
            $banner_id = isset($store_info['banner']) ? $store_info['banner'] : 0;
            $store_name = isset($store_info['store_name']) ? esc_html($store_info['store_name']) : __('N/A', 'dokan');
            $store_url = dokan_get_store_url($seller->ID);
            $seller_icon = get_user_meta($seller->ID, 'dokan_seller_icon', true);
            ?>
                <div class="ff-box">
                    <?php 
            if ($banner_id) {
                $banner_url = wp_get_attachment_image_src($banner_id, 'full');
                ?>
                        <a href="<?php 
                echo $store_url;
                ?>
">
                            <img src="<?php 
                echo $banner_url[0];
                ?>
" class="img-responsive2">
                        </a>
                    <?php 
            }
            ?>
                    <div class="ff-detail">
                        <?php 
            if (!empty($seller_icon)) {
                ?>
                            <div class="ffd-image">
                                <a href="<?php 
                echo $store_url;
                ?>
">
                                    <img src="<?php 
                echo $seller_icon;
                ?>
" class="img-responsive2">
                                </a>
                            </div>
                        <?php 
            }
            ?>
                        <div class="feature-title">
                            <?php 
            if (!empty($store_name)) {
                ?>
                                <h6><a href="<?php 
                echo $store_url;
                ?>
"><?php 
                echo $store_name;
                ?>
</a></h6>
                            <?php 
            }
            ?>
    
                            <span><?php 
            echo sprintf(_n('%s item', '%s items', $seller_products, 'farmtoyou'), $seller_products);
            ?>
</span>
                        </div>
                        <div class="ffd-click"><a href="<?php 
            echo $store_url;
            ?>
"><i class="fa fa-angle-right"></i></a></div>
                    </div>
                </div>
            <?php 
        }
        ?>

        <?php 
        echo $args['after_widget'];
    }
Example #18
0
?>

<div class="dokan-dashboard-wrap">
    <?php 
dokan_get_template('dashboard-nav.php', array('active_menu' => 'settings'));
?>

    <div class="dokan-dashboard-content dokan-settings-content">
        <article class="dokan-settings-area">
            <header class="dokan-dashboard-header">
                <h1 class="entry-title">
                    <?php 
_e('Settings', 'dokan');
?>
                    <small>&rarr; <a href="<?php 
echo dokan_get_store_url(get_current_user_id());
?>
"><?php 
_e('Visit Store', 'dokan');
?>
</a></small>
                </h1>
            </header><!-- .dokan-dashboard-header -->

            <?php 
if (is_wp_error($validate)) {
    $messages = $validate->get_error_messages();
    foreach ($messages as $message) {
        ?>
                    <div class="dokan-alert dokan-alert-danger" style="width: 40%; margin-left: 25%;">
                        <button type="button" class="dokan-close" data-dismiss="alert">&times;</button>
Example #19
0
 /**
  * Send email to admin once a product is added
  *
  * @param int $product_id
  * @param string $status
  */
 function new_product_added($product_id, $status = 'pending')
 {
     $template = DOKAN_INC_DIR . '/emails/new-product-pending.php';
     if ($status == 'publish') {
         $template = DOKAN_INC_DIR . '/emails/new-product.php';
     }
     ob_start();
     include $template;
     $body = ob_get_clean();
     $product = get_product($product_id);
     $seller = get_user_by('id', $product->post->post_author);
     $category = wp_get_post_terms($product->id, 'product_cat', array('fields' => 'names'));
     $category_name = $category ? reset($category) : 'N/A';
     $find = array('%title%', '%price%', '%seller_name%', '%seller_url%', '%category%', '%product_link%', '%site_name%', '%site_url%');
     $replace = array($product->get_title(), $this->currency_symbol($product->get_price()), $seller->display_name, dokan_get_store_url($seller->ID), $category_name, admin_url('post.php?action=edit&post=' . $product_id), $this->get_from_name(), home_url());
     $body = str_replace($find, $replace, $body);
     $subject = sprintf(__('[%s] New Product Added', 'dokan'), $this->get_from_name());
     $this->send($this->admin_email(), $subject, $body);
 }
if (!empty($_GET['farmtoyou_zip'])) {
    $zip_codes = get_zips($_GET['farmtoyou_zip'], $_GET['miles']);
    if (!empty($zip_codes)) {
        $zips = array();
        foreach ($zip_codes as $z) {
            $zips[] = $z->zip_code;
        }
        $seller_args = array('meta_query' => array(array('key' => 'dokan_vendor_zipcode', 'value' => $zips, 'compare' => 'IN')));
    }
    $seller_query = new WP_User_Query($seller_args);
    if (!empty($seller_query->results)) {
        foreach ($seller_query->results as $seller) {
            $store_info = dokan_get_store_info($seller->ID);
            $banner_id = isset($store_info['banner']) ? $store_info['banner'] : 0;
            $store_name = isset($store_info['store_name']) ? esc_html($store_info['store_name']) : __('N/A', 'dokan');
            $store_url = dokan_get_store_url($seller->ID);
            $seller_zipcode = get_user_meta($seller->ID, 'dokan_vendor_zipcode', true);
            ?>
                                <li class="dokan-single-seller">
                                    <div class="dokan-store-thumbnail">

                                        <a href="<?php 
            echo $store_url;
            ?>
">
                                            <?php 
            if ($banner_id) {
                $banner_url = wp_get_attachment_image_src($banner_id, 'medium');
                ?>
                                                <img class="dokan-store-img" src="<?php 
                echo esc_url($banner_url[0]);
function tpvc_wc_mini_vendors_dokan_shortcode($atts)
{
    if (!class_exists('woocommerce')) {
        return;
    }
    if (!class_exists('WeDevs_Dokan')) {
        return;
    }
    extract(shortcode_atts(array('tpvc_wc_vendor_title' => 'Vendors', 'tpvc_wc_vendor_title_color' => '', 'tpvc_wc_vendor_title_bg' => '', 'tpvc_wc_vendor_title_icon' => '', 'tpvc_wc_vendor_title_icon_color' => '', 'tpvc_wc_vendor_numbers' => 36, 'tpvc_wc_vendor_columns' => 12, 'tpvc_wc_vendor_columns_tablet' => 9, 'tpvc_wc_vendor_columns_mobile' => 4, 'tpvc_wc_vendor_orderby' => 'registered', 'tpvc_wc_vendor_order' => 'asc', 'tpvc_wc_vendor_hide_title' => '', 'tpvc_wc_vendor_show_products' => 'no', 'tpvc_wc_vendor_class' => ''), $atts));
    $meta_query = WC()->query->get_meta_query();
    if (intval($tpvc_wc_vendor_numbers) < 1) {
        $tpvc_wc_vendor_numbers = 36;
    }
    if (intval($tpvc_wc_vendor_columns) < 1) {
        $tpvc_wc_vendor_columns = 12;
    }
    if (intval($tpvc_wc_vendor_columns_tablet) < 1) {
        $tpvc_wc_vendor_columns_tablet = 9;
    }
    if (intval($tpvc_wc_vendor_columns_mobile) < 1) {
        $tpvc_wc_vendor_columns_mobile = 4;
    }
    $tpvc_wc_vendor_class .= ' tpvc-mini-product-col-md-' . $tpvc_wc_vendor_columns;
    $tpvc_wc_vendor_class .= ' tpvc-mini-product-col-sm-' . $tpvc_wc_vendor_columns_tablet;
    $tpvc_wc_vendor_class .= ' tpvc-mini-product-col-xs-' . $tpvc_wc_vendor_columns_mobile;
    $paged = 1;
    $offset = 0;
    // Get the paged vendors
    $vendor_paged_args = array('meta_query' => array(array('key' => 'dokan_enable_selling', 'value' => 'yes', 'compare' => '=')), 'orderby' => $tpvc_wc_vendor_orderby, 'order' => $tpvc_wc_vendor_order, 'offset' => $offset, 'number' => $tpvc_wc_vendor_numbers);
    $vendor_paged_query = new WP_User_Query($vendor_paged_args);
    $paged_vendors = $vendor_paged_query->get_results();
    // Pagination calcs
    // $total_vendors = count($all_vendors);
    // $total_vendors_paged = count($paged_vendors);
    // $total_pages = intval($total_vendors / $per_page) + 1;
    ob_start();
    if (!empty($paged_vendors)) {
        ?>

	<div class="tpvc-mini-product woocommerce <?php 
        echo $tpvc_wc_vendor_class;
        ?>
">

		<?php 
        if ("hide" != $tpvc_wc_vendor_hide_title) {
            ?>
			<div class="tpvc-title" <?php 
            if ("" !== $tpvc_wc_vendor_title_bg) {
                echo 'style="background-color:' . $tpvc_wc_vendor_title_bg . '"';
            }
            ?>
>
				<h2 <?php 
            if ("" !== $tpvc_wc_vendor_title_color) {
                echo 'style="color:' . $tpvc_wc_vendor_title_color . '"';
            }
            ?>
>
					<?php 
            if ("" != $tpvc_wc_vendor_title_icon) {
                echo '<i class="' . tpvc_icon($tpvc_wc_vendor_title_icon) . '" ' . ($tpvc_wc_vendor_title_icon_color ? 'style="color:' . $tpvc_wc_vendor_title_icon_color . '"' : '') . '></i>';
            }
            ?>
					<?php 
            echo $tpvc_wc_vendor_title;
            ?>
				</h2>
			</div>
		<?php 
        }
        ?>

		<ul class="products">

			<?php 
        foreach ($paged_vendors as $vendor) {
            ?>

                <?php 
            $store_info = dokan_get_store_info($vendor->ID);
            $vendor_name = isset($store_info['store_name']) ? esc_html($store_info['store_name']) : __('N/A', 'tokopress');
            $vendor_link = dokan_get_store_url($vendor->ID);
            ?>

				<li class="product">

					<?php 
            echo get_avatar($vendor->ID, 200);
            ?>

					<div class="mini-icon-view">
						<a href="<?php 
            echo esc_url($vendor_link);
            ?>
" title="<?php 
            echo esc_attr($vendor_name);
            ?>
">
							<i class="fa fa-search"></i>
						</a>
					</div>

				</li>

			<?php 
        }
        // end of the loop.
        ?>

		</ul>

	</div>

	<?php 
    }
    return ob_get_clean();
}
Example #22
0
/**
 * Get terms and conditions page
 *
 * @since 2.3
 *
 * @param $store_id
 * @param $store_info
 *
 * @return string
 */
function dokan_get_toc_url($store_id)
{
    $userstore = dokan_get_store_url($store_id);
    return apply_filters('dokan_get_toc_url', $userstore . "toc");
}
Example #23
0
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     1.6.4
 */
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
$prefix = FARMTOYOU_META_PREFIX;
global $post;
$store_user = get_userdata($post->post_author);
$store_info = dokan_get_store_info($store_user->ID);
$map_location = isset($store_info['location']) ? esc_attr($store_info['location']) : '';
$scheme = is_ssl() ? 'https' : 'http';
$store_name = $store_info['store_name'];
$store_url = dokan_get_store_url($store_user->ID);
$current_user = wp_get_current_user();
$current_user_email = $current_user->user_email;
$current_user_id = $current_user->ID;
wp_enqueue_script('google-maps', $scheme . '://maps.google.com/maps/api/js?sensor=true');
get_header('shop');
?>

<div class="cupcake-section">
    <div class="container">
            
            <?php 
$args = array('post_type' => FARMTOYOU_NEWSLETTER_POST_TYPE, 'post_status' => 'publish', 'posts_per_page' => '-1', 'meta_query' => array(array('key' => $prefix . 'post_author', 'value' => $store_user->ID), array('key' => $prefix . 'post_title', 'value' => $current_user_email)));
//get newsletter data from database
$all_newsletter = get_posts($args);
?>
Example #24
0
if ($best_products->have_posts()) {
    ?>
        <div class="col-md-5 blog-left">
            <h2><?php 
    _e('This Weeks Best Sellers', 'farmtoyou');
    ?>
</h2>
            <?php 
    while ($best_products->have_posts()) {
        $best_products->the_post();
        $product_feat_image = get_the_post_thumbnail($post->ID, 'shop_catalog');
        $terms = get_the_terms($post->ID, 'product_cat');
        $regular_price = get_post_meta(get_the_ID(), '_regular_price', true);
        $sale_price = get_post_meta(get_the_ID(), '_sale_price', true);
        $author_id = get_the_author_meta('ID');
        $author_url = dokan_get_store_url($author_id);
        ?>
                <div class="blog-box">
                    <div class="col-md-5 blog-image">
                        <?php 
        echo $product_feat_image;
        ?>
                    </div>
                    <div class="col-md-7 blog-content">
                        <h6><?php 
        the_title();
        ?>
</h6>
                        <ul>
                            <li><a href="<?php 
        echo $author_url;
Example #25
0
 function replace_og_url()
 {
     $seller = get_userdata(get_query_var('author'));
     $og_url = dokan_get_store_url($seller->ID);
     return $og_url;
 }
Example #26
0
?>

<ul class="dokan-feature-sellers">
    <?php 
if ($sellers) {
    foreach ($sellers as $key => $seller) {
        $store_info = dokan_get_store_info($seller->ID);
        $rating = dokan_get_seller_rating($seller->ID);
        $display_rating = $rating['rating'];
        if (!$rating['count']) {
            $display_rating = __('No ratings found yet!', 'dokan');
        }
        ?>
            <li>
                <a href="<?php 
        echo dokan_get_store_url($seller->ID);
        ?>
">
                    <?php 
        echo esc_html($store_info['store_name']);
        ?>
                </a><br />
                <i class='fa fa-star'></i>
                <?php 
        echo $display_rating;
        ?>
            </li>

            <?php 
    }
}
Example #27
0
/**
 * Get review page url of a seller
 *
 * @param int $user_id
 * @return string
 */
function dokan_get_review_url($user_id)
{
    $userstore = dokan_get_store_url($user_id);
    return apply_filters('dokan_get_seller_review_url', $userstore . "reviews");
}