wcfmmp_store->get_shop_url(); $logo = ''; if ( apply_filters( 'wcfmmp_is_allow_sold_by_logo', true ) ) { $store_logo = wcfm_get_vendor_store_logo_by_vendor( $vendor_id ); if ( ! $store_logo ) { $store_logo = apply_filters( 'wcfmmp_store_default_logo', $WCFM->plugin_url . 'assets/images/wcfmmp-blue.png' ); } $logo = ''; } $excerpt .= '
' . $logo . $store_name . ''; } } } } return $excerpt; } /* * WCFM - WooCommerce Multivendor Marketplace update search page url for vendors shops */ public function wcfm_searchbox_markup( $markup, $params ) { $store = $this->get_current_store(); if ( $store ) { $markup = preg_replace( '/action="(.+?)"/i', 'action="' . $store->get_shop_url() . '"', $markup ); } return $markup; } /* * WCFM - WooCommerce Multivendor Marketplace limit search inside vendors shop */ public function wcfm_front_data_parameters( $params ) { $store = $this->get_current_store(); if ( $store ) { $params['data-tax'] = 'store:' . $store->get_id(); } return $params; } /* * WCFM - WooCommerce Multivendor Marketplace limit search inside vendoes shop */ public function wcfm_search_query_array( $query ) { $vendor_id = false; if ( isset( $_REQUEST['aws_tax'] ) && $_REQUEST['aws_tax'] && strpos( $_REQUEST['aws_tax'], 'store:' ) !== false ) { $vendor_id = intval( str_replace( 'store:', '', $_REQUEST['aws_tax'] ) ); } else { $store = $this->get_current_store(); if ( $store ) { $vendor_id = $store->get_id(); } } if ( $vendor_id ) { $store_products = get_posts( array( 'posts_per_page' => -1, 'fields' => 'ids', 'post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'suppress_filters' => true, 'no_found_rows' => 1, 'orderby' => 'ID', 'order' => 'DESC', 'lang' => '', 'author' => $vendor_id ) ); if ( $store_products ) { $query['search'] .= " AND ( id IN ( " . implode( ',', $store_products ) . " ) )"; } } return $query; } /* * Get current store object */ private function get_current_store() { $store = false; if ( function_exists('wcfmmp_is_store_page') && function_exists('wcfm_get_option') && wcfmmp_is_store_page() ) { $wcfm_store_url = wcfm_get_option( 'wcfm_store_url', 'store' ); $wcfm_store_name = apply_filters( 'wcfmmp_store_query_var', get_query_var( $wcfm_store_url ) ); if ( $wcfm_store_name ) { $seller_info = get_user_by( 'slug', $wcfm_store_name ); if ( $seller_info && function_exists( 'wcfmmp_get_store' ) ) { $store_user = wcfmmp_get_store( $seller_info->ID ); if ( $store_user ) { $store = $store_user; } } } } return $store; } } endif;