• Resolved cyberespia

    (@cyberespia)


    Currently the url of the file is:
    https://myhost.com/?attachment_id=847&download_file=5cb6534b0fd32&_wpnonce=ba84e0634f
    how can I get the url of the file directly (I need it this way to be able to add a PDF viewer)
    https://myhost.com/wp-content/uploads/2019/04/myfile.pdf

    I have looked in:
    public/class-woocommerce-product-attachment-public

    $wcpoa_file_url_btn = '<a class="wcpoa_attachmentbtn" href="' . esc_url(get_permalink() . esc_attr($wcpoa_attachment_url_arg) . 'attachment_id=' . esc_attr($attachment_id) . '&download_file=' . esc_attr($wcpoa_attachments_id) . '&_wpnonce=' . esc_attr($nonce)) . '" rel="nofollow">' . __("Download", 'woocommerce-product-attachment') . '</a>'

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello @cyberespia,

    This is server specific issue so, we need to debug in details.

    Create support ticket from here so, our technical team contact you soon.

    Thanks,

    Thread Starter cyberespia

    (@cyberespia)

    I have already solved it, with this I get the complete url of the file:

    $wcpoa_file_url_btn = '<a class="wcpoa_attachmentbtn" href="' . wp_get_attachment_url(esc_attr($attachment_id)) . '" rel="nofollow">' . __("Download", 'woocommerce-product-attachment') . '</a>';

    Hello @cyberespia,

    Thanks for the update and congrats for resolved the issue.

    Let us know in future if any help need from us we are happy to help!

    Thanks,

    I did what @cyberespia said or I understood:

    Plugin Author Dotstore

    (@dots)

    Hello @pirata87,

    Thanks for reaching out to us.

    I have notice that, you have copy only one line of the code from the file so, that’s why you are unable to get the attachment URL.

    Please read below steps how you can get attachment file URL or download link.

    You need to copy the code of the function name is “wcpoa_new_product_tab_content” at Line no: 223 and the file path is: “plugins\woo-product-attachment\public\class-woocommerce-product-attachment-public.php”.
    After copy the code please make sure that you are getting the Product ID in $post->ID this variable other wise this code will not work.

    If you are getting trouble during the code integration as per your requirement please create support ticket so we can help you for the same.

    Create support ticket.

    OR you can just copy this shared code.

    Click here to copy shared code in which you just need to change the product ID and you will get all the attachment links.

    Let me know still you have any query on this.

    Thanks,

    • This reply was modified 5 years, 6 months ago by Dotstore.

    meta.php add code url button tab delete ? $wcpoa_file_url_btn = ‘‘ . __(“Download”, ‘woocommerce-product-attachment’) . ‘‘;

    Hello @webcihakan,

    Thanks for sharing the code snippet.

    You can also review our previous message for how to get attachment url.

    Let us know still you have any query.

    Thanks,

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Get Url file’ is closed to new replies.