Forum Replies Created

Viewing 15 replies - 1 through 15 (of 31 total)
  • I have developed some code for a similar purpose for a client. Basically, the idea is to give a choice of dates for the customer to choose in the checkout and then display it in admin Orders and optionally send the delivery date to customer by email. Here is the snippet…

    /**
     * Add the field to the checkout
     **/
    add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');
    
    function my_custom_checkout_field( $checkout ) {
    
        echo '<div id="my_custom_checkout_field"><h2>'.__('Get delivered by').'</h2>';
    
        woocommerce_form_field( 'my_field_name', array(
            'type'          => 'select',
            'class'         => array('my-field-class form-row-wide'),
            'label'         => __('Select a date'),
            'placeholder'       => __('Select a date'),
            'options'     => array(
                '29-May-2021' => '29-May-2021',	
                '29-June-2021' => '29-June-2021'
            )
            ), $checkout->get_value( 'my_field_name' ));
    
        echo '</div>';
    
    }
    
    /**
     * Update the order meta with field value
     **/
    
    add_action('woocommerce_checkout_update_order_meta', 'my_custom_checkout_field_update_order_meta');
    
    function my_custom_checkout_field_update_order_meta( $order_id ) {
        if ($_POST['my_field_name']) update_post_meta( $order_id, 'Get delivered by', esc_attr($_POST['my_field_name']));
    }
    
    /**
     * Display field value on the order edition page
     **/
    add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 );
    
    function my_custom_checkout_field_display_admin_order_meta($order){
        echo '<p><strong>'.__('Get delivered by ').':</strong> ' .get_post_meta( $order->id, 'Get delivered by', true ) .'</p>';
    }
    
    /**
     * Add a custom field (in an order) to the emails
     */
     
    add_filter( 'woocommerce_email_order_meta_fields', 'my_woocommerce_email_order_meta_fields', 10, 3 );
    
    function my_woocommerce_email_order_meta_fields( $fields, $sent_to_admin, $order ) {
        $fields['Get delivered by'] = array(
            'label' => __( 'Get delivered by' ),
            'value' => get_post_meta( $order->id, 'Get delivered by', true ),
        );
        return $fields;
    }

    Put this code in functions.php file and you can customise this to suit to your needs. Hope you will find it useful.

    For selling a product only between specific dates, you can try WPC Product Timer for WooCommerce plugin https://www.ads-software.com/plugins/woo-product-timer/

    For delivering on a single specific date, you can simply specify it in the product description or on the checkout page. For giving customers the option to choose delivery dates, you can try this plugin: https://www.ads-software.com/plugins/order-delivery-date-for-woocommerce/

    Your site might have likely been compromised by malware. I do not see $mtchs variable in the original core file of wp-includes/functions.php on line 52.

    The original file should look something like this: https://github.com/WordPress/WordPress/blob/master/wp-includes/functions.php

    If it is not, then chances are malware has entered your files. You need to clean them up.

    Thread Starter knaveenchand

    (@knaveenchand)

    Thanks for the code, Alex. I wrote a sql query that generates random quiz id for user that has not attempted yet. Here is the code:

    SELECT t1.quizID
    FROM wp_AI_Quiz_tblQuizzes t1
    LEFT JOIN (SELECT * FROM wp_AI_Quiz_tblQuizAttempts t2 WHERE t2.username = 'admin') t3 ON t3.quizID = t1.quizID
    WHERE t3.quizID IS NULL
    ORDER BY RANd()
    LIMIT 1

    This is working on phpmyadmin. Do you think this is also a correct approach? If so, I can use this directly on my page template as a variable that I can pass on to your Quiz ID shortcode. Am I doing it right?

    Thread Starter knaveenchand

    (@knaveenchand)

    Brilliant advice. It just works fine now. thanks a ton.

    Thread Starter knaveenchand

    (@knaveenchand)

    Hi Carolina,

    I am using Chrome browser and I have setup a menu and linked it to the primary menu in the top. All top-level menu items appear and function correctly but the child menu items appear on hovering on their parent item but they disappear immediately when we move our cursor to them. You can try creating sub pages or create a non-clickable item in the parent and put several categories under that.

    The problem seems to be with the logo block (the special cloud for the logo). The moment i removed this piece of code, and replaced with my own code for the logo, the menu items and child items were working properly.

    I replaced this code:

    <div id="header">
    	<div id="header-menu" class="menu-background" role="navigation"><?php wp_nav_menu( array( 'theme_location' => 'header' ) ); ?></div>
    	<div class="logo"><img src="<?php echo get_template_directory_uri()?>/images/cloud-large.png" height="146px" width="316px" alt="<?php wp_title( '|', true, 'right' ); ?>" /></div>
    	<h1 class="site-title" id="headline"><?php bloginfo( 'name' ); ?></h1>
    	<h2 class="site-description" id="tagline"><?php bloginfo( 'description' ); ?></h2>
    </div>

    with my own code:

    <div id="header-menu" class="menu-background" role="navigation"><?php wp_nav_menu( array( 'theme_location' => 'header' ) ); ?>
    </div>
    <div style="font-family:garamond;font-size:60px;color:white;width:100%;text-align:center;font-weight: bold;text-shadow: 2px 2px gray;">Super Kids Chess Academy</div>
    
    <div style="font-family:garamond;font-size:30px;color:white;width:100%;text-align:center;">Sharpening the Minds</div>
    </div>

    Thread Starter knaveenchand

    (@knaveenchand)

    Thanks for your answer, Angelo. I have not tried your solution as I do not want to change the url structure. We have the .html links across all our pages and we do not want to lose the SEO we developed with the urls. Can there be any other way to do this?

    My suspicion is … there are two events on that particular day and that is why it is throwing up wrong url. If there is one single event for that day, there are no errors.

    Could this be the reason?

    Thread Starter knaveenchand

    (@knaveenchand)

    @anmari

    Thanks for the response. For now, I have custom generated the event list using event manager plugin itself. Nevertheless, I have used the code you supplied on my demo site and its working well. The error message disappeared after replacing the code.

    Thanks,
    Naveen

    Thread Starter knaveenchand

    (@knaveenchand)

    @takashi

    Although delayed, I thank you for your response.

    As I could not solve it, I have moved on with another theme. However, your response might be useful for someone facing similar problem with Sunspot theme.

    Thanks.

    I faced this issue of “Location Not Found” when I changed the site url with the same database. My workaround was to Open the Location, Save it again and then go the events and select the correct location and Save the Event again. This resolved “Location Not Found” for me.

    Thread Starter knaveenchand

    (@knaveenchand)

    No buddy. The only workaround was to use a non-ajax based links that I added using menus. Here is the site: https://danapredict.com/groups

    It appears that its a bug in the buddypress.

    Thread Starter knaveenchand

    (@knaveenchand)

    It is still not fixed with 1.2.4 version of SEOPress.

    I have upgraded to 1.2.4 and activated it again but no luck. The site title and description continues to disappear whenever I activate SEOPress plugin. And when I deactivate this plugin, the site title and description appears normally.

    I am using buddypress default theme with latest buddypress plugin and latest wordpress version.

    Please help.

    I am also facing similar problem. I am using Twenty Eleven, the site works well in ie8, ie9. But in ie7, the content doesnt show up. Only the header, sidebar and footer showup correctly. The page content is simply blank. How can I fix it?

    @unstill: I have just checked your site in document mode: ie7 standards using developer tools. You still seem to have problem. The page content doesnt show up even in your case. Were you able to solve?

    Hi. I am also facing similar problem. But in my case I am not using sub-domains. My site structure is like this;

    restaurant.com/restaurant1
    restuarant.com/restaurant2

    Do I still have to create new domains in restaurant.com’s cpanel?

    I’ve created A record in restaurant1.com but the pageok error is coming. By the way, i have also created CNAME record for restaurant1.com pointing to restaurant.com.

    How do I troubleshoot this problem of “pageok” error?

    This is the css you need to edit:

    body {
    background-image:url(https://your-website.com/wp-content/uploads/your-image.png);
    background-repeat:repeat-x;
    }

    Two things:

    1. Try to give complete path of the image inside the bracket. if you have uploaded to your uploads folder, you can also see the path when you click on EDIT in your Media.
    2. Secondly, try to remove background-repeat:repeat-x; if you don’t want your background to repeat.

    Hope this helps.

Viewing 15 replies - 1 through 15 (of 31 total)