Forum Replies Created

Viewing 15 replies - 31 through 45 (of 49 total)
  • Thread Starter John McCarthy

    (@john-lion)

    Hi ancawonka, wondered if you’d take a look at where I’m at?

    I’m sure you’re busy so if it seems like I’m lost then please just ignore me.

    I’ve spent pretty much the whole week in the class-wc-cart.php file and trying to figure out if I can save the required data to the cart. My conclusion so far is… I don’t think so, not in the way I want to.

    Now I’ve moved into simply setting my data to the WC session and retrieving it.

    Here’s a simplified version

    Template form

    <form name="checkout" method="post" class="checkout woocommerce-checkout" action="http://localhost:28/camplight.dev/checkout" enctype="multipart/form-data">
    
        <p class="form-row form-row woocommerce-validated" id="create_new_group_field">
    
            <label for="create_new_group" class="">Create a new group</label>
    
    	<input type="text" class="input-text " name="create_new_group" id="create_new_group" placeholder="" value="">
    
        </p>
    
        <input type="submit" class="button alt" name="" id="place_order" value="submit" data-value="submit" />
    
    </form>

    Functions

    /**
     * 1. Set and Save data to WooCommerce session
     */
    function set_and_save_input_to_session( $group_input_value ) {
    
    	// Test if we're in admin where WC()->session isn't set
    	if( !is_admin( ) ) {
    
    		// User input
    		$group_input_value =  $_POST['create_new_group']; 
    
    		// Set session and save data
    		WC()->session->set( 'group_order_data', $group_input_value );
    	}
    }
    add_action( 'woocommerce_checkout_process', 'set_and_save_input_to_session', 1, 1 );
    
    /**
     * 2. Retrieve and save data to order meta
     */
    function retrieve_and_save_group_input_value_to_order_meta( $retrived_group_input_value, $order_id ) {
    
    	// Get group_input_value
    	$retrived_group_input_value = WC()->session->get( 'name_for_your_data' );
    
    	update_post_meta( $order_id, '_create_new_group', $retrived_group_input_value ) );
    }
    add_action( 'woocommerce_checkout_update_order_meta', 'retrieve_and_save_group_input_value_to_order_meta', 10, 2 );

    I could be way off I know this, but, I really want to do this and do it right. What do think, am I close?

    Thread Starter John McCarthy

    (@john-lion)

    Thanks for the pointers there. I’d come to the same conclusions yesterday after a few attempts of possible solutions.

    I wasn’t very clued up on the checkout process or transients for that matter. I’ve wrapped my head around the concepts and looked deeper into how WC handles data.

    While I see transients as being a possible option, without actually knowing for sure, I feel that it’s too far removed from the WooCommerce process. Therefore I’ve started to investigate a solution using sessions.

    Seeing as WooCommerce creates a user session to hold cart data, I’m going to attempt saving my data in that same session, then save that data to the order in the checkout process.

    Thread Starter John McCarthy

    (@john-lion)

    @ancawonka – Welcome, I’m looking into a solution and will keep this post updated as I develop a solution.

    I’m currently looking into adding the additional details/meta to by creating a new page after the cart but before the checkout that contains a custom form which saves the data to the order meta.

    Will check back soon.

    Thread Starter John McCarthy

    (@john-lion)

    Thanks James,

    that’s where I would usually post it. Upon navigating to the usual forum there was a message that said if the question was about code as apposed to plugin support it’s recommended that I post here instead, maybe I’ve gotten that confused?

    I’ve re-posted in the usual forum now anyways.

    Thread Starter John McCarthy

    (@john-lion)

    Hi Otto,

    So looking through the code I’m not sure how useful it would be to you, so I’ll just give you the concept for now.

    I added two new fields to the WooCommerce checkout:
    1. Create new group
    2. Join existing group.

    Then upon user submission I checked values entered and saved the values to the post_mtea of the order:
    1. If the user wanted to “create new group” I checked to see if the group existed in the database already, if so throw an error if not save the group name to their order.
    2. If the user wanted to be added to “Join an existing group”; I checked to see if the group exists if it did I saved if not throw an error.

    This system gave us a simple meta value to export in our CSV that allowed us to group customers with the same group name together when out in the field setting up their tents.

    I’d be happy to go through any of this in more detail or working together on a better solution.

    Best,
    John

    Thread Starter John McCarthy

    (@john-lion)

    Hi Otto,

    We did solve it but right now I can’t remember exactly how. I’ll have to get to the code I developed and get back to you.

    I know that it was pretty rough from my skill level at the time so maybe we can improve it together.

    I’ll be in touch asap.

    Cheers

    I’ve had the same issue recently.

    I’ve tested on the following environment:

    WordPress 4.3.1
    WooCommerce 2.4.6
    StoreFront theme 1.5

    On a MAMP local install

    I’m using a child theme that has just an index.php, styles.css and functions.php. By a process of elimination I found that the function I was using to override the checkout fields was causing the error.

    add_filter( 'woocommerce_checkout_fields' , 'jmfe_override_checkout_fields' );
    /**
     * Remove Checkout Fields
     * @since 0.0.1
     * @return void
     */
    function jmfe_override_checkout_fields( $fields ) {
    	unset($fields['billing']['billing_country']);
    	unset($fields['billing']['billing_company']);
    
        return $fields;
    }

    Is it possible that this function is causing the problem or could it still be something else?

    Thread Starter John McCarthy

    (@john-lion)

    Heading there now 🙂

    Thread Starter John McCarthy

    (@john-lion)

    Really cool Nate, thanks for letting me know.

    Another thank you for the great plugin, as designer and part developer it’s very refreshing to use the plugin. I’ve used similar solutions and even built one just to have the basic functionality and transparency needed.

    All the best mate.

    Thread Starter John McCarthy

    (@john-lion)

    To add to my previous post.

    I’ve tested multiple examples, including the gist example provided. Having no ‘box’ seems to be the only way of hooking the metabox to a new position.

    Is this something known, or am I wrong in my implementation?

    Thread Starter John McCarthy

    (@john-lion)

    Thanks for filling me in on that one Justin I didn’t know this was added to core, that’s great news!

    I’m somewhat the way there. When removing the title argument the metabox appears where I want it. But I don’t want to remove the Metabox wrap. So, when leaving the title intact, I get a Metabox where I’ve hooked it in, but it’s repeated in a default location too.

    Here’s a gist of the code I’m using

    Can you see a fault with my implementation?

    Thread Starter John McCarthy

    (@john-lion)

    Hi Hal, thanks for chiming in. It only didn’t work on my local install, but did work in the local install if I was in the theme customizer. Now the site is online, the same exact code and database the rotator works no issues.

    Here’s the site live http://www.fitz.johnmccarthy.co/

    But of course this is working with no problems, just the local. I’ll likely be using the plug-in again over the next week on a new local project. I’ll post any results here.

    Thanks again.

    Thread Starter John McCarthy

    (@john-lion)

    Thanks for your input Chris.

    Yeah dev tools was open, no errors and only one slide loading outside of the customizer.looking at the console log you could see that the javascript was working fine, reporting my mouse hover and pausing and replaying.

    I carried on developing and assumed that it would work when I went to a staging version. It did. For now my only conculusion is that browsersync was something to do with invrestigate. I’ve just switched from live-reload and didn’t experience problems before, but I haven’t yet had the time to properly invrestigate.

    Any thoughts on this?

    Just to add to this, on further inspection It seems as though there are two slides but the both are the same i.e. slide-1 and another slide-1 rather than slide-1 and slide-2.

    Hi Hal, Thanks creating and sharing this plug-in.

    I’ve used it a few times now and it’s been great. Today I’m adding the rotator to a front-page.php template. With the code below.

    function source_front_page_reviews() {
    
    	$review_rotator = do_shortcode('[testimonial_rotator id=27]');
    
    	echo '<section class="review_wap-home"><div class="wrap">' . $review_rotator . '</div></section>';
    }
    add_action( 'source_reviews_section', 'source_front_page_reviews' );

    The rotator shows as expected but the rotation doesn’t work, automatically or via click. I’ve tried adding the rotator in various ways for example.

    echo do_shortcode('[testimonial_rotator id=27]');

    But that still results in non moving rotator. Can you assist?

Viewing 15 replies - 31 through 45 (of 49 total)