MarketPress External Link Not Redirecting

I have a product that is an External/Affiliate Link. The actual URL is another page within my site. I did a test purchase, and the order status page was the result after completing the transaction. I would expect it to be my external link page. Am I missing something here? Please advise.

  • Luís

    Hi Scott Daniels ,

    Hope you're doing well today!

    The main focus of an "External/Affiliate Link" is to point/redirect to an external link, so, in the product page, when you click in the "buy" button you should be redirected. This is not happening?

    The page for where you are redirecting is a product too? If yes, you are doing the normal "buy" process, and after the checkout you should receive an "order status" from the product that you was redirected.

    However, can you give us access to your admin panel, so we can give a look?

    If you don't already know, please, follow the link below, to see how enable the staff login:

    http://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    When you enable this option, please post again!

    Cheers, Luís

  • Scott Daniels

    No it is not a product page. I am attempting to sell a service. Upon completion of the purchase, I want the user's browser to redirect to a page with a form to be completed with details necessary to perform the service. I have tried Digital Download with a link to my form page, but it tries to download the link instead of opening it. When I tried the External Link before, I must have not refreshed my page, so please ignore the problem I stated. I just tried it again, and like you said, it is just a hyperlink to my page. So, how can I do what I want to do? The Digital Download seems to be close, but I would need to change the downlink text from 'Download' to something else, and it would need to be an actual link instead of trying to download a file. What is the best approach (other than hacking the actual code)? Is there a plugin capability? Please advise.

  • Luís

    Hi Scott Daniels ,

    Hope you're doing well today!

    1) I made some research in the forum and I found a solution shared by José that could do what you need:

    https://premium.wpmudev.org/forums/topic/marketpress-download-link-to-a-registration-page#post-693232

    José shared a solution (a mu-plugin) to allow a redirection in the "Digital Products. I tested this on my install and I think it can solve your issue.

    2) To change the "Download" link text, I think the best solution should be using the translation file.

    2.1) Go to "wp-content/plugins/marketpress/languages" folder and download the "mp.pot" file;

    2.2) Using a .pot editor, like Poedit add a translation to the string "Download";

    2.3) When you save the file, Poedit will generate two files: .mo and .po;

    2.4) Change the file name to include the language code:

    I.E, if your site language is English (United States) defined in Settings -> General, your translation file should be:

    mp-en_US.mo

    2.5) Then upload the .mo file to "wp-content/plugins/marketpress/languages" folder.

    I hope this information has been helpful. If I can help you in this or other questions, please let me know!

    Cheers, Luís

  • Scott Daniels

    The changing the download link page you referred to worked (it was actually much easier, now that there is a option setting), as long as I don't ever want to offer downloads as well. However, the big problem is that I cannot change the text for just one website without changing it for all. Therefore, what I really need is a way to provide a 4th purchase option. Is there any documentation for creating addons or hooks to do so?

    Thanks,
    Scott

  • Luís

    Hi Scott Daniels ,

    Hope you're doing well today!

    To change the text link in one subsite only, we will need to do this via "mu-plugin". Can you try this code?

    <?php
    
    define('MP_LARGE_DOWNLOADS', true);
    
    add_filter( 'mp_order/details', 'wpmudev_change_download_text_notification', 20, 2 );
    add_filter( 'mp_order/notification_body', 'wpmudev_change_download_text_notification', 20, 2 );
    
    function wpmudev_change_download_text_notification( $msg, $obj ){
        $blog_id = get_current_blog_id();
        if( $blog_id == 8 ){
            $msg = str_replace( 'Download</a>', 'Something else</a>', $msg );
        }
        return $msg;
    }

    Note: Change the "blog_id" to the blog desired and the text "Something else" to the text you want;

    If this solution don't work for you, I can ping the SLS team, to give some directions to create a 4th purchase option. The intent of this "4th purchase option" is to do what was requested in this topic?

    Cheers, Luís

  • Scott Daniels

    Sorry to take so long to reply - I got pulled off onto other projects. I am back at it now, and I used what you gave me to provide an improved solution:

    define("MP_LARGE_DOWNLOADS", true);
    
    add_filter( "mp_order/details", "wpmudev_change_download_text_notification", 20, 2 );
    add_filter( "mp_order/notification_body", "wpmudev_change_download_text_notification", 20, 2 );
    add_filter( "mp_order/shipment_notification_body", "wpmudev_change_download_text_notification", 20, 2 );
    add_filter( "mp_order/mp_order_notification_admin_msg", "wpmudev_change_download_text_notification", 20, 2 );
    
    function wpmudev_change_download_text_notification( $msg, $obj ){
        $msg = str_replace( ">Download</a>", ' class="download-link">IMPORTANT: <Click to complete
        return $msg;
    }

    You don't need to put the code into a mu-plugin; a better option is right into a regular plugin activated for what sites you want it for. Therefore, the check for the blog_id is not needed. Also, I found additional filters needing to be added in order to change the text everywhere.

    Yes, a 4th option to provide a service page would be great. There may be other ways to implement it as part of the download option, but right now, this patch/hack pretty much wipes out that option for sites that implement it.