Support » Plugin: WooCommerce PDF Invoices & Packing Slips » Why not opening in new tab?

  • Its a great plugin, and works good enough in the free version to use while buildig the shop. But the link in my customers dashboard doesn’t even have “target=”_blank”” in the link? Seriously? Wouldn’t that be one of the first basic things you should build into the plugin?
    Who wants to open a PDF invoice, within the same screen? I had to dive into the coding myself to add the little piece of code that makes it open in a new tab. But that will be overwritten as soon as I install an update.

    Very nice work on the plugin, but these tiny things make it very tempting to try out others.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ewout

    (@pomegranate)

    Hello @supervinnie40,
    The button in My Account is not generated by the plugin, but by WooCommerce itself (or your theme if it bundles a custom version for the myaccount/my-orders.php template). WooCommerce only allows for a name (button title) and URL to be added to the actions column (using the filter woocommerce_my_account_my_orders_actions), I can’t generate the actual a tag myself. I could fix this with jQuery, but that would be a bit hacky and prone to errors since the layout of this page can be customized by the theme.

    That said, you mentioned you added code yourself, would you mind sharing this? If I am overlooking anything simple I’d gladly add this to the plugin 🙂

    Thanks!
    Ewout

    supervinnie40

    (@supervinnie40)

    Hi Ewout,

    I made the edit in Woocommerce/orders.php. I simply told Woocommerce to open those links in a new tab. So that will work for now (transferred the file to my theme as well). But it shouldn’t be needed. I also got somebody to make me code that looked for certain classes to then add the target=”” tag to the code. But that just seemed wrong.

    By the way (what I forgot to mention in my first post) is that your plugin actually says “Open PDF/Invoice in new tab/window”. I made a screenshot but wordpress doesn’t allow attachments. Its in the General settings screen all the way in the top.
    Why would you say “new tab/window” if it’s not capable of doing so? Or if you aren’t able to add that tag to the A element?

    supervinnie40

    (@supervinnie40)

    P.s. I’m Dutch if that makes things easier 😉

    Plugin Author Ewout

    (@pomegranate)

    Hi! The setting that you are referring to is for the admin – contrary to the My Account buttons, for the admin buttons I can actually add the target attribrute because I can create the link there myself. But for My Account buttons I am limited to what woocommerce offers. Unfortunately I am limited to the same things you ran into: either changing core woocommerce (which I can’t do from within my plugin and should never do on other peoples sites), or using jQuery/JS to add the target attribute dynamically – which I too think is a wrong solution…

    supervinnie40

    (@supervinnie40)

    I see what you mean. Maybe it would be better to tweak the text in the admin area then. I thought it was referring to the document in the My Account area.

    Maybe also add a little bit of help on how to use Orders.php to get it to open in a new tab/window? Perhaps a blog to your website and then a link to that article?

    And obviously moan at WooCommerce for limiting your plugin 😉

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