Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • I know this is an old thread, but I did come up with a workaround for this. I don’t know of a way to add it to the default woocommerce order complete email, but you can easily add it as an order note that the customer can see from the my account -> view order page, and they will also get an email.

    So what ends up happening, is a customer places an order, easypost updates that order with an order note, and the customer gets two emails: one confirming their order, and one notifying them that a note has been added to their order, which will show their tracking number.

    Add this code to easypost_shipping.php after shipment->buy

    $order->add_order_note(sprintf("Track Your Package: '%s'", $shipment->tracking_code), 1);

    Hi, I know I’m posting to an old thread, but this was pretty helpful when figuring out how to tack a similar issue. I needed the taxonomy lists to show up on separate pages because they were going to be so long. Each letter containing a minimum of 50 terms.

    I think, however, that creating a page template for 26 letters is a little tedious.

    So I decided to go the form route. Here is what I did:

    Make a form that posts to the current page:

    Make a form that posts to current page.
    
    <p>Browse Categories Alphabetically</p>
    <form action='#' method='post' name='form_filter' class="region">
    	<select name="alphabet">
    		<option value="A">A</option>
    		<option value="B">B</option>
    		<option value="C">C</option>
    		<option value="D">D</option>
    		<option value="E">E</option>
    		<option value="F">F</option>
    		<option value="G">G</option>
    		<option value="H">H</option>
    		<option value="I">I</option>
    		<option value="J">J</option>
    		<option value="K">K</option>
    		<option value="L">L</option>
    		<option value="M">M</option>
    		<option value="N">N</option>
    		<option value="O">O</option>
    		<option value="P">P</option>
    		<option value="Q">Q</option>
    		<option value="R">R</option>
    		<option value="S">S</option>
    		<option value="T">T</option>
    		<option value="U">U</option>
    		<option value="V">V</option>
    		<option value="W">W</option>
    		<option value="X">X</option>
    		<option value="Y">Y</option>
    		<option value="Z">Z</option>
    	</select>
    	<input type="submit" value="Filter">
    </form>

    Write code to generate terms dynamically based on form selection:

    <?php
    $alphabet = $_POST['alphabet'];
    if (isset($alphabet)) {
    $terms = get_terms("directory_cat");
    $count = count($terms);
    $letter = $alphabet;
    	if ( $count > 0 ){
    	$ul = "<ul>";
    		foreach ( $terms as $term ) {
    			if ( preg_match("/^$letter/i",$term->name) ) {
    				echo $ul;
    				$ul = '';  // only display once
    				echo '<li><a href="' . get_term_link($term) . '">'. $term->name . '</a></li>';
    			}
    		}
    		if ( $ul == '') {
    		echo "</ul>";
    		}
    	}
    } else {
    $terms = get_terms("directory_cat");
    $count = count($terms);
    $letter = 'A';
    	if ( $count > 0 ){
    	$ul = "<ul>";
    		foreach ( $terms as $term ) {
    			if ( preg_match("/^$letter/i",$term->name) ) {
    				echo $ul;
    				$ul = '';  // only display once
    				echo '<li><a href="' . get_term_link($term) . '">'. $term->name . '</a></li>';
    			}
    		}
    		if ( $ul == '') {
    		echo "</ul>";
    		}
    	}
    }
    ?>

    One template. One piece of code. DONE.

    Thanks for the help, I hope this post makes someone else’s life mildly less tedious :p

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