Support » Plugin: Permalink Manager Lite » Breadcrumbs to Dokan Vendor Page

  • Resolved 0alex0

    (@0alex0)


    Hi,

    I am building a marketplace using WooCommerce + Dokan and I used Permalink Manager Lite in order to modify products permalinks.

    My current permalinks are:

    That is working fine, the problem comes with breadcrumbs. I activated “Breadcrumbs support” checkbox and although breadcrumbs are properly displayed on product page, the href of the vendor page is not correct. Instead of being “domain.com/shops/[shop name]” is “domain.com/attribute/brand/[shop name]”.

    It must be considered that the name of the shop I used to create the shop profile in Dokan coincides with one of my attributes (that I set as product brand).

    I hope there is an easy solution for that! (:

    • This topic was modified 2 months, 1 week ago by 0alex0.
    • This topic was modified 2 months, 1 week ago by 0alex0.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Maciej Bis

    (@mbis)

    Hi @0alex0,

    I wish I could assist, however the breadcrumbs integration is limited to the most basic scenarios, and I am unable to give support for third-party plugins that are responsible for showing the breadcrumbs.

    If you could provide me the name of the breadcrumbs plugin you are using or the URL of your website, I would be happy to send you a link to the breadcrumbs API documentation. This way you could filter the breadcrumbs link to the vendor page instead of the brand attribute term.

    Thread Starter 0alex0

    (@0alex0)

    Hi @mbis,

    Thanks for your prompt response. Really appreciated. I am currently using standard WooCommerce breadcrumbs.

    • This reply was modified 2 months, 1 week ago by 0alex0.
    Plugin Author Maciej Bis

    (@mbis)

    Hi @0alex0

    The code should be as follows:

    function pm_adjust_product_breadcrumbs($crumbs, $breadcrumb) {
    	global $post;
    
    	if(!empty($post) && $post->post_type == 'product' && function_exists('dokan')) {
    		$vendor_id = $post->post_author;
    		$vendor = dokan()->vendor->get($vendor_id);
    
    		$store_name = get_user_meta($vendor_id, 'dokan_store_name', true);
    		$store_url = $vendor->get_shop_url();
    
    		// Change the link and the title of second crumb 
    		$crumbs[1] = array(
    			$store_name,
    			$store_url
    		);
    	}
    
    	return $crumbs;
    }
    add_filter('woocommerce_get_breadcrumb', 'pm_adjust_product_breadcrumbs', 100, 2);

    I am not certain what crumb should be affected, but you can change it by adjusting the array index in $crumbs[1] to eg. $crumbs[2]

    Thread Starter 0alex0

    (@0alex0)

    Working perfectly with that code! I just needed to adjust the array index to “2” as you suggested.

    Thank you so much for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.