• Resolved proguid

    (@procarmanuals)


    Great plugin for products.
    Can it work with regular categories and subcategories?
    A great plugin would be.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Pektsekye

    (@pektsekye)

    Hello,

    Replace:

    
        $taxonomy = 'product_cat’;
    

    with:

    
        $taxonomy = 'category';
    

    in the file:
    wp-content/plugins/product-category-dropdowns/Block/Selector.php

    And replace the lines:

    
    // If WooCommerce plugin is installed and active.
    if (in_array('woocommerce/woocommerce.php', (array) get_option('active_plugins', array())) || in_array('woocommerce/woocommerce.php', array_keys((array) get_site_option('active_sitewide_plugins', array())))){
      Pektsekye_PCD();
    }
    

    with:

    
      Pektsekye_PCD();
    

    in the file:
    wp-content/plugins/product-category-dropdowns/product-category-dropdowns.php

    Thread Starter proguid

    (@procarmanuals)

    thanks for the answer.
    I changed the lines, but I get errors:

    [Tue Oct 06 04:06:48.655878 2020] [fcgid:warn] [pid 1607] [client 192.168.31.221:39672] mod_fcgid: stderr: PHP Fatal error:  Uncaught Error: Call to undefined function wc_get_products() in /var/www/local.com/data/www/local.com/wp-content/plugins/product-category-dropdowns/Block/Selector.php:31, referer: https://local.com/wp-admin/plugins.php
    [Tue Oct 06 04:06:48.655910 2020] [fcgid:warn] [pid 1607] [client 192.168.31.221:39672] mod_fcgid: stderr: Stack trace:, referer: https://local.com/wp-admin/plugins.php
    [Tue Oct 06 04:06:48.655916 2020] [fcgid:warn] [pid 1607] [client 192.168.31.221:39672] mod_fcgid: stderr: #0 /var/www/local.com/data/www/local.com/wp-content/plugins/product-category-dropdowns/view/frontend/templates/selector.php(17): Pektsekye_ProductCategoryDropdowns_Block_Selector->getCategoriesJson(), referer: https://local.com/wp-admin/plugins.php
    [Tue Oct 06 04:06:48.655921 2020] [fcgid:warn] [pid 1607] [client 192.168.31.221:39672] mod_fcgid: stderr: #1 /var/www/local.com/data/www/local.com/wp-content/plugins/product-category-dropdowns/Block/Selector.php(93): include('/var/www/local...'), referer: https://local.com/wp-admin/plugins.php
    [Tue Oct 06 04:06:48.655927 2020] [fcgid:warn] [pid 1607] [client 192.168.31.221:39672] mod_fcgid: stderr: #2 /var/www/local.com/data/www/local.com/wp-content/plugins/product-category-dropd, referer: https://local.com/wp-admin/plugins.php
    [Tue Oct 06 04:06:48.655945 2020] [fcgid:warn] [pid 1607] [client 192.168.31.221:39672] mod_fcgid: stderr: owns/Widget/Selector.php(63): Pektsekye_ProductCategoryDropdowns_Block_Selector->toHtml(), referer: https://local.com/wp-admin/plugins.php
    [Tue Oct 06 04:06:48.655951 2020] [fcgid:warn] [pid 1607] [client 192.168.31.221:39672] mod_fcgid: stderr: #3 /var/www/local.com/data/www/local.com/wp-includes/class-wp-widget.php(380): Pektsekye_ProductCategoryDropdowns_Widget_Selector->widget(Array, Array), referer: https://local.com/wp-admin/plugins.php
    [Tue Oct 06 04:06:48.655956 2020] [fcgid:warn] [pid 1607] [client 192.168.31.221:39672] mod_fcgid: stderr: #4 /var/www/local.com/data/www/local.com/wp-includes/widgets.php(805): WP_Widget in /var/www/local.com/data/www/local.com/wp-content/plugins/product-category-dropdowns/Block/Selector.php on line 31, referer: https://local.com/wp-admin/plugins.php
    
    • This reply was modified 4 years, 1 month ago by proguid. Reason: edit log
    Plugin Author Pektsekye

    (@pektsekye)

    Hello,

    Try to replace the code:

    
       $args = array('orderby' => 'parent', 'order' => 'DESC', 'fields' => 'all');
    
       $ids = wc_get_products(array('return' =>'ids', 'limit' => -1));
    
       $productCategories = wp_get_object_terms($ids, $taxonomy, $args); // only get categories that have products
    

    with:

    
       $productCategories = get_terms($taxonomy, array('fields' => 'all', 'hide_empty' => 1, 'orderby' => 'name'));
    

    in the file:

    wp-content/plugins/product-category-dropdowns/Block/Selector.php

    Stanislav

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Categories not woo’ is closed to new replies.