* Get the name of the plugin vendor
*
* @return string
*/
public function getPluginVersion() {
return ! empty( $this->pluginInfo['Version'] ) ? sanitize_text_field( $this->pluginInfo['Version'] ) : '';
}
/**
* Register settings
*
* @return void
*/
private function addSettings() {
if ( $this->hasBrands() ) {
add_filter( 'dgwt/wcas/settings/section=search', function ( $settingsScope ) {
$label = '';
$pluginName = $this->getPluginName();
if ( ! empty( $pluginName ) ) {
$pluginInfo = $pluginName . ' v' . $this->getPluginVersion();
$label = ' ' . Helpers::createQuestionMark( 'search-in-brands', sprintf( __( 'Based on the plugin %s', 'ajax-search-for-woocommerce' ), $pluginInfo ) );
}
$settingsScope[220] = array(
'name' => 'search_in_product_tax_' . $this->getBrandTaxonomy(),
'label' => __( 'Search in brands', 'ajax-search-for-woocommerce' ) . $label,
'class' => 'dgwt-wcas-premium-only',
'type' => 'checkbox',
'default' => 'off',
);
return $settingsScope;
} );
add_filter( 'dgwt/wcas/settings/section=autocomplete', function ( $settingsScope ) {
$label = '';
$pluginName = $this->getPluginName();
if ( ! empty( $pluginName ) ) {
$pluginInfo = $pluginName . ' v' . $this->getPluginVersion();
$label = ' ' . Helpers::createQuestionMark( 'show-matching-brands', sprintf( __( 'Based on the plugin %s', 'ajax-search-for-woocommerce' ), $pluginInfo ) );
}
$settingsScope[1260] = array(
'name' => 'show_product_tax_' . $this->getBrandTaxonomy(),
'label' => __( 'Show brands', 'ajax-search-for-woocommerce' ) . $label,
'class' => 'dgwt-wcas-premium-only js-dgwt-wcas-options-toggle-sibling',
'type' => 'checkbox',
'default' => 'off',
'input_data' => 'data-option-trigger="show_matching_brands"',
);
if ( $this->doesPluginSupportImages() ) {
$settingsScope[1270] = array(
'name' => 'show_product_tax_' . $this->getBrandTaxonomy() . '_images',
'label' => __( 'show images', 'ajax-search-for-woocommerce' ),
'class' => 'dgwt-wcas-premium-only',
'type' => 'checkbox',
'default' => 'off',
'desc' => __( 'show images', 'ajax-search-for-woocommerce' ),
'move_dest' => 'show_product_tax_' . $this->getBrandTaxonomy(),
'input_data' => 'data-option-trigger="show_brands_images"',
);
}
return $settingsScope;
} );
}
}
/**
* Rebuild details panel header for brands
*
* @param $title
* @param $termID
* @param $taxonomy
* @param $termName
*
* @return string
*/
public function rebuildDetailsHeader( $title, $termID, $taxonomy, $termName ) {
if ( ! empty( $taxonomy ) && $taxonomy === $this->getBrandTaxonomy() ) {
$title = '';
$title .= '';
$title .= Helpers::getLabel( 'tax_' . $this->getBrandTaxonomy() ) . ': ';
$title .= '';
$title .= $termName;
$title .= '';
}
return $title;
}
/**
* @param string $src
* @param int $termID
* @param string $size
* @param Term $term
*/
public function termThumbnailSrc( $src, $termID, $size, $term ) {
/**
* Notes:
* - "YITH WooCommerce Brands uses 'thumbnail_id' meta, so we don't need to overwrite URL in this filter
* - "WooCommerce Brands" uses 'thumbnail_id' meta, so we don't need to overwrite URL in this filter
*/
if ( $this->hasBrands() && $this->doesPluginSupportImages() ) {
switch ( $this->pluginSlug ) {
case 'perfect-woocommerce-brands/main.php':
case 'perfect-woocommerce-brands/perfect-woocommerce-brands.php':
$imageID = get_term_meta( $termID, 'pwb_brand_image', true );
if ( ! empty( $imageID ) ) {
$imageSrc = wp_get_attachment_image_src( $imageID, $size );
if ( is_array( $imageSrc ) && ! empty( $imageSrc[0] ) ) {
$src = $imageSrc[0];
}
}
break;
case 'brands-for-woocommerce/woocommerce-brand.php':
$url = get_term_meta( $termID, 'brand_image_url', true );
$src = empty( $url ) ? $src : $url;
break;
}
}
return $src;
}
/**
* Add brand to collection of supported taxonomies
*
* @param array $taxonomies Supported taxonomies
*
* @return array
*/
public function addBrandToCollectionOfTaxonomies( $taxonomies ) {
if ( ! $this->hasBrands() ) {
return $taxonomies;
}
$taxonomies = is_array( $taxonomies ) ? $taxonomies : array();
$taxonomies[] = array(
'taxonomy' => $this->getBrandTaxonomy(),
'labels' => array(
'name' => __( 'Brands', 'ajax-search-for-woocommerce' ),
'singular_name' => __( 'Brand', 'ajax-search-for-woocommerce' ),
),
'image_support' => $this->doesPluginSupportImages(),
);
return $taxonomies;
}
/**
* Check if a current brand plugin does support images
*
* @return bool
*/
private function doesPluginSupportImages() {
$result = in_array(
$this->pluginSlug,
array(
'yith-woocommerce-brands-add-on-premium/init.php',
'yith-woocommerce-brands-add-on/init.php',
'woocommerce-brands/woocommerce-brands.php',
'perfect-woocommerce-brands/main.php',
'perfect-woocommerce-brands/perfect-woocommerce-brands.php',
'brands-for-woocommerce/woocommerce-brand.php',
'premmerce-woocommerce-brands/premmerce-brands.php',
)
);
return apply_filters( 'dgwt/wcas/brands/image_support', $result );
}
}
Fatal error: Uncaught Error: Class 'DgoraWcas\Integrations\Brands' not found in /home/merciket/public_html/wp-content/plugins/ajax-search-for-woocommerce/ajax-search-for-woocommerce.php:97
Stack trace:
#0 /home/merciket/public_html/wp-content/plugins/ajax-search-for-woocommerce/ajax-search-for-woocommerce.php(405): DGWT_WC_Ajax_Search::getInstance()
#1 /home/merciket/public_html/wp-includes/class-wp-hook.php(324): DGWT_WCAS('')
#2 /home/merciket/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#3 /home/merciket/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#4 /home/merciket/public_html/wp-settings.php(506): do_action('plugins_loaded')
#5 /home/merciket/public_html/wp-config.php(92): require_once('/home/merciket/...')
#6 /home/merciket/public_html/wp-load.php(50): require_once('/home/merciket/...')
#7 /home/merciket/public_html/wp-blog-header.php(13): require_once('/home/merciket/...')
#8 /home/merciket/public_html/index.php(17): require('/home/merciket/...')
#9 {main in /home/merciket/public_html/wp-content/plugins/ajax-search-for-woocommerce/ajax-search-for-woocommerce.php on line 97