Results 1 to 10 of 544

Hybrid View

  1. #1
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Order Delivery Date Support Thread

    Looking at it again, in first "chunk"
    this:
    Code:
        if (!isset($_SESSION['sendto']) return true;
    is missing a closing paranthesis:
    Code:
        if (!isset($_SESSION['sendto'])) return true;
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #2
    Join Date
    Dec 2008
    Posts
    15
    Plugin Contributions
    0

    Default Re: Order Delivery Date Support Thread

    Thanks again! I added the parenthesis and tested the site at every "chunk" edit. The site is working with no issues now. However, the delivery date picker is still showing up even though I've selected an overseas address.

    Is there some part of the code for the observer file that I'm not editing right? So far I've just cut and pasted wholesale.

    Quote Originally Posted by mc12345678 View Post
    Looking at it again, in first "chunk"
    this:
    Code:
        if (!isset($_SESSION['sendto']) return true;
    is missing a closing paranthesis:
    Code:
        if (!isset($_SESSION['sendto'])) return true;

  3. #3
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Order Delivery Date Support Thread

    Audrey,

    Okay, had a chance to look this over and try to use it. As said it was untested. There were parts that worked, and parts that did not... For example, if the location were set to national and an international address were chosen, then the customer would not be able to check out and would be stuck in a loop. That has been corrected in the following commit that incorporates this entire concept.

    Note, it defaults to accept the date from both national and international, then if one of those is chosen, the date box is defaulted to display always. To change either/both of these settings such that the date box only displays for orders that really need them, modify the settings in the includes/extra_datafiles/order_delivery_date_location.php file.

    https://github.com/mc12345678/order-.../tree/locality

    The specific commit where the changes are shown is: https://github.com/mc12345678/order-...35349c8124621b
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Dec 2008
    Posts
    15
    Plugin Contributions
    0

    Default Re: Order Delivery Date Support Thread

    Ok, I think that flew right over my head. But thank you MC12345678 for taking the time to walk me through this. I'll try my best to follow. Really appreciate your time!

  5. #5
    Join Date
    Dec 2008
    Posts
    15
    Plugin Contributions
    0

    Default Re: Order Delivery Date Support Thread

    Ok wow, I can't believe how easy your instructions were. I followed it to a T and the mod is working beautifully now. Thank you so much :)

    For those looking to have the Delivery Date Picker show up only for local orders and not international orders, and if you have been following the thread, all I had to do was:

    (1) edit the file -----> includes/extra_datafiles/order_delivery_date_location.php
    with this define set to "national" instead of "both". like this:

    Code:
    <?php
    /**
     * This file contains the definition for when to display the order delivery date field based on the shipping destination.
     **/
    define('ORDER_DELIVERY_DATE_LOCATION', 'national'); // values are 'national', 'international', or 'both'
    (2) THEN, make the changes to the file -----> includes/classes/observers/auto.order_delivery_date_observer.php
    with the new edits in this link ------> https://github.com/mc12345678/order-...35349c8124621b

    Psyched that this worked out. Thank you again MC12345678!
    Last edited by audrey; 29 Jan 2018 at 05:18 PM.

  6. #6
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Order Delivery Date Support Thread

    Glad that worked out for you. It was an interesting issue to try to address, required some reworking of the code to be able to detect the delivery address.

    Note: a separate setting to consider and to achieve the goal of item 1 above (or to always display the field) is that within the same file there is an additional define that should be considered. As provided it defaults to false, but if set to true then it would always display the field:
    Code:
    define('ORDER_DELIVERY_DATE_DISPLAY_ALWAYS', 'false');
    Now though I just realized an additional "arrangement" of options. The text indicating that the delivery date for a national delivery is required but is optional for an international delivery. The code (checkout process) already operates in this manner, but the displayed text does not.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Dec 2008
    Posts
    15
    Plugin Contributions
    0

    Default Re: Order Delivery Date Support Thread

    Do you mean the text that is actually displayed on the website? I had no issue with that at all following the above.

    In fact, I went a step further and applied the code you gave (below) for the template files to :

    includes/templates/YOUR_TEMPLATE/templates/tpl_checkout_shipping_confirmation.php

    just so it doesn't pop up there as well and confuse the customer, being that they did not get the chance to select a date in the checkout payment step.

    Code:
    <!-- Bof Order Delivery Date -->
    <?php if (isset($display_delivery_date) ? $display_delivery_date : true) { ?>
    <fieldset class="shipping" id="order_delivery_date">
    <legend><?php echo sprintf(TABLE_HEADING_DELIVERY_DATE,  (defined('MIN_DISPLAY_DELIVERY_DATE') &&  MIN_DISPLAY_DELIVERY_DATE > 0) ?  TABLE_HEADING_DELIVERY_DATE_IS_REQUIRED :  TABLE_HEADING_DELIVERY_DATE_IS_OPTIONAL); ?></legend>
    
    <label for="order_delivery_date">Date:</label>
    <input id="date" name="order_delivery_date" type="text" value="<?php echo $order_delivery_date; ?>">
    </fieldset>
    <?php } ?>
    <!-- Eof Order Delivery Date -->
    As for this below, I omitted it and the mod still achieves the intended outcome. It's a safeguard I suppose and handy to have if you want to always have it on/off. How interesting!

    Code:
    define('ORDER_DELIVERY_DATE_DISPLAY_ALWAYS', 'false');

  8. #8
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Order Delivery Date Support Thread

    Thank you for pointing out that part as well, will update the code accordingly.

    You wouldn't have seen the issue I described based on your desired usage. The text display issue to which I was referring would be seen in the following "complex" condition:
    Location to require entry set to something other than both.
    Display of the field set to always (true).
    The order_delivery_date identified as required (configuration->minimums area with a non-zero value)
    And the purchaser having entered a shipto address that is opposite of the location setting.

    When the checkout_shipping page is displayed, the text "above" the date field would be displayed as required, but the user could click through without entering anything because the existing internal checkout logic doesn't require the date to be entered for that condition.

    The text should actually display as the date being optional at that point.

    So instead of this logic:
    Code:
    defined('MIN_DISPLAY_DELIVERY_DATE') &&  MIN_DISPLAY_DELIVERY_DATE > 0) ?  TABLE_HEADING_DELIVERY_DATE_IS_REQUIRED :  TABLE_HEADING_DELIVERY_DATE_IS_OPTIONAL
    It would be:
    Code:
    defined('MIN_DISPLAY_DELIVERY_DATE') &&  MIN_DISPLAY_DELIVERY_DATE > 0 && (method_exists($zcObserverOrderDeliveryDateObserver, 'display_delivery_date') ? $zcObserverOrderDeliveryDateObserver->display_delivery_date($order) : true)) ?  TABLE_HEADING_DELIVERY_DATE_IS_REQUIRED :  TABLE_HEADING_DELIVERY_DATE_IS_OPTIONAL
    The addition, bolded above, will toggle the required to optional text in the condition described above.

    Ideally, perhaps an additional function would be added to the code to identify that the date is required as compared to optional considering that logic is basically used in more than one place (internal to the observer and then in the template files).

    On some other things, I see that the branch I set aside for this functionality did not end up with all of the code and that your previous post addressed that by reference to the other commit where the additional code ended up. I'm working to correct that issue and to have all of the added functionality to support this in one commit instead of spread out. I didn't see the template file that was specifically referenced, but am thinking that it was intended to be the checkout_confirmation not the checkout_shipping_confirmation page. Need to look a little further, but makes me wonder if anything further downstram needs to be modified such as the email, the admin orders, etc... I thought though that there was enough present to allow end user/installer to modify the output relatively consistently.

    Btw, since I started writing this, I have updated the locality branch to incorporate the required/optional swap and properly pulled in the display_delivery_date function that accidentally was captured in a later commit instead of where it should have been.

    Unfortunately, with the complexity that this module is beginning to have, it is almost as if a separate configuration area may be necessary to support the additional features which may not be a bad thing considering it would then make it easier to modify the operation of the script when/where it is used. Especially if the previously posted method of incorporating a time option is used (instead of using a script based method of incorporating a time picker.)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. order delivery date addon - date not showing in checkout
    By jagall in forum Addon Shipping Modules
    Replies: 4
    Last Post: 19 Oct 2017, 09:09 PM
  2. JK Order Exporter - Support Thread
    By eVelt in forum All Other Contributions/Addons
    Replies: 4
    Last Post: 26 Sep 2015, 07:06 AM
  3. v151 Order Delivery date on Product Info Page
    By nicksab in forum General Questions
    Replies: 0
    Last Post: 30 Dec 2013, 03:23 AM
  4. Support Thread for JS Date Picker for options
    By eVelt in forum All Other Contributions/Addons
    Replies: 17
    Last Post: 5 Dec 2013, 05:44 AM
  5. Order Delivery Date Mod
    By fagriffin in forum Addon Shipping Modules
    Replies: 1
    Last Post: 11 Oct 2008, 04:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg