PHP code example of thelia / delivery-exclude-date-module

1. Go to this page and download the library: Download thelia/delivery-exclude-date-module library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thelia / delivery-exclude-date-module example snippets


    $event = new DateIsAvailableEvent(new \DateTime('2015-09-09'));

    $this->getDispatcher()->dispatch(
        DeliveryExcludeDateEvents::DATE_IS_AVAILABLE,
        $event
    );

    if ($event->getIsAvailable()) {
        // date is available
    } else {
        // date is not available
    }

    $date1 = new \DateTime('2015-09-09');
    $date2 = new \DateTime('2015-10-09');
    $date3 = new \DateTime('2015-11-09');

    $event = new DatesIsAvailableEvent(array($date1, $date2, $date3));

    $this->getDispatcher()->dispatch(
        DeliveryExcludeDateEvents::DATES_IS_AVAILABLE,
        $event
    );

    if ($event->getIsAvailable($date1)) {
        // date 1 is available
    } else {
        // date 1 is not available
    }

    if ($event->getIsAvailable($date2)) {
        // date 1 is available
    } else {
        // date 1 is not available
    }

    if ($event->getIsAvailable($date3)) {
        // date 1 is available
    } else {
        // date 1 is not available
    }