function trail($separator = ' - ')
 {
     $trail_string = '';
     for ($i = 0, $n = sizeof($this->_trail); $i < $n; $i++) {
         if (isset($this->_trail[$i]['link']) && tep_not_null($this->_trail[$i]['link'])) {
             $trail_string .= '<li><a href="' . $this->_trail[$i]['link'] . '" class="headerNavigation">' . convert_to_entities($this->_trail[$i]['title']) . '</a></li>';
         } else {
             $trail_string .= '<li>' . convert_to_entities($this->_trail[$i]['title']) . '</li>';
         }
         //if (($i+1) < $n) $trail_string .= $separator;
     }
     return '<ul>' . $trail_string . '</ul>';
 }
 public function process_data()
 {
     global $temp_orders_id, $step, $customer_id, $cart, $customer_country_id, $Customer;
     $dbfields = array();
     $billing_is_delivery = true;
     $this->errors[get_class($this)] = array();
     //check if customer wants to login
     if ($this->config['login']['value'] == 'true' && $_POST['action'] == 'login') {
         $loggedIn = log_customer_in($_POST['login_email'], $_POST['login_pass']);
         if ($loggedIn !== true) {
             $this->errors[get_class($this)]['login'] = $loggedIn;
         } else {
             $this->update_products_to_db($customer_country_id);
         }
         return false;
     } else {
         if (tep_session_is_registered('customer_id')) {
             //logged in
             if (isset($_POST['save_new_address']) && $_POST['save_new_address'] == 'true') {
                 //add new address
                 if ($_POST['action'] != 'cancel') {
                     if (!$this->create_address_book_item()) {
                         $_GET['add_new_address'] = 'true';
                     }
                 }
                 return false;
                 //do not proceed to next step
                 //end add new address
             } else {
                 //process choosen address
                 //check if address is choosen for each block
                 if (count($_POST['address_book_id']) != count($this->fields)) {
                     //there isn't an address choosen for each block
                     if (count($_POST['address_book_id']) == 0) {
                         $this->errors[get_class($this)]['address_book_list'][] = Translate('Kies a.u.b. uw adressen.');
                     } else {
                         foreach ($this->fields as $block => $blockdata) {
                             if (!isset($_POST['address_book_id'][$block])) {
                                 $this->errors[get_class($this)]['address_book_list'][] = Translate('Kies a.u.b. een adres voor') . ' "' . $blockdata['title'] . '"';
                             }
                         }
                     }
                     return false;
                     //de not proceed to next step
                 } else {
                     //address is choosen for each block, save choosen data
                     //save address_book_id
                     tep_db_query('UPDATE temp_orders SET delivery_address_id = "' . $_POST['address_book_id']['delivery'] . '", billing_address_id = "' . $_POST['address_book_id']['billing'] . '" WHERE orders_id = "' . $temp_orders_id . '"');
                     $c_query = tep_db_query('SELECT customers_firstname, customers_email_address, customers_telephone, customers_default_address_id FROM customers WHERE customers_id = "' . $customer_id . '"');
                     $c = tep_db_fetch_array($c_query);
                     $dbfields['customers_name'] = $c['customers_firstname'];
                     $firstblock = key($_POST['address_book_id']);
                     foreach ($_POST['address_book_id'] as $block => $address_book_id) {
                         $ab_query = tep_db_query('SELECT * FROM address_book WHERE address_book_id = "' . $address_book_id . '"');
                         $ab = tep_db_fetch_array($ab_query);
                         $ab = array_merge($ab, $c);
                         if ($block == $firstblock) {
                             $dbfields['customers_id'] = $customer_id;
                             $dbfields['customers_company'] = $ab['entry_company'];
                             $dbfields['customers_street_address'] = $ab['entry_street_address'];
                             $dbfields['customers_suburb'] = $ab['entry_suburb'];
                             $dbfields['customers_city'] = $ab['entry_city'];
                             $dbfields['customers_postcode'] = $ab['entry_postcode'];
                             $dbfields['customers_state'] = $ab['entry_state'];
                             $dbfields['customers_country'] = $ab['entry_country_id'];
                         }
                         foreach ($this->fields[$block]['fields'] as $field => $fieldData) {
                             //check if data is in database for this field
                             if (isset($ab[$fieldData['dbvalue']])) {
                                 if ($field == 'billing_country') {
                                     $this->update_products_to_db($ab[$fieldData['dbvalue']]);
                                 }
                                 $dbfields[$field] = $ab[$fieldData['dbvalue']];
                                 //check if this field has a regular expression check
                                 if ($fieldData['expression'] != '') {
                                     //if (!preg_match($fieldData['expression'], $ab[$fieldData['dbvalue']])) {
                                     if (!preg_match($fieldData['expression'], convert_to_entities($ab[$fieldData['dbvalue']]))) {
                                         //echo "if".$fieldData['expression'].'-'.$fieldData['dbvalue'];
                                         $this->errors[get_class($this)][$field] = $fieldData['error'];
                                     }
                                     //check if this field has a function check
                                 } else {
                                     if ($fieldData['function'] != '') {
                                         if (!$fieldData['function']($ab[$fieldData['dbvalue']])) {
                                             $this->errors[get_class($this)][$field] = $fieldData['error'];
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 //end check if address is choosen for each block
             }
             //end process choosen address
         } else {
             //end logged in
             if (isset($_POST['different_delivery_address']) && $_POST['different_delivery_address'] == 'true') {
                 $billing_is_delivery = false;
             }
             //echo '<pre>';print_r($this->fields);
             //go through all active fields
             foreach ($this->fields as $block => $blockData) {
                 foreach ($blockData['fields'] as $field => $fieldData) {
                     //check if data is posted for this field
                     if ($fieldData['block'] == 'delivery' && $billing_is_delivery) {
                         //delivery data is equal to billing data, don't process it
                     } else {
                         if (isset($_POST[get_class($this) . '_' . $field])) {
                             $dbfields[$field] = $_POST[get_class($this) . '_' . $field];
                             if ($billing_is_delivery && strstr($field, 'billing') && $field != 'billing_tva_intracom') {
                                 $delivery_field = str_replace('billing', 'delivery', $field);
                                 $dbfields[$delivery_field] = $_POST[get_class($this) . '_' . $field];
                             }
                             if ($field == 'billing_name' || $field == 'billing_firstname' || $field == 'billing_lastname' || $field == 'delivery_firstname' || $field == 'delivery_lastname') {
                                 if (empty($dbfields['customers_name'])) {
                                     $dbfields['customers_name'] = $_POST[get_class($this) . '_billing_lastname'] . ' ' . $_POST[get_class($this) . '_billing_firstname'];
                                     $dbfields['billing_name'] = $_POST[get_class($this) . '_billing_lastname'] . ' ' . $_POST[get_class($this) . '_billing_firstname'];
                                     if ($billing_is_delivery) {
                                         $dbfields['delivery_name'] = $_POST[get_class($this) . '_billing_lastname'] . ' ' . $_POST[get_class($this) . '_billing_firstname'];
                                     } else {
                                         $dbfields['delivery_name'] = $_POST[get_class($this) . '_delivery_lastname'] . ' ' . $_POST[get_class($this) . '_delivery_firstname'];
                                     }
                                 }
                                 unset($dbfields['billing_firstname']);
                                 unset($dbfields['billing_lastname']);
                                 unset($dbfields['delivery_firstname']);
                                 unset($dbfields['delivery_lastname']);
                             }
                             if ($field == 'billing_company') {
                                 $dbfields['customers_company'] = $_POST[get_class($this) . '_' . $field];
                             }
                             if ($field == 'billing_street_address') {
                                 $dbfields['customers_street_address'] = $_POST[get_class($this) . '_' . $field];
                             }
                             if ($field == 'billing_city') {
                                 $dbfields['customers_city'] = $_POST[get_class($this) . '_' . $field];
                             }
                             if ($field == 'billing_postcode') {
                                 $dbfields['customers_postcode'] = $_POST[get_class($this) . '_' . $field];
                             }
                             if ($field == 'billing_country') {
                                 $dbfields['customers_country'] = $_POST[get_class($this) . '_' . $field];
                             }
                             //check if this field has a regular expression check
                             if ($fieldData['expression'] != '') {
                                 if (!preg_match($fieldData['expression'], $_POST[get_class($this) . '_' . $field])) {
                                     $this->errors[get_class($this)][$block][$field] = $fieldData['error'];
                                 }
                                 //check if this field has a function check
                             } else {
                                 if ($fieldData['function'] != '') {
                                     if (!$fieldData['function']($_POST[get_class($this) . '_' . $field])) {
                                         $this->errors[get_class($this)][$block][$field] = $fieldData['error'];
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             $this->update_products_to_db($_POST[get_class($this) . '_billing_country']);
         }
         //end not logged in
         //save data to db
         if (count($dbfields) > 0) {
             if ($temp_orders_id == 0) {
                 if (is_object($Checkout)) {
                     $temp_orders_id = $Checkout->create_order();
                     $dbfields['billing_name'] = $_POST[get_class($this) . '_billing_lastname'] . ' ' . $_POST[get_class($this) . '_billing_firstname'];
                     if ($billing_is_delivery) {
                         $dbfields['delivery_name'] = $_POST[get_class($this) . '_billing_lastname'] . ' ' . $_POST[get_class($this) . '_billing_firstname'];
                     } else {
                         $dbfields['delivery_name'] = $_POST[get_class($this) . '_delivery_lastname'] . ' ' . $_POST[get_class($this) . '_delivery_firstname'];
                     }
                     if ($dbfields['billing_name'] == '') {
                         $dbfields['billing_name'] = $dbfields['billing_firstname'];
                     }
                     if ($dbfields['delivery_name'] == '') {
                         $dbfields['delivery_name'] = $dbfields['delivery_firstname'];
                     }
                     //$dbfields['billing_name'] = $dbfields['billing_firstname'];
                     //$dbfields['delivery_name'] = $dbfields['delivery_firstname'];
                     unset($dbfields['billing_firstname']);
                     unset($dbfields['billing_lastname']);
                     unset($dbfields['delivery_firstname']);
                     unset($dbfields['delivery_lastname']);
                     tep_db_perform('temp_orders', $dbfields, 'update', 'orders_id = "' . $temp_orders_id . '"');
                 }
             } else {
                 //Amar changes atart here - 18-12-2012
                 $dbfields['billing_name'] = $_POST[get_class($this) . '_billing_lastname'] . ' ' . $_POST[get_class($this) . '_billing_firstname'];
                 if ($billing_is_delivery) {
                     $dbfields['delivery_name'] = $_POST[get_class($this) . '_billing_lastname'] . ' ' . $_POST[get_class($this) . '_billing_firstname'];
                 } else {
                     $dbfields['delivery_name'] = $_POST[get_class($this) . '_delivery_lastname'] . ' ' . $_POST[get_class($this) . '_delivery_firstname'];
                 }
                 //$dbfields['billing_name'] = $dbfields['billing_firstname'];
                 //$dbfields['delivery_name'] = $dbfields['delivery_firstname'];
                 if ($dbfields['billing_name'] == '' || $dbfields['billing_name'] == ' ') {
                     $dbfields['billing_name'] = $dbfields['billing_firstname'];
                 }
                 if ($dbfields['delivery_name'] == '' || $dbfields['delivery_name'] == ' ') {
                     $dbfields['delivery_name'] = $dbfields['delivery_firstname'];
                 }
                 //As billing name is a new field let it not show any errors now.. hence dsabling errors for it Amar
                 //unset($this->errors[get_class($this)]['billing']['billing_name']);
                 //unset($this->errors[get_class($this)]['billing']['billing_firstname']);
                 //End of error handling
                 unset($dbfields['billing_firstname']);
                 unset($dbfields['billing_lastname']);
                 unset($dbfields['delivery_firstname']);
                 unset($dbfields['delivery_lastname']);
                 //Amar changes ends
                 //Amar : changes for the logged in customer .. name in the mail 17-12-2013
                 //end of Amar: chages
                 tep_db_perform('temp_orders', $dbfields, 'update', 'orders_id = "' . $temp_orders_id . '"');
             }
         }
         //check if there where errors found
         if (count($this->errors[get_class($this)]) > 0) {
             return false;
         } else {
             //Create account
             if ($this->config['create_account']['value'] == 'true' && !tep_session_is_registered('customer_id') && $_POST['action'] == 'create_account') {
                 if ($_POST[get_class($this) . '_password'] == $_POST[get_class($this) . '_password2']) {
                     //Transform data for use with Customer class
                     $_POST['name'] = $_POST[get_class($this) . '_billing_name'];
                     $_POST['email_address'] = $_POST[get_class($this) . '_customers_email_address'];
                     $_POST['street_address'] = $_POST[get_class($this) . '_billing_street_address'];
                     $_POST['postcode'] = $_POST[get_class($this) . '_billing_postcode'];
                     $_POST['city'] = $_POST[get_class($this) . '_billing_city'];
                     $_POST['country'] = $_POST[get_class($this) . '_billing_country'];
                     $_POST['telephone'] = $_POST[get_class($this) . '_customers_telephone'];
                     $_POST['password'] = $_POST[get_class($this) . '_password'];
                     $_POST['confirmation'] = $_POST[get_class($this) . '_password2'];
                     //Create account
                     $create_customer = $Customer->create_customer($_POST);
                     //Check if there were errors
                     //If everything is right the only error here can be 'terms'.
                     //If there are other errors then 'terms' then the conditions are different in $Customer and here
                     if (isset($create_customer['errors'])) {
                         // chnaged name to billing_name - nikhil
                         if (isset($create_customer['errors']['billing_name'])) {
                             $this->errors[get_class($this)]['billing']['billing_name'] = $create_customer['errors']['billing_name'];
                         }
                         // chnaged name to billing_name - nikhil ends
                         if (isset($create_customer['errors']['email_address'])) {
                             $this->errors[get_class($this)]['billing']['customers_email_address'] = $create_customer['errors']['email_address'];
                         }
                         if (isset($create_customer['errors']['street_address'])) {
                             $this->errors[get_class($this)]['billing']['billing_street_address'] = $create_customer['errors']['street_address'];
                         }
                         if (isset($create_customer['errors']['postcode'])) {
                             $this->errors[get_class($this)]['billing']['billing_postcode'] = $create_customer['errors']['postcode'];
                         }
                         if (isset($create_customer['errors']['city'])) {
                             $this->errors[get_class($this)]['billing']['billing_city'] = $create_customer['errors']['city'];
                         }
                         if (isset($create_customer['errors']['country'])) {
                             $this->errors[get_class($this)]['billing']['billing_country'] = $create_customer['errors']['country'];
                         }
                         if (isset($create_customer['errors']['telephone'])) {
                             $this->errors[get_class($this)]['billing']['customers_telephone'] = $create_customer['errors']['telephone'];
                         }
                         if (isset($create_customer['errors']['terms'])) {
                             $this->errors[get_class($this)]['create_account'] = $create_customer['errors']['terms'];
                         }
                         if (isset($create_customer['errors']['confirmation'])) {
                             $this->errors[get_class($this)]['create_account'] = $create_customer['errors']['confirmation'];
                         }
                         if (isset($create_customer['errors']['password'])) {
                             $this->errors[get_class($this)]['create_account'] = $create_customer['errors']['password'];
                         }
                     } else {
                         $customer_id = $create_customer['customer_id'];
                         //Check if billing address and delivery address are different
                         if (isset($_POST['different_delivery_address']) && $_POST['different_delivery_address'] == 'true') {
                             $address_book_data = array();
                             $address_book_data['name'] = $_POST[get_class($this) . '_delivery_name'];
                             $address_book_data['street_address'] = $_POST[get_class($this) . '_delivery_street_address'];
                             $address_book_data['city'] = $_POST[get_class($this) . '_delivery_city'];
                             $address_book_data['postcode'] = $_POST[get_class($this) . '_delivery_postcode'];
                             $address_book_data['country'] = $_POST[get_class($this) . '_delivery_country'];
                             $address_book_item = $Customer->create_address_book_item($customer_id, $address_book_data);
                             if (isset($address_book_item['errors'])) {
                                 if (isset($address_book_item['errors']['name'])) {
                                     $this->errors[get_class($this)]['delivery']['delivery_name'] = $address_book_item['errors']['name'];
                                 }
                                 if (isset($address_book_item['errors']['street_address'])) {
                                     $this->errors[get_class($this)]['delivery']['delivery_street_address'] = $address_book_item['errors']['street_address'];
                                 }
                                 if (isset($address_book_item['errors']['postcode'])) {
                                     $this->errors[get_class($this)]['delivery']['delivery_postcode'] = $address_book_item['errors']['postcode'];
                                 }
                                 if (isset($address_book_item['errors']['city'])) {
                                     $this->errors[get_class($this)]['delivery']['delivery_city'] = $address_book_item['errors']['city'];
                                 }
                                 if (isset($address_book_item['errors']['country'])) {
                                     $this->errors[get_class($this)]['delivery']['delivery_country'] = $address_book_item['errors']['country'];
                                 }
                                 return false;
                             } else {
                                 tep_db_query('UPDATE temp_orders SET delivery_address_id = "' . $address_book_item['address_book_id'] . '" WHERE orders_id = "' . $temp_orders_id . '"');
                             }
                         }
                         //Set billing address id
                         tep_db_query('UPDATE temp_orders SET customers_id = "' . $create_customer['customer_id'] . '", billing_address_id = "' . $create_customer['address_book_id'] . '" WHERE orders_id = "' . $temp_orders_id . '"');
                         return true;
                     }
                     return false;
                 } else {
                     $this->errors[get_class($this)]['create_account'] = Translate('De ingevoerde wachtwoorden moeten hetzelfde zijn. Voer ze opnieuw in.');
                     return false;
                 }
             }
             return true;
         }
     }
 }
Exemple #3
0
?>
	<tr>
		<td>
			<div class="orders">
				<h2><?php echo Translate('Overzicht'); ?> <?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL') . '">' . Translate('Laatste bestellingen') . '</a>'; ?></h2>
				<table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
$orders_query = tep_db_query("select o.orders_id, o.date_purchased, o.delivery_name, o.delivery_country, o.billing_name, o.billing_country, ot.text as order_total, s.orders_status_name from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$customer_id . "' and o.orders_id = ot.orders_id and ot.class = 'ot_total' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' order by orders_id desc limit 3");
$i=0;
while ($orders = tep_db_fetch_array($orders_query)) {
	if (tep_not_null($orders['delivery_name'])) {
		$order_name = convert_to_entities($orders['delivery_name']);
		$order_country = convert_to_entities($orders['delivery_country']);
	} else {
		$order_name = convert_to_entities($orders['billing_name']);
		$order_country = convert_to_entities($orders['billing_country']);
	}
	if ($i%2) {
		$class = "odd";
	} else {
		$class = "even";
	}
?>
					<tr class="<?php echo $class;?>" onClick="document.location.href='<?php echo tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL'); ?>'">
						<td height="5" colspan="6"></td>
					</tr>
					<tr class="<?php echo $class;?>" onClick="document.location.href='<?php echo tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL'); ?>'">
						<td class="main" width="80"><?php echo tep_date_short($orders['date_purchased']); ?></td>
						<td class="main"><?php echo '#' . $orders['orders_id']; ?></td>
						<td class="main"><?php echo tep_output_string_protected($order_name) . ', ' . $order_country; ?></td>
						<td class="main"><?php echo $orders['orders_status_name']; ?></td>
Exemple #4
0
function tep_get_countries($countries_id = '', $with_iso_codes = false)
{
    $countries_array = array();
    if (tep_not_null($countries_id)) {
        if ($with_iso_codes == true) {
            $countries = tep_db_query("select countries_name, countries_iso_code_2, countries_iso_code_3 from " . TABLE_COUNTRIES . " where countries_id = '" . (int) $countries_id . "' order by countries_name");
            $countries_values = tep_db_fetch_array($countries);
            $countries_array = array('countries_name' => convert_to_entities($countries_values['countries_name']), 'countries_iso_code_2' => $countries_values['countries_iso_code_2'], 'countries_iso_code_3' => $countries_values['countries_iso_code_3']);
        } else {
            $countries = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . (int) $countries_id . "'");
            $countries_values = tep_db_fetch_array($countries);
            $countries_array = array('countries_name' => convert_to_entities($countries_values['countries_name']));
        }
    } else {
        if (COUNTRIES_SELECT != 'all') {
            $countries = tep_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " where status = 'true' order by countries_name");
        } else {
            $countries = tep_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " order by countries_name");
        }
        while ($countries_values = tep_db_fetch_array($countries)) {
            $countries_array[] = array('countries_id' => $countries_values['countries_id'], 'countries_name' => convert_to_entities($countries_values['countries_name']));
        }
    }
    return $countries_array;
}
Exemple #5
0
                }
                //to avoid spambots.
                if ($defaultTags['name'] == 'meta_replyto' && $defaultTags['value'] == '1') {
                    $headertags_extra .= ' <meta name="Reply-to" content="' . STORE_OWNER_EMAIL_ADDRESS . '" />' . "\n";
                }
                // globaal contact adres for the website.
                if ($defaultTags['name'] == 'meta_canonical' && $defaultTags['value'] == '1') {
                    $headertags_extra .= tep_not_null($canonical_url) ? ' <link rel="canonical" href="' . $canonical_url . '" />' . "\n" : ' <link rel="canonical" href="' . GetCanonicalURL() . '" />' . "\n";
                }
                // prevent duplicated content for search engines (google, live, yahoo). The canonical url gives the right page link to search engines
            }
        }
        // EOF extra meta info
        break;
}
$sts->template['headertags'] = ' <meta http-equiv="Content-Type" content="text/html; charset=' . CHARSET . '" />' . "\n" . ($sts->template['headertags'] .= ' <title>' . convert_to_entities($header_tags_array['title']) . '</title>' . "\n");
// can only have a maximum of 66 characters
if ($header_tags_array['desc'] != '') {
    $sts->template['headertags'] .= ' <meta name="Description" content="' . $header_tags_array['desc'] . '" />' . "\n";
}
if ($header_tags_array['keywords'] != '') {
    $sts->template['headertags'] .= ' <meta name="Keywords" content="' . $header_tags_array['keywords'] . '" />' . "\n";
}
$sts->template['headertags'] .= $headertags_extra;
//css
$sts->template['headertags'] .= ' <link rel="shortcut icon" href="' . HTTP_SERVER . DIR_WS_HTTP_CATALOG . '/favicon.ico" type="image/x-icon" />' . "\n";
$sts->template['headertags'] .= ' <link rel="stylesheet" type="text/css" href="' . substr(($request_type == 'SSL' ? DIR_WS_HTTPS_CATALOG : DIR_WS_HTTP_CATALOG) . STS_TEMPLATE_DIR, 0, -1) . '/css/style.css" />' . "\n";
$sts->template['headertags'] .= ' <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/base/jquery-ui.css" />' . "\n";
$sts->template['headertags'] .= $headertags_extra_css;
//js
$sts->template['headertags'] .= ' <script type="text/javascript" src="https://www.google.com/jsapi"></script>' . "\n";