Ankündigung

Einklappen
Keine Ankündigung bisher.

PDF Rechnung versendet keine Rechnung und Agb usw. mehr.

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    PDF Rechnung versendet keine Rechnung und Agb usw. mehr.

    Hallo,
    ich komme einfach nicht weiter, bzw. ich habe keine Idee mehr wo ich suchen soll.

    Leider kann ich nicht sagen seit wann es so ist, aber PDF-Rechnung versendet einfach keine Rechnungen usw. mehr.

    Kann mir da jemand eine Tipp geben?

    Grüße
    Manfred
    Zuletzt geändert von webchills; 25.08.2012, 09:39.

    #2
    Wenn es schon funktioniert hat und auf einmal nicht mehr, dann hast Du etwas verändert. Hast Du eine andere Erweiterung installiert, die die includes/classes/order.php verändert hat?

    Kommentar


      #3
      Danke für die Hilfe.

      Ich habe mir diese Datei noch einmal ganz genau angeschaut. Dort fehlte eine Klamme ( } ).

      Jetzt passiert folgendes.

      Der Kunde bekommt jetzt zwei Mails. Eine mit den PDF_Unterlagen und eine ohne.

      In der Order.php ist auch noch das Modul "COWOA" eingebaut.

      Kann es sein, das dieses Modul eine zusätzliche Mail versendet?


      Grüße
      Manfred

      Kommentar


        #4
        pdf Rechnung, COWOA und Buttonlösung nehmen alle Änderungen in der includes/classes/order.php vor. Du musst korrekt mergen, dann spielen die auch problemlos zusammen.
        Poste am besten mal den kompletten Inhalt Deiner derzeitigen includes/classes/order.php aber bitte unbedingt als CODE (Rautesymbol im Editor).

        Kommentar


          #5
          Bitte schön.


          Code:
          <?php
          /**
           * File contains the order-processing class ("order")
           *
           * @package classes
           * @copyright Copyright 2003-2011 Zen Cart Development Team
           * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
           * @version $Id: order.php for COWOA 3.0 ZC150 2011-11-28 09:39:03Z webchills $
           */
          /**
           * order class
           *
           * Handles all order-processing functions
           *
           * @package classes
           */
          if (!defined('IS_ADMIN_FLAG')) {
            die('Illegal Access');
          }
          class order extends base {
            var $info, $totals, $products, $customer, $delivery, $content_type, $email_low_stock, $products_ordered_attributes,
            $products_ordered, $products_ordered_email, $attachArray;
          
            function order($order_id = '') {
              $this->info = array();
              $this->totals = array();
              $this->products = array();
              $this->customer = array();
              $this->delivery = array();
          
              if (zen_not_null($order_id)) {
                $this->query($order_id);
              } else {
                $this->cart();
              }
            }
          
            function query($order_id) {
              global $db;
          
              $order_id = zen_db_prepare_input($order_id);
          
              $order_query = "select customers_id, customers_name, customers_company,
                                   customers_street_address, customers_suburb, customers_city,
                                   customers_postcode, customers_state, customers_country,
                                   customers_telephone, customers_email_address, customers_address_format_id,
                                   delivery_name, delivery_company, delivery_street_address, delivery_suburb,
                                   delivery_city, delivery_postcode, delivery_state, delivery_country,
                                   delivery_address_format_id, billing_name, billing_company,
                                   billing_street_address, billing_suburb, billing_city, billing_postcode,
                                   billing_state, billing_country, billing_address_format_id,
                                   payment_method, payment_module_code, shipping_method, shipping_module_code,
                                   coupon_code, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value,
                                   date_purchased, orders_status, last_modified, order_total, order_tax, ip_address ,COWOA_order
                                  from " . TABLE_ORDERS . "
                                  where orders_id = '" . (int)$order_id . "'";
          
              $order = $db->Execute($order_query);
          
              $totals_query = "select title, text, class
                                   from " . TABLE_ORDERS_TOTAL . "
                                   where orders_id = '" . (int)$order_id . "'
                                   order by sort_order";
          
              $totals = $db->Execute($totals_query);
          
              while (!$totals->EOF) {
          
          
                if ($totals->fields['class'] == 'ot_coupon') {
                  $coupon_link_query = "SELECT coupon_id
                          from " . TABLE_COUPONS . "
                          where coupon_code ='" . $order->fields['coupon_code'] . "'";
                  $coupon_link = $db->Execute($coupon_link_query);
                  $zc_coupon_link = '<a href="javascript:couponpopupWindow(\'' . zen_href_link(FILENAME_POPUP_COUPON_HELP, 'cID=' . $coupon_link->fields['coupon_id']) . '\')">';
                }
                $this->totals[] = array('title' => ($totals->fields['class'] == 'ot_coupon' ? $zc_coupon_link . $totals->fields['title'] . '</a>' : $totals->fields['title']),
                                        'text' => $totals->fields['text'],
                                        'class' => $totals->fields['class']);
                $totals->MoveNext();
              }
          
              $order_total_query = "select text, value
                                       from " . TABLE_ORDERS_TOTAL . "
                                       where orders_id = '" . (int)$order_id . "'
                                       and class = 'ot_total'";
          
          
              $order_total = $db->Execute($order_total_query);
          
          
              $shipping_method_query = "select title, value
                                          from " . TABLE_ORDERS_TOTAL . "
                                          where orders_id = '" . (int)$order_id . "'
                                          and class = 'ot_shipping'";
          
          
              $shipping_method = $db->Execute($shipping_method_query);
          
              $order_status_query = "select orders_status_name
                                       from " . TABLE_ORDERS_STATUS . "
                                       where orders_status_id = '" . $order->fields['orders_status'] . "'
                                       and language_id = '" . (int)$_SESSION['languages_id'] . "'";
          
              $order_status = $db->Execute($order_status_query);
          
              $this->info = array('currency' => $order->fields['currency'],
                                  'currency_value' => $order->fields['currency_value'],
                                  'payment_method' => $order->fields['payment_method'],
                                  'payment_module_code' => $order->fields['payment_module_code'],
                                  'shipping_method' => $order->fields['shipping_method'],
                                  'shipping_module_code' => $order->fields['shipping_module_code'],
                                  'coupon_code' => $order->fields['coupon_code'],
                                  'cc_type' => $order->fields['cc_type'],
                                  'cc_owner' => $order->fields['cc_owner'],
                                  'cc_number' => $order->fields['cc_number'],
                                  'cc_expires' => $order->fields['cc_expires'],
                                  'date_purchased' => $order->fields['date_purchased'],
                                  'orders_status' => $order_status->fields['orders_status_name'],
                                  'last_modified' => $order->fields['last_modified'],
                                  'total' => $order->fields['order_total'],
                                  'tax' => $order->fields['order_tax'],
                                  'ip_address' => $order->fields['ip_address']
                                  );
          
              $this->customer = array('id' => $order->fields['customers_id'],
                                      'name' => $order->fields['customers_name'],
                                      'company' => $order->fields['customers_company'],
                                      'street_address' => $order->fields['customers_street_address'],
                                      'suburb' => $order->fields['customers_suburb'],
                                      'city' => $order->fields['customers_city'],
                                      'postcode' => $order->fields['customers_postcode'],
                                      'state' => $order->fields['customers_state'],
                                      'country' => $order->fields['customers_country'],
                                      'format_id' => $order->fields['customers_address_format_id'],
                                      'telephone' => $order->fields['customers_telephone'],
                                      'email_address' => $order->fields['customers_email_address']);
          
              $this->delivery = array('name' => $order->fields['delivery_name'],
                                      'company' => $order->fields['delivery_company'],
                                      'street_address' => $order->fields['delivery_street_address'],
                                      'suburb' => $order->fields['delivery_suburb'],
                                      'city' => $order->fields['delivery_city'],
                                      'postcode' => $order->fields['delivery_postcode'],
                                      'state' => $order->fields['delivery_state'],
                                      'country' => $order->fields['delivery_country'],
                                      'format_id' => $order->fields['delivery_address_format_id']);
          
              if (empty($this->delivery['name']) && empty($this->delivery['street_address'])) {
                $this->delivery = false;
              }
          
              $this->billing = array('name' => $order->fields['billing_name'],
                                     'company' => $order->fields['billing_company'],
                                     'street_address' => $order->fields['billing_street_address'],
                                     'suburb' => $order->fields['billing_suburb'],
                                     'city' => $order->fields['billing_city'],
                                     'postcode' => $order->fields['billing_postcode'],
                                     'state' => $order->fields['billing_state'],
                                     'country' => $order->fields['billing_country'],
                                     'format_id' => $order->fields['billing_address_format_id']);
          
              $index = 0;
              $orders_products_query = "select orders_products_id, products_id, products_name,
                                           products_model, products_price, products_tax,
                                           products_quantity, final_price,
                                           onetime_charges,
                                           products_priced_by_attribute, product_is_free, products_discount_type,
                                           products_discount_type_from
                                            from " . TABLE_ORDERS_PRODUCTS . "
                                            where orders_id = '" . (int)$order_id . "'
                                            order by orders_products_id";
          
              $orders_products = $db->Execute($orders_products_query);
          
              while (!$orders_products->EOF) {
                // convert quantity to proper decimals - account history
                if (QUANTITY_DECIMALS != 0) {
                  $fix_qty = $orders_products->fields['products_quantity'];
                  switch (true) {
                    case (!strstr($fix_qty, '.')):
                    $new_qty = $fix_qty;
                    break;
                    default:
                    $new_qty = preg_replace('/[0]+$/', '', $orders_products->fields['products_quantity']);
                    break;
                  }
                } else {
                  $new_qty = $orders_products->fields['products_quantity'];
                }
          
                $new_qty = round($new_qty, QUANTITY_DECIMALS);
          
                if ($new_qty == (int)$new_qty) {
                  $new_qty = (int)$new_qty;
                }
          
                $this->products[$index] = array('qty' => $new_qty,
                                                'id' => $orders_products->fields['products_id'],
                                                'name' => $orders_products->fields['products_name'],
                                                'model' => $orders_products->fields['products_model'],
                                                'tax' => $orders_products->fields['products_tax'],
                                                'price' => $orders_products->fields['products_price'],
                                                'final_price' => $orders_products->fields['final_price'],
                                                'onetime_charges' => $orders_products->fields['onetime_charges'],
                                                'products_priced_by_attribute' => $orders_products->fields['products_priced_by_attribute'],
                                                'product_is_free' => $orders_products->fields['product_is_free'],
                                                'products_discount_type' => $orders_products->fields['products_discount_type'],
                                                'products_discount_type_from' => $orders_products->fields['products_discount_type_from']);
          
                $subindex = 0;
                $attributes_query = "select products_options_id, products_options_values_id, products_options, products_options_values,
                                        options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . "
                                         where orders_id = '" . (int)$order_id . "'
                                         and orders_products_id = '" . (int)$orders_products->fields['orders_products_id'] . "'";
          
                $attributes = $db->Execute($attributes_query);
                if ($attributes->RecordCount()) {
                  while (!$attributes->EOF) {
                    $this->products[$index]['attributes'][$subindex] = array('option' => $attributes->fields['products_options'],
                                                                             'value' => $attributes->fields['products_options_values'],
                                                                             'option_id' => $attributes->fields['products_options_id'],
                                                                             'value_id' => $attributes->fields['products_options_values_id'],
                                                                             'prefix' => $attributes->fields['price_prefix'],
                                                                             'price' => $attributes->fields['options_values_price']);
          
                    $subindex++;
                    $attributes->MoveNext();
                  }
                }
          
                $this->info['tax_groups']["{$this->products[$index]['tax']}"] = '1';
          
                $index++;
                $orders_products->MoveNext();
              }
            }
          
            function cart() {
              global $db, $currencies;
          
              $decimals = $currencies->get_decimal_places($_SESSION['currency']);
              $this->content_type = $_SESSION['cart']->get_content_type();
          
              $customer_address_query = "select c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_telephone,
                                              c.customers_email_address, ab.entry_company, ab.entry_street_address,
                                              ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id,
                                              z.zone_name, co.countries_id, co.countries_name,
                                              co.countries_iso_code_2, co.countries_iso_code_3,
                                              co.address_format_id, ab.entry_state
                                             from (" . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab )
                                             left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)
                                             left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id)
                                             where c.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                             and ab.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                             and c.customers_default_address_id = ab.address_book_id";
          
              $customer_address = $db->Execute($customer_address_query);
          
              $shipping_address_query = "select ab.entry_firstname, ab.entry_lastname, ab.entry_company,
                                              ab.entry_street_address, ab.entry_suburb, ab.entry_postcode,
                                              ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id,
                                              c.countries_id, c.countries_name, c.countries_iso_code_2,
                                              c.countries_iso_code_3, c.address_format_id, ab.entry_state
                                             from " . TABLE_ADDRESS_BOOK . " ab
                                             left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)
                                             left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id)
                                             where ab.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                             and ab.address_book_id = '" . (int)$_SESSION['sendto'] . "'";
          
              $shipping_address = $db->Execute($shipping_address_query);
          
              $billing_address_query = "select ab.entry_firstname, ab.entry_lastname, ab.entry_company,
                                             ab.entry_street_address, ab.entry_suburb, ab.entry_postcode,
                                             ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id,
                                             c.countries_id, c.countries_name, c.countries_iso_code_2,
                                             c.countries_iso_code_3, c.address_format_id, ab.entry_state
                                            from " . TABLE_ADDRESS_BOOK . " ab
                                            left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)
                                            left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id)
                                            where ab.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                            and ab.address_book_id = '" . (int)$_SESSION['billto'] . "'";
          
              $billing_address = $db->Execute($billing_address_query);
          
              // set default tax calculation for not-logged-in visitors
              $taxCountryId = $taxZoneId = -1;
          
              $tax_address_query = '';
              switch (STORE_PRODUCT_TAX_BASIS) {
                case 'Shipping':
          
                $tax_address_query = "select ab.entry_country_id, ab.entry_zone_id
                                        from " . TABLE_ADDRESS_BOOK . " ab
                                        left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)
                                        where ab.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                        and ab.address_book_id = '" . (int)($this->content_type == 'virtual' ? $_SESSION['billto'] : $_SESSION['sendto']) . "'";
                break;
                case 'Billing':
          
                $tax_address_query = "select ab.entry_country_id, ab.entry_zone_id
                                        from " . TABLE_ADDRESS_BOOK . " ab
                                        left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)
                                        where ab.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                        and ab.address_book_id = '" . (int)$_SESSION['billto'] . "'";
                break;
                case 'Store':
                if ($billing_address->fields['entry_zone_id'] == STORE_ZONE) {
          
                  $tax_address_query = "select ab.entry_country_id, ab.entry_zone_id
                                          from " . TABLE_ADDRESS_BOOK . " ab
                                          left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)
                                          where ab.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                          and ab.address_book_id = '" . (int)$_SESSION['billto'] . "'";
                } else {
                  $tax_address_query = "select ab.entry_country_id, ab.entry_zone_id
                                          from " . TABLE_ADDRESS_BOOK . " ab
                                          left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)
                                          where ab.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                          and ab.address_book_id = '" . (int)($this->content_type == 'virtual' ? $_SESSION['billto'] : $_SESSION['sendto']) . "'";
                }
              }
              if ($tax_address_query != '') {
                $tax_address = $db->Execute($tax_address_query);
                if ($tax_address->recordCount() > 0) {
                  $taxCountryId = $tax_address->fields['entry_country_id'];
                  $taxZoneId = $tax_address->fields['entry_zone_id'];
                }
              }
          
              $class =& $_SESSION['payment'];
          
              if (isset($_SESSION['cc_id'])) {
                $coupon_code_query = "select coupon_code
                                        from " . TABLE_COUPONS . "
                                        where coupon_id = '" . (int)$_SESSION['cc_id'] . "'";
          
                $coupon_code = $db->Execute($coupon_code_query);
          
          
              }
          
              $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,
                                  'currency' => $_SESSION['currency'],
                                  'currency_value' => $currencies->currencies[$_SESSION['currency']]['value'],
                                  'payment_method' => $GLOBALS[$class]->title,
                                  'payment_module_code' => $GLOBALS[$class]->code,
                                  'coupon_code' => $coupon_code->fields['coupon_code'],
              //                          'cc_type' => (isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : ''),
              //                          'cc_owner' => (isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : ''),
              //                          'cc_number' => (isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : ''),
              //                          'cc_expires' => (isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : ''),
              //                          'cc_cvv' => (isset($GLOBALS['cc_cvv']) ? $GLOBALS['cc_cvv'] : ''),
                                  'shipping_method' => (is_array($_SESSION['shipping']) ? $_SESSION['shipping']['title'] : $_SESSION['shipping']),
                                  'shipping_module_code' => (isset($_SESSION['shipping']['id']) && strpos($_SESSION['shipping']['id'], '_') > 0 ? $_SESSION['shipping']['id'] : $_SESSION['shipping']),
                                  'shipping_cost' => $_SESSION['shipping']['cost'],
                                  'subtotal' => 0,
                                  'shipping_tax' => 0,
                                  'tax' => 0,
                                  'total' => 0,
                                  'tax_groups' => array(),
                                  'comments' => (isset($_SESSION['comments']) ? $_SESSION['comments'] : ''),
                                  'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR']
                                  );
          
              //print_r($GLOBALS[$class]);
              //echo $class;
              //print_r($GLOBALS);
              //echo $_SESSION['payment'];
              /*
              // this is set above to the module filename it should be set to the module title like Checks/Money Order rather than moneyorder
              if (isset($$_SESSION['payment']) && is_object($$_SESSION['payment'])) {
              $this->info['payment_method'] = $$_SESSION['payment']->title;
              }
              */
          
          /*
          // bof: move below calculations
              if ($this->info['total'] == 0) {
                if (DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID == 0) {
                  $this->info['order_status'] = DEFAULT_ORDERS_STATUS_ID;
                } else {
                  $this->info['order_status'] = DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID;
                }
              }
              if (isset($GLOBALS[$class]) && is_object($GLOBALS[$class])) {
                if ( isset($GLOBALS[$class]->order_status) && is_numeric($GLOBALS[$class]->order_status) && ($GLOBALS[$class]->order_status > 0) ) {
                  $this->info['order_status'] = $GLOBALS[$class]->order_status;
                }
              }
          // eof: move below calculations
          */
              $this->customer = array('gender' => $customer_address->fields['customers_gender'],
                                                              'firstname' => $customer_address->fields['customers_firstname'],
                                      'lastname' => $customer_address->fields['customers_lastname'],
                                      'company' => $customer_address->fields['entry_company'],
                                      'street_address' => $customer_address->fields['entry_street_address'],
                                      'suburb' => $customer_address->fields['entry_suburb'],
                                      'city' => $customer_address->fields['entry_city'],
                                      'postcode' => $customer_address->fields['entry_postcode'],
                                      'state' => ((zen_not_null($customer_address->fields['entry_state'])) ? $customer_address->fields['entry_state'] : $customer_address->fields['zone_name']),
                                      'zone_id' => $customer_address->fields['entry_zone_id'],
                                      'country' => array('id' => $customer_address->fields['countries_id'], 'title' => $customer_address->fields['countries_name'], 'iso_code_2' => $customer_address->fields['countries_iso_code_2'], 'iso_code_3' => $customer_address->fields['countries_iso_code_3']),
                                      'format_id' => (int)$customer_address->fields['address_format_id'],
                                      'telephone' => $customer_address->fields['customers_telephone'],
                                      'email_address' => $customer_address->fields['customers_email_address']);
          
              $this->delivery = array('firstname' => $shipping_address->fields['entry_firstname'],
                                      'lastname' => $shipping_address->fields['entry_lastname'],
                                      'company' => $shipping_address->fields['entry_company'],
                                      'street_address' => $shipping_address->fields['entry_street_address'],
                                      'suburb' => $shipping_address->fields['entry_suburb'],
                                      'city' => $shipping_address->fields['entry_city'],
                                      'postcode' => $shipping_address->fields['entry_postcode'],
                                      'state' => ((zen_not_null($shipping_address->fields['entry_state'])) ? $shipping_address->fields['entry_state'] : $shipping_address->fields['zone_name']),
                                      'zone_id' => $shipping_address->fields['entry_zone_id'],
                                      'country' => array('id' => $shipping_address->fields['countries_id'], 'title' => $shipping_address->fields['countries_name'], 'iso_code_2' => $shipping_address->fields['countries_iso_code_2'], 'iso_code_3' => $shipping_address->fields['countries_iso_code_3']),
                                      'country_id' => $shipping_address->fields['entry_country_id'],
                                      'format_id' => (int)$shipping_address->fields['address_format_id']);
          
              $this->billing = array('firstname' => $billing_address->fields['entry_firstname'],
                                     'lastname' => $billing_address->fields['entry_lastname'],
                                     'company' => $billing_address->fields['entry_company'],
                                     'street_address' => $billing_address->fields['entry_street_address'],
                                     'suburb' => $billing_address->fields['entry_suburb'],
                                     'city' => $billing_address->fields['entry_city'],
                                     'postcode' => $billing_address->fields['entry_postcode'],
                                     'state' => ((zen_not_null($billing_address->fields['entry_state'])) ? $billing_address->fields['entry_state'] : $billing_address->fields['zone_name']),
                                     'zone_id' => $billing_address->fields['entry_zone_id'],
                                     'country' => array('id' => $billing_address->fields['countries_id'], 'title' => $billing_address->fields['countries_name'], 'iso_code_2' => $billing_address->fields['countries_iso_code_2'], 'iso_code_3' => $billing_address->fields['countries_iso_code_3']),
                                     'country_id' => $billing_address->fields['entry_country_id'],
                                     'format_id' => (int)$billing_address->fields['address_format_id']);
          
              $index = 0;
              $products = $_SESSION['cart']->get_products();
              for ($i=0, $n=sizeof($products); $i<$n; $i++) {
                if (($i/2) == floor($i/2)) {
                  $rowClass="rowEven";
                } else {
                  $rowClass="rowOdd";
                }
                $taxRates = zen_get_multiple_tax_rates($products[$i]['tax_class_id'], $taxCountryId, $taxZoneId);
                $this->products[$index] = array('qty' => $products[$i]['quantity'],
                                                'name' => $products[$i]['name'],
                                                'merkmale' => $products[$i]['merkmale'],
                                                'model' => $products[$i]['model'],
                                                'image' => $products[$i]['image'],
                                                'tax' => zen_get_tax_rate($products[$i]['tax_class_id'], $taxCountryId, $taxZoneId),
                                                'tax_groups'=>$taxRates,
                                                'tax_description' => zen_get_tax_description($products[$i]['tax_class_id'], $taxCountryId, $taxZoneId),
                                                'price' => $products[$i]['price'],
                                                'final_price' => $products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']),
                                                'onetime_charges' => $_SESSION['cart']->attributes_price_onetime_charges($products[$i]['id'], $products[$i]['quantity']),
                                                'weight' => $products[$i]['weight'],
                                                'products_priced_by_attribute' => $products[$i]['products_priced_by_attribute'],
                                                'product_is_free' => $products[$i]['product_is_free'],
                                                'products_discount_type' => $products[$i]['products_discount_type'],
                                                'products_discount_type_from' => $products[$i]['products_discount_type_from'],
                                                'id' => $products[$i]['id'],
                                                'rowClass' => $rowClass);
                $this->notify('NOTIFY_ORDER_CART_ADD_PRODUCT_LIST', array('index'=>$index, 'products'=>$products[$i]));
                if ($products[$i]['attributes']) {
                  $subindex = 0;
                  reset($products[$i]['attributes']);
                  while (list($option, $value) = each($products[$i]['attributes'])) {
                    /*
                    //clr 030714 Determine if attribute is a text attribute and change products array if it is.
                    if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID){
                    $attr_value = $products[$i]['attributes_values'][$option];
                    } else {
                    $attr_value = $attributes->fields['products_options_values_name'];
                    }
                    */
          
                    $attributes_query = "select popt.products_options_name, poval.products_options_values_name,
                                                    pa.options_values_price, pa.price_prefix
                                             from " . TABLE_PRODUCTS_OPTIONS . " popt,
                                                  " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval,
                                                  " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                             where pa.products_id = '" . (int)$products[$i]['id'] . "'
                                             and pa.options_id = '" . (int)$option . "'
                                             and pa.options_id = popt.products_options_id
                                             and pa.options_values_id = '" . (int)$value . "'
                                             and pa.options_values_id = poval.products_options_values_id
                                             and popt.language_id = '" . (int)$_SESSION['languages_id'] . "'
                                             and poval.language_id = '" . (int)$_SESSION['languages_id'] . "'";
          
                    $attributes = $db->Execute($attributes_query);
          
                    //clr 030714 Determine if attribute is a text attribute and change products array if it is.
                    if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID){
                      $attr_value = $products[$i]['attributes_values'][$option];
                    } else {
                      $attr_value = $attributes->fields['products_options_values_name'];
                    }
          
                    $this->products[$index]['attributes'][$subindex] = array('option' => $attributes->fields['products_options_name'],
                                                                             'value' => $attr_value,
                                                                             'option_id' => $option,
                                                                             'value_id' => $value,
                                                                             'prefix' => $attributes->fields['price_prefix'],
                                                                             'price' => $attributes->fields['options_values_price']);
          
                    $this->notify('NOTIFY_ORDER_CART_ADD_ATTRIBUTE_LIST', array('index'=>$index, 'subindex'=>$subindex, 'products'=>$products[$i], 'attributes'=>$attributes));
                    $subindex++;
                  }
                }
          
                // add onetime charges here
                //$_SESSION['cart']->attributes_price_onetime_charges($products[$i]['id'], $products[$i]['quantity'])
          
                /*********************************************
                 * Calculate taxes for this product
                 *********************************************/
                $shown_price = zen_round(zen_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) ,$decimals) * $this->products[$index]['qty'];
                $shown_price +=  zen_round(zen_add_tax($this->products[$index]['onetime_charges'], $this->products[$index]['tax']), $decimals);
                
                $this->notify('NOTIFIY_ORDER_CART_SUBTOTAL_CALCULATE', array('shown_price'=>$shown_price));
                // find product's tax rate and description
                $products_tax = $this->products[$index]['tax'];
                $products_tax_description = $this->products[$index]['tax_description'];
                $this->info['subtotal'] += $shown_price;
                $totalTaxAdd = 0;
                foreach ($taxRates as $taxDescription=>$taxRate)
                {
                  $taxAdd = 0;
                  if ($taxDescription == $products_tax_description)
                  {
                    if (DISPLAY_PRICE_WITH_TAX == 'true')
                    {
                      $taxAdd = zen_round($shown_price / (100 + $this->products[$index]['tax']) * $this->products[$index]['tax'], $decimals);
                    } else 
                    {
                        $taxAdd = zen_calculate_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
                                +  zen_round(zen_calculate_tax($this->products[$index]['onetime_charges'], $this->products[$index]['tax']), $decimals);
                    }
                    if (isset($this->info['tax_groups'][$taxDescription]))
                    {
                      $this->info['tax_groups'][$taxDescription] += $taxAdd;
                    } else
                    {
                      $this->info['tax_groups'][$taxDescription] = $taxAdd;
                    }
                  }
                  $totalTaxAdd += $taxAdd;
                }
                $this->info['tax'] += $totalTaxAdd;
                /*********************************************
                 * END: Calculate taxes for this product
                 *********************************************/
                $index++;
              }
          
              // Update the final total to include tax if not already tax-inc
              if (DISPLAY_PRICE_WITH_TAX == 'true') {
                $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
              } else {
                $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
              }
          
          /*
          // moved to function create
              if ($this->info['total'] == 0) {
                if (DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID == 0) {
                  $this->info['order_status'] = DEFAULT_ORDERS_STATUS_ID;
                } else {
                  $this->info['order_status'] = DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID;
                }
              }
          */
              if (isset($GLOBALS[$class]) && is_object($GLOBALS[$class])) {
                if ( isset($GLOBALS[$class]->order_status) && is_numeric($GLOBALS[$class]->order_status) && ($GLOBALS[$class]->order_status > 0) ) {
                  $this->info['order_status'] = $GLOBALS[$class]->order_status;
                }
              }
              $this->notify('NOTIFY_ORDER_CART_FINISHED');
            }
          
            function create($zf_ot_modules, $zf_mode = 2) {
              global $db;
          
              if ($this->info['total'] == 0) {
                if (DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID == 0) {
                  $this->info['order_status'] = DEFAULT_ORDERS_STATUS_ID;
                } else {
                  if ($_SESSION['payment'] != 'freecharger') {
                    $this->info['order_status'] = DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID;
                  }
                }
              }
          
              if ($_SESSION['shipping'] == 'free_free') {
                $this->info['shipping_module_code'] = $_SESSION['shipping'];
              }
          
              // Sanitize cc-num if present, using maximum 10 chars, with middle chars stripped out with XX
              if (strlen($this->info['cc_number']) > 10) {
                $cEnd = substr($this->info['cc_number'], -4);
                $cOffset = strlen($this->info['cc_number']) -4;
                $cStart = substr($this->info['cc_number'], 0, ($cOffset > 4 ? 4 : (int)$cOffset));
                $this->info['cc_number'] = str_pad($cStart, 6, 'X') . $cEnd;
              };
          
              $sql_data_array = array('customers_id' => $_SESSION['customer_id'],
                                      'customers_name' => $this->customer['firstname'] . ' ' . $this->customer['lastname'],
                                      'customers_company' => $this->customer['company'],
                                      'customers_street_address' => $this->customer['street_address'],
                                      'customers_suburb' => $this->customer['suburb'],
                                      'customers_city' => $this->customer['city'],
                                      'customers_postcode' => $this->customer['postcode'],
                                      'customers_state' => $this->customer['state'],
                                      'customers_country' => $this->customer['country']['title'],
                                      'customers_telephone' => $this->customer['telephone'],
                                      'customers_email_address' => $this->customer['email_address'],
                                      'customers_address_format_id' => $this->customer['format_id'],
                                      'delivery_name' => $this->delivery['firstname'] . ' ' . $this->delivery['lastname'],
                                      'delivery_company' => $this->delivery['company'],
                                      'delivery_street_address' => $this->delivery['street_address'],
                                      'delivery_suburb' => $this->delivery['suburb'],
                                      'delivery_city' => $this->delivery['city'],
                                      'delivery_postcode' => $this->delivery['postcode'],
                                      'delivery_state' => $this->delivery['state'],
                                      'delivery_country' => $this->delivery['country']['title'],
                                      'delivery_address_format_id' => $this->delivery['format_id'],
                                      'billing_name' => $this->billing['firstname'] . ' ' . $this->billing['lastname'],
                                      'billing_company' => $this->billing['company'],
                                      'billing_street_address' => $this->billing['street_address'],
                                      'billing_suburb' => $this->billing['suburb'],
                                      'billing_city' => $this->billing['city'],
                                      'billing_postcode' => $this->billing['postcode'],
                                      'billing_state' => $this->billing['state'],
                                      'billing_country' => $this->billing['country']['title'],
                                      'billing_address_format_id' => $this->billing['format_id'],
                                      'payment_method' => (($this->info['payment_module_code'] == '' and $this->info['payment_method'] == '') ? PAYMENT_METHOD_GV : $this->info['payment_method']),
                                      'payment_module_code' => (($this->info['payment_module_code'] == '' and $this->info['payment_method'] == '') ? PAYMENT_MODULE_GV : $this->info['payment_module_code']),
                                      'shipping_method' => $this->info['shipping_method'],
                                      'shipping_module_code' => (strpos($this->info['shipping_module_code'], '_') > 0 ? substr($this->info['shipping_module_code'], 0, strpos($this->info['shipping_module_code'], '_')) : $this->info['shipping_module_code']),
                                      'coupon_code' => $this->info['coupon_code'],
                                      'cc_type' => $this->info['cc_type'],
                                      'cc_owner' => $this->info['cc_owner'],
                                      'cc_number' => $this->info['cc_number'],
                                      'cc_expires' => $this->info['cc_expires'],
                                      'date_purchased' => 'now()',
                                      'orders_status' => $this->info['order_status'],
                                      'order_total' => $this->info['total'],
                                      'order_tax' => $this->info['tax'],
                                      'currency' => $this->info['currency'],
                                      'currency_value' => $this->info['currency_value'],
                                      'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR']
                                      );
          
              if ($_SESSION['COWOA']) $sql_data_array[COWOA_order] = 1;
          
              zen_db_perform(TABLE_ORDERS, $sql_data_array);
          
              $insert_id = $db->Insert_ID();
          
              $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ORDER_HEADER', array_merge(array('orders_id' => $insert_id, 'shipping_weight' => $_SESSION['cart']->weight), $sql_data_array));
          
              for ($i=0, $n=sizeof($zf_ot_modules); $i<$n; $i++) {
                $sql_data_array = array('orders_id' => $insert_id,
                                        'title' => $zf_ot_modules[$i]['title'],
                                        'text' => $zf_ot_modules[$i]['text'],
                                        'value' => (is_numeric($zf_ot_modules[$i]['value'])) ? $zf_ot_modules[$i]['value'] : '0',
                                        'class' => $zf_ot_modules[$i]['code'],
                                        'sort_order' => $zf_ot_modules[$i]['sort_order']);
          
                zen_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
          
                $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ORDERTOTAL_LINE_ITEM', $sql_data_array);
              }
          
              $customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';
              $sql_data_array = array('orders_id' => $insert_id,
                                      'orders_status_id' => $this->info['order_status'],
                                      'date_added' => 'now()',
                                      'customer_notified' => $customer_notification,
                                      'comments' => $this->info['comments']);
          
              zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
          
              $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ORDER_COMMENT', $sql_data_array);
          
              return($insert_id);
          
            }
          
          
            function  create_add_products($zf_insert_id, $zf_mode = false) {
              global $db, $currencies, $order_total_modules, $order_totals;
          
              // initialized for the email confirmation
              $this->products_ordered = '';
              $this->products_ordered_html = '';
              $this->subtotal = 0;
              $this->total_tax = 0;
          
              // lowstock email report
              $this->email_low_stock='';
          
              for ($i=0, $n=sizeof($this->products); $i<$n; $i++) {
                $custom_insertable_text = '';
                // Stock Update - Joao Correia
                if (STOCK_LIMITED == 'true') {
                  if (DOWNLOAD_ENABLED == 'true') {
                    $stock_query_raw = "select p.products_quantity, pad.products_attributes_filename, p.product_is_always_free_shipping
                                        from " . TABLE_PRODUCTS . " p
                                        left join " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                         on p.products_id=pa.products_id
                                        left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
                                         on pa.products_attributes_id=pad.products_attributes_id
                                        WHERE p.products_id = '" . zen_get_prid($this->products[$i]['id']) . "'";
          
                    // Will work with only one option for downloadable products
                    // otherwise, we have to build the query dynamically with a loop
                    $products_attributes = $this->products[$i]['attributes'];
                    if (is_array($products_attributes)) {
                      $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
                    }
                    $stock_values = $db->Execute($stock_query_raw);
                  } else {
                    $stock_values = $db->Execute("select * from " . TABLE_PRODUCTS . " where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
                  }
          
                  $this->notify('NOTIFY_ORDER_PROCESSING_STOCK_DECREMENT_BEGIN');
          
                  if ($stock_values->RecordCount() > 0) {
                    // do not decrement quantities if products_attributes_filename exists
                    if ((DOWNLOAD_ENABLED != 'true') || $stock_values->fields['product_is_always_free_shipping'] == 2 || (!$stock_values->fields['products_attributes_filename']) ) {
                      $stock_left = $stock_values->fields['products_quantity'] - $this->products[$i]['qty'];
                      $this->products[$i]['stock_reduce'] = $this->products[$i]['qty'];
                    } else {
                      $stock_left = $stock_values->fields['products_quantity'];
                    }
          
                    //            $this->products[$i]['stock_value'] = $stock_values->fields['products_quantity'];
          
                    $db->Execute("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
                    //        if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
                    if ($stock_left <= 0) {
                      // only set status to off when not displaying sold out
                      if (SHOW_PRODUCTS_SOLD_OUT == '0') {
                        $db->Execute("update " . TABLE_PRODUCTS . " set products_status = 0 where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
                      }
                    }
          
                    // for low stock email
                    if ( $stock_left <= STOCK_REORDER_LEVEL ) {
                      // WebMakers.com Added: add to low stock email
                      $this->email_low_stock .=  'ID# ' . zen_get_prid($this->products[$i]['id']) . "\t\t" . $this->products[$i]['model'] . "\t\t" . $this->products[$i]['name'] . "\t\t" . ' Qty Left: ' . $stock_left . "\n";
                    }
                  }
                }
          
                // Update products_ordered (for bestsellers list)
                //    $db->Execute("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . zen_get_prid($order->products[$i]['id']) . "'");
                $db->Execute("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%f', $this->products[$i]['qty']) . " where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
          
                $this->notify('NOTIFY_ORDER_PROCESSING_STOCK_DECREMENT_END');
          
                $sql_data_array = array('orders_id' => $zf_insert_id,
                                        'products_id' => zen_get_prid($this->products[$i]['id']),
                                        'products_model' => $this->products[$i]['model'],
                                        'products_name' => $this->products[$i]['name'],
                                        'products_price' => $this->products[$i]['price'],
                                        'final_price' => $this->products[$i]['final_price'],
                                        'onetime_charges' => $this->products[$i]['onetime_charges'],
                                        'products_tax' => $this->products[$i]['tax'],
                                        'products_quantity' => $this->products[$i]['qty'],
                                        'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'],
                                        'product_is_free' => $this->products[$i]['product_is_free'],
                                        'products_discount_type' => $this->products[$i]['products_discount_type'],
                                        'products_discount_type_from' => $this->products[$i]['products_discount_type_from'],
                                        'products_prid' => $this->products[$i]['id']);
                zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
          
                $order_products_id = $db->Insert_ID();
          
                $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_PRODUCT_LINE_ITEM', array_merge(array('orders_products_id' => $order_products_id), $sql_data_array));
          
                $this->notify('NOTIFY_ORDER_PROCESSING_CREDIT_ACCOUNT_UPDATE_BEGIN');
                $order_total_modules->update_credit_account($i);//ICW ADDED FOR CREDIT CLASS SYSTEM
          
                $this->notify('NOTIFY_ORDER_PROCESSING_ATTRIBUTES_BEGIN');
          
                //------ bof: insert customer-chosen options to order--------
                $attributes_exist = '0';
                $this->products_ordered_attributes = '';
                if (isset($this->products[$i]['attributes'])) {
                  $attributes_exist = '1';
                  for ($j=0, $n2=sizeof($this->products[$i]['attributes']); $j<$n2; $j++) {
                    if (DOWNLOAD_ENABLED == 'true') {
                      $attributes_query = "select popt.products_options_name, poval.products_options_values_name,
                                           pa.options_values_price, pa.price_prefix,
                                           pa.product_attribute_is_free, pa.products_attributes_weight, pa.products_attributes_weight_prefix,
                                           pa.attributes_discounted, pa.attributes_price_base_included, pa.attributes_price_onetime,
                                           pa.attributes_price_factor, pa.attributes_price_factor_offset,
                                           pa.attributes_price_factor_onetime, pa.attributes_price_factor_onetime_offset,
                                           pa.attributes_qty_prices, pa.attributes_qty_prices_onetime,
                                           pa.attributes_price_words, pa.attributes_price_words_free,
                                           pa.attributes_price_letters, pa.attributes_price_letters_free,
                                           pad.products_attributes_maxdays, pad.products_attributes_maxcount, pad.products_attributes_filename
                                           from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " .
                      TABLE_PRODUCTS_ATTRIBUTES . " pa
                                            left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
                                            on pa.products_attributes_id=pad.products_attributes_id
                                           where pa.products_id = '" . zen_db_input($this->products[$i]['id']) . "'
                                            and pa.options_id = '" . $this->products[$i]['attributes'][$j]['option_id'] . "'
                                            and pa.options_id = popt.products_options_id
                                            and pa.options_values_id = '" . $this->products[$i]['attributes'][$j]['value_id'] . "'
                                            and pa.options_values_id = poval.products_options_values_id
                                            and popt.language_id = '" . $_SESSION['languages_id'] . "'
                                            and poval.language_id = '" . $_SESSION['languages_id'] . "'";
          
                      $attributes_values = $db->Execute($attributes_query);
                    } else {
                      $attributes_values = $db->Execute("select popt.products_options_name, poval.products_options_values_name,
                                           pa.options_values_price, pa.price_prefix,
                                           pa.product_attribute_is_free, pa.products_attributes_weight, pa.products_attributes_weight_prefix,
                                           pa.attributes_discounted, pa.attributes_price_base_included, pa.attributes_price_onetime,
                                           pa.attributes_price_factor, pa.attributes_price_factor_offset,
                                           pa.attributes_price_factor_onetime, pa.attributes_price_factor_onetime_offset,
                                           pa.attributes_qty_prices, pa.attributes_qty_prices_onetime,
                                           pa.attributes_price_words, pa.attributes_price_words_free,
                                           pa.attributes_price_letters, pa.attributes_price_letters_free
                                           from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                           where pa.products_id = '" . $this->products[$i]['id'] . "' and pa.options_id = '" . (int)$this->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$this->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $_SESSION['languages_id'] . "' and poval.language_id = '" . $_SESSION['languages_id'] . "'");
                    }
          
                    //clr 030714 update insert query.  changing to use values form $order->products for products_options_values.
                    $sql_data_array = array('orders_id' => $zf_insert_id,
                                            'orders_products_id' => $order_products_id,
                                            'products_options' => $attributes_values->fields['products_options_name'],
          
                    //                                 'products_options_values' => $attributes_values->fields['products_options_values_name'],
                                            'products_options_values' => $this->products[$i]['attributes'][$j]['value'],
                                            'options_values_price' => $attributes_values->fields['options_values_price'],
                                            'price_prefix' => $attributes_values->fields['price_prefix'],
                                            'product_attribute_is_free' => $attributes_values->fields['product_attribute_is_free'],
                                            'products_attributes_weight' => $attributes_values->fields['products_attributes_weight'],
                                            'products_attributes_weight_prefix' => $attributes_values->fields['products_attributes_weight_prefix'],
                                            'attributes_discounted' => $attributes_values->fields['attributes_discounted'],
                                            'attributes_price_base_included' => $attributes_values->fields['attributes_price_base_included'],
                                            'attributes_price_onetime' => $attributes_values->fields['attributes_price_onetime'],
                                            'attributes_price_factor' => $attributes_values->fields['attributes_price_factor'],
                                            'attributes_price_factor_offset' => $attributes_values->fields['attributes_price_factor_offset'],
                                            'attributes_price_factor_onetime' => $attributes_values->fields['attributes_price_factor_onetime'],
                                            'attributes_price_factor_onetime_offset' => $attributes_values->fields['attributes_price_factor_onetime_offset'],
                                            'attributes_qty_prices' => $attributes_values->fields['attributes_qty_prices'],
                                            'attributes_qty_prices_onetime' => $attributes_values->fields['attributes_qty_prices_onetime'],
                                            'attributes_price_words' => $attributes_values->fields['attributes_price_words'],
                                            'attributes_price_words_free' => $attributes_values->fields['attributes_price_words_free'],
                                            'attributes_price_letters' => $attributes_values->fields['attributes_price_letters'],
                                            'attributes_price_letters_free' => $attributes_values->fields['attributes_price_letters_free'],
                                            'products_options_id' => (int)$this->products[$i]['attributes'][$j]['option_id'],
                                            'products_options_values_id' => (int)$this->products[$i]['attributes'][$j]['value_id'],
                                            'products_prid' => $this->products[$i]['id']
                                            );
          
          
                    zen_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
          
                    $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_LINE_ITEM', $sql_data_array);
          
                    if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values->fields['products_attributes_filename']) && zen_not_null($attributes_values->fields['products_attributes_filename'])) {
                      $sql_data_array = array('orders_id' => $zf_insert_id,
                                              'orders_products_id' => $order_products_id,
                                              'orders_products_filename' => $attributes_values->fields['products_attributes_filename'],
                                              'download_maxdays' => $attributes_values->fields['products_attributes_maxdays'],
                                              'download_count' => $attributes_values->fields['products_attributes_maxcount'],
                                              'products_prid' => $this->products[$i]['id']
                                              );
          
                      zen_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
          
                      $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_DOWNLOAD_LINE_ITEM', $sql_data_array);
                    }
                    $this->products_ordered_attributes .= "\n\t" . $attributes_values->fields['products_options_name'] . ' ' . zen_decode_specialchars($this->products[$i]['attributes'][$j]['value']);
                  }
                }
                //------eof: insert customer-chosen options ----
              $this->notify('NOTIFY_ORDER_PROCESSING_ATTRIBUTES_EXIST', $attributes_exist);
          
              $this->notify('NOTIFY_ORDER_DURING_CREATE_ADD_PRODUCTS', $custom_insertable_text);
          
          /* START: ADD MY CUSTOM DETAILS
           * 1. calculate/prepare custom information to be added to this product entry in order-confirmation, perhaps as a function call to custom code to build a serial number etc:
           *   Possible parameters to pass to custom functions at this point:
           *     Product ID ordered (for this line item): $this->products[$i]['id']
           *     Quantity ordered (of this line-item): $this->products[$i]['qty']
           *     Order number: $zf_insert_id
           *     Attribute Option Name ID: (int)$this->products[$i]['attributes'][$j]['option_id']
           *     Attribute Option Value ID: (int)$this->products[$i]['attributes'][$j]['value_id']
           *     Attribute Filename: $attributes_values->fields['products_attributes_filename']
           *
           * 2. Add that data to the $this->products_ordered_attributes variable, using this sort of format:
           *      $this->products_ordered_attributes .=  {INSERT CUSTOM INFORMATION HERE};
           */
          
              $this->products_ordered_attributes .= $custom_insertable_text;
          
          /* END: ADD MY CUSTOM DETAILS */
          
                // update totals counters
                $this->total_weight += ($this->products[$i]['qty'] * $this->products[$i]['weight']);
                $this->total_tax += zen_calculate_tax($total_products_price * $this->products[$i]['qty'], $products_tax);
                $this->total_cost += $total_products_price;
          
                $this->notify('NOTIFY_ORDER_PROCESSING_ONE_TIME_CHARGES_BEGIN');
          
                // build output for email notification
                $this->products_ordered .=  $this->products[$i]['qty'] . ' x ' . $this->products[$i]['name'] . ($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . ' = ' .
                $currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
                ($this->products[$i]['onetime_charges'] !=0 ? "\n" . TEXT_ONETIME_CHARGES_EMAIL . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
                $this->products_ordered_attributes . "\n";
                $this->products_ordered_html .=
                '<tr>' . "\n" .
                '<td class="product-details" align="right" valign="top" width="30">' . $this->products[$i]['qty'] . '&nbsp;x</td>' . "\n" .
                '<td class="product-details" valign="top">' . nl2br($this->products[$i]['name']) . ($this->products[$i]['model'] != '' ? ' (' . nl2br($this->products[$i]['model']) . ') ' : '') . "\n" .
                '<nobr>' .
                '<small><em> '. nl2br($this->products_ordered_attributes) .'</em></small>' .
                '</nobr>' .
                '</td>' . "\n" .
                '<td class="product-details-num" valign="top" align="right">' .
                $currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
                ($this->products[$i]['onetime_charges'] !=0 ?
                '</td></tr>' . "\n" . '<tr><td class="product-details">' . nl2br(TEXT_ONETIME_CHARGES_EMAIL) . '</td>' . "\n" .
                '<td>' . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
                '</td></tr>' . "\n";
              }
          
              $order_total_modules->apply_credit();//ICW ADDED FOR CREDIT CLASS SYSTEM
              $this->notify('NOTIFY_ORDER_AFTER_ORDER_CREATE_ADD_PRODUCTS');
            }
          
          
            function send_order_email($zf_insert_id, $zf_mode) {
              global $currencies, $order_totals;
              if ($this->email_low_stock != '' and SEND_LOWSTOCK_EMAIL=='1') {
                // send an email
                $email_low_stock = SEND_EXTRA_LOW_STOCK_EMAIL_TITLE . "\n\n" . $this->email_low_stock;
                zen_mail('', SEND_EXTRA_LOW_STOCK_EMAILS_TO, EMAIL_TEXT_SUBJECT_LOWSTOCK, $email_low_stock, STORE_OWNER, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => nl2br($email_low_stock)),'low_stock');
              }
          
              // lets start with the email confirmation
              // make an array to store the html version
              $html_msg=array();
          // COWOA:If COWOA and Send Order Status is True     
          
              if ($_SESSION['COWOA'] && (COWOA_ORDER_STATUS == 'true'))  {
              $htmlInvoiceURL=EMAIL_TEXT_INVOICE_URL_CLICK;;
              $htmlInvoiceValue=zen_href_link(FILENAME_ORDER_STATUS, 'order_id=' . $zf_insert_id, 'SSL', false);
              $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" .
             
          
           $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" .
              EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" .
              EMAIL_SEPARATOR . "\n" .
              EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" .
              EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" .
              EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ORDER_STATUS, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
              $html_msg['EMAIL_TEXT_HEADER']     = EMAIL_TEXT_HEADER;
              $html_msg['EMAIL_TEXT_FROM']       = EMAIL_TEXT_FROM;
              $html_msg['INTRO_STORE_NAME']      = STORE_NAME;
              $html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
              $html_msg['EMAIL_DETAILS_FOLLOW']  = EMAIL_DETAILS_FOLLOW;
              $html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
              $html_msg['INTRO_ORDER_NUMBER']    = $zf_insert_id;
              $html_msg['INTRO_DATE_TITLE']      = EMAIL_TEXT_DATE_ORDERED;
              $html_msg['INTRO_DATE_ORDERED']    = strftime(DATE_FORMAT_LONG);
              $html_msg['INTRO_URL_TEXT']        = EMAIL_TEXT_INVOICE_URL_CLICK;
              $html_msg['INTRO_URL_VALUE']       = zen_href_link(FILENAME_ORDER_STATUS, 'order_id=' . $zf_insert_id, 'SSL', false);
              }
              
          // COWOA:If COWOA but Send Order Status is False
              if ($_SESSION['COWOA'] && (COWOA_ORDER_STATUS == 'false')){
              $htmlInvoiceURL='';
              $htmlInvoiceValue='';
              $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" .
              $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" .
              EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" .
              EMAIL_SEPARATOR . "\n" .
              EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" .
              EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
              $html_msg['EMAIL_TEXT_HEADER']     = EMAIL_TEXT_HEADER;
              $html_msg['EMAIL_TEXT_FROM']       = EMAIL_TEXT_FROM;
              $html_msg['INTRO_STORE_NAME']      = STORE_NAME;
              $html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
              $html_msg['EMAIL_DETAILS_FOLLOW']  = EMAIL_DETAILS_FOLLOW;
              $html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
              $html_msg['INTRO_ORDER_NUMBER']    = $zf_insert_id;
              $html_msg['INTRO_DATE_TITLE']      = EMAIL_TEXT_DATE_ORDERED;
              $html_msg['INTRO_DATE_ORDERED']    = strftime(DATE_FORMAT_LONG);
              $html_msg['INTRO_URL_TEXT']        = '';
              $html_msg['INTRO_URL_VALUE']       = '';
              }
              // NO COWOA, so lets set up the Text and HTML E-mail Information for the Order History Info
           if (!$_SESSION['COWOA']){  
                $invoiceInfo=EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
                $htmlInvoiceURL=EMAIL_TEXT_INVOICE_URL_CLICK;;
                $htmlInvoiceValue=zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false);
          }  
                  //intro area
               $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n";
                 if ($this->customer['gender'] == "m") {
                $email_order .= EMAIL_GREETING_MR .' ' ;
               } else {
                $email_order .= EMAIL_GREETING_MS .' ' ;
                }
          
              $email_order .= $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" .
              EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" .
              EMAIL_SEPARATOR . "\n" .
              EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" .
              EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" .
              EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
              $html_msg['EMAIL_TEXT_HEADER']     = EMAIL_TEXT_HEADER;
              $html_msg['EMAIL_TEXT_FROM']       = EMAIL_TEXT_FROM;
              $html_msg['INTRO_STORE_NAME']      = STORE_NAME;
              $html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
              $html_msg['EMAIL_DETAILS_FOLLOW']  = EMAIL_DETAILS_FOLLOW;
              $html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
              $html_msg['INTRO_ORDER_NUMBER']    = $zf_insert_id;
              $html_msg['INTRO_DATE_TITLE']      = EMAIL_TEXT_DATE_ORDERED;
              $html_msg['INTRO_DATE_ORDERED']    = strftime(DATE_FORMAT_LONG);
              $html_msg['INTRO_URL_TEXT']        = EMAIL_TEXT_INVOICE_URL_CLICK;
              $html_msg['INTRO_URL_VALUE']       = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false);
            
              //comments area
              if ($this->info['comments']) {
                $email_order .= zen_db_output($this->info['comments']) . "\n\n";
                $html_msg['ORDER_COMMENTS'] = nl2br(zen_db_output($this->info['comments']));
              } else {
                $html_msg['ORDER_COMMENTS'] = '';
              }
          
              //products area
              $email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
              EMAIL_SEPARATOR . "\n" .
              $this->products_ordered .
              EMAIL_SEPARATOR . "\n";
              $html_msg['PRODUCTS_TITLE'] = EMAIL_TEXT_PRODUCTS;
              $html_msg['PRODUCTS_DETAIL']='<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2">' . $this->products_ordered_html . '</table>';
          
              //order totals area
              $html_ot = '<tr><td class="order-totals-text" align="right" width="100%">' . '&nbsp;' . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' .'</td> </tr>' . "\n";
              for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
                $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
                $html_ot .= '<tr><td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' .($order_totals[$i]['text']) .'</td> </tr>' . "\n";
              }
              $html_msg['ORDER_TOTALS'] = '<table border="0" width="100%" cellspacing="0" cellpadding="2"> ' . $html_ot . ' </table>';
          
              //addresses area: Delivery
              $html_msg['HEADING_ADDRESS_INFORMATION']= HEADING_ADDRESS_INFORMATION;
              $html_msg['ADDRESS_DELIVERY_TITLE']     = EMAIL_TEXT_DELIVERY_ADDRESS;
              $html_msg['ADDRESS_DELIVERY_DETAIL']    = ($this->content_type != 'virtual') ? zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, '', "<br />") : 'n/a';
              $html_msg['SHIPPING_METHOD_TITLE']      = HEADING_SHIPPING_METHOD;
              $html_msg['SHIPPING_METHOD_DETAIL']     = (zen_not_null($this->info['shipping_method'])) ? $this->info['shipping_method'] : 'n/a';
          
              if ($this->content_type != 'virtual') {
                $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .
                EMAIL_SEPARATOR . "\n" .
                zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n";
              }
          
              //addresses area: For COWOA - Billing info sent if the Cart has a dollar value otherwise, do not show the billing address
              if ($_SESSION['cart']->show_total() != 0) {
              $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
              EMAIL_SEPARATOR . "\n" .
              zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n";
              $html_msg['ADDRESS_BILLING_TITLE']   = EMAIL_TEXT_BILLING_ADDRESS;
              $html_msg['ADDRESS_BILLING_DETAIL']  = zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], true, '', "<br />");
              } else{
              $html_msg['ADDRESS_BILLING_TITLE']   = '';
              $html_msg['ADDRESS_BILLING_DETAIL']  = ' <br />';    
              }
                 
              if (is_object($GLOBALS[$_SESSION['payment']])) {
                $cc_num_display = (isset($this->info['cc_number']) && $this->info['cc_number'] != '') ? /*substr($this->info['cc_number'], 0, 4) . */ str_repeat('X', (strlen($this->info['cc_number']) - 8)) . substr($this->info['cc_number'], -4) . "\n\n" : '';
                $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
                EMAIL_SEPARATOR . "\n";
                $payment_class = $_SESSION['payment'];
                $email_order .= $GLOBALS[$payment_class]->title . "\n\n";
                $email_order .= (isset($this->info['cc_type']) && $this->info['cc_type'] != '') ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : '';
                $email_order .= ($GLOBALS[$payment_class]->email_footer) ? $GLOBALS[$payment_class]->email_footer . "\n\n" : '';
              } else {
                $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
                EMAIL_SEPARATOR . "\n";
                $email_order .= PAYMENT_METHOD_GV . "\n\n";
              }
              $html_msg['PAYMENT_METHOD_TITLE']  = EMAIL_TEXT_PAYMENT_METHOD;
              $html_msg['PAYMENT_METHOD_DETAIL'] = (is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->title : PAYMENT_METHOD_GV );
              $html_msg['PAYMENT_METHOD_FOOTER'] = (is_object($GLOBALS[$_SESSION['payment']]) && $GLOBALS[$payment_class]->email_footer != '') ? nl2br($GLOBALS[$payment_class]->email_footer) : (isset($this->info['cc_type']) && $this->info['cc_type'] != '' ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : '');
          
              // include disclaimer
              if (defined('EMAIL_DISCLAIMER') && EMAIL_DISCLAIMER != '') $email_order .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
              // include copyright
              if (defined('EMAIL_FOOTER_COPYRIGHT')) $email_order .= "\n-----\n" . EMAIL_FOOTER_COPYRIGHT . "\n\n";
          
              while (strstr($email_order, '&nbsp;')) $email_order = str_replace('&nbsp;', ' ', $email_order);
          
              if ($this->customer['gender'] == "m") {
                  $html_msg['EMAIL_GREETING'] = EMAIL_GREETING_MR;
              } else {
                  $html_msg['EMAIL_GREETING'] = EMAIL_GREETING_MS;
              }
              $html_msg['EMAIL_FIRST_NAME'] = $this->customer['firstname'];
              $html_msg['EMAIL_LAST_NAME'] = $this->customer['lastname'];
              //  $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
              $html_msg['EXTRA_INFO'] = '';
              $this->notify('NOTIFY_ORDER_INVOICE_CONTENT_READY_TO_SEND', array('zf_insert_id' => $zf_insert_id, 'text_email' => $email_order, 'html_email' => $html_msg));
              zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout', $this->attachArray);
              // BOF rl_invoice3
              $this->attachArray = array();
              if(RL_INVOICE3_SEND_PDF=='1'){
                  if(!(0==$this->info['total'] && RL_INVOICE3_NOT_NULL_INVOICE==0)){     
                      if( (defined('RL_INVOICE3_ORDERSTATUS')) && ($this->info['order_status'] >= RL_INVOICE3_ORDERSTATUS)) {
                          require_once(DIR_WS_INCLUDES . 'classes/class.rl_invoice3.php');
                          
                          $pdfT = new rl_invoice3($zf_insert_id, $paper['orientation'], $paper['unit'], $paper['format']);
                          $pdfT -> createPdfFile(true);
                          $this->attachArray = $pdfT->getPDFAttachments();
                          #$this->attachArray[] = array('file'=>$x, 'mime_type'=>'pdf');
                      }
                  }
              }
              zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout', $this->attachArray);
              // EOF rl_invoice3
              
              // send additional emails
              if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
                $extra_info=email_collect_extra_info('','', $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], $this->customer['telephone']);
                $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
          
                // include authcode and transaction id in admin-copy of email
                if ($GLOBALS[$_SESSION['payment']]->auth_code || $GLOBALS[$_SESSION['payment']]->transaction_id) {
                  $pmt_details = ($GLOBALS[$_SESSION['payment']]->auth_code != '' ? 'AuthCode: ' . $GLOBALS[$_SESSION['payment']]->auth_code . '  ' : '') . ($GLOBALS[$_SESSION['payment']]->transaction_id != '' ?  'TransID: ' . $GLOBALS[$_SESSION['payment']]->transaction_id : '') . "\n\n";
                  $email_order = $pmt_details . $email_order;
                  $html_msg['EMAIL_TEXT_HEADER'] = nl2br($pmt_details) . $html_msg['EMAIL_TEXT_HEADER'];
                }
                $this->notify('NOTIFY_ORDER_INVOICE_CONTENT_FOR_ADDITIONAL_EMAILS', array('zf_insert_id' => $zf_insert_id, 'text_email' => $email_order, 'html_email' => $html_msg));
          
                if(method_exists($pdfT, "getPDFAttachments")){
                  $this->attachArray = $pdfT->getPDFAttachments('NO');
                }
                zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
                $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray);
              }
              $this->notify('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL', array($zf_insert_id, $email_order, $extra_info, $html_msg));
            }
          
          }

          Kommentar


            #6
            Klammern am falschen Platz und ein zenmail zuviel.
            Korrekt gemerged wär es so:
            Code:
                <?php
                /**
                 * File contains the order-processing class ("order")
                 *
                 * @package classes
                 * @copyright Copyright 2003-2012 Zen Cart Development Team
                 * @license https://www.zen-cart-pro.at/license/2_0.txt GNU Public License V2.0
                 * @version $Id: order.php for COWOA 3.0, Buttonloesung und pdf Rechnung 3.1 ZC150 2012-08-25 12:01:03Z webchills $
                 */
                /**
                 * order class
                 *
                 * Handles all order-processing functions
                 *
                 * @package classes
                 */
                if (!defined('IS_ADMIN_FLAG')) {
                  die('Illegal Access');
                }
                class order extends base {
                  var $info, $totals, $products, $customer, $delivery, $content_type, $email_low_stock, $products_ordered_attributes,
                  $products_ordered, $products_ordered_email, $attachArray;
            
                  function order($order_id = '') {
                    $this->info = array();
                    $this->totals = array();
                    $this->products = array();
                    $this->customer = array();
                    $this->delivery = array();
            
                    if (zen_not_null($order_id)) {
                      $this->query($order_id);
                    } else {
                      $this->cart();
                    }
                  }
            
                  function query($order_id) {
                    global $db;
            
                    $order_id = zen_db_prepare_input($order_id);
            
                    $order_query = "select customers_id, customers_name, customers_company,
                                         customers_street_address, customers_suburb, customers_city,
                                         customers_postcode, customers_state, customers_country,
                                         customers_telephone, customers_email_address, customers_address_format_id,
                                         delivery_name, delivery_company, delivery_street_address, delivery_suburb,
                                         delivery_city, delivery_postcode, delivery_state, delivery_country,
                                         delivery_address_format_id, billing_name, billing_company,
                                         billing_street_address, billing_suburb, billing_city, billing_postcode,
                                         billing_state, billing_country, billing_address_format_id,
                                         payment_method, payment_module_code, shipping_method, shipping_module_code,
                                         coupon_code, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value,
                                         date_purchased, orders_status, last_modified, order_total, order_tax, ip_address ,COWOA_order
                                        from " . TABLE_ORDERS . "
                                        where orders_id = '" . (int)$order_id . "'";
            
                    $order = $db->Execute($order_query);
            
                    $totals_query = "select title, text, class
                                         from " . TABLE_ORDERS_TOTAL . "
                                         where orders_id = '" . (int)$order_id . "'
                                         order by sort_order";
            
                    $totals = $db->Execute($totals_query);
            
                    while (!$totals->EOF) {
            
            
                      if ($totals->fields['class'] == 'ot_coupon') {
                        $coupon_link_query = "SELECT coupon_id
                                from " . TABLE_COUPONS . "
                                where coupon_code ='" . $order->fields['coupon_code'] . "'";
                        $coupon_link = $db->Execute($coupon_link_query);
                        $zc_coupon_link = '<a href="javascript:couponpopupWindow(\'' . zen_href_link(FILENAME_POPUP_COUPON_HELP, 'cID=' . $coupon_link->fields['coupon_id']) . '\')">';
                      }
                      $this->totals[] = array('title' => ($totals->fields['class'] == 'ot_coupon' ? $zc_coupon_link . $totals->fields['title'] . '</a>' : $totals->fields['title']),
                                              'text' => $totals->fields['text'],
                                              'class' => $totals->fields['class']);
                      $totals->MoveNext();
                    }
            
                    $order_total_query = "select text, value
                                             from " . TABLE_ORDERS_TOTAL . "
                                             where orders_id = '" . (int)$order_id . "'
                                             and class = 'ot_total'";
            
            
                    $order_total = $db->Execute($order_total_query);
            
            
                    $shipping_method_query = "select title, value
                                                from " . TABLE_ORDERS_TOTAL . "
                                                where orders_id = '" . (int)$order_id . "'
                                                and class = 'ot_shipping'";
            
            
                    $shipping_method = $db->Execute($shipping_method_query);
            
                    $order_status_query = "select orders_status_name
                                             from " . TABLE_ORDERS_STATUS . "
                                             where orders_status_id = '" . $order->fields['orders_status'] . "'
                                             and language_id = '" . (int)$_SESSION['languages_id'] . "'";
            
                    $order_status = $db->Execute($order_status_query);
            
                    $this->info = array('currency' => $order->fields['currency'],
                                        'currency_value' => $order->fields['currency_value'],
                                        'payment_method' => $order->fields['payment_method'],
                                        'payment_module_code' => $order->fields['payment_module_code'],
                                        'shipping_method' => $order->fields['shipping_method'],
                                        'shipping_module_code' => $order->fields['shipping_module_code'],
                                        'coupon_code' => $order->fields['coupon_code'],
                                        'cc_type' => $order->fields['cc_type'],
                                        'cc_owner' => $order->fields['cc_owner'],
                                        'cc_number' => $order->fields['cc_number'],
                                        'cc_expires' => $order->fields['cc_expires'],
                                        'date_purchased' => $order->fields['date_purchased'],
                                        'orders_status' => $order_status->fields['orders_status_name'],
                                        'last_modified' => $order->fields['last_modified'],
                                        'total' => $order->fields['order_total'],
                                        'tax' => $order->fields['order_tax'],
                                        'ip_address' => $order->fields['ip_address']
                                        );
            
                    $this->customer = array('id' => $order->fields['customers_id'],
                                            'name' => $order->fields['customers_name'],
                                            'company' => $order->fields['customers_company'],
                                            'street_address' => $order->fields['customers_street_address'],
                                            'suburb' => $order->fields['customers_suburb'],
                                            'city' => $order->fields['customers_city'],
                                            'postcode' => $order->fields['customers_postcode'],
                                            'state' => $order->fields['customers_state'],
                                            'country' => $order->fields['customers_country'],
                                            'format_id' => $order->fields['customers_address_format_id'],
                                            'telephone' => $order->fields['customers_telephone'],
                                            'email_address' => $order->fields['customers_email_address']);
            
                    $this->delivery = array('name' => $order->fields['delivery_name'],
                                            'company' => $order->fields['delivery_company'],
                                            'street_address' => $order->fields['delivery_street_address'],
                                            'suburb' => $order->fields['delivery_suburb'],
                                            'city' => $order->fields['delivery_city'],
                                            'postcode' => $order->fields['delivery_postcode'],
                                            'state' => $order->fields['delivery_state'],
                                            'country' => $order->fields['delivery_country'],
                                            'format_id' => $order->fields['delivery_address_format_id']);
            
                    if (empty($this->delivery['name']) && empty($this->delivery['street_address'])) {
                      $this->delivery = false;
                    }
            
                    $this->billing = array('name' => $order->fields['billing_name'],
                                           'company' => $order->fields['billing_company'],
                                           'street_address' => $order->fields['billing_street_address'],
                                           'suburb' => $order->fields['billing_suburb'],
                                           'city' => $order->fields['billing_city'],
                                           'postcode' => $order->fields['billing_postcode'],
                                           'state' => $order->fields['billing_state'],
                                           'country' => $order->fields['billing_country'],
                                           'format_id' => $order->fields['billing_address_format_id']);
            
                    $index = 0;
                    $orders_products_query = "select orders_products_id, products_id, products_name,
                                                 products_model, products_price, products_tax,
                                                 products_quantity, final_price,
                                                 onetime_charges,
                                                 products_priced_by_attribute, product_is_free, products_discount_type,
                                                 products_discount_type_from
                                                  from " . TABLE_ORDERS_PRODUCTS . "
                                                  where orders_id = '" . (int)$order_id . "'
                                                  order by orders_products_id";
            
                    $orders_products = $db->Execute($orders_products_query);
            
                    while (!$orders_products->EOF) {
                      // convert quantity to proper decimals - account history
                      if (QUANTITY_DECIMALS != 0) {
                        $fix_qty = $orders_products->fields['products_quantity'];
                        switch (true) {
                          case (!strstr($fix_qty, '.')):
                          $new_qty = $fix_qty;
                          break;
                          default:
                          $new_qty = preg_replace('/[0]+$/', '', $orders_products->fields['products_quantity']);
                          break;
                        }
                      } else {
                        $new_qty = $orders_products->fields['products_quantity'];
                      }
            
                      $new_qty = round($new_qty, QUANTITY_DECIMALS);
            
                      if ($new_qty == (int)$new_qty) {
                        $new_qty = (int)$new_qty;
                      }
            
                      $this->products[$index] = array('qty' => $new_qty,
                                                      'id' => $orders_products->fields['products_id'],
                                                      'name' => $orders_products->fields['products_name'],
                                                      'model' => $orders_products->fields['products_model'],
                                                      'tax' => $orders_products->fields['products_tax'],
                                                      'price' => $orders_products->fields['products_price'],
                                                      'final_price' => $orders_products->fields['final_price'],
                                                      'onetime_charges' => $orders_products->fields['onetime_charges'],
                                                      'products_priced_by_attribute' => $orders_products->fields['products_priced_by_attribute'],
                                                      'product_is_free' => $orders_products->fields['product_is_free'],
                                                      'products_discount_type' => $orders_products->fields['products_discount_type'],
                                                      'products_discount_type_from' => $orders_products->fields['products_discount_type_from']);
            
                      $subindex = 0;
                      $attributes_query = "select products_options_id, products_options_values_id, products_options, products_options_values,
                                              options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . "
                                               where orders_id = '" . (int)$order_id . "'
                                               and orders_products_id = '" . (int)$orders_products->fields['orders_products_id'] . "'";
            
                      $attributes = $db->Execute($attributes_query);
                      if ($attributes->RecordCount()) {
                        while (!$attributes->EOF) {
                          $this->products[$index]['attributes'][$subindex] = array('option' => $attributes->fields['products_options'],
                                                                                   'value' => $attributes->fields['products_options_values'],
                                                                                   'option_id' => $attributes->fields['products_options_id'],
                                                                                   'value_id' => $attributes->fields['products_options_values_id'],
                                                                                   'prefix' => $attributes->fields['price_prefix'],
                                                                                   'price' => $attributes->fields['options_values_price']);
            
                          $subindex++;
                          $attributes->MoveNext();
                        }
                      }
            
                      $this->info['tax_groups']["{$this->products[$index]['tax']}"] = '1';
            
                      $index++;
                      $orders_products->MoveNext();
                    }
                  }
            
                  function cart() {
                    global $db, $currencies;
            
                    $decimals = $currencies->get_decimal_places($_SESSION['currency']);
                    $this->content_type = $_SESSION['cart']->get_content_type();
            
                    $customer_address_query = "select c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_telephone,
                                                    c.customers_email_address, ab.entry_company, ab.entry_street_address,
                                                    ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id,
                                                    z.zone_name, co.countries_id, co.countries_name,
                                                    co.countries_iso_code_2, co.countries_iso_code_3,
                                                    co.address_format_id, ab.entry_state
                                                   from (" . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab )
                                                   left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)
                                                   left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id)
                                                   where c.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                                   and ab.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                                   and c.customers_default_address_id = ab.address_book_id";
            
                    $customer_address = $db->Execute($customer_address_query);
            
                    $shipping_address_query = "select ab.entry_firstname, ab.entry_lastname, ab.entry_company,
                                                    ab.entry_street_address, ab.entry_suburb, ab.entry_postcode,
                                                    ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id,
                                                    c.countries_id, c.countries_name, c.countries_iso_code_2,
                                                    c.countries_iso_code_3, c.address_format_id, ab.entry_state
                                                   from " . TABLE_ADDRESS_BOOK . " ab
                                                   left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)
                                                   left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id)
                                                   where ab.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                                   and ab.address_book_id = '" . (int)$_SESSION['sendto'] . "'";
            
                    $shipping_address = $db->Execute($shipping_address_query);
            
                    $billing_address_query = "select ab.entry_firstname, ab.entry_lastname, ab.entry_company,
                                                   ab.entry_street_address, ab.entry_suburb, ab.entry_postcode,
                                                   ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id,
                                                   c.countries_id, c.countries_name, c.countries_iso_code_2,
                                                   c.countries_iso_code_3, c.address_format_id, ab.entry_state
                                                  from " . TABLE_ADDRESS_BOOK . " ab
                                                  left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)
                                                  left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id)
                                                  where ab.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                                  and ab.address_book_id = '" . (int)$_SESSION['billto'] . "'";
            
                    $billing_address = $db->Execute($billing_address_query);
            
                    // set default tax calculation for not-logged-in visitors
                    $taxCountryId = $taxZoneId = -1;
            
                    $tax_address_query = '';
                    switch (STORE_PRODUCT_TAX_BASIS) {
                      case 'Shipping':
            
                      $tax_address_query = "select ab.entry_country_id, ab.entry_zone_id
                                              from " . TABLE_ADDRESS_BOOK . " ab
                                              left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)
                                              where ab.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                              and ab.address_book_id = '" . (int)($this->content_type == 'virtual' ? $_SESSION['billto'] : $_SESSION['sendto']) . "'";
                      break;
                      case 'Billing':
            
                      $tax_address_query = "select ab.entry_country_id, ab.entry_zone_id
                                              from " . TABLE_ADDRESS_BOOK . " ab
                                              left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)
                                              where ab.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                              and ab.address_book_id = '" . (int)$_SESSION['billto'] . "'";
                      break;
                      case 'Store':
                      if ($billing_address->fields['entry_zone_id'] == STORE_ZONE) {
            
                        $tax_address_query = "select ab.entry_country_id, ab.entry_zone_id
                                                from " . TABLE_ADDRESS_BOOK . " ab
                                                left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)
                                                where ab.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                                and ab.address_book_id = '" . (int)$_SESSION['billto'] . "'";
                      } else {
                        $tax_address_query = "select ab.entry_country_id, ab.entry_zone_id
                                                from " . TABLE_ADDRESS_BOOK . " ab
                                                left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)
                                                where ab.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                                and ab.address_book_id = '" . (int)($this->content_type == 'virtual' ? $_SESSION['billto'] : $_SESSION['sendto']) . "'";
                      }
                    }
                    if ($tax_address_query != '') {
                      $tax_address = $db->Execute($tax_address_query);
                      if ($tax_address->recordCount() > 0) {
                        $taxCountryId = $tax_address->fields['entry_country_id'];
                        $taxZoneId = $tax_address->fields['entry_zone_id'];
                      }
                    }
            
                    $class =& $_SESSION['payment'];
            
                    if (isset($_SESSION['cc_id'])) {
                      $coupon_code_query = "select coupon_code
                                              from " . TABLE_COUPONS . "
                                              where coupon_id = '" . (int)$_SESSION['cc_id'] . "'";
            
                      $coupon_code = $db->Execute($coupon_code_query);
            
            
                    }
            
                    $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,
                                        'currency' => $_SESSION['currency'],
                                        'currency_value' => $currencies->currencies[$_SESSION['currency']]['value'],
                                        'payment_method' => $GLOBALS[$class]->title,
                                        'payment_module_code' => $GLOBALS[$class]->code,
                                        'coupon_code' => $coupon_code->fields['coupon_code'],
                    //                          'cc_type' => (isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : ''),
                    //                          'cc_owner' => (isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : ''),
                    //                          'cc_number' => (isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : ''),
                    //                          'cc_expires' => (isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : ''),
                    //                          'cc_cvv' => (isset($GLOBALS['cc_cvv']) ? $GLOBALS['cc_cvv'] : ''),
                                        'shipping_method' => (is_array($_SESSION['shipping']) ? $_SESSION['shipping']['title'] : $_SESSION['shipping']),
                                        'shipping_module_code' => (isset($_SESSION['shipping']['id']) && strpos($_SESSION['shipping']['id'], '_') > 0 ? $_SESSION['shipping']['id'] : $_SESSION['shipping']),
                                        'shipping_cost' => $_SESSION['shipping']['cost'],
                                        'subtotal' => 0,
                                        'shipping_tax' => 0,
                                        'tax' => 0,
                                        'total' => 0,
                                        'tax_groups' => array(),
                                        'comments' => (isset($_SESSION['comments']) ? $_SESSION['comments'] : ''),
                                        'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR']
                                        );
            
                    //print_r($GLOBALS[$class]);
                    //echo $class;
                    //print_r($GLOBALS);
                    //echo $_SESSION['payment'];
                    /*
                    // this is set above to the module filename it should be set to the module title like Checks/Money Order rather than moneyorder
                    if (isset($$_SESSION['payment']) && is_object($$_SESSION['payment'])) {
                    $this->info['payment_method'] = $$_SESSION['payment']->title;
                    }
                    */
            
                /*
                // bof: move below calculations
                    if ($this->info['total'] == 0) {
                      if (DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID == 0) {
                        $this->info['order_status'] = DEFAULT_ORDERS_STATUS_ID;
                      } else {
                        $this->info['order_status'] = DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID;
                      }
                    }
                    if (isset($GLOBALS[$class]) && is_object($GLOBALS[$class])) {
                      if ( isset($GLOBALS[$class]->order_status) && is_numeric($GLOBALS[$class]->order_status) && ($GLOBALS[$class]->order_status > 0) ) {
                        $this->info['order_status'] = $GLOBALS[$class]->order_status;
                      }
                    }
                // eof: move below calculations
            */
                    $this->customer = array('gender' => $customer_address->fields['customers_gender'],
                                                                    'firstname' => $customer_address->fields['customers_firstname'],
                                            'lastname' => $customer_address->fields['customers_lastname'],
                                            'company' => $customer_address->fields['entry_company'],
                                            'street_address' => $customer_address->fields['entry_street_address'],
                                            'suburb' => $customer_address->fields['entry_suburb'],
                                            'city' => $customer_address->fields['entry_city'],
                                            'postcode' => $customer_address->fields['entry_postcode'],
                                            'state' => ((zen_not_null($customer_address->fields['entry_state'])) ? $customer_address->fields['entry_state'] : $customer_address->fields['zone_name']),
                                            'zone_id' => $customer_address->fields['entry_zone_id'],
                                            'country' => array('id' => $customer_address->fields['countries_id'], 'title' => $customer_address->fields['countries_name'], 'iso_code_2' => $customer_address->fields['countries_iso_code_2'], 'iso_code_3' => $customer_address->fields['countries_iso_code_3']),
                                            'format_id' => (int)$customer_address->fields['address_format_id'],
                                            'telephone' => $customer_address->fields['customers_telephone'],
                                            'email_address' => $customer_address->fields['customers_email_address']);
            
                    $this->delivery = array('firstname' => $shipping_address->fields['entry_firstname'],
                                            'lastname' => $shipping_address->fields['entry_lastname'],
                                            'company' => $shipping_address->fields['entry_company'],
                                            'street_address' => $shipping_address->fields['entry_street_address'],
                                            'suburb' => $shipping_address->fields['entry_suburb'],
                                            'city' => $shipping_address->fields['entry_city'],
                                            'postcode' => $shipping_address->fields['entry_postcode'],
                                            'state' => ((zen_not_null($shipping_address->fields['entry_state'])) ? $shipping_address->fields['entry_state'] : $shipping_address->fields['zone_name']),
                                            'zone_id' => $shipping_address->fields['entry_zone_id'],
                                            'country' => array('id' => $shipping_address->fields['countries_id'], 'title' => $shipping_address->fields['countries_name'], 'iso_code_2' => $shipping_address->fields['countries_iso_code_2'], 'iso_code_3' => $shipping_address->fields['countries_iso_code_3']),
                                            'country_id' => $shipping_address->fields['entry_country_id'],
                                            'format_id' => (int)$shipping_address->fields['address_format_id']);
            
                    $this->billing = array('firstname' => $billing_address->fields['entry_firstname'],
                                           'lastname' => $billing_address->fields['entry_lastname'],
                                           'company' => $billing_address->fields['entry_company'],
                                           'street_address' => $billing_address->fields['entry_street_address'],
                                           'suburb' => $billing_address->fields['entry_suburb'],
                                           'city' => $billing_address->fields['entry_city'],
                                           'postcode' => $billing_address->fields['entry_postcode'],
                                           'state' => ((zen_not_null($billing_address->fields['entry_state'])) ? $billing_address->fields['entry_state'] : $billing_address->fields['zone_name']),
                                           'zone_id' => $billing_address->fields['entry_zone_id'],
                                           'country' => array('id' => $billing_address->fields['countries_id'], 'title' => $billing_address->fields['countries_name'], 'iso_code_2' => $billing_address->fields['countries_iso_code_2'], 'iso_code_3' => $billing_address->fields['countries_iso_code_3']),
                                           'country_id' => $billing_address->fields['entry_country_id'],
                                           'format_id' => (int)$billing_address->fields['address_format_id']);
            
                    $index = 0;
                    $products = $_SESSION['cart']->get_products();
                    for ($i=0, $n=sizeof($products); $i<$n; $i++) {
                      if (($i/2) == floor($i/2)) {
                        $rowClass="rowEven";
                      } else {
                        $rowClass="rowOdd";
                      }
                      $taxRates = zen_get_multiple_tax_rates($products[$i]['tax_class_id'], $taxCountryId, $taxZoneId);
                      $this->products[$index] = array('qty' => $products[$i]['quantity'],
                                                      'name' => $products[$i]['name'],
                                                      'merkmale' => $products[$i]['merkmale'],
                                                      'model' => $products[$i]['model'],
                                                      'image' => $products[$i]['image'],
                                                      'tax' => zen_get_tax_rate($products[$i]['tax_class_id'], $taxCountryId, $taxZoneId),
                                                      'tax_groups'=>$taxRates,
                                                      'tax_description' => zen_get_tax_description($products[$i]['tax_class_id'], $taxCountryId, $taxZoneId),
                                                      'price' => $products[$i]['price'],
                                                      'final_price' => $products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']),
                                                      'onetime_charges' => $_SESSION['cart']->attributes_price_onetime_charges($products[$i]['id'], $products[$i]['quantity']),
                                                      'weight' => $products[$i]['weight'],
                                                      'products_priced_by_attribute' => $products[$i]['products_priced_by_attribute'],
                                                      'product_is_free' => $products[$i]['product_is_free'],
                                                      'products_discount_type' => $products[$i]['products_discount_type'],
                                                      'products_discount_type_from' => $products[$i]['products_discount_type_from'],
                                                      'id' => $products[$i]['id'],
                                                      'rowClass' => $rowClass);
                      $this->notify('NOTIFY_ORDER_CART_ADD_PRODUCT_LIST', array('index'=>$index, 'products'=>$products[$i]));
                      if ($products[$i]['attributes']) {
                        $subindex = 0;
                        reset($products[$i]['attributes']);
                        while (list($option, $value) = each($products[$i]['attributes'])) {
                          /*
                          //clr 030714 Determine if attribute is a text attribute and change products array if it is.
                          if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID){
                          $attr_value = $products[$i]['attributes_values'][$option];
                          } else {
                          $attr_value = $attributes->fields['products_options_values_name'];
                          }
                          */
            
                          $attributes_query = "select popt.products_options_name, poval.products_options_values_name,
                                                          pa.options_values_price, pa.price_prefix
                                                   from " . TABLE_PRODUCTS_OPTIONS . " popt,
                                                        " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval,
                                                        " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                                   where pa.products_id = '" . (int)$products[$i]['id'] . "'
                                                   and pa.options_id = '" . (int)$option . "'
                                                   and pa.options_id = popt.products_options_id
                                                   and pa.options_values_id = '" . (int)$value . "'
                                                   and pa.options_values_id = poval.products_options_values_id
                                                   and popt.language_id = '" . (int)$_SESSION['languages_id'] . "'
                                                   and poval.language_id = '" . (int)$_SESSION['languages_id'] . "'";
            
                          $attributes = $db->Execute($attributes_query);
            
                          //clr 030714 Determine if attribute is a text attribute and change products array if it is.
                          if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID){
                            $attr_value = $products[$i]['attributes_values'][$option];
                          } else {
                            $attr_value = $attributes->fields['products_options_values_name'];
                          }
            
                          $this->products[$index]['attributes'][$subindex] = array('option' => $attributes->fields['products_options_name'],
                                                                                   'value' => $attr_value,
                                                                                   'option_id' => $option,
                                                                                   'value_id' => $value,
                                                                                   'prefix' => $attributes->fields['price_prefix'],
                                                                                   'price' => $attributes->fields['options_values_price']);
            
                          $this->notify('NOTIFY_ORDER_CART_ADD_ATTRIBUTE_LIST', array('index'=>$index, 'subindex'=>$subindex, 'products'=>$products[$i], 'attributes'=>$attributes));
                          $subindex++;
                        }
                      }
            
                      // add onetime charges here
                      //$_SESSION['cart']->attributes_price_onetime_charges($products[$i]['id'], $products[$i]['quantity'])
            
                      /*********************************************
                       * Calculate taxes for this product
                       *********************************************/
                      $shown_price = zen_round(zen_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) ,$decimals) * $this->products[$index]['qty'];
                      $shown_price +=  zen_round(zen_add_tax($this->products[$index]['onetime_charges'], $this->products[$index]['tax']), $decimals);
                      
                      $this->notify('NOTIFIY_ORDER_CART_SUBTOTAL_CALCULATE', array('shown_price'=>$shown_price));
                      // find product's tax rate and description
                      $products_tax = $this->products[$index]['tax'];
                      $products_tax_description = $this->products[$index]['tax_description'];
                      $this->info['subtotal'] += $shown_price;
                      $totalTaxAdd = 0;
                      foreach ($taxRates as $taxDescription=>$taxRate)
                      {
                        $taxAdd = 0;
                        if ($taxDescription == $products_tax_description)
                        {
                          if (DISPLAY_PRICE_WITH_TAX == 'true')
                          {
                            $taxAdd = zen_round($shown_price / (100 + $this->products[$index]['tax']) * $this->products[$index]['tax'], $decimals);
                          } else 
                          {
                              $taxAdd = zen_calculate_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
                                      +  zen_round(zen_calculate_tax($this->products[$index]['onetime_charges'], $this->products[$index]['tax']), $decimals);
                          }
                          if (isset($this->info['tax_groups'][$taxDescription]))
                          {
                            $this->info['tax_groups'][$taxDescription] += $taxAdd;
                          } else
                          {
                            $this->info['tax_groups'][$taxDescription] = $taxAdd;
                          }
                        }
                        $totalTaxAdd += $taxAdd;
                      }
                      $this->info['tax'] += $totalTaxAdd;
                      /*********************************************
                       * END: Calculate taxes for this product
                       *********************************************/
                      $index++;
                    }
            
                    // Update the final total to include tax if not already tax-inc
                    if (DISPLAY_PRICE_WITH_TAX == 'true') {
                      $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
                    } else {
                      $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
                    }
            
                /*
                // moved to function create
                    if ($this->info['total'] == 0) {
                      if (DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID == 0) {
                        $this->info['order_status'] = DEFAULT_ORDERS_STATUS_ID;
                      } else {
                        $this->info['order_status'] = DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID;
                      }
                    }
            */
                    if (isset($GLOBALS[$class]) && is_object($GLOBALS[$class])) {
                      if ( isset($GLOBALS[$class]->order_status) && is_numeric($GLOBALS[$class]->order_status) && ($GLOBALS[$class]->order_status > 0) ) {
                        $this->info['order_status'] = $GLOBALS[$class]->order_status;
                      }
                    }
                    $this->notify('NOTIFY_ORDER_CART_FINISHED');
                  }
            
                  function create($zf_ot_modules, $zf_mode = 2) {
                    global $db;
            
                    if ($this->info['total'] == 0) {
                      if (DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID == 0) {
                        $this->info['order_status'] = DEFAULT_ORDERS_STATUS_ID;
                      } else {
                        if ($_SESSION['payment'] != 'freecharger') {
                          $this->info['order_status'] = DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID;
                        }
                      }
                    }
            
                    if ($_SESSION['shipping'] == 'free_free') {
                      $this->info['shipping_module_code'] = $_SESSION['shipping'];
                    }
            
                    // Sanitize cc-num if present, using maximum 10 chars, with middle chars stripped out with XX
                    if (strlen($this->info['cc_number']) > 10) {
                      $cEnd = substr($this->info['cc_number'], -4);
                      $cOffset = strlen($this->info['cc_number']) -4;
                      $cStart = substr($this->info['cc_number'], 0, ($cOffset > 4 ? 4 : (int)$cOffset));
                      $this->info['cc_number'] = str_pad($cStart, 6, 'X') . $cEnd;
                    };
            
                    $sql_data_array = array('customers_id' => $_SESSION['customer_id'],
                                            'customers_name' => $this->customer['firstname'] . ' ' . $this->customer['lastname'],
                                            'customers_company' => $this->customer['company'],
                                            'customers_street_address' => $this->customer['street_address'],
                                            'customers_suburb' => $this->customer['suburb'],
                                            'customers_city' => $this->customer['city'],
                                            'customers_postcode' => $this->customer['postcode'],
                                            'customers_state' => $this->customer['state'],
                                            'customers_country' => $this->customer['country']['title'],
                                            'customers_telephone' => $this->customer['telephone'],
                                            'customers_email_address' => $this->customer['email_address'],
                                            'customers_address_format_id' => $this->customer['format_id'],
                                            'delivery_name' => $this->delivery['firstname'] . ' ' . $this->delivery['lastname'],
                                            'delivery_company' => $this->delivery['company'],
                                            'delivery_street_address' => $this->delivery['street_address'],
                                            'delivery_suburb' => $this->delivery['suburb'],
                                            'delivery_city' => $this->delivery['city'],
                                            'delivery_postcode' => $this->delivery['postcode'],
                                            'delivery_state' => $this->delivery['state'],
                                            'delivery_country' => $this->delivery['country']['title'],
                                            'delivery_address_format_id' => $this->delivery['format_id'],
                                            'billing_name' => $this->billing['firstname'] . ' ' . $this->billing['lastname'],
                                            'billing_company' => $this->billing['company'],
                                            'billing_street_address' => $this->billing['street_address'],
                                            'billing_suburb' => $this->billing['suburb'],
                                            'billing_city' => $this->billing['city'],
                                            'billing_postcode' => $this->billing['postcode'],
                                            'billing_state' => $this->billing['state'],
                                            'billing_country' => $this->billing['country']['title'],
                                            'billing_address_format_id' => $this->billing['format_id'],
                                            'payment_method' => (($this->info['payment_module_code'] == '' and $this->info['payment_method'] == '') ? PAYMENT_METHOD_GV : $this->info['payment_method']),
                                            'payment_module_code' => (($this->info['payment_module_code'] == '' and $this->info['payment_method'] == '') ? PAYMENT_MODULE_GV : $this->info['payment_module_code']),
                                            'shipping_method' => $this->info['shipping_method'],
                                            'shipping_module_code' => (strpos($this->info['shipping_module_code'], '_') > 0 ? substr($this->info['shipping_module_code'], 0, strpos($this->info['shipping_module_code'], '_')) : $this->info['shipping_module_code']),
                                            'coupon_code' => $this->info['coupon_code'],
                                            'cc_type' => $this->info['cc_type'],
                                            'cc_owner' => $this->info['cc_owner'],
                                            'cc_number' => $this->info['cc_number'],
                                            'cc_expires' => $this->info['cc_expires'],
                                            'date_purchased' => 'now()',
                                            'orders_status' => $this->info['order_status'],
                                            'order_total' => $this->info['total'],
                                            'order_tax' => $this->info['tax'],
                                            'currency' => $this->info['currency'],
                                            'currency_value' => $this->info['currency_value'],
                                            'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR']
                                            );
            
                    if ($_SESSION['COWOA']) $sql_data_array[COWOA_order] = 1;
            
                    zen_db_perform(TABLE_ORDERS, $sql_data_array);
            
                    $insert_id = $db->Insert_ID();
            
                    $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ORDER_HEADER', array_merge(array('orders_id' => $insert_id, 'shipping_weight' => $_SESSION['cart']->weight), $sql_data_array));
            
                    for ($i=0, $n=sizeof($zf_ot_modules); $i<$n; $i++) {
                      $sql_data_array = array('orders_id' => $insert_id,
                                              'title' => $zf_ot_modules[$i]['title'],
                                              'text' => $zf_ot_modules[$i]['text'],
                                              'value' => (is_numeric($zf_ot_modules[$i]['value'])) ? $zf_ot_modules[$i]['value'] : '0',
                                              'class' => $zf_ot_modules[$i]['code'],
                                              'sort_order' => $zf_ot_modules[$i]['sort_order']);
            
                      zen_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
            
                      $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ORDERTOTAL_LINE_ITEM', $sql_data_array);
                    }
            
                    $customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';
                    $sql_data_array = array('orders_id' => $insert_id,
                                            'orders_status_id' => $this->info['order_status'],
                                            'date_added' => 'now()',
                                            'customer_notified' => $customer_notification,
                                            'comments' => $this->info['comments']);
            
                    zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
            
                    $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ORDER_COMMENT', $sql_data_array);
            
                    return($insert_id);
            
                  }
            
            
                  function  create_add_products($zf_insert_id, $zf_mode = false) {
                    global $db, $currencies, $order_total_modules, $order_totals;
            
                    // initialized for the email confirmation
                    $this->products_ordered = '';
                    $this->products_ordered_html = '';
                    $this->subtotal = 0;
                    $this->total_tax = 0;
            
                    // lowstock email report
                    $this->email_low_stock='';
            
                    for ($i=0, $n=sizeof($this->products); $i<$n; $i++) {
                      $custom_insertable_text = '';
                      // Stock Update - Joao Correia
                      if (STOCK_LIMITED == 'true') {
                        if (DOWNLOAD_ENABLED == 'true') {
                          $stock_query_raw = "select p.products_quantity, pad.products_attributes_filename, p.product_is_always_free_shipping
                                              from " . TABLE_PRODUCTS . " p
                                              left join " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                               on p.products_id=pa.products_id
                                              left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
                                               on pa.products_attributes_id=pad.products_attributes_id
                                              WHERE p.products_id = '" . zen_get_prid($this->products[$i]['id']) . "'";
            
                          // Will work with only one option for downloadable products
                          // otherwise, we have to build the query dynamically with a loop
                          $products_attributes = $this->products[$i]['attributes'];
                          if (is_array($products_attributes)) {
                            $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
                          }
                          $stock_values = $db->Execute($stock_query_raw);
                        } else {
                          $stock_values = $db->Execute("select * from " . TABLE_PRODUCTS . " where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
                        }
            
                        $this->notify('NOTIFY_ORDER_PROCESSING_STOCK_DECREMENT_BEGIN');
            
                        if ($stock_values->RecordCount() > 0) {
                          // do not decrement quantities if products_attributes_filename exists
                          if ((DOWNLOAD_ENABLED != 'true') || $stock_values->fields['product_is_always_free_shipping'] == 2 || (!$stock_values->fields['products_attributes_filename']) ) {
                            $stock_left = $stock_values->fields['products_quantity'] - $this->products[$i]['qty'];
                            $this->products[$i]['stock_reduce'] = $this->products[$i]['qty'];
                          } else {
                            $stock_left = $stock_values->fields['products_quantity'];
                          }
            
                          //            $this->products[$i]['stock_value'] = $stock_values->fields['products_quantity'];
            
                          $db->Execute("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
                          //        if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
                          if ($stock_left <= 0) {
                            // only set status to off when not displaying sold out
                            if (SHOW_PRODUCTS_SOLD_OUT == '0') {
                              $db->Execute("update " . TABLE_PRODUCTS . " set products_status = 0 where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
                            }
                          }
            
                          // for low stock email
                          if ( $stock_left <= STOCK_REORDER_LEVEL ) {
                            // WebMakers.com Added: add to low stock email
                            $this->email_low_stock .=  'ID# ' . zen_get_prid($this->products[$i]['id']) . "\t\t" . $this->products[$i]['model'] . "\t\t" . $this->products[$i]['name'] . "\t\t" . ' Qty Left: ' . $stock_left . "\n";
                          }
                        }
                      }
            
                      // Update products_ordered (for bestsellers list)
                      //    $db->Execute("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . zen_get_prid($order->products[$i]['id']) . "'");
                      $db->Execute("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%f', $this->products[$i]['qty']) . " where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
            
                      $this->notify('NOTIFY_ORDER_PROCESSING_STOCK_DECREMENT_END');
            
                      $sql_data_array = array('orders_id' => $zf_insert_id,
                                              'products_id' => zen_get_prid($this->products[$i]['id']),
                                              'products_model' => $this->products[$i]['model'],
                                              'products_name' => $this->products[$i]['name'],
                                              'products_price' => $this->products[$i]['price'],
                                              'final_price' => $this->products[$i]['final_price'],
                                              'onetime_charges' => $this->products[$i]['onetime_charges'],
                                              'products_tax' => $this->products[$i]['tax'],
                                              'products_quantity' => $this->products[$i]['qty'],
                                              'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'],
                                              'product_is_free' => $this->products[$i]['product_is_free'],
                                              'products_discount_type' => $this->products[$i]['products_discount_type'],
                                              'products_discount_type_from' => $this->products[$i]['products_discount_type_from'],
                                              'products_prid' => $this->products[$i]['id']);
                      zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
            
                      $order_products_id = $db->Insert_ID();
            
                      $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_PRODUCT_LINE_ITEM', array_merge(array('orders_products_id' => $order_products_id), $sql_data_array));
            
                      $this->notify('NOTIFY_ORDER_PROCESSING_CREDIT_ACCOUNT_UPDATE_BEGIN');
                      $order_total_modules->update_credit_account($i);//ICW ADDED FOR CREDIT CLASS SYSTEM
            
                      $this->notify('NOTIFY_ORDER_PROCESSING_ATTRIBUTES_BEGIN');
            
                      //------ bof: insert customer-chosen options to order--------
                      $attributes_exist = '0';
                      $this->products_ordered_attributes = '';
                      if (isset($this->products[$i]['attributes'])) {
                        $attributes_exist = '1';
                        for ($j=0, $n2=sizeof($this->products[$i]['attributes']); $j<$n2; $j++) {
                          if (DOWNLOAD_ENABLED == 'true') {
                            $attributes_query = "select popt.products_options_name, poval.products_options_values_name,
                                                 pa.options_values_price, pa.price_prefix,
                                                 pa.product_attribute_is_free, pa.products_attributes_weight, pa.products_attributes_weight_prefix,
                                                 pa.attributes_discounted, pa.attributes_price_base_included, pa.attributes_price_onetime,
                                                 pa.attributes_price_factor, pa.attributes_price_factor_offset,
                                                 pa.attributes_price_factor_onetime, pa.attributes_price_factor_onetime_offset,
                                                 pa.attributes_qty_prices, pa.attributes_qty_prices_onetime,
                                                 pa.attributes_price_words, pa.attributes_price_words_free,
                                                 pa.attributes_price_letters, pa.attributes_price_letters_free,
                                                 pad.products_attributes_maxdays, pad.products_attributes_maxcount, pad.products_attributes_filename
                                                 from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " .
                            TABLE_PRODUCTS_ATTRIBUTES . " pa
                                                  left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
                                                  on pa.products_attributes_id=pad.products_attributes_id
                                                 where pa.products_id = '" . zen_db_input($this->products[$i]['id']) . "'
                                                  and pa.options_id = '" . $this->products[$i]['attributes'][$j]['option_id'] . "'
                                                  and pa.options_id = popt.products_options_id
                                                  and pa.options_values_id = '" . $this->products[$i]['attributes'][$j]['value_id'] . "'
                                                  and pa.options_values_id = poval.products_options_values_id
                                                  and popt.language_id = '" . $_SESSION['languages_id'] . "'
                                                  and poval.language_id = '" . $_SESSION['languages_id'] . "'";
            
                            $attributes_values = $db->Execute($attributes_query);
                          } else {
                            $attributes_values = $db->Execute("select popt.products_options_name, poval.products_options_values_name,
                                                 pa.options_values_price, pa.price_prefix,
                                                 pa.product_attribute_is_free, pa.products_attributes_weight, pa.products_attributes_weight_prefix,
                                                 pa.attributes_discounted, pa.attributes_price_base_included, pa.attributes_price_onetime,
                                                 pa.attributes_price_factor, pa.attributes_price_factor_offset,
                                                 pa.attributes_price_factor_onetime, pa.attributes_price_factor_onetime_offset,
                                                 pa.attributes_qty_prices, pa.attributes_qty_prices_onetime,
                                                 pa.attributes_price_words, pa.attributes_price_words_free,
                                                 pa.attributes_price_letters, pa.attributes_price_letters_free
                                                 from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
                                                 where pa.products_id = '" . $this->products[$i]['id'] . "' and pa.options_id = '" . (int)$this->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$this->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $_SESSION['languages_id'] . "' and poval.language_id = '" . $_SESSION['languages_id'] . "'");
                          }
            
                          //clr 030714 update insert query.  changing to use values form $order->products for products_options_values.
                          $sql_data_array = array('orders_id' => $zf_insert_id,
                                                  'orders_products_id' => $order_products_id,
                                                  'products_options' => $attributes_values->fields['products_options_name'],
            
                          //                                 'products_options_values' => $attributes_values->fields['products_options_values_name'],
                                                  'products_options_values' => $this->products[$i]['attributes'][$j]['value'],
                                                  'options_values_price' => $attributes_values->fields['options_values_price'],
                                                  'price_prefix' => $attributes_values->fields['price_prefix'],
                                                  'product_attribute_is_free' => $attributes_values->fields['product_attribute_is_free'],
                                                  'products_attributes_weight' => $attributes_values->fields['products_attributes_weight'],
                                                  'products_attributes_weight_prefix' => $attributes_values->fields['products_attributes_weight_prefix'],
                                                  'attributes_discounted' => $attributes_values->fields['attributes_discounted'],
                                                  'attributes_price_base_included' => $attributes_values->fields['attributes_price_base_included'],
                                                  'attributes_price_onetime' => $attributes_values->fields['attributes_price_onetime'],
                                                  'attributes_price_factor' => $attributes_values->fields['attributes_price_factor'],
                                                  'attributes_price_factor_offset' => $attributes_values->fields['attributes_price_factor_offset'],
                                                  'attributes_price_factor_onetime' => $attributes_values->fields['attributes_price_factor_onetime'],
                                                  'attributes_price_factor_onetime_offset' => $attributes_values->fields['attributes_price_factor_onetime_offset'],
                                                  'attributes_qty_prices' => $attributes_values->fields['attributes_qty_prices'],
                                                  'attributes_qty_prices_onetime' => $attributes_values->fields['attributes_qty_prices_onetime'],
                                                  'attributes_price_words' => $attributes_values->fields['attributes_price_words'],
                                                  'attributes_price_words_free' => $attributes_values->fields['attributes_price_words_free'],
                                                  'attributes_price_letters' => $attributes_values->fields['attributes_price_letters'],
                                                  'attributes_price_letters_free' => $attributes_values->fields['attributes_price_letters_free'],
                                                  'products_options_id' => (int)$this->products[$i]['attributes'][$j]['option_id'],
                                                  'products_options_values_id' => (int)$this->products[$i]['attributes'][$j]['value_id'],
                                                  'products_prid' => $this->products[$i]['id']
                                                  );
            
            
                          zen_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
            
                          $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_LINE_ITEM', $sql_data_array);
            
                          if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values->fields['products_attributes_filename']) && zen_not_null($attributes_values->fields['products_attributes_filename'])) {
                            $sql_data_array = array('orders_id' => $zf_insert_id,
                                                    'orders_products_id' => $order_products_id,
                                                    'orders_products_filename' => $attributes_values->fields['products_attributes_filename'],
                                                    'download_maxdays' => $attributes_values->fields['products_attributes_maxdays'],
                                                    'download_count' => $attributes_values->fields['products_attributes_maxcount'],
                                                    'products_prid' => $this->products[$i]['id']
                                                    );
            
                            zen_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
            
                            $this->notify('NOTIFY_ORDER_DURING_CREATE_ADDED_ATTRIBUTE_DOWNLOAD_LINE_ITEM', $sql_data_array);
                          }
                          $this->products_ordered_attributes .= "\n\t" . $attributes_values->fields['products_options_name'] . ' ' . zen_decode_specialchars($this->products[$i]['attributes'][$j]['value']);
                        }
                      }
                      //------eof: insert customer-chosen options ----
                    $this->notify('NOTIFY_ORDER_PROCESSING_ATTRIBUTES_EXIST', $attributes_exist);
            
                    $this->notify('NOTIFY_ORDER_DURING_CREATE_ADD_PRODUCTS', $custom_insertable_text);
            
                /* START: ADD MY CUSTOM DETAILS
                 * 1. calculate/prepare custom information to be added to this product entry in order-confirmation, perhaps as a function call to custom code to build a serial number etc:
                 *   Possible parameters to pass to custom functions at this point:
                 *     Product ID ordered (for this line item): $this->products[$i]['id']
                 *     Quantity ordered (of this line-item): $this->products[$i]['qty']
                 *     Order number: $zf_insert_id
                 *     Attribute Option Name ID: (int)$this->products[$i]['attributes'][$j]['option_id']
                 *     Attribute Option Value ID: (int)$this->products[$i]['attributes'][$j]['value_id']
                 *     Attribute Filename: $attributes_values->fields['products_attributes_filename']
                 *
                 * 2. Add that data to the $this->products_ordered_attributes variable, using this sort of format:
                 *      $this->products_ordered_attributes .=  {INSERT CUSTOM INFORMATION HERE};
                 */
            
                    $this->products_ordered_attributes .= $custom_insertable_text;
            
                /* END: ADD MY CUSTOM DETAILS */
            
                      // update totals counters
                      $this->total_weight += ($this->products[$i]['qty'] * $this->products[$i]['weight']);
                      $this->total_tax += zen_calculate_tax($total_products_price * $this->products[$i]['qty'], $products_tax);
                      $this->total_cost += $total_products_price;
            
                      $this->notify('NOTIFY_ORDER_PROCESSING_ONE_TIME_CHARGES_BEGIN');
            
                      // build output for email notification
                      $this->products_ordered .=  $this->products[$i]['qty'] . ' x ' . $this->products[$i]['name'] . ($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . ' = ' .
                      $currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
                      ($this->products[$i]['onetime_charges'] !=0 ? "\n" . TEXT_ONETIME_CHARGES_EMAIL . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
                      $this->products_ordered_attributes . "\n";
                      $this->products_ordered_html .=
                      '<tr>' . "\n" .
                      '<td class="product-details" align="right" valign="top" width="30">' . $this->products[$i]['qty'] . '&nbsp;x</td>' . "\n" .
                      '<td class="product-details" valign="top">' . nl2br($this->products[$i]['name']) . ($this->products[$i]['model'] != '' ? ' (' . nl2br($this->products[$i]['model']) . ') ' : '') . "\n" .
                      '<nobr>' .
                      '<small><em> '. nl2br($this->products_ordered_attributes) .'</em></small>' .
                      '</nobr>' .
                      '</td>' . "\n" .
                      '<td class="product-details-num" valign="top" align="right">' .
                      $currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
                      ($this->products[$i]['onetime_charges'] !=0 ?
                      '</td></tr>' . "\n" . '<tr><td class="product-details">' . nl2br(TEXT_ONETIME_CHARGES_EMAIL) . '</td>' . "\n" .
                      '<td>' . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
                      '</td></tr>' . "\n";
                    }
            
                    $order_total_modules->apply_credit();//ICW ADDED FOR CREDIT CLASS SYSTEM
                    $this->notify('NOTIFY_ORDER_AFTER_ORDER_CREATE_ADD_PRODUCTS');
                  }
            
            
                  function send_order_email($zf_insert_id, $zf_mode) {
                    global $currencies, $order_totals;
                    if ($this->email_low_stock != '' and SEND_LOWSTOCK_EMAIL=='1') {
                      // send an email
                      $email_low_stock = SEND_EXTRA_LOW_STOCK_EMAIL_TITLE . "\n\n" . $this->email_low_stock;
                      zen_mail('', SEND_EXTRA_LOW_STOCK_EMAILS_TO, EMAIL_TEXT_SUBJECT_LOWSTOCK, $email_low_stock, STORE_OWNER, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => nl2br($email_low_stock)),'low_stock');
                    }
            
                    // lets start with the email confirmation
                    // make an array to store the html version
                    $html_msg=array();
                // COWOA:If COWOA and Send Order Status is True     
            
                    if ($_SESSION['COWOA'] && (COWOA_ORDER_STATUS == 'true'))  {
                    $htmlInvoiceURL=EMAIL_TEXT_INVOICE_URL_CLICK;;
                    $htmlInvoiceValue=zen_href_link(FILENAME_ORDER_STATUS, 'order_id=' . $zf_insert_id, 'SSL', false);
                    $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" .
                   
            
                 $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" .
                    EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" .
                    EMAIL_SEPARATOR . "\n" .
                    EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" .
                    EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" .
                    EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ORDER_STATUS, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
                    $html_msg['EMAIL_TEXT_HEADER']     = EMAIL_TEXT_HEADER;
                    $html_msg['EMAIL_TEXT_FROM']       = EMAIL_TEXT_FROM;
                    $html_msg['INTRO_STORE_NAME']      = STORE_NAME;
                    $html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
                    $html_msg['EMAIL_DETAILS_FOLLOW']  = EMAIL_DETAILS_FOLLOW;
                    $html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
                    $html_msg['INTRO_ORDER_NUMBER']    = $zf_insert_id;
                    $html_msg['INTRO_DATE_TITLE']      = EMAIL_TEXT_DATE_ORDERED;
                    $html_msg['INTRO_DATE_ORDERED']    = strftime(DATE_FORMAT_LONG);
                    $html_msg['INTRO_URL_TEXT']        = EMAIL_TEXT_INVOICE_URL_CLICK;
                    $html_msg['INTRO_URL_VALUE']       = zen_href_link(FILENAME_ORDER_STATUS, 'order_id=' . $zf_insert_id, 'SSL', false);
                    }
                    
                // COWOA:If COWOA but Send Order Status is False
                    if ($_SESSION['COWOA'] && (COWOA_ORDER_STATUS == 'false')){
                    $htmlInvoiceURL='';
                    $htmlInvoiceValue='';
                    $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" .
                    $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" .
                    EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" .
                    EMAIL_SEPARATOR . "\n" .
                    EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" .
                    EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
                    $html_msg['EMAIL_TEXT_HEADER']     = EMAIL_TEXT_HEADER;
                    $html_msg['EMAIL_TEXT_FROM']       = EMAIL_TEXT_FROM;
                    $html_msg['INTRO_STORE_NAME']      = STORE_NAME;
                    $html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
                    $html_msg['EMAIL_DETAILS_FOLLOW']  = EMAIL_DETAILS_FOLLOW;
                    $html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
                    $html_msg['INTRO_ORDER_NUMBER']    = $zf_insert_id;
                    $html_msg['INTRO_DATE_TITLE']      = EMAIL_TEXT_DATE_ORDERED;
                    $html_msg['INTRO_DATE_ORDERED']    = strftime(DATE_FORMAT_LONG);
                    $html_msg['INTRO_URL_TEXT']        = '';
                    $html_msg['INTRO_URL_VALUE']       = '';
                    }
                    // NO COWOA, so lets set up the Text and HTML E-mail Information for the Order History Info
                 if (!$_SESSION['COWOA']){  
                      $invoiceInfo=EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
                      $htmlInvoiceURL=EMAIL_TEXT_INVOICE_URL_CLICK;;
                      $htmlInvoiceValue=zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false);
               
                        //intro area
                     $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n";
                       if ($this->customer['gender'] == "m") {
                      $email_order .= EMAIL_GREETING_MR .' ' ;
                     } else {
                      $email_order .= EMAIL_GREETING_MS .' ' ;
                      }
            
                    $email_order .= $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" .
                    EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" .
                    EMAIL_SEPARATOR . "\n" .
                    EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" .
                    EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" .
                    EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n";
                    $html_msg['EMAIL_TEXT_HEADER']     = EMAIL_TEXT_HEADER;
                    $html_msg['EMAIL_TEXT_FROM']       = EMAIL_TEXT_FROM;
                    $html_msg['INTRO_STORE_NAME']      = STORE_NAME;
                    $html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING;
                    $html_msg['EMAIL_DETAILS_FOLLOW']  = EMAIL_DETAILS_FOLLOW;
                    $html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER;
                    $html_msg['INTRO_ORDER_NUMBER']    = $zf_insert_id;
                    $html_msg['INTRO_DATE_TITLE']      = EMAIL_TEXT_DATE_ORDERED;
                    $html_msg['INTRO_DATE_ORDERED']    = strftime(DATE_FORMAT_LONG);
                    $html_msg['INTRO_URL_TEXT']        = EMAIL_TEXT_INVOICE_URL_CLICK;
                    $html_msg['INTRO_URL_VALUE']       = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false);
              }
                    //comments area
                    if ($this->info['comments']) {
                      $email_order .= zen_db_output($this->info['comments']) . "\n\n";
                      $html_msg['ORDER_COMMENTS'] = nl2br(zen_db_output($this->info['comments']));
                    } else {
                      $html_msg['ORDER_COMMENTS'] = '';
                    }
            
                    //products area
                    $email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
                    EMAIL_SEPARATOR . "\n" .
                    $this->products_ordered .
                    EMAIL_SEPARATOR . "\n";
                    $html_msg['PRODUCTS_TITLE'] = EMAIL_TEXT_PRODUCTS;
                    $html_msg['PRODUCTS_DETAIL']='<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2">' . $this->products_ordered_html . '</table>';
            
                    //order totals area
                    $html_ot = '<tr><td class="order-totals-text" align="right" width="100%">' . '&nbsp;' . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' .'</td> </tr>' . "\n";
                    for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
                      $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
                      $html_ot .= '<tr><td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' .($order_totals[$i]['text']) .'</td> </tr>' . "\n";
                    }
                    $html_msg['ORDER_TOTALS'] = '<table border="0" width="100%" cellspacing="0" cellpadding="2"> ' . $html_ot . ' </table>';
            
                    //addresses area: Delivery
                    $html_msg['HEADING_ADDRESS_INFORMATION']= HEADING_ADDRESS_INFORMATION;
                    $html_msg['ADDRESS_DELIVERY_TITLE']     = EMAIL_TEXT_DELIVERY_ADDRESS;
                    $html_msg['ADDRESS_DELIVERY_DETAIL']    = ($this->content_type != 'virtual') ? zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, '', "<br />") : 'n/a';
                    $html_msg['SHIPPING_METHOD_TITLE']      = HEADING_SHIPPING_METHOD;
                    $html_msg['SHIPPING_METHOD_DETAIL']     = (zen_not_null($this->info['shipping_method'])) ? $this->info['shipping_method'] : 'n/a';
            
                    if ($this->content_type != 'virtual') {
                      $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .
                      EMAIL_SEPARATOR . "\n" .
                      zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n";
                    }
            
                    //addresses area: For COWOA - Billing info sent if the Cart has a dollar value otherwise, do not show the billing address
                    if ($_SESSION['cart']->show_total() != 0) {
                    $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                    EMAIL_SEPARATOR . "\n" .
                    zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n";
                    $html_msg['ADDRESS_BILLING_TITLE']   = EMAIL_TEXT_BILLING_ADDRESS;
                    $html_msg['ADDRESS_BILLING_DETAIL']  = zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], true, '', "<br />");
                    } else{
                    $html_msg['ADDRESS_BILLING_TITLE']   = '';
                    $html_msg['ADDRESS_BILLING_DETAIL']  = ' <br />';    
                    }
                       
                    if (is_object($GLOBALS[$_SESSION['payment']])) {
                      $cc_num_display = (isset($this->info['cc_number']) && $this->info['cc_number'] != '') ? /*substr($this->info['cc_number'], 0, 4) . */ str_repeat('X', (strlen($this->info['cc_number']) - 8)) . substr($this->info['cc_number'], -4) . "\n\n" : '';
                      $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
                      EMAIL_SEPARATOR . "\n";
                      $payment_class = $_SESSION['payment'];
                      $email_order .= $GLOBALS[$payment_class]->title . "\n\n";
                      $email_order .= (isset($this->info['cc_type']) && $this->info['cc_type'] != '') ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : '';
                      $email_order .= ($GLOBALS[$payment_class]->email_footer) ? $GLOBALS[$payment_class]->email_footer . "\n\n" : '';
                    } else {
                      $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
                      EMAIL_SEPARATOR . "\n";
                      $email_order .= PAYMENT_METHOD_GV . "\n\n";
                    }
                    $html_msg['PAYMENT_METHOD_TITLE']  = EMAIL_TEXT_PAYMENT_METHOD;
                    $html_msg['PAYMENT_METHOD_DETAIL'] = (is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->title : PAYMENT_METHOD_GV );
                    $html_msg['PAYMENT_METHOD_FOOTER'] = (is_object($GLOBALS[$_SESSION['payment']]) && $GLOBALS[$payment_class]->email_footer != '') ? nl2br($GLOBALS[$payment_class]->email_footer) : (isset($this->info['cc_type']) && $this->info['cc_type'] != '' ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : '');
            
                    // include disclaimer
                    if (defined('EMAIL_DISCLAIMER') && EMAIL_DISCLAIMER != '') $email_order .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
                    // include copyright
                    if (defined('EMAIL_FOOTER_COPYRIGHT')) $email_order .= "\n-----\n" . EMAIL_FOOTER_COPYRIGHT . "\n\n";
            
                    while (strstr($email_order, '&nbsp;')) $email_order = str_replace('&nbsp;', ' ', $email_order);
            
                    if ($this->customer['gender'] == "m") {
                        $html_msg['EMAIL_GREETING'] = EMAIL_GREETING_MR;
                    } else {
                        $html_msg['EMAIL_GREETING'] = EMAIL_GREETING_MS;
                    }
                    $html_msg['EMAIL_FIRST_NAME'] = $this->customer['firstname'];
                    $html_msg['EMAIL_LAST_NAME'] = $this->customer['lastname'];
                    //  $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER;
                    $html_msg['EXTRA_INFO'] = '';
                    $this->notify('NOTIFY_ORDER_INVOICE_CONTENT_READY_TO_SEND', array('zf_insert_id' => $zf_insert_id, 'text_email' => $email_order, 'html_email' => $html_msg));
                    // BOF rl_invoice3
                    $this->attachArray = array();
                    if(RL_INVOICE3_SEND_PDF=='1'){
                        if(!(0==$this->info['total'] && RL_INVOICE3_NOT_NULL_INVOICE==0)){     
                            if( (defined('RL_INVOICE3_ORDERSTATUS')) && ($this->info['order_status'] >= RL_INVOICE3_ORDERSTATUS)) {
                                require_once(DIR_WS_INCLUDES . 'classes/class.rl_invoice3.php');
                                
                                $pdfT = new rl_invoice3($zf_insert_id, $paper['orientation'], $paper['unit'], $paper['format']);
                                $pdfT -> createPdfFile(true);
                                $this->attachArray = $pdfT->getPDFAttachments();
                                #$this->attachArray[] = array('file'=>$x, 'mime_type'=>'pdf');
                            }
                        }
                    }
                    zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout', $this->attachArray);
                    // EOF rl_invoice3
                    
                    // send additional emails
                    if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
                      $extra_info=email_collect_extra_info('','', $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], $this->customer['telephone']);
                      $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
            
                      // include authcode and transaction id in admin-copy of email
                      if ($GLOBALS[$_SESSION['payment']]->auth_code || $GLOBALS[$_SESSION['payment']]->transaction_id) {
                        $pmt_details = ($GLOBALS[$_SESSION['payment']]->auth_code != '' ? 'AuthCode: ' . $GLOBALS[$_SESSION['payment']]->auth_code . '  ' : '') . ($GLOBALS[$_SESSION['payment']]->transaction_id != '' ?  'TransID: ' . $GLOBALS[$_SESSION['payment']]->transaction_id : '') . "\n\n";
                        $email_order = $pmt_details . $email_order;
                        $html_msg['EMAIL_TEXT_HEADER'] = nl2br($pmt_details) . $html_msg['EMAIL_TEXT_HEADER'];
                      }
                      $this->notify('NOTIFY_ORDER_INVOICE_CONTENT_FOR_ADDITIONAL_EMAILS', array('zf_insert_id' => $zf_insert_id, 'text_email' => $email_order, 'html_email' => $html_msg));
            
                      if(method_exists($pdfT, "getPDFAttachments")){
                        $this->attachArray = $pdfT->getPDFAttachments('NO');
                      }
                      zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
                      $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray);
                    }
                    $this->notify('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL', array($zf_insert_id, $email_order, $extra_info, $html_msg));
                  }
            
                }

            Kommentar


              #7
              Jepp,

              jetzt funktioniert es.


              Danke für die schnelle Hilfe.

              Es wäre wirklich eine große Erleichterung, wenn grundsätzliche Module direkt in ZenCart eingebunden wären.

              COWOA, PDF-Rechnung, Image-Handler und Paket-Tracking hat doch eh fast jeder in seinem Shop. Sollten sie dann wirklich nicht benötigt werden kann man sie ja "stumm" schalten.

              Grüße und noch ein schönen Wochenende.
              Manfred

              Kommentar


                #8
                Hallo webchills,

                ich habe hier noch ein kleines Problem. Jedesmal wenn ich den Status einer Bestellung im Admin-Bereich ändere stehen im kleinen Fenster unten links immer ZWEI Einträge.

                Wo muß ich den Fehler suchen?

                Klicke auf die Grafik für eine vergrößerte Ansicht

Name: fehler.jpg
Ansichten: 1
Größe: 104,6 KB
ID: 102832

                Grüße und Danke
                Manfred

                Kommentar


                  #9
                  Es wäre wirklich eine große Erleichterung, wenn grundsätzliche Module direkt in ZenCart eingebunden wären. COWOA, PDF-Rechnung, Image-Handler und Paket-Tracking hat doch eh fast jeder in seinem Shop. Sollten sie dann wirklich nicht benötigt werden kann man sie ja "stumm" schalten.
                  Dann müsste es aber auch für all diese Module einen "Stummschalter" geben so ähnlich wie beim Buttonlösungsmodul. Das bläht den Grundcode extrem auf und fragt dann ständig ab, ob vielleicht das und das aktiv ist. Nicht jeder Shop benötigt diese Funktionen. Alle Adminfunktionen dieser Module müssten für User, die das nicht brauchen versteckt werden. Ein Downloadshop z.B. hat keine Freude mit irgendwelchen Paket-Tracking Eingabefeldern. Ein Update der Grundinstallation würde damit ebenfalls bedeutend schwieriger.

                  Der Grund für Deine doppelten Einträge liegt auch hier im falschen Mergen von Dateien. Wenn Du Paket Tracking, COWOA, pdf Rechnung und was weiss ich noch alles kombinierst, dann geht es nicht ohne sorgfältiges Mergen.

                  All diese Module ändern die DEINADMIN/orders.php und die solltest Du Dir genauer anschauen.

                  Das beste Tool dazu ist BeyondCompare.
                  Wenn Du Deinen Shop stark modifizierst und das alles selbst machen willst, dann geht es nicht ohne das. Wenn das Schwierigkeiten macht, dann wäre es ratsamer solche Dinge an Dienstleister auszulagern.

                  Kommentar


                    #10
                    Auch auf die Gefahr hin das ich nerve.

                    Ich finde da nichts was da nicht paßt. Zumindest nach meinem Vergleich.

                    Entsteht durch diese Datei denn der zweite Eintrag im Adminbereich?


                    MeinAdmin/orders.php

                    Code:
                    <?php
                    /**
                     * @package admin
                     * @copyright Copyright 2003-2011 Zen Cart Development Team
                     * @copyright Portions Copyright 2003 osCommerce
                     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
                     * @version $Id: orders.php for COWOA 3.0 ZC150 2011-11-28 11:12:51Z webchills $
                     */
                    
                      require('includes/application_top.php');
                    
                      require(DIR_WS_CLASSES . 'currencies.php');
                      $currencies = new currencies();
                    
                      if (isset($_GET['oID'])) $_GET['oID'] = (int)$_GET['oID'];
                      if (isset($_GET['download_reset_on'])) $_GET['download_reset_on'] = (int)$_GET['download_reset_on'];
                      if (isset($_GET['download_reset_off'])) $_GET['download_reset_off'] = (int)$_GET['download_reset_off'];
                    
                      include(DIR_WS_CLASSES . 'order.php');
                    
                      // prepare order-status pulldown list
                      $orders_statuses = array();
                      $orders_status_array = array();
                      $orders_status = $db->Execute("select orders_status_id, orders_status_name
                                                     from " . TABLE_ORDERS_STATUS . "
                                                     where language_id = '" . (int)$_SESSION['languages_id'] . "' order by orders_status_id");
                      while (!$orders_status->EOF) {
                        $orders_statuses[] = array('id' => $orders_status->fields['orders_status_id'],
                                                   'text' => $orders_status->fields['orders_status_name'] . ' [' . $orders_status->fields['orders_status_id'] . ']');
                        $orders_status_array[$orders_status->fields['orders_status_id']] = $orders_status->fields['orders_status_name'];
                        $orders_status->MoveNext();
                      }
                    
                      $action = (isset($_GET['action']) ? $_GET['action'] : '');
                      $order_exists = false;
                      if (isset($_GET['oID']) && trim($_GET['oID']) == '') unset($_GET['oID']);
                      if ($action == 'edit' && !isset($_GET['oID'])) $action = '';
                    
                      $oID = FALSE;
                      if (isset($_POST['oID'])) {
                        $oID = zen_db_prepare_input(trim($_POST['oID']));
                      } elseif (isset($_GET['oID'])) {
                        $oID = zen_db_prepare_input(trim($_GET['oID']));
                      }
                      if ($oID) {
                        $orders = $db->Execute("select orders_id from " . TABLE_ORDERS . "
                                                where orders_id = '" . (int)$oID . "'");
                        $order_exists = true;
                        if ($orders->RecordCount() <= 0) {
                          $order_exists = false;
                          if ($action != '') $messageStack->add_session(ERROR_ORDER_DOES_NOT_EXIST . ' ' . $oID, 'error');
                          zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')), 'NONSSL'));
                        }
                      }
                    
                      if (zen_not_null($action) && $order_exists == true) {
                        switch ($action) {
                          case 'edit':
                          // reset single download to on
                            if ($_GET['download_reset_on'] > 0) {
                              // adjust download_maxdays based on current date
                              $check_status = $db->Execute("select customers_name, customers_email_address, orders_status,
                                                          date_purchased, COWOA_order from " . TABLE_ORDERS . "
                                                          where orders_id = '" . $_GET['oID'] . "'");
                    
                              // check for existing product attribute download days and max
                              $chk_products_download_query = "SELECT orders_products_id, orders_products_filename, products_prid from " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " WHERE orders_products_download_id='" . $_GET['download_reset_on'] . "'";
                              $chk_products_download = $db->Execute($chk_products_download_query);
                    
                              $chk_products_download_time_query = "SELECT pa.products_attributes_id, pa.products_id, pad.products_attributes_filename, pad.products_attributes_maxdays, pad.products_attributes_maxcount
                              from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
                              WHERE pa.products_attributes_id = pad.products_attributes_id
                              and pad.products_attributes_filename = '" . $chk_products_download->fields['orders_products_filename'] . "'
                              and pa.products_id = '" . (int)$chk_products_download->fields['products_prid'] . "'";
                    
                              $chk_products_download_time = $db->Execute($chk_products_download_time_query);
                    
                              if ($chk_products_download_time->EOF) {
                                $zc_max_days = (DOWNLOAD_MAX_DAYS == 0 ? 0 : zen_date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + DOWNLOAD_MAX_DAYS);
                                $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . DOWNLOAD_MAX_COUNT . "' where orders_id='" . $_GET['oID'] . "' and orders_products_download_id='" . $_GET['download_reset_on'] . "'";
                              } else {
                                $zc_max_days = ($chk_products_download_time->fields['products_attributes_maxdays'] == 0 ? 0 : zen_date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + $chk_products_download_time->fields['products_attributes_maxdays']);
                                $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . $chk_products_download_time->fields['products_attributes_maxcount'] . "' where orders_id='" . $_GET['oID'] . "' and orders_products_download_id='" . $_GET['download_reset_on'] . "'";
                              }
                    
                              $db->Execute($update_downloads_query);
                              unset($_GET['download_reset_on']);
                    
                              $messageStack->add_session(SUCCESS_ORDER_UPDATED_DOWNLOAD_ON, 'success');
                              zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
                            }
                          // reset single download to off
                            if ($_GET['download_reset_off'] > 0) {
                              // adjust download_maxdays based on current date
                              // *** fix: adjust count not maxdays to cancel download
                    //          $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='0', download_count='0' where orders_id='" . $_GET['oID'] . "' and orders_products_download_id='" . $_GET['download_reset_off'] . "'";
                              $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_count='0' where orders_id='" . $_GET['oID'] . "' and orders_products_download_id='" . $_GET['download_reset_off'] . "'";
                              $db->Execute($update_downloads_query);
                              unset($_GET['download_reset_off']);
                    
                              $messageStack->add_session(SUCCESS_ORDER_UPDATED_DOWNLOAD_OFF, 'success');
                              zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
                            }
                          break;
                          case 'update_order':
                            // demo active test
                            if (zen_admin_demo()) {
                              $_GET['action']= '';
                              $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
                              zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
                            }
                            $oID = zen_db_prepare_input($_GET['oID']);
                    // Begin Paket Tracking 2.1
                            $track_id1 = str_replace(" ", "", zen_db_prepare_input($_POST['track_id1']));
                            $track_id2 = str_replace(" ", "", zen_db_prepare_input($_POST['track_id2']));
                            $track_id3 = str_replace(" ", "", zen_db_prepare_input($_POST['track_id3']));
                            $track_id4 = str_replace(" ", "", zen_db_prepare_input($_POST['track_id4']));
                            $track_id5 = str_replace(" ", "", zen_db_prepare_input($_POST['track_id5']));
                    // End Paket Tracking 2.1
                            $comments = zen_db_prepare_input($_POST['comments']);
                            $status = (int)zen_db_prepare_input($_POST['status']);
                            if ($status < 1) break;
                    
                            $order_updated = false;
                            $check_status = $db->Execute("select customers_name, customers_email_address, orders_status,
                                                          date_purchased, COWOA_order from " . TABLE_ORDERS . "
                                                          where orders_id = '" . (int)$oID . "'");
                     
                           // BOF rl_incoice3                                       
                            $rlStat = explode('|', RL_INVOICE3_SEND_ORDERSTATUS_CHANGE);
                            $rl_invoice3_send = in_array($status, $rlStat);
                            if ( ($check_status->fields['orders_status'] != $status  && $status==RL_INVOICE3_ORDERSTATUS)  || ($rl_invoice3_send == true)){
                                require_once (DIR_FS_CATALOG . DIR_WS_INCLUDES . 'classes/class.rl_invoice3.php');     
                                require_once ('../' . DIR_WS_LANGUAGES . $_SESSION['language'] . '/extra_definitions/rl_invoice3.php');
                                $paper = rl_invoice3::getDefault(RL_INVOICE3_PAPER, array('format' => 'A4', 'unit' => 'mm', 'orientation' => 'P'));
                                $pdfT = new rl_invoice3($oID, $paper['orientation'], $paper['unit'], $paper['format']);
                                $pdfT->createPdfFile(true);
                                $attach = $pdfT->getPDFAttachments('ALL');
                            } else {
                                $attach = null;
                            }
                            // EOF rl_incoice3
                            if ( ($check_status->fields['orders_status'] != $status) || zen_not_null($comments)) {
                              $db->Execute("update " . TABLE_ORDERS . "
                                            set orders_status = '" . zen_db_input($status) . "', last_modified = now()
                                            where orders_id = '" . (int)$oID . "'");
                    
                              $customer_notified = '0';
                              if (isset($_POST['notify']) && ($_POST['notify'] == '1')) {
                    
                             $notify_comments = '';
                    // Begin Paket Tracking 2.1
                                if (isset($_POST['notify_comments']) && ($_POST['notify_comments'] == 'on')) {
                                  if (zen_not_null($comments)) {
                                    $notify_comments = EMAIL_TEXT_COMMENTS_UPDATE . $comments . "\n\n";
                                  }
                                  if (zen_not_null($track_id1)) { $notify_comments .= "\n" .PT_EMAIL_YOURID ." " . CARRIER_NAME_1 . " Tracking ID " .PT_EMAIL_YOURIDIS ." " . $track_id1 . " \n\n<br />" .PT_EMAIL_LINKINFO ." \n<br />" . CARRIER_LINK_1 . $track_id1 . "\n\n<br />" .PT_EMAIL_24HOURS ."" . "\n\n<br />"; }
                                  if (zen_not_null($track_id2)) { $notify_comments .= "\n" .PT_EMAIL_YOURID ." " . CARRIER_NAME_2 . " Tracking ID " .PT_EMAIL_YOURIDIS ." " . $track_id2 . " \n\n<br />" .PT_EMAIL_LINKINFO ." \n<br />" . CARRIER_LINK_2 . $track_id2 . "\n\n<br />" .PT_EMAIL_24HOURS ."" . "\n\n<br />"; }
                                  if (zen_not_null($track_id3)) { $notify_comments .= "\n" .PT_EMAIL_YOURID ." " . CARRIER_NAME_3 . " Tracking ID " .PT_EMAIL_YOURIDIS ." " . $track_id3 . " \n\n<br />" .PT_EMAIL_LINKINFO ." \n<br />" . CARRIER_LINK_3 . $track_id3 . "\n\n<br />" .PT_EMAIL_24HOURS ."" . "\n\n<br />"; }
                                  if (zen_not_null($track_id4)) { $notify_comments .= "\n" .PT_EMAIL_YOURID ." " . CARRIER_NAME_4 . " Tracking ID " .PT_EMAIL_YOURIDIS ." " . $track_id4 . " \n\n<br />" .PT_EMAIL_LINKINFO ." \n<br />" . CARRIER_LINK_4 . $track_id4 . "\n\n<br />" .PT_EMAIL_24HOURS ."" . "\n\n<br />"; }
                                  if (zen_not_null($track_id5)) { $notify_comments .= "\n" .PT_EMAIL_YOURID ." " . CARRIER_NAME_5 . " Tracking ID " .PT_EMAIL_YOURIDIS ." " . $track_id5 . " \n\n<br />" .PT_EMAIL_LINKINFO ." \n<br />" . CARRIER_LINK_5 . $track_id5 . "\n\n<br />" .PT_EMAIL_24HOURS ."" . "\n\n<br />"; }
                    // End Paket Tracking 2.1
                              }
                    //send emails
                    
                    
                    // BOF COWOA SEND ORDER_STATUS EMAIL
                    if (COWOA_ORDER_STATUS == 'true') {
                        if ($check_status->fields['COWOA_order'] == 1)  {
                      
                    
                    
                                $message =
                                EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n\n" .
                                EMAIL_TEXT_COWOA_URL . ' ' . zen_catalog_href_link(FILENAME_ORDER_STATUS, 'order_id=' . $oID, 'SSL') . "\n\n" .
                                EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
                          strip_tags($notify_comments) .
                          EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) .
                          EMAIL_TEXT_STATUS_PLEASE_REPLY;
                    
                              $html_msg['EMAIL_CUSTOMERS_NAME']    = $check_status->fields['customers_name'];
                              $html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID;
                              $html_msg['EMAIL_TEXT_INVOICE_URL']  = '<a href="' . zen_catalog_href_link(FILENAME_ORDER_STATUS, 'order_id=' . $oID, 'SSL') .'">'.str_replace(':','',EMAIL_TEXT_COWOA_URL).'</a>';
                              $html_msg['EMAIL_TEXT_DATE_ORDERED'] = EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']);
                              $html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments);
                              $html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace('\n','', EMAIL_TEXT_STATUS_UPDATED);
                              $html_msg['EMAIL_TEXT_STATUS_LABEL'] = str_replace('\n','', sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ));
                              $html_msg['EMAIL_TEXT_NEW_STATUS'] = $orders_status_array[$status];
                              $html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace('\n','', EMAIL_TEXT_STATUS_PLEASE_REPLY);
                    
                    
                                zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status');
                                $customer_notified = '1';
                              }
                        } 
                    if (COWOA_ORDER_STATUS == 'false') {
                          if ($check_status->fields['COWOA_order'] == 1)  {
                    
                              $htmlInvoiceURL='';
                              $htmlInvoiceValue='';
                              $message =
                              EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n\n" .
                              EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
                              strip_tags($notify_comments) .
                              EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) .
                              EMAIL_TEXT_STATUS_PLEASE_REPLY;
                              $html_msg['EMAIL_CUSTOMERS_NAME']    = $check_status->fields['customers_name'];
                              $html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID;
                              $html_msg['INTRO_URL_TEXT']        = '';
                              $html_msg['INTRO_URL_VALUE']       = '';
                              $html_msg['EMAIL_TEXT_DATE_ORDERED'] = EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']);
                              $html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments);
                              $html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace('\n','', EMAIL_TEXT_STATUS_UPDATED);
                              $html_msg['EMAIL_TEXT_STATUS_LABEL'] = str_replace('\n','', sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ));
                              $html_msg['EMAIL_TEXT_NEW_STATUS'] = $orders_status_array[$status];
                              $html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace('\n','', EMAIL_TEXT_STATUS_PLEASE_REPLY);
                    
                                zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status');
                                $customer_notified = '1';
                              }    
                        }
                    // EOF COWOA SEND ORDER_STATUS EMAIL    
                        if ($check_status->fields['COWOA_order'] != 1)  {
                                $message =
                                EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n\n" .
                                EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n\n" .
                                EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
                          strip_tags($notify_comments) .
                          EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) .
                          EMAIL_TEXT_STATUS_PLEASE_REPLY;
                    
                              $html_msg['EMAIL_CUSTOMERS_NAME']    = $check_status->fields['customers_name'];
                              $html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID;
                              $html_msg['EMAIL_TEXT_INVOICE_URL']  = '<a href="' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') .'">'.str_replace(':','',EMAIL_TEXT_INVOICE_URL).'</a>';
                              $html_msg['EMAIL_TEXT_DATE_ORDERED'] = EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']);
                              $html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments);
                              $html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace('\n','', EMAIL_TEXT_STATUS_UPDATED);
                              $html_msg['EMAIL_TEXT_STATUS_LABEL'] = str_replace('\n','', sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ));
                              $html_msg['EMAIL_TEXT_NEW_STATUS'] = $orders_status_array[$status];
                              $html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace('\n','', EMAIL_TEXT_STATUS_PLEASE_REPLY);
                              $html_msg['EMAIL_PAYPAL_TRANSID'] = '';
                    
                                zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status');
                                $customer_notified = '1';
                    
                                // PayPal Trans ID, if any
                                $sql = "select txn_id, parent_txn_id from " . TABLE_PAYPAL . " where order_id = :orderID order by last_modified DESC, date_added DESC, parent_txn_id DESC, paypal_ipn_id DESC ";
                                $sql = $db->bindVars($sql, ':orderID', $oID, 'integer');
                                $result = $db->Execute($sql);
                                if ($result->RecordCount() > 0) {
                                  $message .= "\n\n" . ' PayPal Trans ID: ' . $result->fields['txn_id'];
                                  $html_msg['EMAIL_PAYPAL_TRANSID'] = $result->fields['txn_id'];
                                }
                    
                                //send extra emails
                                if (SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_STATUS == '1' and SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO != '') {
                                  zen_mail('', SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO, SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status_extra');
                                }
                              } elseif (isset($_POST['notify']) && ($_POST['notify'] == '-1')) {
                                // hide comment
                                $customer_notified = '-1';
                              }
                    
                              $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
                                          (orders_id, orders_status_id, date_added, customer_notified, comments)
                                          values ('" . (int)$oID . "',
                                          '" . zen_db_input($status) . "',
                                          now(),
                                          '" . zen_db_input($customer_notified) . "',
                                          '" . zen_db_input($comments)  . "')");
                              $order_updated = true;
                         
                    // Begin Paket Tracking 2.1
                              $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
                                          (orders_id, orders_status_id, date_added, customer_notified, track_id1, track_id2, track_id3, track_id4, track_id5, comments)
                                          values ('" . (int)$oID . "',
                                          '" . zen_db_input($status) . "',
                                          now(),
                                          '" . zen_db_input($customer_notified) . "',
                                          '" . zen_db_input($track_id1) . "',
                                          '" . zen_db_input($track_id2) . "',
                                          '" . zen_db_input($track_id3) . "',
                                          '" . zen_db_input($track_id4) . "',
                                          '" . zen_db_input($track_id5) . "',
                                          '" . zen_db_input($comments)  . "')");
                              $order_updated = true;
                            }
                    // End Paket Tracking 2.1
                            // trigger any appropriate updates which should be sent back to the payment gateway:
                            $order = new order((int)$oID);
                            if ($order->info['payment_module_code']) {
                              if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) {
                                require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php');
                                require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
                                $module = new $order->info['payment_module_code'];
                                if (method_exists($module, '_doStatusUpdate')) {
                                  $response = $module->_doStatusUpdate($oID, $status, $comments, $customer_notified, $check_status->fields['orders_status']);
                                }
                              }
                            }
                            if ($order_updated == true) {
                             if ($status == DOWNLOADS_ORDERS_STATUS_UPDATED_VALUE) {
                                // adjust download_maxdays based on current date
                                $chk_downloads_query = "SELECT opd.*, op.products_id from " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd, " . TABLE_ORDERS_PRODUCTS . " op
                                                        WHERE op.orders_id='" . (int)$oID . "'
                                                        and opd.orders_products_id = op.orders_products_id";
                                $chk_downloads = $db->Execute($chk_downloads_query);
                    
                                while (!$chk_downloads->EOF) {
                                  $chk_products_download_time_query = "SELECT pa.products_attributes_id, pa.products_id, pad.products_attributes_filename, pad.products_attributes_maxdays, pad.products_attributes_maxcount
                                                                        from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
                                                                        WHERE pa.products_attributes_id = pad.products_attributes_id
                                                                        and pad.products_attributes_filename = '" . $chk_downloads->fields['orders_products_filename'] . "'
                                                                        and pa.products_id = '" . $chk_downloads->fields['products_id'] . "'";
                    
                                  $chk_products_download_time = $db->Execute($chk_products_download_time_query);
                    
                                  if ($chk_products_download_time->EOF) {
                                    $zc_max_days = (DOWNLOAD_MAX_DAYS == 0 ? 0 : zen_date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + DOWNLOAD_MAX_DAYS);
                                    $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . DOWNLOAD_MAX_COUNT . "' where orders_id='" . (int)$oID . "' and orders_products_download_id='" . $_GET['download_reset_on'] . "'";
                                  } else {
                                    $zc_max_days = ($chk_products_download_time->fields['products_attributes_maxdays'] == 0 ? 0 : zen_date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + $chk_products_download_time->fields['products_attributes_maxdays']);
                                    $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . $chk_products_download_time->fields['products_attributes_maxcount'] . "' where orders_id='" . (int)$oID . "' and orders_products_download_id='" . $chk_downloads->fields['orders_products_download_id'] . "'";
                                  }
                    
                                  $db->Execute($update_downloads_query);
                    
                                  $chk_downloads->MoveNext();
                                }
                              }
                              $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
                            } else {
                              $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
                           }
                            zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
                          }
                            break;
                          case 'deleteconfirm':
                            // demo active test
                            if (zen_admin_demo()) {
                              $_GET['action']= '';
                              $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
                              zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')), 'NONSSL'));
                            }
                            $oID = zen_db_prepare_input($_POST['oID']);
                    
                            zen_remove_order($oID, $_POST['restock']);
                    
                            zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')), 'NONSSL'));
                            break;
                          case 'delete_cvv':
                            $delete_cvv = $db->Execute("update " . TABLE_ORDERS . " set cc_cvv = '" . TEXT_DELETE_CVV_REPLACEMENT . "' where orders_id = '" . (int)$_GET['oID'] . "'");
                            zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
                            break;
                          case 'mask_cc':
                            $result  = $db->Execute("select cc_number from " . TABLE_ORDERS . " where orders_id = '" . (int)$_GET['oID'] . "'");
                            $old_num = $result->fields['cc_number'];
                            $new_num = substr($old_num, 0, 4) . str_repeat('*', (strlen($old_num) - 8)) . substr($old_num, -4);
                            $mask_cc = $db->Execute("update " . TABLE_ORDERS . " set cc_number = '" . $new_num . "' where orders_id = '" . (int)$_GET['oID'] . "'");
                            zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
                            break;
                    
                          case 'doRefund':
                            $order = new order($oID);
                            if ($order->info['payment_module_code']) {
                              if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) {
                                require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php');
                                require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
                                $module = new $order->info['payment_module_code'];
                                if (method_exists($module, '_doRefund')) {
                                  $module->_doRefund($oID);
                                }
                              }
                            }
                            zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
                            break;
                          case 'doAuth':
                            $order = new order($oID);
                            if ($order->info['payment_module_code']) {
                              if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) {
                                require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php');
                                require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
                                $module = new $order->info['payment_module_code'];
                                if (method_exists($module, '_doAuth')) {
                                  $module->_doAuth($oID, $order->info['total'], $order->info['currency']);
                                }
                              }
                            }
                            zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
                            break;
                          case 'doCapture':
                            $order = new order($oID);
                            if ($order->info['payment_module_code']) {
                              if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) {
                                require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php');
                                require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
                                $module = new $order->info['payment_module_code'];
                                if (method_exists($module, '_doCapt')) {
                                  $module->_doCapt($oID, 'Complete', $order->info['total'], $order->info['currency']);
                                }
                              }
                            }
                            zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
                            break;
                          case 'doVoid':
                            $order = new order($oID);
                            if ($order->info['payment_module_code']) {
                              if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) {
                                require_once(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php');
                                require_once(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
                                $module = new $order->info['payment_module_code'];
                                if (method_exists($module, '_doVoid')) {
                                  $module->_doVoid($oID);
                                }
                              }
                            }
                            zen_redirect(zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', 'NONSSL'));
                            break;
                        }
                      }
                    ?>
                    <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
                    <html <?php echo HTML_PARAMS; ?>>
                    <head>
                    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
                    <title><?php echo TITLE; ?></title>
                    <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
                    <link rel="stylesheet" type="text/css" media="print" href="includes/stylesheet_print.css">
                    <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
                    <script language="javascript" src="includes/menu.js"></script>
                    <script language="javascript" src="includes/general.js"></script>
                    <script type="text/javascript">
                      <!--
                      function init()
                      {
                        cssjsmenu('navbar');
                        if (document.getElementById)
                        {
                          var kill = document.getElementById('hoverJS');
                          kill.disabled = true;
                        }
                      }
                      // -->
                    </script>
                    <script language="javascript" type="text/javascript"><!--
                    function couponpopupWindow(url) {
                      window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=280,screenX=150,screenY=150,top=150,left=150')
                    }
                    //--></script>
                    </head>
                    <body onLoad="init()">
                    <!-- header //-->
                    <div class="header-area">
                    <?php
                      require(DIR_WS_INCLUDES . 'header.php');
                    ?>
                    </div>
                    <!-- header_eof //-->
                    
                    <!-- body //-->
                    <table border="0" width="100%" cellspacing="2" cellpadding="2">
                    <!-- body_text //-->
                    
                    <?php if ($action == '') { ?>
                    <!-- search -->
                      <tr>
                        <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
                          <tr>
                            <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
                             <tr><?php echo zen_draw_form('search', FILENAME_ORDERS, '', 'get', '', true); ?>
                                <td width="65%" class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
                                <td colspan="2" class="smallText" align="right">
                    <?php
                    // show reset search
                      if ((isset($_GET['search']) && zen_not_null($_GET['search'])) or $_GET['cID'] !='') {
                        echo '<a href="' . zen_href_link(FILENAME_ORDERS, '', 'NONSSL') . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a><br />';
                      }
                    ?>
                    <?php
                      echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search') . zen_hide_session_id();
                      if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
                        $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
                        echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords;
                      }
                    ?>
                                </td>
                              </form>
                    
                    
                             <?php echo zen_draw_form('search_orders_products', FILENAME_ORDERS, '', 'get', '', true); ?>
                                <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
                                <td colspan="2" class="smallText" align="right">
                    <?php
                    // show reset search orders_products
                      if ((isset($_GET['search_orders_products']) && zen_not_null($_GET['search_orders_products'])) or $_GET['cID'] !='') {
                        echo '<a href="' . zen_href_link(FILENAME_ORDERS, '', 'NONSSL') . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a><br />';
                      }
                    ?>
                    <?php
                      echo HEADING_TITLE_SEARCH_DETAIL_ORDERS_PRODUCTS . ' ' . zen_draw_input_field('search_orders_products') . zen_hide_session_id();
                      if (isset($_GET['search_orders_products']) && zen_not_null($_GET['search_orders_products'])) {
                        $keywords_orders_products = zen_db_input(zen_db_prepare_input($_GET['search_orders_products']));
                        echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER_ORDERS_PRODUCTS . zen_db_prepare_input($keywords_orders_products);
                      }
                    ?>
                                </td>
                              </form>
                    
                            </table></td>
                          </tr>
                    <!-- search -->
                    <?php } ?>
                    
                    
                    <?php
                      if (($action == 'edit') && ($order_exists == true)) {
                        $order = new order($oID);
                        if ($order->info['payment_module_code']) {
                          if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) {
                            require(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php');
                            require(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php');
                            $module = new $order->info['payment_module_code'];
                    //        echo $module->admin_notification($oID);
                          }
                        }
                    // Begin Paket Tracking 2.1
                        $get_prev = $db->Execute("SELECT orders_id FROM " . TABLE_ORDERS . " WHERE orders_id < '" . $oID . "' ORDER BY orders_id DESC LIMIT 1");
                    
                        if (zen_not_null($get_prev->fields['orders_id'])) {
                          $prev_button = '            <INPUT TYPE="BUTTON" VALUE="<<< ' . $get_prev->fields['orders_id'] . '" ONCLICK="window.location.href=\'' . zen_href_link(FILENAME_ORDERS, 'oID=' . $get_prev->fields['orders_id'] . '&action=edit') . '\'">';
                        }
                        else {
                          $prev_button = '            <INPUT TYPE="BUTTON" VALUE="' . BUTTON_TO_LIST . '" ONCLICK="window.location.href=\'' . zen_href_link(FILENAME_ORDERS) . '\'">';
                        }
                    
                    
                        $get_next = $db->Execute("SELECT orders_id FROM " . TABLE_ORDERS . " WHERE orders_id > '" . $oID . "' ORDER BY orders_id ASC LIMIT 1");
                    
                        if (zen_not_null($get_next->fields['orders_id'])) {
                          $next_button = '            <INPUT TYPE="BUTTON" VALUE="' . $get_next->fields['orders_id'] . ' >>>" ONCLICK="window.location.href=\'' . zen_href_link(FILENAME_ORDERS, 'oID=' . $get_next->fields['orders_id'] . '&action=edit') . '\'">';
                        }
                        else {
                          $next_button = '            <INPUT TYPE="BUTTON" VALUE="' . BUTTON_TO_LIST . '" ONCLICK="window.location.href=\'' . zen_href_link(FILENAME_ORDERS) . '\'">';
                      }
                    // End Paket Tracking 2.1
                    ?>
                          <tr>
                            <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
                              <tr>
                    <!-- Begin Paket Tracking 2.1 -->
                                <td class="pageHeading"><?php echo HEADING_TITLE_ORDER_DETAILS . $oID; ?></td>
                                <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
                                <?php if ($so->status) { ?>
                                <?php } ?>
                                <td align="center">
                            <table border="0" cellspacing="3" cellpadding="0">
                                  <tr>
                                    <td class="main" align="center" valign="bottom"><?php echo $prev_button; ?></td>
                                    <td class="smallText" align="center" valign="bottom"><?php
                                      echo SELECT_ORDER_LIST . '<br>';
                                      echo zen_draw_form('input_oid', FILENAME_ORDERS, '', 'get', '', true);
                                      echo zen_draw_input_field('oID', '', 'size="6"');
                                      echo zen_draw_hidden_field('action', 'edit');
                                      echo '</form>';
                                    ?></td>
                                    <td class="main" align="center" valign="bottom"><?php echo $next_button; ?></td>
                                  </tr>
                                </table>
                          </td>
                    <!-- End Paket Tracking 2.1 -->
                                <td class="pageHeading" align="right"><?php echo '<a href="javascript:history.back()">' . zen_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
                              </tr>
                            </table>
                    </td>
                          </tr>
                          <tr>
                            <td><table width="100%" border="0" cellspacing="0" cellpadding="2">
                              <tr>
                                <td colspan="3"><?php echo zen_draw_separator(); ?></td>
                              </tr>
                              <tr>
                                <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
                                  <tr>
                                    <td class="main" valign="top"><strong><?php echo ENTRY_CUSTOMER; ?></strong></td>
                                    <td class="main"><?php echo zen_address_format($order->customer['format_id'], $order->customer, 1, '', '<br />'); ?></td>
                                  </tr>
                                  <tr>
                                    <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
                                  </tr>
                                  <tr>
                                    <td class="main"><strong><?php echo ENTRY_TELEPHONE_NUMBER; ?></strong></td>
                                    <td class="main"><?php echo $order->customer['telephone']; ?></td>
                                  </tr>
                                  <tr>
                                    <td class="main"><strong><?php echo ENTRY_EMAIL_ADDRESS; ?></strong></td>
                                    <td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '">' . $order->customer['email_address'] . '</a>'; ?></td>
                                  </tr>
                                  <tr>
                                    <td class="main"><strong><?php echo TEXT_INFO_IP_ADDRESS; ?></strong></td>
                                    <td class="main"><?php echo $order->info['ip_address']; ?></td>
                                  </tr>
                                </table></td>
                                <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
                                  <tr>
                                    <td class="main" valign="top"><strong><?php echo ENTRY_SHIPPING_ADDRESS; ?></strong></td>
                                    <td class="main"><?php echo zen_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />'); ?></td>
                                  </tr>
                                </table></td>
                                <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
                                  <tr>
                                    <td class="main" valign="top"><strong><?php echo ENTRY_BILLING_ADDRESS; ?></strong></td>
                                    <td class="main"><?php echo zen_address_format($order->billing['format_id'], $order->billing, 1, '', '<br />'); ?></td>
                                  </tr>
                                </table></td>
                              </tr>
                            </table></td>
                          </tr>
                          <tr>
                            <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
                          </tr>
                          <tr>
                            <td class="main"><strong><?php echo ENTRY_ORDER_ID . $oID; ?></strong></td>
                          </tr>
                          <tr>
                         <td><table border="0" cellspacing="0" cellpadding="2">
                            <tr>
                               <td class="main"><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong></td>
                               <td class="main"><?php echo zen_date_long($order->info['date_purchased']); ?></td>
                            </tr>
                            <tr>
                               <td class="main"><strong><?php echo ENTRY_PAYMENT_METHOD; ?></strong></td>
                               <td class="main"><?php echo $order->info['payment_method']; ?></td>
                            </tr>
                    <?php
                        if (zen_not_null($order->info['cc_type']) || zen_not_null($order->info['cc_owner']) || zen_not_null($order->info['cc_number'])) {
                    ?>
                              <tr>
                                <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
                              </tr>
                              <tr>
                                <td class="main"><?php echo ENTRY_CREDIT_CARD_TYPE; ?></td>
                                <td class="main"><?php echo $order->info['cc_type']; ?></td>
                              </tr>
                              <tr>
                                <td class="main"><?php echo ENTRY_CREDIT_CARD_OWNER; ?></td>
                                <td class="main"><?php echo $order->info['cc_owner']; ?></td>
                              </tr>
                              <tr>
                                <td class="main"><?php echo ENTRY_CREDIT_CARD_NUMBER; ?></td>
                                <td class="main"><?php echo $order->info['cc_number'] . (zen_not_null($order->info['cc_number']) && !strstr($order->info['cc_number'],'X') && !strstr($order->info['cc_number'],'********') ? '&nbsp;&nbsp;<a href="' . zen_href_link(FILENAME_ORDERS, '&action=mask_cc&oID=' . $oID, 'NONSSL') . '" class="noprint">' . TEXT_MASK_CC_NUMBER . '</a>' : ''); ?><td>
                              </tr>
                    <?php if (zen_not_null($order->info['cc_cvv'])) { ?>
                              <tr>
                                <td class="main"><?php echo ENTRY_CREDIT_CARD_CVV; ?></td>
                                <td class="main"><?php echo $order->info['cc_cvv'] . (zen_not_null($order->info['cc_cvv']) && !strstr($order->info['cc_cvv'],TEXT_DELETE_CVV_REPLACEMENT) ? '&nbsp;&nbsp;<a href="' . zen_href_link(FILENAME_ORDERS, '&action=delete_cvv&oID=' . $oID, 'NONSSL') . '" class="noprint">' . TEXT_DELETE_CVV_FROM_DATABASE . '</a>' : ''); ?><td>
                              </tr>
                    <?php } ?>
                              <tr>
                                <td class="main"><?php echo ENTRY_CREDIT_CARD_EXPIRES; ?></td>
                                <td class="main"><?php echo $order->info['cc_expires']; ?></td>
                              </tr>
                    <?php
                        }
                    ?>
                            </table></td>
                          </tr>
                    <?php
                          if (method_exists($module, 'admin_notification')) {
                    ?>
                          <tr>
                            <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
                          </tr>
                          <tr>
                            <?php echo $module->admin_notification($oID); ?>
                          </tr>
                          <tr>
                            <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
                          </tr>
                    <?php
                    }
                    ?>
                          <tr>
                            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
                              <tr class="dataTableHeadingRow">
                                <td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
                                <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
                                <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td>
                                <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_EXCLUDING_TAX; ?></td>
                                <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_INCLUDING_TAX; ?></td>
                                <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></td>
                                <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></td>
                              </tr>
                    <?php
                        for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
                          if (DISPLAY_PRICE_WITH_TAX_ADMIN == 'true')
                          {
                            $priceIncTax = $currencies->format(zen_round(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']),$currencies->get_decimal_places($order->info['currency'])) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']);
                          } else
                          {
                            $priceIncTax = $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']);
                          }
                          echo '          <tr class="dataTableRow">' . "\n" .
                               '            <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . '&nbsp;x</td>' . "\n" .
                               '            <td class="dataTableContent" valign="top">' . $order->products[$i]['name'];
                    
                          if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) {
                            for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) {
                              echo '<br /><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value']));
                              if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';
                              if ($order->products[$i]['attributes'][$j]['product_attribute_is_free'] == '1' and $order->products[$i]['product_is_free'] == '1') echo TEXT_INFO_ATTRIBUTE_FREE;
                              echo '</i></small></nobr>';
                            }
                          }
                    
                          echo '            </td>' . "\n" .
                               '            <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n" .
                               '            <td class="dataTableContent" align="right" valign="top">' . zen_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" .
                               '            <td class="dataTableContent" align="right" valign="top"><strong>' .
                                              $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) .
                                              ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') .
                                            '</strong></td>' . "\n" .
                               '            <td class="dataTableContent" align="right" valign="top"><strong>' .
                                              $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) .
                                              ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') .
                                            '</strong></td>' . "\n" .
                               '            <td class="dataTableContent" align="right" valign="top"><strong>' .
                                              $currencies->format(zen_round($order->products[$i]['final_price'], $currencies->get_decimal_places($order->info['currency'])) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) .
                                              ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format($order->products[$i]['onetime_charges'], true, $order->info['currency'], $order->info['currency_value']) : '') .
                                            '</strong></td>' . "\n" .
                               '            <td class="dataTableContent" align="right" valign="top"><strong>' .
                                              $priceIncTax .
                                              ($order->products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->format(zen_add_tax($order->products[$i]['onetime_charges'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) : '') .
                                            '</strong></td>' . "\n";
                          echo '          </tr>' . "\n";
                        }
                    ?>
                              <tr>
                                <td align="right" colspan="8"><table border="0" cellspacing="0" cellpadding="2">
                    <?php
                        for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
                          echo '              <tr>' . "\n" .
                               '                <td align="right" class="'. str_replace('_', '-', $order->totals[$i]['class']) . '-Text">' . $order->totals[$i]['title'] . '</td>' . "\n" .
                               '                <td align="right" class="'. str_replace('_', '-', $order->totals[$i]['class']) . '-Amount">' . $currencies->format($order->totals[$i]['value'], false) . '</td>' . "\n" .
                               '              </tr>' . "\n";
                        }
                    ?>
                                </table></td>
                              </tr>
                            </table></td>
                          </tr>
                    
                    <?php
                      // show downloads
                      require(DIR_WS_MODULES . 'orders_download.php');
                    ?>
                    
                          <tr>
                            <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
                          </tr>
                          <tr>
                            <td class="main"><table border="1" cellspacing="0" cellpadding="5">
                              <tr>
                                <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_DATE_ADDED; ?></strong></td>
                                <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_CUSTOMER_NOTIFIED; ?></strong></td>
                                <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_STATUS; ?></strong></td>
                    <!-- Begin Paket Tracking 2.0 ------------------------------->
                            <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_TRACKING_ID; ?></strong></td>
                    <!-- End Paket Tracking 2.0 ------------------------------------------------------------>
                                <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_COMMENTS; ?></strong></td>
                              </tr>
                    <?php
                    
                    // Begin Paket Tracking 2.1
                        $orders_history = $db->Execute("select orders_status_id, date_added, customer_notified, track_id1, track_id2, track_id3, track_id4, track_id5, comments
                                                        from " . TABLE_ORDERS_STATUS_HISTORY . "
                                                        where orders_id = '" . zen_db_input($oID) . "'
                                                        order by date_added");
                    // End Paket Tracking 2.1
                        if ($orders_history->RecordCount() > 0) {
                          while (!$orders_history->EOF) {
                            echo '          <tr>' . "\n" .
                                 '            <td class="smallText" align="center">' . zen_datetime_short($orders_history->fields['date_added']) . '</td>' . "\n" .
                                 '            <td class="smallText" align="center">';
                            if ($orders_history->fields['customer_notified'] == '1') {
                              echo zen_image(DIR_WS_ICONS . 'tick.gif', TEXT_YES) . "</td>\n";
                            } else if ($orders_history->fields['customer_notified'] == '-1') {
                              echo zen_image(DIR_WS_ICONS . 'locked.gif', TEXT_HIDDEN) . "</td>\n";
                            } else {
                              echo zen_image(DIR_WS_ICONS . 'unlocked.gif', TEXT_VISIBLE) . "</td>\n";
                            }
                            echo '            <td class="smallText">' . $orders_status_array[$orders_history->fields['orders_status_id']] . '</td>' . "\n";
                    // Begin Paket Tracking 2.1
                            $display_track_id = '&nbsp;';
                        $display_track_id .= (empty($orders_history->fields['track_id1']) ? '' : CARRIER_NAME_1 . ": <a href=" . CARRIER_LINK_1 . nl2br(zen_output_string_protected($orders_history->fields['track_id1'])) . ' target="_blank">' . nl2br(zen_output_string_protected($orders_history->fields['track_id1'])) . "</a>&nbsp;" );
                        $display_track_id .= (empty($orders_history->fields['track_id2']) ? '' : CARRIER_NAME_2 . ": <a href=" . CARRIER_LINK_2 . nl2br(zen_output_string_protected($orders_history->fields['track_id2'])) . ' target="_blank">' . nl2br(zen_output_string_protected($orders_history->fields['track_id2'])) . "</a>&nbsp;" );
                        $display_track_id .= (empty($orders_history->fields['track_id3']) ? '' : CARRIER_NAME_3 . ": <a href=" . CARRIER_LINK_3 . nl2br(zen_output_string_protected($orders_history->fields['track_id3'])) . ' target="_blank">' . nl2br(zen_output_string_protected($orders_history->fields['track_id3'])) . "</a>&nbsp;" );
                        $display_track_id .= (empty($orders_history->fields['track_id4']) ? '' : CARRIER_NAME_4 . ": <a href=" . CARRIER_LINK_4 . nl2br(zen_output_string_protected($orders_history->fields['track_id4'])) . ' target="_blank">' . nl2br(zen_output_string_protected($orders_history->fields['track_id4'])) . "</a>&nbsp;" );
                        $display_track_id .= (empty($orders_history->fields['track_id5']) ? '' : CARRIER_NAME_5 . ": <a href=" . CARRIER_LINK_5 . nl2br(zen_output_string_protected($orders_history->fields['track_id5'])) . ' target="_blank">' . nl2br(zen_output_string_protected($orders_history->fields['track_id5'])) . "</a>&nbsp;" );
                            echo '            <td class="smallText" align="left" valign="top">' . $display_track_id . '</td>' . "\n";
                    // End Paket Tracking 2.1
                            echo '            <td class="smallText">' . nl2br(zen_db_output($orders_history->fields['comments'])) . '&nbsp;</td>' . "\n" .
                                 '          </tr>' . "\n";
                            $orders_history->MoveNext();
                          }
                        } else {
                            echo '          <tr>' . "\n" .
                                 '            <td class="smallText" colspan="5">' . TEXT_NO_ORDER_HISTORY . '</td>' . "\n" .
                                 '          </tr>' . "\n";
                        }
                    ?>
                            </table></td>
                          </tr>
                          <tr>
                            <td class="main noprint"><br /><strong><?php echo TABLE_HEADING_COMMENTS; ?></strong></td>
                          </tr>
                          <tr>
                            <td class="noprint"><?php echo zen_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
                          </tr>
                          <tr><?php echo zen_draw_form('status', FILENAME_ORDERS, zen_get_all_get_params(array('action')) . 'action=update_order', 'post', '', true); ?>
                            <td class="main noprint"><?php echo zen_draw_textarea_field('comments', 'soft', '60', '5'); ?></td>
                          </tr>
                          <tr>
                            <td>
                    <?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?>
                    <!-- Begin Paket Tracking 2.1 -->
                        <table border="0" cellpadding="3" cellspacing="0">          
                            <tr>
                                <td class="main"><strong><?php echo zen_image(DIR_WS_IMAGES . 'icon_track_add.png', ENTRY_ADD_TRACK) . '&nbsp;' . ENTRY_ADD_TRACK; ?></strong></td>
                            </tr>
                            <tr valign="top">
                                <td width="400">
                                    <table border="1" cellpadding="3" cellspacing="0" width="100%">
                                        <tr class="dataTableHeadingRow">
                                            <td class="dataTableHeadingContent smallText"><strong><?php echo TABLE_HEADING_CARRIER_NAME; ?></strong></td>
                                            <td class="dataTableHeadingContent smallText"><strong><?php echo TABLE_HEADING_TRACKING_ID; ?></strong></td>
                                        </tr>
                                        <?php if (CARRIER_STATUS_1 == 'True') { ?>
                                        <tr>
                                            <td><?php echo CARRIER_NAME_1; ?></td><td valign="top"><?php echo zen_draw_input_field('track_id1', '', 'size="50"'); ?></td>
                                        </tr>
                                        <?php } ?>
                                        <?php if (CARRIER_STATUS_2 == 'True') { ?>
                                        <tr>
                                            <td><?php echo CARRIER_NAME_2; ?></td><td valign="top"><?php echo zen_draw_input_field('track_id2', '', 'size="50"'); ?></td>
                                        </tr>
                                        <?php } ?>
                                        <?php if (CARRIER_STATUS_3 == 'True') { ?>
                                        <tr>
                                            <td><?php echo CARRIER_NAME_3; ?></td><td valign="top"><?php echo zen_draw_input_field('track_id3', '', 'size="50"'); ?></td>
                                        </tr>
                                        <?php } ?>
                                        <?php if (CARRIER_STATUS_4 == 'True') { ?>
                                        <tr>
                                            <td><?php echo CARRIER_NAME_4; ?></td><td valign="top"><?php echo zen_draw_input_field('track_id4', '', 'size="50"'); ?></td>
                                        </tr>
                                        <?php } ?>
                                        <?php if (CARRIER_STATUS_5 == 'True') { ?>
                                        <tr>
                                            <td><?php echo CARRIER_NAME_5; ?></td><td valign="top"><?php echo zen_draw_input_field('track_id5', '', 'size="50"'); ?></td>
                                        </tr>
                                        <?php } ?>
                                    </table>
                                </td>
                            </tr>
                        </table>      
                    <!-- Begin Paket Tracking 2.1 -->
                    </td>
                          </tr>
                          <tr>
                            <td><table border="0" cellspacing="0" cellpadding="2" class="noprint">
                              <tr>
                                <td><table border="0" cellspacing="0" cellpadding="2">
                                  <tr>
                                    <td class="main"><strong><?php echo ENTRY_STATUS; ?></strong> <?php echo zen_draw_pull_down_menu('status', $orders_statuses, $order->info['orders_status']); ?></td>
                                  </tr>
                                  <tr>
                                    <td class="main"><strong><?php echo ENTRY_NOTIFY_CUSTOMER; ?></strong> [<?php echo zen_draw_radio_field('notify', '1', true) . '-' . TEXT_EMAIL . ' ' . zen_draw_radio_field('notify', '0', FALSE) . '-' . TEXT_NOEMAIL . ' ' . zen_draw_radio_field('notify', '-1', FALSE) . '-' . TEXT_HIDE; ?>]&nbsp;&nbsp;&nbsp;</td>
                                    <td class="main"><strong><?php echo ENTRY_NOTIFY_COMMENTS; ?></strong> <?php echo zen_draw_checkbox_field('notify_comments', '', true); ?></td>
                                  </tr>
                                  <tr><td><br /></td></tr>
                                </table></td>
                                <td valign="top"><?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE); ?></td>
                              </tr>
                            </table></td>
                          </form></tr>
                          <tr>
                            <td colspan="2" align="right" class="noprint"><?php echo '<a href="' . zen_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $_GET['oID']) . '" TARGET="_blank">' . zen_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . zen_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $_GET['oID']) . '" TARGET="_blank">' . zen_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a> <a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('action'))) . '">' . zen_image_button('button_orders.gif', IMAGE_ORDERS) . '</a>'; ?></td>
                          </tr>
                    <?php
                    // check if order has open gv
                            $gv_check = $db->Execute("select order_id, unique_id
                                                      from " . TABLE_COUPON_GV_QUEUE ."
                                                      where order_id = '" . $_GET['oID'] . "' and release_flag='N' limit 1");
                            if ($gv_check->RecordCount() > 0) {
                              $goto_gv = '<a href="' . zen_href_link(FILENAME_GV_QUEUE, 'order=' . $_GET['oID']) . '">' . zen_image_button('button_gift_queue.gif',IMAGE_GIFT_QUEUE) . '</a>';
                              echo '      <tr><td align="right"><table width="225"><tr>';
                              echo '        <td align="center">';
                              echo $goto_gv . '&nbsp;&nbsp;';
                              echo '        </td>';
                              echo '      </tr></table></td></tr>';
                            }
                    ?>
                    <?php
                      } else {
                    ?>
                          <tr>
                            <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
                              <tr>
                                <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
                                <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
                                <td align="right"><table border="0" width="100%" cellspacing="0" cellpadding="0">
                                  <tr><?php echo zen_draw_form('orders', FILENAME_ORDERS, '', 'get', '', true); ?>
                                    <td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . zen_draw_input_field('oID', '', 'size="12"') . zen_draw_hidden_field('action', 'edit') . zen_hide_session_id(); ?></td>
                                  </form></tr>
                                  <tr><?php echo zen_draw_form('status', FILENAME_ORDERS, '', 'get', '', true); ?>
                                    <td class="smallText" align="right">
                                      <?php
                                        echo HEADING_TITLE_STATUS . ' ' . zen_draw_pull_down_menu('status', array_merge(array(array('id' => '', 'text' => TEXT_ALL_ORDERS)), $orders_statuses), $_GET['status'], 'onChange="this.form.submit();"');
                                        echo zen_hide_session_id();
                                      ?>
                                    </td>
                                  </form></tr>
                                </table></td>
                              </tr>
                            </table></td>
                          </tr>
                          <tr>
                            <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
                              <tr>
                                <td class="smallText"><?php echo TEXT_LEGEND . ' ' . zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_BILLING_SHIPPING_MISMATCH, 10, 10) . ' ' . TEXT_BILLING_SHIPPING_MISMATCH; ?>
                              </td>
                              <tr>
                                <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
                                  <tr class="dataTableHeadingRow">
                    <?php
                    // Sort Listing
                              switch ($_GET['list_order']) {
                                  case "id-asc":
                                  $disp_order = "c.customers_id";
                                  break;
                                  case "firstname":
                                  $disp_order = "c.customers_firstname";
                                  break;
                                  case "firstname-desc":
                                  $disp_order = "c.customers_firstname DESC";
                                  break;
                                  case "lastname":
                                  $disp_order = "c.customers_lastname, c.customers_firstname";
                                  break;
                                  case "lastname-desc":
                                  $disp_order = "c.customers_lastname DESC, c.customers_firstname";
                                  break;
                                  case "company":
                                  $disp_order = "a.entry_company";
                                  break;
                                  case "company-desc":
                                  $disp_order = "a.entry_company DESC";
                                  break;
                                  default:
                                  $disp_order = "c.customers_id DESC";
                              }
                    ?>
                                    <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_ORDERS_ID; ?></td>
                                    <td class="dataTableHeadingContent" align="left" width="50"><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></td>
                                    <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td>
                                    <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ORDER_TOTAL; ?></td>
                                    <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DATE_PURCHASED; ?></td>
                                    <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>
                                    <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_CUSTOMER_COMMENTS; ?></td>
                                    <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
                                  </tr>
                    
                    <?php
                    // Only one or the other search
                    // create search_orders_products filter
                      $search = '';
                      $new_table = '';
                      $new_fields = '';
                      if (isset($_GET['search_orders_products']) && zen_not_null($_GET['search_orders_products'])) {
                        $new_fields = '';
                        $search_distinct = ' distinct ';
                        $new_table = " left join " . TABLE_ORDERS_PRODUCTS . " op on (op.orders_id = o.orders_id) ";
                        $keywords = zen_db_input(zen_db_prepare_input($_GET['search_orders_products']));
                        $search = " and (op.products_model like '%" . $keywords . "%' or op.products_name like '" . $keywords . "%')";
                        if (substr(strtoupper($_GET['search_orders_products']), 0, 3) == 'ID:') {
                          $keywords = TRIM(substr($_GET['search_orders_products'], 3));
                          $search = " and op.products_id ='" . (int)$keywords . "'";
                        }
                      } else {
                    ?>
                    <?php
                    // create search filter
                      $search = '';
                      if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
                        $search_distinct = ' ';
                        $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
                        $search = " and (o.customers_city like '%" . $keywords . "%' or o.customers_postcode like '%" . $keywords . "%' or o.date_purchased like '%" . $keywords . "%' or o.billing_name like '%" . $keywords . "%' or o.billing_company like '%" . $keywords . "%' or o.billing_street_address like '%" . $keywords . "%' or o.delivery_city like '%" . $keywords . "%' or o.delivery_postcode like '%" . $keywords . "%' or o.delivery_name like '%" . $keywords . "%' or o.delivery_company like '%" . $keywords . "%' or o.delivery_street_address like '%" . $keywords . "%' or o.billing_city like '%" . $keywords . "%' or o.billing_postcode like '%" . $keywords . "%' or o.customers_email_address like '%" . $keywords . "%' or o.customers_name like '%" . $keywords . "%' or o.customers_company like '%" . $keywords . "%' or o.customers_street_address  like '%" . $keywords . "%' or o.customers_telephone like '%" . $keywords . "%' or o.ip_address  like '%" . $keywords . "%')";
                        $new_table = '';
                    //    $new_fields = ", o.customers_company, o.customers_email_address, o.customers_street_address, o.delivery_company, o.delivery_name, o.delivery_street_address, o.billing_company, o.billing_name, o.billing_street_address, o.payment_module_code, o.shipping_module_code, o.ip_address ";
                      }
                    } // eof: search orders or orders_products
                        $new_fields = ", o.customers_company, o.customers_email_address, o.customers_street_address, o.delivery_company, o.delivery_name, o.delivery_street_address, o.billing_company, o.billing_name, o.billing_street_address, o.payment_module_code, o.shipping_module_code, o.ip_address ";
                    ?>
                    <?php
                        if (isset($_GET['cID'])) {
                          $cID = zen_db_prepare_input($_GET['cID']);
                          $orders_query_raw =   "select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total" .
                                                $new_fields . "
                                                from (" . TABLE_ORDERS_STATUS . " s, " .
                                                TABLE_ORDERS . " o " .
                                                $new_table . ")
                                                left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id and ot.class = 'ot_total') " . "
                                                where o.customers_id = '" . (int)$cID . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$_SESSION['languages_id'] . "' order by orders_id DESC";
                    
                    //echo '<BR><BR>I SEE A: ' . $orders_query_raw . '<BR><BR>';
                    
                        } elseif ($_GET['status'] != '') {
                          $status = zen_db_prepare_input($_GET['status']);
                          $orders_query_raw = "select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total" .
                                              $new_fields . "
                                              from (" . TABLE_ORDERS_STATUS . " s, " .
                                              TABLE_ORDERS . " o " .
                                              $new_table . ")
                                              left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id and ot.class = 'ot_total') " . "
                                              where o.orders_status = s.orders_status_id and s.language_id = '" . (int)$_SESSION['languages_id'] . "' and s.orders_status_id = '" . (int)$status . "'  " .
                                              $search . " order by o.orders_id DESC";
                    
                    //echo '<BR><BR>I SEE B: ' . $orders_query_raw . '<BR><BR>';
                    
                        } else {
                          $orders_query_raw = "select " . $search_distinct . " o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total" .
                                              $new_fields . "
                                              from (" . TABLE_ORDERS_STATUS . " s, " .
                                              TABLE_ORDERS . " o " .
                                              $new_table . ")
                                              left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id and ot.class = 'ot_total') " . "
                                              where (o.orders_status = s.orders_status_id and s.language_id = '" . (int)$_SESSION['languages_id'] . "')  " .
                                              $search . " order by o.orders_id DESC";
                    
                    //echo '<BR><BR>I SEE C: ' . $orders_query_raw . '<BR><BR>';
                    
                        }
                    
                    // Split Page
                    // reset page when page is unknown
                    if (($_GET['page'] == '' or $_GET['page'] <= 1) and $_GET['oID'] != '') {
                      $check_page = $db->Execute($orders_query_raw);
                      $check_count=1;
                      if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS_ORDERS) {
                        while (!$check_page->EOF) {
                          if ($check_page->fields['orders_id'] == $_GET['oID']) {
                            break;
                          }
                          $check_count++;
                          $check_page->MoveNext();
                        }
                        $_GET['page'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS_ORDERS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS_ORDERS) !=0 ? .5 : 0)),0);
                      } else {
                        $_GET['page'] = 1;
                      }
                    }
                    
                    //    $orders_query_numrows = '';
                        $orders_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_ORDERS, $orders_query_raw, $orders_query_numrows);
                        $orders = $db->Execute($orders_query_raw);
                        while (!$orders->EOF) {
                        if ((!isset($_GET['oID']) || (isset($_GET['oID']) && ($_GET['oID'] == $orders->fields['orders_id']))) && !isset($oInfo)) {
                            $oInfo = new objectInfo($orders->fields);
                          }
                    
                          if (isset($oInfo) && is_object($oInfo) && ($orders->fields['orders_id'] == $oInfo->orders_id)) {
                            echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit', 'NONSSL') . '\'">' . "\n";
                          } else {
                            echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID')) . 'oID=' . $orders->fields['orders_id'], 'NONSSL') . '\'">' . "\n";
                          }
                    
                          $show_difference = '';
                          if (($orders->fields['delivery_name'] != $orders->fields['billing_name'] and $orders->fields['delivery_name'] != '')) {
                            $show_difference = zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_BILLING_SHIPPING_MISMATCH, 10, 10) . '&nbsp;';
                          }
                          if (($orders->fields['delivery_street_address'] != $orders->fields['billing_street_address'] and $orders->fields['delivery_street_address'] != '')) {
                            $show_difference = zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_BILLING_SHIPPING_MISMATCH, 10, 10) . '&nbsp;';
                          }
                          $show_payment_type = $orders->fields['payment_module_code'] . '<br />' . $orders->fields['shipping_module_code'];
                    ?>
                                    <td class="dataTableContent" align="right"><?php echo $show_difference . $orders->fields['orders_id']; ?></td>
                                    <td class="dataTableContent" align="left" width="50"><?php echo $show_payment_type; ?></td>
                                    <td class="dataTableContent"><?php echo '<a href="' . zen_href_link(FILENAME_CUSTOMERS, 'cID=' . $orders->fields['customers_id'], 'NONSSL') . '">' . zen_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW . ' ' . TABLE_HEADING_CUSTOMERS) . '</a>&nbsp;' . $orders->fields['customers_name'] . ($orders->fields['customers_company'] != '' ? '<br />' . $orders->fields['customers_company'] : ''); ?></td>
                                    <td class="dataTableContent" align="right"><?php echo strip_tags($orders->fields['order_total']); ?></td>
                                    <td class="dataTableContent" align="center"><?php echo zen_datetime_short($orders->fields['date_purchased']); ?></td>
                                    <td class="dataTableContent" align="right"><?php echo $orders->fields['orders_status_name']; ?></td>
                                    <td class="dataTableContent" align="center"><?php echo (zen_get_orders_comments($orders->fields['orders_id']) == '' ? '' : zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', TEXT_COMMENTS_YES, 16, 16)); ?></td>
                    
                                    <td class="dataTableContent" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $orders->fields['orders_id'] . '&action=edit', 'NONSSL') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>'; ?><?php if (isset($oInfo) && is_object($oInfo) && ($orders->fields['orders_id'] == $oInfo->orders_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID')) . 'oID=' . $orders->fields['orders_id'], 'NONSSL') . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
                                  </tr>
                    <?php
                          $orders->MoveNext();
                        }
                    ?>
                                  <tr>
                                    <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2">
                                      <tr>
                                        <td class="smallText" valign="top"><?php echo $orders_split->display_count($orders_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_ORDERS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_ORDERS); ?></td>
                                        <td class="smallText" align="right"><?php echo $orders_split->display_links($orders_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_ORDERS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], zen_get_all_get_params(array('page', 'oID', 'action'))); ?></td>
                                      </tr>
                    <?php
                      if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
                    ?>
                                      <tr>
                                        <td class="smallText" align="right" colspan="2">
                                          <?php
                                            echo '<a href="' . zen_href_link(FILENAME_ORDERS, '', 'NONSSL') . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>';
                                            if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
                                              $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
                                              echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords;
                                            }
                                          ?>
                                        </td>
                                      </tr>
                    <?php
                      }
                    ?>
                                    </table></td>
                                  </tr>
                                </table></td>
                    <?php
                      $heading = array();
                      $contents = array();
                    
                      switch ($action) {
                        case 'delete':
                          $heading[] = array('text' => '<strong>' . TEXT_INFO_HEADING_DELETE_ORDER . '</strong>');
                    
                          $contents = array('form' => zen_draw_form('orders', FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . '&action=deleteconfirm', 'post', '', true) . zen_draw_hidden_field('oID', $oInfo->orders_id));
                    //      $contents[] = array('text' => TEXT_INFO_DELETE_INTRO . '<br /><br /><strong>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</strong>');
                          $contents[] = array('text' => TEXT_INFO_DELETE_INTRO . '<br /><br /><strong>' . ENTRY_ORDER_ID . $oInfo->orders_id . '<br />' . $oInfo->order_total . '<br />' . $oInfo->customers_name . ($oInfo->customers_company != '' ? '<br />' . $oInfo->customers_company : '') . '</strong>');
                          $contents[] = array('text' => '<br />' . zen_draw_checkbox_field('restock') . ' ' . TEXT_INFO_RESTOCK_PRODUCT_QUANTITY);
                          $contents[] = array('align' => 'center', 'text' => '<br />' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id, 'NONSSL') . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
                          break;
                        default:
                          if (isset($oInfo) && is_object($oInfo)) {
                            $heading[] = array('text' => '<strong>[' . $oInfo->orders_id . ']&nbsp;&nbsp;' . zen_datetime_short($oInfo->date_purchased) . '</strong>');
                    
                            $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit', 'NONSSL') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=delete', 'NONSSL') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
                            $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . zen_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . zen_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . zen_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a>');
                            $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_RL_INVOICE3, 'oID=' . $oInfo -> orders_id) . '" TARGET="_blank">' . zen_image_button('button_rl_invoice3.gif', IMAGE_RL_INVOICE) );
                           $contents[] = array('text' => '<br />' . TEXT_DATE_ORDER_CREATED . ' ' . zen_date_short($oInfo->date_purchased));
                            $contents[] = array('text' => '<br />' . $oInfo->customers_email_address);
                            $contents[] = array('text' => TEXT_INFO_IP_ADDRESS . ' ' . $oInfo->ip_address);
                            if (zen_not_null($oInfo->last_modified)) $contents[] = array('text' => TEXT_DATE_ORDER_LAST_MODIFIED . ' ' . zen_date_short($oInfo->last_modified));
                            $contents[] = array('text' => '<br />' . TEXT_INFO_PAYMENT_METHOD . ' '  . $oInfo->payment_method);
                            $contents[] = array('text' => '<br />' . ENTRY_SHIPPING . ' '  . $oInfo->shipping_method);
                    
                    // check if order has open gv
                            $gv_check = $db->Execute("select order_id, unique_id
                                                      from " . TABLE_COUPON_GV_QUEUE ."
                                                      where order_id = '" . $oInfo->orders_id . "' and release_flag='N' limit 1");
                            if ($gv_check->RecordCount() > 0) {
                              $goto_gv = '<a href="' . zen_href_link(FILENAME_GV_QUEUE, 'order=' . $oInfo->orders_id) . '">' . zen_image_button('button_gift_queue.gif',IMAGE_GIFT_QUEUE) . '</a>';
                              $contents[] = array('text' => '<br />' . zen_image(DIR_WS_IMAGES . 'pixel_black.gif','','100%','3'));
                              $contents[] = array('align' => 'center', 'text' => $goto_gv);
                            }
                          }
                    
                    // indicate if comments exist
                          $orders_history_query = $db->Execute("select orders_status_id, date_added, customer_notified, comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . $oInfo->orders_id . "' and comments !='" . "'" );
                          if ($orders_history_query->RecordCount() > 0) {
                            $contents[] = array('align' => 'left', 'text' => '<br />' . TABLE_HEADING_COMMENTS);
                          }
                    
                          $contents[] = array('text' => '<br />' . zen_image(DIR_WS_IMAGES . 'pixel_black.gif','','100%','3'));
                          $order = new order($oInfo->orders_id);
                          $contents[] = array('text' => 'Products Ordered: ' . sizeof($order->products) );
                          for ($i=0; $i<sizeof($order->products); $i++) {
                            $contents[] = array('text' => $order->products[$i]['qty'] . '&nbsp;x&nbsp;' . $order->products[$i]['name']);
                    
                            if (sizeof($order->products[$i]['attributes']) > 0) {
                              for ($j=0; $j<sizeof($order->products[$i]['attributes']); $j++) {
                                $contents[] = array('text' => '&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value'])) . '</i></nobr>' );
                              }
                            }
                            if ($i > MAX_DISPLAY_RESULTS_ORDERS_DETAILS_LISTING and MAX_DISPLAY_RESULTS_ORDERS_DETAILS_LISTING != 0) {
                              $contents[] = array('align' => 'left', 'text' => TEXT_MORE);
                              break;
                            }
                          }
                    
                          if (sizeof($order->products) > 0) {
                            $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit', 'NONSSL') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');
                          }
                          break;
                      }
                    
                      if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
                        echo '            <td width="25%" valign="top">' . "\n";
                    
                        $box = new box;
                        echo $box->infoBox($heading, $contents);
                    
                        echo '            </td>' . "\n";
                      }
                    ?>
                              </tr>
                            </table></td>
                          </tr>
                    <?php
                      }
                    ?>
                        </table></td>
                    <!-- body_text_eof //-->
                      </tr>
                    </table>
                    <!-- body_eof //-->
                    
                    <!-- footer //-->
                    <div class="footer-area">
                    <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
                    </div>
                    <!-- footer_eof //-->
                    <br />
                    </body>
                    </html>
                    <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
                    Grüße und Danke
                    Manfred

                    Kommentar


                      #11
                      Es geht darum ALLE Dateien von den diversen Modulen, die Du integriert hast, die Originaldateien verändert haben, anzuschauen und die jeweiligen Änderungen Schritt für Schritt mit den Orginal Zen-Cart Files zu mergen.
                      Ich weiss nicht, welche Erweiterungen Du alle aktiv hast, ich sehe Deine Files nicht und kann daher auch keine Standardlösung posten. Das ist völlig individuell und eine Fehlersuche erfordert Zeit und eine Analyse aller betroffenen Dateien.
                      Ein nützliches Tool zum Mergen habe ich empfohlen. Viel Erfolg.

                      Kommentar


                        #12
                        mergen

                        Zitat von webchills Beitrag anzeigen
                        Es geht darum ALLE Dateien von den diversen Modulen, die Du integriert hast, die Originaldateien verändert haben, anzuschauen und die jeweiligen Änderungen Schritt für Schritt mit den Orginal Zen-Cart Files zu mergen.
                        Ich weiss nicht, welche Erweiterungen Du alle aktiv hast, ich sehe Deine Files nicht und kann daher auch keine Standardlösung posten. Das ist völlig individuell und eine Fehlersuche erfordert Zeit und eine Analyse aller betroffenen Dateien.
                        Ein nützliches Tool zum Mergen habe ich empfohlen. Viel Erfolg.
                        Also, vorab... Webchills, was Du hier alles so machst, DIR gehört ein DENKMAL gesetzt!!

                        Aber fachlich... das mergen is n Elendsjob, ich hab mich auch schon nächtelang damit rumgequält und ich kann PHP / MySQL lesen wie andere ne Bildzeitung...
                        Aber für nen *normalen* Shopbetreiber ist es einfach nicht mehr machbar. Ein weiteres GROSSES Prob isses, wenn man als Drittprogger dann in einem bestehenden Shop Dinge vergleichen / anpassen / erweitern muss - da kannste ja wahnsinnig werden.

                        Deshalb plädiere ich tendenziell auch für die KOMPLETTE Grundinstallation mit den meisten Modulen inclusive. Das Argument von unnötig aufgebläht kann man m.E. in der heutigen Zeit vergessen, ein einziges PDF oder grosses, nicht komprimiertes IMAGE macht genausoviel Traffic.

                        Und das zweite Argument, das man *das nicht braucht* .. nun gut, man könnte es trotzdem installern, und per klick abschalten... zumal das allermeiste dann ja auch gar nicht in die entsprechende Abfrage/Schleife läuft.

                        Jedenfalls: mein Fazit nach viel MERGEN - DAS ist DEFI kein Königsweg - insbesondere wenn man sich andere gelungene *Plug-in install Routinen anschaut* - und einem ambitionierten Webmaster mit rudimentären Kenntnissen einfach nicht zuzumuten, der is schon heilfroh, wenn er noch 'n Fieldset um vieles in reinem HTML hinwurschteln kann.

                        Nichts desto Trotz - I love ZEN und dieses Forum, wohl das BESTE Shop-SYSTEM, das man seit vielen Jahren finden kann, vom grandiosen Support (Merci Eentje und DIR und den vielen Helfenden) mal ganz abgesehen.

                        Aber mergen... Gott is das Kacke )))))))))))

                        In diesem Sinne, nicht böse sein, nur meine pers Erfahrung mit diversen Modulen und zum Schluss der PDF Rechnung - ich kann nur empfehlen, erstmal pdf, dann die anderen Module ( COWOA usw)

                        Beste Grüsse
                        Zuletzt geändert von Domain; 29.08.2012, 00:59.

                        Kommentar


                          #13
                          Zitat von Domain Beitrag anzeigen
                          Jedenfalls: mein Fazit nach viel MERGEN - DAS ist DEFI kein Königsweg - insbesondere wenn man sich andere gelungene *Plug-in install Routinen anschaut*
                          Die gibt der derzeitige Zen-Cart Code aber halt nicht her. Es gibt kein Pluginsystem, es werden Corefiles verändert. Das kann man mögen oder nicht, es ist leider so.

                          Zitat von Domain Beitrag anzeigen
                          Deshalb plädiere ich tendenziell auch für die KOMPLETTE Grundinstallation mit den meisten Modulen inclusive
                          Und wenn dann ein weiteres Modul integriert werden soll, muss nicht mehr gemerged werden oder wie?

                          Zitat von Doamin Beitrag anzeigen
                          Das Argument von unnötig aufgebläht kann man m.E. in der heutigen Zeit vergessen, ein einziges PDF oder grosses, nicht komprimiertes IMAGE macht genausoviel Traffic.
                          Hier gehts ja nicht um Traffic.

                          Zitat von Domain Beitrag anzeigen
                          Aber mergen... Gott is das Kacke )))))))))))
                          Ganz Deiner Meinung. Ich hätt auch lieber ein Pluginsystem à la WordPress. Wenn Du eins geschrieben hast, lass es mich wissen.

                          Kommentar


                            #14
                            Guten Abend,

                            Zitat von Domain
                            -- Die gibt der derzeitige Zen-Cart Code aber halt nicht her. Es gibt kein Pluginsystem, es werden Corefiles verändert. Das kann man mögen oder nicht, es ist leider so.

                            Ja schon logo, das war auch nicht als Kritik gemeint, eher als Anregung für kommende Versionen, ist doch schade, wenn viele von ZEN wieder zu OScomm-Scherz umschwenken,
                            nur weil Sie massiv Probs haben, n paar Plug-ins einzubauen.

                            Zitat von Domain
                            -- Und wenn dann ein weiteres Modul integriert werden soll, muss nicht mehr gemerged werden oder wie?

                            Auch das liest sich böser* als es gemeint war...
                            Ich sagte, die meisten Module inclusive, nicht alles was bei drei nicht auf den Bäumen ist. Alternativ liesse sich auch eine *umfangreichere Zweitversion* zum Download einstellen...

                            Zitat von Doamin
                            -- Hier gehts ja nicht um Traffic.

                            Naja, was ist dann gemeint? Die paar Admin - Einstellungen, oder die Menge an zusätzlichen Datei / Datenbanken ?

                            Zitat von Domain
                            Aber mergen... Gott is das Kacke )))))))))))

                            -- Ganz Deiner Meinung. Ich hätt auch lieber ein Pluginsystem à la WordPress. Wenn Du eins geschrieben hast, lass es mich wissen.

                            Ich gestehe Dir mal, ich habe sowas in der Art mal für nen Kunden gemacht... soooon* Riesen Hexenwerk ist das gar nicht. Allerdings wurden die Files ZENTRAL von einem Server geholt
                            und Kunden / Downloader hatten einen festen Account, das vereinfacht vieles...

                            Aber z.B. ... da habt ihr nun eine gute Installationsroutine und eigentlich wäre es z.B: keine grosse Sache, einmal zuerst DEINTEMPLATE anzugeben und dann die fertige Struktur zu kriegen
                            als durch jeden Ordner zu klixen und zu guggen, ob DEINTEMPLATE geändert werden muss...

                            In der PDF (zumindest bei mir) war die PDF Zeile fürs mergen nicht kommentiert, nach COWOA und einigen fieldsets/ Tables ist da nix mehr gleich... so ziehen sich noch viele Kleinigkeiten noch durch das Zen System

                            Wenn man es aber langsam rafft ( Zungeschnalz - Gott ist das genial) dann hoffe ich, daß es *ein biß-chen* anwenderfreundlicher wird in Sachen Plug-ins und mergen, denn ich fürchte, das schreckt
                            viele nach den ersten missratenen Versuchen doch ab und zen endet als Dateileiche auf mancher Platte.

                            Wie immer... nur meine pers. Meinung mit dem deutlichen Hinweis, das ich weiss, wieviel unendlicher FLEISS und ARBEIT in einem so mächtigen System steckt, und ich vermute, zu Allem kommt noch, daß
                            ihr das in eurer *Freizeit* und mit einer Eselsgeduld macht und natürlich keine Kohle dafür bekommt.

                            Es waren nur Gedanken zum Thema, keinesfalls sollte es negativ wirken.

                            In diesem Sinne

                            Vielen Dank, Grosse Klasse, Respekt

                            Beste Grüsse


                            P.S.:
                            Antwort ist auch nicht nötig, denn letztlich kann man da ja nix auf die Schnelle daran ändern, nur so ganz unkommentiert wollte ich es halt auch ned stehen lassen...

                            Kommentar


                              #15
                              Zitat von Domain Beitrag anzeigen
                              Guten Abend,

                              ....
                              Zitat von Domain
                              Aber mergen... Gott is das Kacke )))))))))))

                              ....
                              Wenn man es aber langsam rafft ( Zungeschnalz - Gott ist das genial) dann hoffe ich, daß es *ein biß-chen* anwenderfreundlicher wird in Sachen Plug-ins und mergen, denn ich fürchte, das schreckt
                              viele nach den ersten missratenen Versuchen doch ab und zen endet als Dateileiche auf mancher Platte.

                              .....
                              Beim mergen komme ich mir vor wie zu den alten DOS-Zeiten und Kommandozeileninterpreter. Das war damals schon mehr als grauenhaft.

                              Ich will es nicht schwarz malen, und auch von mir Respekt für die ganze tolle Arbeit, ABER, wenn sich da auf die Dauer nichts ändert, wird das der meiner Meinung nach ein großes Problem für ZenCart.

                              Schaue dir mal das Magento Community Shop-System an. Auch kostenlos. Habe mir mal einen "Probe-Shop" aufgespielt. Nicht schlecht das System.

                              Grüße
                              Manfred

                              Kommentar

                              Info zu diesem Forenarchiv:
                              Mit Release von 1.5.7 wurde die deutsche Zen Cart Version auf eine reine DIY-Lösung umgestellt.
                              Für einen Support via Forum stehen keine personellen und zeitlichen Ressourcen mehr zur Verfügung.
                              Dieses Supportforum bleibt im Nur-Lesen-Modus als Wissensarchiv noch online verfügbar.
                              PM Funktionalität, Registrierung und Posten neuer Beiträge sind deaktiviert.
                              Zugriff auf Anhänge in den Postings ist auch ohne Registrierung/Einloggen möglich.
                              FAQ und Downloadbereich des Forums wurden in die neue umfangreiche Knowledgebase auf der zen-cart-pro.at Website übernommen.

                              Das Development der deutschen Zen Cart Version geht wie bisher auf Github weiter.
                              Wir werden auch weiterhin neue Versionen bereitstellen und die Onlinedokumentation/Knowledgebase aktualisieren.
                              Fehler in der Software können auf Github als Issues gemeldet werden.
                              Follow us
                              aktuelle version
                              Zen Cart 1.5.7g deutsch
                              vom 12.12.2023
                              [Download]
                              Lädt...
                              X