Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Contributor Jeremiah

    (@jprummer)

    Hello! Are you talking about displaying it as a widget in the sidebar? Could you post a link to your site so I can better understand what you’re referring to? Thanks!

    Jeremiah

    Thread Starter iamdhunt

    (@iamdhunt)

    Yep: http://livinglifefearless.com/, it’s the user bar at the top.

    Plugin Contributor Ewout

    (@pomegranate)

    Try the following:

    add to __construct:

    add_action('admin_bar_menu', array( &$this, 'add_toolbar_wcmenucart' ), 100);

    then add the function:

    public function add_toolbar_wcmenucart($admin_bar){
    		if (!is_admin()) {
    			$dom = new DOMDocument();
    			$dom->loadHTML($this->wcmenucart_menu_item());
    
    			foreach ($dom->getElementsByTagName('a') as $a) {
    			    $menutitle = $a->nodeValue;
    				$menuhref = $a->getAttribute('href');
    			}
    
    			$admin_bar->add_menu( array(
    				'id'    => 'wcmenucart',
    				'title' => '<i class="wcmenucart-icon-shopping-cart-0"></i>'.$menutitle,
    				'href'  => $menuhref,
    				'meta'  => array(
    					'title' => __('View your shopping cart', 'wcmenucart'),
    				),
    			));
    		}
    	}

    should work

    Plugin Contributor Ewout

    (@pomegranate)

    btw, this doesn’t take your setting for the cart icon into account, just delete the <i> element from the title if you don’t want it (dom doesn’t support innerHTML, which makes it a bit harder to include the whole menu item)

    Thread Starter iamdhunt

    (@iamdhunt)

    This all goes in my functions.php correct?

    Plugin Contributor Jeremiah

    (@jprummer)

    Actually, you’ll want to add that to the plugin itself. If you open the menu cart plugin’s main php file you’ll be able to see where you need to place the filter and the function. Let us know if you need any more help with this.

    Thread Starter iamdhunt

    (@iamdhunt)

    Thanks! Works great. Only thing is that fly out doesn’t work. If it’s not possible that understandable, great plugin anyways.

    Thread Starter iamdhunt

    (@iamdhunt)

    Actually I also just noticed that in my footer I’m getting this error:

    Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: Empty string supplied as input in /woocommerce-menu-cart-pro/woocommerce-menu-cart-pro.php on line 67

    Any ideas on why?

    Plugin Contributor Jeremiah

    (@jprummer)

    Hey there! I just checked your site and I don’t see it active. We can’t trouble shoot the flyout without being able to see it on your site. My guess is that it has to do with the fact that your menu is the admin menu instead of the standard WP menu. As far as error in your footer, you could try commenting out or deleting line 67: load_plugin_textdomain( ‘wcmenucart’, false, dirname( plugin_basename( __FILE__ ) ) . ‘/languages/’ );

    Again, it’s probably because this is being loaded via the admin menu instead of the standard wp menu. That particular line just loads other language translations, but I’m guessing your site will be in English, correct?

    Thread Starter iamdhunt

    (@iamdhunt)

    Oh sorry it’s active again and the error has seemed to have gone away, and yes it will be in english so language translations isn’t much of a concern for me right now.

    http://livinglifefearless.com

    Plugin Contributor Ewout

    (@pomegranate)

    I’m guessing that your line 67 is not the language but the custom function I posted. I have no idea what could have caused the error, let us know when it comes back.

    Unfortunately it’s not possible to enable the flyout in the admin bar the way the plugin is currently setup & how the WP admin bar interface works.

    Thanks for purchasing the pro version by the way, I couldn’t tell from your username πŸ™‚
    If you need more in depth support, do not hesitate to contact us on support@wpovernight.com, as this forum is mainly about the free version.

    Thread Starter iamdhunt

    (@iamdhunt)

    Yeah it’s the custom function that’s causing the error and it’s popped up again. You can see it at the bottom of the site.

    Plugin Contributor Ewout

    (@pomegranate)

    Possibly this is because you don’t have the ‘always display’ setting enabled: the error disappears when I add something to the cart.

    You could try to replace this (first line in the custom function):

    if (!is_admin()) {

    with this:

    if (!is_admin() && $this->wcmenucart_menu_item() != '') {

    let me know if this solves the error for you!

    Thread Starter iamdhunt

    (@iamdhunt)

    You were correct not having it always displayed was causing the error. But that fixed the problem. Thanks!

    Plugin Contributor Jeremiah

    (@jprummer)

    Great! I’d say this is resolved then. Let us know if you have any other questions. πŸ™‚

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Display In Admin Bar’ is closed to new replies.