Example #1
0
   ' . TABLE_PRODUCT_STORAGE_TYPES . '.storage_type,
   ' . TABLE_PRODUCT_STORAGE_TYPES . '.storage_code,
   ' . TABLE_MEMBER . '.auth_type,
   FLOOR(' . TABLE_INVENTORY . '.quantity / ' . NEW_TABLE_PRODUCTS . '.inventory_pull) AS inventory_quantity,
   ' . NEW_TABLE_BASKET_ITEMS . '.total_weight,
   ' . NEW_TABLE_PRODUCTS . '.product_fee_percent,
   ' . TABLE_SUBCATEGORY . '.subcategory_fee_percent,
   ' . TABLE_PRODUCER . '.producer_fee_percent,
   ' . NEW_TABLE_BASKET_ITEMS . '.out_of_stock,
   ' . NEW_TABLE_BASKET_ITEMS . '.quantity AS basket_quantity,
   (SELECT GROUP_CONCAT(site_id) FROM ' . TABLE_AVAILABILITY . ' WHERE ' . TABLE_AVAILABILITY . '.producer_id=' . NEW_TABLE_PRODUCTS . '.producer_id) AS availability_list,
   ' . NEW_TABLE_MESSAGES . '.message
 FROM
   (' . NEW_TABLE_PRODUCTS . ',
   ' . TABLE_MEMBER . ')
 LEFT JOIN ' . TABLE_PRODUCER . ' ON ' . TABLE_PRODUCER . '.producer_id = ' . NEW_TABLE_PRODUCTS . '.producer_id
 LEFT JOIN ' . TABLE_SUBCATEGORY . ' ON ' . TABLE_SUBCATEGORY . '.subcategory_id = ' . NEW_TABLE_PRODUCTS . '.subcategory_id
 LEFT JOIN ' . TABLE_CATEGORY . ' ON ' . TABLE_CATEGORY . '.category_id = ' . TABLE_SUBCATEGORY . '.category_id
 LEFT JOIN ' . TABLE_PRODUCT_TYPES . ' ON ' . TABLE_PRODUCT_TYPES . '.production_type_id = ' . NEW_TABLE_PRODUCTS . '.production_type_id
 LEFT JOIN ' . TABLE_AVAILABILITY . ' ON ' . TABLE_AVAILABILITY . '.producer_id = ' . TABLE_PRODUCER . '.producer_id
 LEFT JOIN ' . TABLE_INVENTORY . ' ON ' . NEW_TABLE_PRODUCTS . '.inventory_id = ' . TABLE_INVENTORY . '.inventory_id
 LEFT JOIN ' . TABLE_PRODUCT_STORAGE_TYPES . ' ON ' . NEW_TABLE_PRODUCTS . '.storage_id = ' . TABLE_PRODUCT_STORAGE_TYPES . '.storage_id
 LEFT JOIN ' . NEW_TABLE_BASKET_ITEMS . ' ON
   (' . NEW_TABLE_BASKET_ITEMS . '.product_id = ' . NEW_TABLE_PRODUCTS . '.product_id
   AND ' . NEW_TABLE_BASKET_ITEMS . '.basket_id = "' . mysql_real_escape_string(CurrentBasket::basket_id()) . '"
   AND ' . NEW_TABLE_BASKET_ITEMS . '.basket_id > 0)
 LEFT JOIN ' . NEW_TABLE_MESSAGES . ' ON (referenced_key1 = bpid AND message_type_id =
   (SELECT message_type_id FROM ' . NEW_TABLE_MESSAGE_TYPES . ' WHERE description = "customer notes to producer"))
 WHERE' . $where_producer_pending . $where_unlisted_producer . $where_misc . $where_zero_inventory . $where_confirmed . $where_auth . '
 GROUP BY CONCAT(' . NEW_TABLE_PRODUCTS . '.product_id, "-", ' . NEW_TABLE_PRODUCTS . '.product_version)
 ORDER BY' . $order_by;
Example #2
0
// Assign template file
$template_type = 'producer_list';
// Execute the main product_list query
$query = '
  SELECT
    SQL_CALC_FOUND_ROWS
    ' . NEW_TABLE_PRODUCTS . '.*,
    ' . TABLE_CATEGORY . '.*,
    ' . TABLE_SUBCATEGORY . '.*,
    ' . TABLE_PRODUCER . '.producer_id,
    ' . TABLE_PRODUCER . '.business_name AS producer_name,
    ' . TABLE_PRODUCER . '.producer_fee_percent,
    ' . TABLE_PRODUCT_TYPES . '.prodtype,
    ' . TABLE_PRODUCT_STORAGE_TYPES . '.*,
    FLOOR(' . TABLE_INVENTORY . '.quantity / ' . NEW_TABLE_PRODUCTS . '.inventory_pull) AS inventory_quantity,
    ' . NEW_TABLE_BASKET_ITEMS . '.quantity AS basket_quantity,
    (SELECT GROUP_CONCAT(site_id) FROM ' . TABLE_AVAILABILITY . ' WHERE ' . TABLE_AVAILABILITY . '.producer_id=' . NEW_TABLE_PRODUCTS . '.producer_id) AS availability_list
    /* GROUP_CONCAT(CONCAT_WS(",", ' . TABLE_AVAILABILITY . '.site_id)) AS availability_list */
  FROM
    ' . NEW_TABLE_PRODUCTS . '
  LEFT JOIN ' . TABLE_PRODUCER . ' ON ' . TABLE_PRODUCER . '.producer_id = ' . NEW_TABLE_PRODUCTS . '.producer_id
  LEFT JOIN ' . TABLE_SUBCATEGORY . ' ON ' . TABLE_SUBCATEGORY . '.subcategory_id = ' . NEW_TABLE_PRODUCTS . '.subcategory_id
  LEFT JOIN ' . TABLE_CATEGORY . ' ON ' . TABLE_CATEGORY . '.category_id = ' . TABLE_SUBCATEGORY . '.category_id
  LEFT JOIN ' . TABLE_PRODUCT_TYPES . ' ON ' . TABLE_PRODUCT_TYPES . '.production_type_id = ' . NEW_TABLE_PRODUCTS . '.production_type_id
  LEFT JOIN ' . TABLE_AVAILABILITY . ' ON ' . TABLE_AVAILABILITY . '.producer_id = ' . TABLE_PRODUCER . '.producer_id
  LEFT JOIN ' . TABLE_INVENTORY . ' ON ' . NEW_TABLE_PRODUCTS . '.inventory_id = ' . TABLE_INVENTORY . '.inventory_id
  LEFT JOIN ' . TABLE_PRODUCT_STORAGE_TYPES . ' ON ' . NEW_TABLE_PRODUCTS . '.storage_id = ' . TABLE_PRODUCT_STORAGE_TYPES . '.storage_id
  LEFT JOIN ' . NEW_TABLE_BASKET_ITEMS . ' ON ' . NEW_TABLE_BASKET_ITEMS . '.product_id = ' . NEW_TABLE_PRODUCTS . '.product_id AND ' . NEW_TABLE_BASKET_ITEMS . '.basket_id = "' . mysql_real_escape_string(CurrentBasket::basket_id()) . '"
  WHERE' . $where_producer_pending . $where_misc . $where_zero_inventory . $where_confirmed . $where_auth_type . '
  GROUP BY CONCAT(' . NEW_TABLE_PRODUCTS . '.product_id, "-", ' . NEW_TABLE_PRODUCTS . '.product_version)
  ORDER BY' . $order_by;
function get_baskets_list()
{
    global $connection;
    // Get a list of the order cycles since the member joined
    $delivery_id_array = array();
    $delivery_attrib = array();
    $query = '
      SELECT 
        delivery_id,
        date_open,
        date_closed,
        order_fill_deadline,
        delivery_date
      FROM
        ' . TABLE_ORDER_CYCLES . '
      WHERE
        delivery_date > "' . mysql_real_escape_string($_SESSION['renewal_info']['membership_date']) . '"
        AND date_open < NOW()
      ORDER BY
        delivery_date DESC';
    $result = @mysql_query($query, $connection) or die(debug_print("ERROR: 898034 ", array($query, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
    while ($row = mysql_fetch_array($result)) {
        array_push($delivery_id_array, $row['delivery_id']);
        $delivery_attrib[$row['delivery_id']]['date_open'] = $row['date_open'];
        $delivery_attrib[$row['delivery_id']]['time_open'] = strtotime($row['date_open']);
        $delivery_attrib[$row['delivery_id']]['date_closed'] = $row['date_closed'];
        $delivery_attrib[$row['delivery_id']]['time_closed'] = strtotime($row['date_closed']);
        $delivery_attrib[$row['delivery_id']]['order_fill_deadline'] = $row['order_fill_deadline'];
        $delivery_attrib[$row['delivery_id']]['delivery_date'] = $row['delivery_date'];
    }
    // Now get this customer's baskets
    $query = '
      SELECT 
        *
      FROM
        ' . NEW_TABLE_BASKETS . '
      WHERE
        member_id = "' . mysql_real_escape_string($_SESSION['member_id']) . '"
      ORDER BY
        delivery_id DESC';
    $result = @mysql_query($query, $connection) or die(debug_print("ERROR: 898034 ", array($query, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
    while ($row = mysql_fetch_array($result)) {
        $delivery_attrib[$row['delivery_id']]['basket_id'] = $row['basket_id'];
        $delivery_attrib[$row['delivery_id']]['site_id'] = $row['site_id'];
        $delivery_attrib[$row['delivery_id']]['delivery_type'] = $row['delivery_type'];
        $delivery_attrib[$row['delivery_id']]['checked_out'] = $row['checked_out'];
    }
    // Display the order cycles and baskets...
    $display .= '
        <div id="basket_dropdown" class="dropdown">
          <a href="' . $_SERVER['SCRIPT_NAME'] . '?action=basket_list_only"><h1 class="basket_history">
            Ordering History
          </h1></a>
          <div id="basket_history">
            <ul class="basket_history">';
    foreach ($delivery_id_array as $delivery_id) {
        $full_empty = '';
        $open_closed = '';
        $future_past = '';
        // Check if basket for the delivery had any items...
        if ($delivery_attrib[$delivery_id]['checked_out'] != 0) {
            $fe = 'f';
            // full
            $full_empty = 'full';
        } else {
            $fe = 'e';
            // empty
            $full_empty = 'empty';
        }
        // Check if this basket is currently open...
        if ($delivery_attrib[$delivery_id]['time_open'] < time() && $delivery_attrib[$delivery_id]['time_closed'] > time()) {
            $cg = 'c';
            // colored
            $current = true;
            // Start the after_current counter
            $open_closed = 'open';
            $after_current_count = 1;
        } else {
            $cg = 'g';
            // grey
            $open_closed = 'closed';
        }
        // Check if this is a future delivery...
        if ($delivery_attrib[$delivery_id]['time_open'] > time()) {
            $is = 'i';
            // insubstantial
            $cg = 'c';
            // colored
            $current = false;
            $after_current_count++;
            $future_past = 'future';
        } else {
            $is = 's';
            // substantial
            $future_past = 'past';
        }
        $day_open = date('j', $delivery_attrib[$delivery_id]['time_open']);
        $month_open = date('M', $delivery_attrib[$delivery_id]['time_open']);
        $year_open = date('Y', $delivery_attrib[$delivery_id]['time_open']);
        $day_closed = date('j', $delivery_attrib[$delivery_id]['time_closed']);
        $month_closed = date('M', $delivery_attrib[$delivery_id]['time_closed']);
        $year_closed = date('Y', $delivery_attrib[$delivery_id]['time_closed']);
        if ($day_open == $day_closed) {
            $day_open = '';
        }
        if ($month_open == $month_closed) {
            $month_closed = '';
        }
        if ($year_open == $year_closed) {
            $year_open = '';
        }
        $items_in_basket = abs($delivery_attrib[$delivery_id]['checked_out']);
        $current_link = '';
        // Process basket quantity display
        if ($future_past != 'future') {
            if ($items_in_basket) {
                $basket_quantity_text = '[' . $items_in_basket . ' ' . Inflect::pluralize_if($items_in_basket, 'item') . ']';
                $current_link = 'View
                  <a href="product_list.php?type=basket&delivery_id=' . $delivery_id . '">Basket</a> /
                  <a href="show_report.php?type=customer_invoice&delivery_id=' . $delivery_id . '">Invoice</a>';
            } else {
                $basket_quantity_text = '[Empty]';
            }
        }
        // Current order... set link for opening or checking basket
        if ($open_closed == 'open') {
            // Basket does not exist?
            if (!$delivery_attrib[$delivery_id]['basket_id']) {
                $current_link = '
                  <!-- <a href="">Start an Order</a> -->';
            } else {
                $current_link = 'View...
                  <a href="product_list.php?type=basket&delivery_id=' . $delivery_id . '">Basket</a>';
            }
            $basket_quantity_text = '';
        }
        if ($after_current_count <= 2) {
            // Need some onclick code for class=view (full baskets)
            $display .= '
              <li class="' . $fe . $cg . $is . ($full_empty == 'full' || $current == 'true' ? ' view' : '') . '"' . ($open_closed == 'open' ? ' id="current"' : '') . '>
                <span class="delivery_date">Delivery: ' . date('M j, Y', strtotime($delivery_attrib[$delivery_id]['delivery_date'])) . '</span>' . (CurrentBasket::basket_id() && $current == 'true' ? '
                  <span class="basket_link"><a href="product_list.php?type=basket&delivery_id=' . $delivery_id . '">Basket</a></span>
                   &bull; <!--
                   <span class="accounting_link"><a href="member_view_balance.php?account_type=member&delivery_id=' . $delivery_id . '">Account</a></span>
                   &bull; -->
                   <span class="accounting_link"><a href="show_report.php?type=customer_invoice&delivery_id=' . $delivery_id . '&member_id=' . $_SESSION['member_id'] . '">Invoice</a></span>' : '') . '
                <span class="order_dates">' . $month_open . ' ' . $day_open . ' ' . $year_open . ' &ndash; ' . $month_closed . ' ' . $day_closed . ' ' . $year_closed . '</span>
                <span class="basket_qty">' . $basket_quantity_text . '</span>
                <span class="basket_action">' . $current_link . '</span>
              </li>';
        }
    }
    $display .= '
            </ul>
          </div>
        </div>';
    return $display;
}
Example #4
0
    } elseif ($basket_info['site_selection'] == 'revert') {
        echo 'site_id reverted: ' . $basket_info['site_long'];
        exit(1);
    }
    $basket_id = $basket_info['basket_id'];
}
// Make sure the quantity we think is in the basket is the quantity that really is in the basket
$query = '
  SELECT
    (
      SELECT
        CONCAT(bpid,":",quantity)
      FROM
        ' . NEW_TABLE_BASKET_ITEMS . '
      WHERE
        basket_id = "' . mysql_real_escape_string(CurrentBasket::basket_id()) . '"
        AND product_id = "' . mysql_real_escape_string($product_id) . '"
        AND product_version = "' . mysql_real_escape_string($product_version) . '"
    ) AS bpid_quantity,
    ' . NEW_TABLE_PRODUCTS . '.inventory_id,
    ' . NEW_TABLE_PRODUCTS . '.inventory_pull,
    FLOOR(' . TABLE_INVENTORY . '.quantity / ' . NEW_TABLE_PRODUCTS . '.inventory_pull) AS inventory_quantity
  FROM
    ' . NEW_TABLE_PRODUCTS . '
  LEFT JOIN ' . TABLE_INVENTORY . ' ON ' . TABLE_INVENTORY . '.inventory_id = ' . NEW_TABLE_PRODUCTS . '.inventory_id
  WHERE
    ' . NEW_TABLE_PRODUCTS . '.product_id = "' . mysql_real_escape_string($product_id) . '"
    AND ' . NEW_TABLE_PRODUCTS . '.product_version = "' . mysql_real_escape_string($product_version) . '"';
$result = @mysql_query($query, $connection) or die(debug_print("ERROR: 738102 ", array($query, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
if ($row = mysql_fetch_object($result)) {
    list($bpid, $basket_quantity) = explode(':', $row->bpid_quantity);
function get_delivery_codes_list($request_data)
{
    global $connection;
    // See if it is okay to open a basket...
    if (ActiveCycle::delivery_id() && (ActiveCycle::ordering_window() == 'open' || CurrentMember::auth_type('orderex'))) {
        // If requested to open-basket...
        if ($request_data['action'] == 'open_basket') {
            if ($request_data['site_id'] && $request_data['delivery_type']) {
                $site_id = $request_data['site_id'];
                $delivery_type = $request_data['delivery_type'];
                // First try an assigned delivery_id... then use the current active one
                $delivery_id = $request_data['delivery_id'];
                if (!$delivery_id) {
                    $delivery_id = ActiveCycle::delivery_id();
                }
                // First try an assigned member_id... then use the current session one
                $member_id = $request_data['member_id'];
                if (!$member_id) {
                    $member_id = $_SESSION['member_id'];
                }
                // Update the basket
                $basket_info = open_update_basket(array('member_id' => $member_id, 'delivery_id' => $delivery_id, 'site_id' => $site_id, 'delivery_type' => $delivery_type));
            }
        } else {
            $basket_info = get_basket($request_data['member_id'], $request_data['delivery_id']);
        }
        //         // Ordering is open and there is no basket open yet
        //         // Get this member's most recent delivery location
        //         $query = '
        //           SELECT
        //             '.NEW_TABLE_SITES.'.site_id,
        //             '.NEW_TABLE_SITES.'.deltype
        //           FROM
        //             '.NEW_TABLE_BASKETS.'
        //           LEFT JOIN
        //             '.NEW_TABLE_SITES.' USING(site_id)
        //           WHERE
        //             '.NEW_TABLE_BASKETS.'.member_id = "'.mysql_real_escape_string($_SESSION['member_id']).'"
        //             AND '.NEW_TABLE_SITES.'.inactive = "0"
        //           ORDER BY
        //             delivery_id DESC
        //           LIMIT
        //             1';
        //           $result = mysql_query ($query, $connection) or die(debug_print ("ERROR: 548167 ", array ($query,mysql_error()), basename(__FILE__).' LINE '.__LINE__));
        //           if ($row = mysql_fetch_array ($result))
        //             {
        //               $site_id_prior = $row['site_id'];
        //               $deltype_prior = $row['deltype'];
        //             }
        // Constrain this shopper's baskets to the site_type they are enabled to use
        $site_type_constraint = '';
        if (CurrentMember::auth_type('member')) {
            $site_type_constraint .= '
              ' . (strlen($site_type_constraint) > 0 ? 'OR ' : '') . 'site_type LIKE "%customer%"';
        }
        if (CurrentMember::auth_type('institution')) {
            $site_type_constraint .= '
              ' . (strlen($site_type_constraint) > 0 ? 'OR ' : '') . 'site_type LIKE "%institution%"';
        }
        $site_type_constraint = '
            AND (' . $site_type_constraint . '
              )';
        // Now get the list of all available delivery codes and flag the one
        // that corresponds to this member's prior order
        $query = '
          SELECT
            ' . NEW_TABLE_SITES . '.site_id,
            ' . NEW_TABLE_SITES . '.site_short,
            ' . NEW_TABLE_SITES . '.site_long,
            ' . NEW_TABLE_SITES . '.delivery_type,
            ' . NEW_TABLE_SITES . '.site_description,
            ' . NEW_TABLE_SITES . '.delivery_charge,
            ' . NEW_TABLE_SITES . '.inactive,
            ' . TABLE_MEMBER . '.address_line1,
            ' . TABLE_MEMBER . '.work_address_line1
          FROM
            (' . NEW_TABLE_SITES . ',
            ' . TABLE_MEMBER . ')
          WHERE
            ' . NEW_TABLE_SITES . '.inactive != "1"
            AND ' . TABLE_MEMBER . '.member_id = "' . mysql_real_escape_string($_SESSION['member_id']) . '"' . $site_type_constraint . '
          ORDER BY
            site_long';
        $result = mysql_query($query, $connection) or die(debug_print("ERROR: 671934 ", array($query, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
        $site_id_array = array();
        $delivery_type_array = array();
        $display .= '
            <div id="delivery_dropdown" class="dropdown">
              <a href="' . $_SERVER['SCRIPT_NAME'] . '?action=delivery_list_only"><h1 class="delivery_select">' . ($basket_info['site_id'] ? 'Selected: ' . $basket_info['site_long'] : 'Select Location') . '
              </h1></a>
              <div id="delivery_select">
                <ul class="delivery_select">';
        while ($row = mysql_fetch_array($result)) {
            // Simplify variables
            $site_id = $row['site_id'];
            $site_long = $row['site_long'];
            $delivery_type = $row['delivery_type'];
            $site_description = $row['site_description'];
            $delivery_charge = $row['delivery_charge'];
            $inactive = $row['inactive'];
            $address = $row['address_line1'];
            $work_address = $row['work_address_line1'];
            // Set up some text for the $delivery type (delivery or pickup)
            if ($delivery_type == 'P') {
                $delivery_type_text = 'Pick up your order here';
                $delivery_type_class = 'delivery_type-p';
            } elseif ($delivery_type == 'D') {
                $delivery_type_text_h = 'HOME delivery';
                $delivery_type_text_w = 'WORK delivery';
                if ($delivery_charge) {
                    $delivery_type_text_h .= ' ($' . number_format($delivery_charge, 2) . ' charge)';
                    $delivery_type_text_w .= ' ($' . number_format($delivery_charge, 2) . ' charge)';
                }
                $delivery_type_class = 'delivery_type-d';
            } else {
                $delivery_type_text = '';
                $delivery_type_class = '';
            }
            // Process the inactive options
            if ($inactive == 0) {
                $show_site = true;
                $active_class = ' active';
                $select_link_href = $_SERVER['SCRIPT_NAME'] . '?action=open_basket&amp;site_id=' . $site_id . '&amp;delivery_type=P';
                $select_link_h_href = $_SERVER['SCRIPT_NAME'] . '?action=open_basket&amp;site_id=' . $site_id . '&amp;delivery_type=H';
                $select_link_w_href = $_SERVER['SCRIPT_NAME'] . '?action=open_basket&amp;site_id=' . $site_id . '&amp;delivery_type=W';
                $delivery_type_class .= 'a';
                // color
            } elseif ($inactive == 2) {
                $show_site = true;
                $active_class = ' inactive';
                $select_link_href = '';
                $select_link_h_href = '';
                $select_link_w_href = '';
                $delivery_type_class .= 'i';
                // color
                $delivery_type_text = '(Not available for pick up this cycle)';
                // clobber the delivery type text
                $delivery_type_text_h = '(Not available for home delivery this cycle)';
                // clobber the delivery type text
                $delivery_type_text_w = '(Not available for work delivery this cycle)';
                // clobber the delivery type text
            } else {
                $show_site = false;
                $active_class = ' suspended';
                $select_link_href = '';
                $select_link_h_href = '';
                $select_link_w_href = '';
                $delivery_type_class .= 'i';
                // color
                $delivery_type_text = '(Not available for pick up this cycle)';
                // clobber the delivery type text
                $delivery_type_text_h = '(Not available for home delivery this cycle)';
                // clobber the delivery type text
                $delivery_type_text_w = '(Not available for work delivery this cycle)';
                // clobber the delivery type text
            }
            // Process current selection
            if ($site_id == CurrentBasket::site_id()) {
                $selected = true;
                $select_class = ' select';
                $delivery_type_class .= 'c';
                // color
            } else {
                $selected = 'false';
                $select_class = '';
                $delivery_type_class .= 'g';
                // greyscale
            }
            if ($show_site == true) {
                if ($delivery_type == 'P') {
                    $display .= '
                  <li class="' . $delivery_type_class . $active_class . $select_class . '" ' . ($select_link_href != '' ? 'onclick="javascript:location.href=\'' . $select_link_href : '') . '\';parent.close_delivery_selector();">
                      <span class="site_long">' . $site_long . '</span>
                      <span class="site_action">' . $delivery_type_text . '</span>
                      <span class="site_description">' . br2nl($site_description) . '</span>
                  </li>';
                }
                // For delivery_type = delivery, we will give an option for "home"
                if ($delivery_type == 'D' && $address) {
                    if ($basket_info['delivery_type'] != 'H') {
                        $select_class = '';
                    }
                    $display .= '
                  <li class="' . $delivery_type_class . $active_class . $select_class . '" ' . ($select_link_h_href != '' ? 'onclick="javascript:location.href=\'' . $select_link_h_href : '') . '\';parent.close_delivery_selector();">
                      <span class="site_long">' . $site_long . '</span>
                      <span class="site_action">' . $delivery_type_text_h . '</span>
                      <span class="site_description"><strong>To home address:</strong> ' . $address . '<br>' . br2nl($site_description) . '</span>
                  </li>';
                }
                // For delivery_type = delivery, we will also give an option for "work"
                if ($delivery_type == 'D' && $work_address) {
                    if ($basket_info['delivery_type'] != 'W') {
                        $select_class = '';
                    }
                    $display .= '
                  <li class="' . $delivery_type_class . $active_class . $select_class . '" ' . ($select_link_w_href != '' ? 'onclick="javascript:location.href=\'' . $select_link_w_href : '') . '\';parent.close_delivery_selector();">
                      <span class="site_long">' . $site_long . '</span>
                      <span class="site_action">' . $delivery_type_text_w . '</span>
                      <span class="site_description"><strong>To work address:</strong> ' . $work_address . '<br>' . br2nl($site_description) . '</span>
                  </li>';
                }
            }
        }
        $display .= '
                </ul>
              </div>
            </div>';
    }
    return $display;
}
Example #6
0
 private static function get_basket_info()
 {
     if (self::$query_complete === false) {
         global $connection;
         $query = '
           SELECT
             ' . NEW_TABLE_BASKETS . '.basket_id,
             ' . NEW_TABLE_SITES . '.site_id,
             ' . NEW_TABLE_SITES . '.site_short,
             ' . NEW_TABLE_SITES . '.site_long,
             ' . NEW_TABLE_BASKETS . '.checked_out
           FROM
             ' . NEW_TABLE_BASKETS . '
           LEFT JOIN ' . NEW_TABLE_SITES . ' USING(site_id)
           WHERE
             ' . NEW_TABLE_BASKETS . '.delivery_id = "' . mysql_real_escape_string(ActiveCycle::delivery_id()) . '"
             AND ' . NEW_TABLE_BASKETS . '.member_id = "' . mysql_real_escape_string($_SESSION['member_id']) . '"';
         $result = @mysql_query($query, $connection) or die(debug_print("ERROR: 783032 ", array($query, mysql_error()), basename(__FILE__) . ' LINE ' . __LINE__));
         if ($row = mysql_fetch_object($result)) {
             self::$basket_id = $row->basket_id;
             self::$site_id = $row->site_id;
             self::$site_short = $row->site_short;
             self::$site_long = $row->site_long;
             self::$basket_checked_out = $row->checked_out;
             self::$query_complete = true;
         }
     }
 }