Forum Replies Created

Viewing 15 replies - 1 through 15 (of 43 total)
  • Thread Starter Mr. W

    (@gabriel-winnberg)

    Hi,

    After fixing the problem as I described I haven’t noticed anything. The plugin has been updated and works fine, sorry I couldn’t test it while the error still occurred. At least there are none of these in the database:

    (23, 'Order snippets by date', 'Order snippets by last modification date by default in the snippets table.', '\nadd_filter( \'code_snippets/list_table/default_orderby\', function () {\n return \'modified\';\n} );\n\nadd_filter( \'code_snippets/list_table/default_order\', function () {\n return \'desc\';\n} );\n', 'code-snippets-plugin', 'admin', 0, 10, '2020-02-24 09:02:33'),

    Thread Starter Mr. W

    (@gabriel-winnberg)

    Oh, not that it probably matters but I did increase memory from 512 to 768 MB before I did the above. Thanks for looking into it.

    Thread Starter Mr. W

    (@gabriel-winnberg)

    Thanks. I don’t know the cause of the error, but exported the snippets from phpMyAdmin, removed the plugin, dropped the table, reinstalled and manually entered the snippets. Now it’s working again.

    When I tried to open the Snippets overview page, the CPU would race, memory usage for the entire VPS would double to 1,5 GB and I had to restart PHP to reset it.

    I haven’t had time to investigate details, but there were some odd looking entries in the table, like this:

    (23, 'Order snippets by date', 'Order snippets by last modification date by default in the snippets table.', '\nadd_filter( \'code_snippets/list_table/default_orderby\', function () {\n	return \'modified\';\n} );\n\nadd_filter( \'code_snippets/list_table/default_order\', function () {\n	return \'desc\';\n} );\n', 'code-snippets-plugin', 'admin', 0, 10, '2020-02-24 09:02:33'),
    (24, 'Order snippets by date', 'Order snippets by last modification date by default in the snippets table.', '\nadd_filter( \'code_snippets/list_table/default_orderby\', function () {\n	return \'modified\';\n} );\n\nadd_filter( \'code_snippets/list_table/default_order\', function () {\n	return \'desc\';\n} );\n', 'code-snippets-plugin', 'admin', 0, 10, '2020-02-24 09:02:33'),
    (25, 'Order snippets by date', 'Order snippets by last modification date by default in the snippets table.', '\nadd_filter( \'code_snippets/list_table/default_orderby\', function () {\n	return \'modified\';\n} );\n\nadd_filter( \'code_snippets/list_table/default_order\', function () {\n	return \'desc\';\n} );\n', 'code-snippets-plugin', 'admin', 0, 10, '2020-02-24 09:02:35'),
    (26, 'Order snippets by date', 'Order snippets by last modification date by default in the snippets table.', '\nadd_filter( \'code_snippets/list_table/default_orderby\', function () {\n	return \'modified\';\n} );\n\nadd_filter( \'code_snippets/list_table/default_order\', function () {\n	return \'desc\';\n} );\n', 'code-snippets-plugin', 'admin', 0, 10, '2020-02-24 09:02:37'),
    (27, 'Order snippets by date', 'Order snippets by last modification date by default in the snippets table.', '\nadd_filter( \'code_snippets/list_table/default_orderby\', function () {\n	return \'modified\';\n} );\n\nadd_filter( \'code_snippets/list_table/default_order\', function () {\n	return \'desc\';\n} );\n', 'code-snippets-plugin', 'admin', 0, 10, '2020-02-24 09:02:38'),
    (28, 'Order snippets by date', 'Order snippets by last modification date by default in the snippets table.', '\nadd_filter( \'code_snippets/list_table/default_orderby\', function () {\n	return \'modified\';\n} );\n\nadd_filter( \'code_snippets/list_table/default_order\', function () {\n	return \'desc\';\n} );\n', 'code-snippets-plugin', 'admin', 0, 10, '2020-02-24 09:02:49'),
    (29, 'Order snippets by date', 'Order snippets by last modification date by default in the snippets table.', '\nadd_filter( \'code_snippets/list_table/default_orderby\', function () {\n	return \'modified\';\n} );\n\nadd_filter( \'code_snippets/list_table/default_order\', function () {\n	return \'desc\';\n} );\n', 'code-snippets-plugin', 'admin', 0, 10, '2020-02-24 09:02:51'),
    (30, 'Order snippets by date', 'Order snippets by last modification date by default in the snippets table.', '\nadd_filter( \'code_snippets/list_table/default_orderby\', function () {\n	return \'modified\';\n} );\n\nadd_filter( \'code_snippets/list_table/default_order\', function () {\n	return \'desc\';\n} );\n', 'code-snippets-plugin', 'admin', 0, 10, '2020-02-24 09:02:52'),
    (31, 'Order snippets by date', 'Order snippets by last modification date by default in the snippets table.', '\nadd_filter( \'code_snippets/list_table/default_orderby\', function () {\n	return \'modified\';\n} );\n\nadd_filter( \'code_snippets/list_table/default_order\', function () {\n	return \'desc\';\n} );\n', 'code-snippets-plugin', 'admin', 0, 10, '2020-02-24 09:02:53'),
    (32, 'Order snippets by date', 'Order snippets by last modification date by default in the snippets table.', '\nadd_filter( \'code_snippets/list_table/default_orderby\', function () {\n	return \'modified\';\n} );\n\nadd_filter( \'code_snippets/list_table/default_order\', function () {\n	return \'desc\';\n} );\n', 'code-snippets-plugin', 'admin', 0, 10, '2020-02-24 09:02:54'),
    (33, 'Order snippets by date', 'Order snippets by last modification date by default in the snippets table.', '\nadd_filter( \'code_snippets/list_table/default_orderby\', function () {\n	return \'modified\';\n} );\n\nadd_filter( \'code_snippets/list_table/default_order\', function () {\n	return \'desc\';\n} );\n', 'code-snippets-plugin', 'admin', 0, 10, '2020-02-24 09:02:59');
    Mr. W

    (@gabriel-winnberg)

    Thanks but I get the same result, it removes the “blog” slug but returns a 404. A bit further down, on the page I linked to, there’s a solution for taxonomies that I modified.

    Somewhere I read somewhere that has_archive must be set to true for it to work, could that be it?

    Mr. W

    (@gabriel-winnberg)

    Ok, I wasn’t aware that anything put into the post permalink structure would be prepended to custom taxonomies, unless 'with_front' => false.

    I found this solution to be put into functions.php, it does set the correct URL but no page is generated (404):

    https://wordpress.stackexchange.com/questions/224371/how-to-change-with-front-key-from-an-existing-custom-post-type

    Perhaps you @masedinet are able to tweak it?

    Thread Starter Mr. W

    (@gabriel-winnberg)

    Forgot to add:

    Array
    (
        [home_url] => https://www.example.com
        [site_url] => https://www.example.com
        [version] => 3.5.3
        [wp_version] => 5.0.2
        [wp_multisite] => 
        [wp_memory_limit] => 256M
        [wp_debug_mode] => 
        [wp_cron] => 1
        [language] => en_US
        [server_info] => nginx/1.10.3
        [php_version] => 7.0.32-0ubuntu0.16.04.1
        [php_post_max_size] => 96M
        [php_max_execution_time] => 300
        [php_max_input_vars] => 6000
        [max_upload_size] => 67108864
        [default_timezone] => UTC
        [theme] => Array
            (
                [name] => X – Child Theme
                [version] => 1.0.0
                [parent_theme] => X
            )
    
        [active_plugins] => Array
            (
                [0] => cornerstone/cornerstone.php
                [1] => perfect-woocommerce-brands/main.php
                [2] => tco-under-construction/tco-under-construction.php
                [3] => woocommerce-google-analytics-pro/woocommerce-google-analytics-pro.php
                [4] => woocommerce-products-filter/index.php
                [5] => woocommerce-variation-master/woocommerce-variation-master.php
                [6] => woocommerce/woocommerce.php
            )
    
        [pwb_options] => Array
            (
                [version] => 1.7.0
                [wc_pwb_admin_tab_brand_single_position] => after_meta
                [old_wc_pwb_admin_tab_slug] => marke-test
                [wc_pwb_notice_plugin_review] => 0
                [wc_pwb_admin_tab_slug] => marke-test
                [wc_pwb_admin_tab_brand_desc] => yes
                [wc_pwb_admin_tab_brand_single_product_tab] => yes
                [wc_pwb_admin_tab_brands_in_loop] => no
                [wc_pwb_admin_tab_brands_in_single] => brand_image
                [wc_pwb_admin_tab_brand_logo_size] => woocommerce_thumbnail
            )
    
    )
    • This reply was modified 6 years, 3 months ago by Mr. W.
    Mr. W

    (@gabriel-winnberg)

    I having conflicts with WOOF, are you using the same filter plugin?

    WOOF will display filter terms as slugs instead of product category names when PWB is active. Also, there are weird things happening to the filter search fields, sometimes they disappear after only having applied one filter option.

    Array
    (
        [home_url] => https://www.example.com
        [site_url] => https://www.example.com
        [version] => 3.5.3
        [wp_version] => 5.0.2
        [wp_multisite] => 
        [wp_memory_limit] => 256M
        [wp_debug_mode] => 
        [wp_cron] => 1
        [language] => en_US
        [server_info] => nginx/1.10.3
        [php_version] => 7.0.32-0ubuntu0.16.04.1
        [php_post_max_size] => 96M
        [php_max_execution_time] => 300
        [php_max_input_vars] => 6000
        [max_upload_size] => 67108864
        [default_timezone] => UTC
        [theme] => Array
            (
                [name] => X – Child Theme
                [version] => 1.0.0
                [parent_theme] => X
            )
    
        [active_plugins] => Array
            (
                [0] => cornerstone/cornerstone.php
                [1] => perfect-woocommerce-brands/main.php
                [2] => tco-under-construction/tco-under-construction.php
                [3] => woocommerce-google-analytics-pro/woocommerce-google-analytics-pro.php
                [4] => woocommerce-products-filter/index.php
                [5] => woocommerce-variation-master/woocommerce-variation-master.php
                [6] => woocommerce/woocommerce.php
            )
    
        [pwb_options] => Array
            (
                [version] => 1.7.0
                [wc_pwb_admin_tab_brand_single_position] => after_meta
                [old_wc_pwb_admin_tab_slug] => marke-test
                [wc_pwb_notice_plugin_review] => 0
                [wc_pwb_admin_tab_slug] => marke-test
                [wc_pwb_admin_tab_brand_desc] => yes
                [wc_pwb_admin_tab_brand_single_product_tab] => yes
                [wc_pwb_admin_tab_brands_in_loop] => no
                [wc_pwb_admin_tab_brands_in_single] => brand_image
                [wc_pwb_admin_tab_brand_logo_size] => woocommerce_thumbnail
            )
    
    )
    Mr. W

    (@gabriel-winnberg)

    I have the same issue. For the site in question I’ve added “/blog/” to the blog entry permalink structure, to separate blog articles from products. It seems PWB uses this permalink structure rather than the shop structure, where for example product categories show like “example.com/productcategory/category-name” and not “example.com/blog/productcategory/category-name”.

    Why doesn’t PWB use the normal shop permalink structure?

    Thanks for the solution, but it’s an annoyance having to manually edit the plugin at each update.

    I don’t even know if it’s relevant, but did you try the new option “Brands page id for linking breadcrumbs” that I mention here?
    https://www.ads-software.com/support/topic/brands-page-id-for-linking-breadcrumbs-how-does-it-work/

    Array
    (
        [home_url] => https://www.example.com
        [site_url] => https://www.example.com
        [version] => 3.5.3
        [wp_version] => 5.0.2
        [wp_multisite] => 
        [wp_memory_limit] => 256M
        [wp_debug_mode] => 
        [wp_cron] => 1
        [language] => en_US
        [server_info] => nginx/1.10.3
        [php_version] => 7.0.32-0ubuntu0.16.04.1
        [php_post_max_size] => 96M
        [php_max_execution_time] => 300
        [php_max_input_vars] => 6000
        [max_upload_size] => 67108864
        [default_timezone] => UTC
        [theme] => Array
            (
                [name] => X – Child Theme
                [version] => 1.0.0
                [parent_theme] => X
            )
    
        [active_plugins] => Array
            (
                [0] => cornerstone/cornerstone.php
                [1] => perfect-woocommerce-brands/main.php
                [2] => tco-under-construction/tco-under-construction.php
                [3] => woocommerce-google-analytics-pro/woocommerce-google-analytics-pro.php
                [4] => woocommerce-products-filter/index.php
                [5] => woocommerce-variation-master/woocommerce-variation-master.php
                [6] => woocommerce/woocommerce.php
            )
    
        [pwb_options] => Array
            (
                [version] => 1.7.0
                [wc_pwb_admin_tab_brand_single_position] => after_meta
                [old_wc_pwb_admin_tab_slug] => marke-test
                [wc_pwb_notice_plugin_review] => 0
                [wc_pwb_admin_tab_slug] => marke-test
                [wc_pwb_admin_tab_brand_desc] => yes
                [wc_pwb_admin_tab_brand_single_product_tab] => yes
                [wc_pwb_admin_tab_brands_in_loop] => no
                [wc_pwb_admin_tab_brands_in_single] => brand_image
                [wc_pwb_admin_tab_brand_logo_size] => woocommerce_thumbnail
            )
    
    )
    • This reply was modified 6 years, 3 months ago by Mr. W.
    • This reply was modified 6 years, 3 months ago by Mr. W.
    Mr. W

    (@gabriel-winnberg)

    Please have a look at my previous post, I just did that.

    Thread Starter Mr. W

    (@gabriel-winnberg)

    It was just a matter of adding this to main.php:

    require 'classes/shortcodes/class-pwb-brand-info.php';

    Thread Starter Mr. W

    (@gabriel-winnberg)

    I added this to brands in loop:

    $image_size = 'thumbnail';
    $image_size_selected = get_option('wc_pwb_admin_tab_brand_logo_size');
    if($image_size_selected!=false){
        $image_size = $image_size_selected;
    }
    
    $attachment_html = wp_get_attachment_image($attachment_id,$image_size);
    
    Thread Starter Mr. W

    (@gabriel-winnberg)

    Perhaps something like this could be used to create a shortcode [pwd-brand-info] that in turn could be placed for example in a tab.

    This one per se didn’t work for me, I’m too much of a script kiddie, but similar code worked when creating a custom tab in functions.php. I tried to edit class-perfect-woocommerce-brands.php but perhaps I missed something.

    <?php
    	namespace Perfect_Woocommerce_Brands\Shortcodes;
    
    	defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
    
    	class PWB_Brand_Info_Shortcode{
    
    		public static function brand_info_shortcode( $atts ) {
    			global $post;
    			$atts = shortcode_atts( array(
    				'product_id' => null,
    				'image_size' => 'thumbnail'
    			), $atts, 'pwb-brand' );
    
    			ob_start();
    
    			$brands = wp_get_post_terms( $post->ID, 'pwb-brand', array("fields" => "all") );
    
    			echo '<div class="pwb-brand-info-shortcode">';
    
    			foreach($brands as $brand){
    				$brand_link = get_term_link ( $brand->term_id, 'pwb-brand' );
    				$attachment_id = get_term_meta( $brand->term_id, 'pwb_brand_image', 1 );
    				$attachment_html = wp_get_attachment_image($attachment_id,$atts['image_size']);
    
    				if(!empty($attachment_html)){
    					echo '<a href="'.$brand_link.'" title="'.__( 'View brand', 'perfect-woocommerce-brands' ).'">'.$attachment_html.'</a>';
    				}else{
    					echo '<a href="'.$brand_link.'" title="'.__( 'View brand', 'perfect-woocommerce-brands' ).'">'.$brand->name.'</a>';
    				}
    			  	$queried_object = get_queried_object();
    			  	echo term_description( $brand->term_id, 'pwb-brand' );
    		 	}
    
    			echo '</div>';
    
    			return ob_get_clean();
    
    		}
    
    	}
    Mr. W

    (@gabriel-winnberg)

    I got it to work using the snippet above plus the snippet from here:
    https://www.ads-software.com/support/topic/brand-slugs/#post-8427732

    Change ‘custom-brands-slug’ to whatever and add to functions.php:

    // Remove Brands base
    add_filter( ‘yith_wcbr_taxonomy_with_front’, ‘__return_false’ );

    // Rename Brands slug
    if( defined( ‘YITH_WCBR’ ) && ! function_exists( ‘yith_wcbr_change_rewrite_rule’ ) ){
    function yith_wcbr_change_rewrite_rule( $rewrite ){
    return ‘custom-brands-slug’;
    }
    add_filter( ‘yith_wcbr_taxonomy_rewrite’, ‘yith_wcbr_change_rewrite_rule’ );
    }

    Mr. W

    (@gabriel-winnberg)

    This works, thanks!
    But can it be added it via functions.php?

    Mr. W

    (@gabriel-winnberg)

    When editing a brand and opening screen options I see an error:

    Notice: Undefined index: cb in /var/www/dev.konsttorget.se/wp-content/plugins/yith-woocommerce-brands-add-on/includes/class.yith-wcbr-admin.php on line 182

Viewing 15 replies - 1 through 15 (of 43 total)