Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter koenvn

    (@koenvn)

    Wooow! Mike, thank you so much!
    And sorry for being such a pain.

    Please let me know where I can send the beer!

    Thread Starter koenvn

    (@koenvn)

    Yes, I’ve reviewed a fair few of the pre-made plugins.
    Unfortunately those solutions do typically the following things (and therefore do not fit 🙁 ):
    1. They just post it on the timelines of the customers. Whether I need to provide my customers just with the link to the product variation, so they can post it within FB groups, instead of on their own timelines. I haven’t seen any plugins being able to do that.
    2. Even if posting on their own timeline would be sufficient, the plugins typically don’t link to the variation, just to the product.

    So, I honestly only need to output the link to the product variation, nothing fancy with sharing buttons etc.

    Appreciate all your thoughts!

    Thread Starter koenvn

    (@koenvn)

    Sure – and thanks for not giving up yet. If there is any way to send you beers let me know :-)!

    What I aim to do is pretty straight forward (I think at least).
    Goal is to provide the clients with the product variation url at the thankyou page in order that they can share their variation on their social networks. Typically my clients only order a single product (they order tickets), but the tickets only go ahead if enough people buy them – therefore they share them on event pages of their social networks (there is no plugin available who can share on pages of groups, typically the plugins only share on timelines)

    The structure of the Thank you page is currently as follow:
    – Titel
    – Thank you order received message
    – Order details (as in: order number, order date, order total, payment method)
    – Details payment method
    – Ordered items details (table with ordered products, the link to the variation, and the amount of products) and a total value
    – Client details (name, email, etc)

    The only difference I would like to have is:
    – Titel
    – Thank you order received message
    – (message:)Please copy the following URL in the facebook group: [ URL to the product (variation!) ]
    – Order details (as in: order number, order date, order total, payment method)
    – Details payment method
    – Ordered items details (table with ordered products, the link to the variation, and the amount of products) and a total value
    – Client details (name, email, etc)

    So we only need the code to output the ordered product variation URLS (as per your first response) and loop that again on the thankyou page. But any other ideas would be appreciated as well (e.g. alternatively, could we make a order-details-items2.php, alter that code to only show the URL’s, and load that from the thankyou page?)

    Thread Starter koenvn

    (@koenvn)

    Honestly – I just need that bunch of links as output 🙂
    So no need for anything more advanced.

    But, it’s driving me absolutely nuts, since the basic example you provided still throws errors :S
    This time ‘data’ related and something else:

    Notice: Undefined index: data in /home/[domain]/public_html/wp-content/themes/[theme]/woocommerce/checkout/thankyou.php on line 72

    Fatal error: Call to a member function get_permalink() on a non-object in /home/[domain]/public_html/wp-content/themes/[theme]/woocommerce/checkout/thankyou.php on line 72

    And yes, further down it is providing the right URL already, through the order-details-items.php, but I need it again a little bit higher on the thankyou page. That’s why I started originally with pieces of the code as provided by you over here: https://github.com/woothemes/woocommerce/commit/39e8d981a054ddf42e97545782c44f92ec8e6982

    🙁

    Thread Starter koenvn

    (@koenvn)

    Sorry – long day. As per your updates

    Notice: Undefined variable: item in /home/[domain]/public_html/wp-content/themes/[theme]/woocommerce/checkout/thankyou.php on line 70

    Fatal error: Call to a member function get_permalink() on a non-object in /home/[domain]/public_html/wp-content/themes/[theme]/woocommerce/checkout/thankyou.php on line 70

    Thread Starter koenvn

    (@koenvn)

    Parse error: syntax error, unexpected ‘,’ in /home/[domain]/public_html/wp-content/themes/[theme]/woocommerce/checkout/thankyou.php on line 71

    Line 71
    echo apply_filters( 'woocommerce_order_item_name', $product_permalink ? sprintf( '<a href="%s">%s</a>', $product_permalink, $product_permalink ), $item, $is_visible );

    Have tried to remove the ‘,’ one by one, but without luck 🙁

    Line 70 (FYI)
    $product_permalink = $item['data']->get_permalink( $item );

    Thread Starter koenvn

    (@koenvn)

    Thanks

    This is the error:
    Parse error: syntax error, unexpected ‘;’ in /home/[domain]/public_html/wp-content/themes/[theme]/woocommerce/checkout/thankyou.php on line 71

    Which seems weird to me, since 71 is:

    echo apply_filters( 'woocommerce_order_item_name', $product_permalink ? sprintf( '<a href="%s">%s</a>', $product_permalink, $product_permalink, $item, $is_visible );

    Thread Starter koenvn

    (@koenvn)

    That still returns a blank page (except for the headers and the titel)
    🙁

    Thread Starter koenvn

    (@koenvn)

    Thread Starter koenvn

    (@koenvn)

    Sorry Mike you lost me. I don’t even see an $order in the code you provided (which I just placed between <?php and ?> brackets).

    But, all other $order echo’s on the thankyou.php page seem to work e.g.
    <?php echo $order->get_order_number(); ?>

    Thread Starter koenvn

    (@koenvn)

    Thanks.

    But no, the loop breaks the page.

    Thread Starter koenvn

    (@koenvn)

    Sorry to bother you again Mike, but for some reason I can’t get the URL working elsewhere on the thankyou page – although it shows the ordered products. Probably it is something stupid I’m forgetting or so – any help would be appreciated.

    What I’ve done so far:
    1. Made a copy of my thankyou.php in my child theme
    2. Included the following code at the place where I wanted it to show up:

    <?php
          if ( sizeof( $order->get_items() ) > 0 ) {
                 foreach( $order->get_items() as $item ) {
                }
            }
    ?>
    <?php
    if ( ! apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
    	return;    }
    
    $is_visible        = $product && $product->is_visible();
    $product_permalink = apply_filters( 'woocommerce_order_item_permalink', $is_visible ? $product->get_permalink( $item ) : '', $item, $order );
    echo apply_filters( 'woocommerce_order_item_name', $product_permalink ? sprintf( '<a href="%s">%s</a>', $product_permalink, $item['name'] ) : $item['name'], $item, $is_visible );
    
    ?>

    3. I know this is still the original edited (by you) echo as a test, but this is only showing the name of the product ordered and there is no link behind the product.
    In the end I only want to show the actual URL with a link of the same URL behind it, so probably like this:

    $product->get_permalink( $item ) : '', $item, $order );
    echo apply_filters( 'woocommerce_order_item_name', $product_permalink ? sprintf( '<a href="%s">%s</a>', $product_permalink, $product_permalink, $item, $is_visible );

    When I look in the source code it only returns the name of the product and not the etc. So the problem seems that I can’t get the URL to show up here.

    Thread Starter koenvn

    (@koenvn)

    You are awesome Mike, works like a charm!!!

    Another question, what would be the code (echo?) to just place this URL including variations somewhere in the order-received page (not sure yet where I want to place this information, but I’ll probably place it in any of those order templates).

    In order that the output (text) block will look something like

    Copy this URL in your Facebook Group:
    http://mydomain.nl/product/?attribute_color=black

    (Reason is, that with the typical social sharing plugins you can only post on your own timeline, while my product thrives when people post it in certain groups)

Viewing 13 replies - 1 through 13 (of 13 total)