s2diout.php
/// Art: Shop Ausgabe
/// Inhalt: Anweisungen
/// Beschreibung: Ausgabe der Shop Seite an der Renderposition innerhalb des Designs
/// Benötigt: template.php
/// CML-Parsing: nein
///
//////////////////////////////////////////////////////////////////////////////////////////
///
/// Letzte Änderungen:
/// 29.07.2007 E-Commerce Analytics ergänzt
/// 14.01.2009 Ergänzung von PostFinance/Yellowpay
/// 16.02.2009 Änderung Gutscheine
/// 17.02.2009 Verschlüsselung geändert
/// 17.03.2009 Shopmore angepasst
/// 18.03.2009 Anpassungen Trusted Shops
/// 20.03.2009 Sofortueberweisung md5 auf sha1 geändert
/// 06.04.2009 Entcryption für Bank/Karten entfernt
/// 05.05.2009 Erweiterte Produktfelder auf für ohne Kundenkonto
/// 25.05.2009 Bei digitalen Gütern Option Kaufen ohne Kundenkonto ausgeblendet
/// 22.09.2009 split -> explode
/// shop to date 7
/// 02.09.2009 Moneybookers hinzugefügt
/// 06.10.2009 U.B. ub_project_id in mylicenses
/// 07.12.2009 Warenkorbsperre bei Minderbestand hinzugefügt
/// 08.12.2009 Grafiken im Warenkorb hinzugefügt
/// 09.12.2009 Cookiecheck hinzugefügt
/// 09.12.2009 Rabattsperre hinzugefügt
/// 18.12.2009 Firma bei Adressen ergänzt
/// 22.01.2010 Email Adresse wiederholen
/// 23.01.2010 ESD Änderungen Uwe Braun eingefügt -> ESDUB
/// 31.01.2010 Moneybookers erweitert
/// 09.02.2010 ESD Änderungen Uwe Braun angepasst -> ESDUB
/// 10.03.2010 Bestelloptionen
/// 14.07.2010 Moneybookers Parametrer Reihenfolge verbessert
/// 17.07.2010 Präfixe eingebaut
/// 31.07.2010 Trusted Shops erweitert
/// 01.08.2010 ESD Übertrag von 6
/// 01.08.2010 Unserialize Warning verhindert PHP4
///
//////////////////////////////////////////////////////////////////////////////////////////
///<01.08.2010/7.0.1.5/>
if (!defined('SHOP_TO_DATE'))
die('Forbidden');
// Je nach Seite verschiedenen tun
switch (FILENAME) {
// Warenkorb
case CC_FILENAME_BASKET:
$sum = 0;
$vatsum = 0;
$vat = array();
$template = new template(CC_TPL_BASKET);
// Cookiecheck
$template->show_cond($session->just_created, 'cookiesrequired');
$template->show_cond($order->get_weight(), 'weight');
$count_items = 0;
$count_memos = 0;
foreach($order->items as $item)
if ($item->memo)
$count_memos++;
else
$count_items++;
$template->show_cond(!$count_items, 'basketempty');
$template->show_cond(!$count_memos, 'memoempty');
$size = 0;
foreach ($order->items as $item)
$size = max($size, (5 + ($item->qprecision ? 1 : 0) + $item->qprecision) * 7);
$notrebatable = false;
foreach ($order->items as $item) {
$specialinfo = '';
// Eco-Tax Anpassung Frankreich / Abhängige Artikel
// Bei abhängigen Artikeln keine konfiguration auslesen
if ($item->specialinfo && !$item->position_main)
foreach(explode("\n", $item->specialinfo) as $z) {
$specialparts = explode('=', $z);
$specialinfo .= urldecode($specialparts[0]).": ".urldecode($specialparts[1])."
";
}
///MO45+
///MO45-<
// Bilder im Warenkorb
if (CC_SITE_BASKETPICTURES) {
if (!file_exists($product_file = DBPATH.$item->uid.'.'.CC_SITE_SCRIPTEXTENSION))
die('No such item '.$product_file);
include($product_file);
}
$template->loop($item->memo ? 'memo' : 'item', array(
'_specialinfo' => $specialinfo,
'_basketpicurl' => CC_SITE_BASKETPICTURES ? $product_data->basketpicture : '',
'hasbasketpic' => CC_SITE_BASKETPICTURES && $product_data->basketpicture ? true : false,
'_vat' => format::vat($item->vat),
'_quantity' => $item->new_quantity !== null ? $item->new_quantity : format::quantity($item->quantity, $item->qprecision),
'_actualpriceone' => format::price($item->get_price(), $order->currency),
'_actualpriceall' => format::price($item->get_priceall(), $order->currency),
'_error' => $item->new_quantity !== null ? 'h' : '',
'_maxlength' => 4 + ($item->qprecision ? 1 : 0) + $item->qprecision,
'_size' => $size,
'_morecaption' => isset($parts[2]) ? $parts[2] : '',
), $item);
///MO45>
if (!$item->rebatable)
$notrebatable = true;
}
$template->show_cond($notrebatable, 'notrebatable');
foreach ($order->vatarray->vatarray as $vat) {
$template->loop('vat', array(
'_percent' => format::vat($vat->percent),
'_amount' => format::price($vat->amount, $order->currency),
), null);
}
$template->show_cond($order->get_rebate(), 'rebate');
foreach($messages as $message)
$template->loop('message', array('message' => $message));
$template->assign(array(
'_subtotal' => format::price($order->get_subtotal(), $order->currency),
'_rebate' => format::price($order->get_rebate(), $order->currency),
'_total' => format::price($order->get_subtotal() - $order->get_rebate(), $order->currency),
'_gross' => format::price($order->get_subtotal() - $order->get_rebate() + $order->get_totalvat(), $order->currency),
'_session_id' => $order->order_id,
'_redirect' => xcrypt::str2hex(CC_URL_ADDRESSES),
'_shopmore' => isset($shopmore) ? $shopmore : CC_SITE_SHOPMORE,
'_weight' => format::weight($order->get_weight()),
'_b2b' => $order->b2b,
));
$template->show_cond($order->b2b, 'b2b');
break;
// Loginfile
case CC_FILENAME_LOGIN:
$template = new template(CC_TPL_LOGIN);
$template->show_cond(isset($sendpassword_done), 'sendpassword_done');
// Einloggen mit Email und Passwort
if (CC_SITE_LOGINMODE != LOGIN_OFF) {
$template->show('login');
$template->show_cond($error && $mode == MODE_LOGIN, 'login_error');
$template->assign_cond($mode == MODE_LOGIN, array(
'_error_login_email' => $error ? 'h' : '',
'_error_login_password' => $error ? 'h' : '',
'_login_email' => post('login_email'),
));
}
if (CC_SITE_LOGINMODE != LOGIN_OFF &&
!strstr(xcrypt::hex2str($redirect), CC_URL_OSINDEX) &&
!strstr(xcrypt::hex2str($redirect), CC_URL_OSCLIENTS) &&
!strstr(xcrypt::hex2str($redirect), CC_URL_OSORDERS) &&
!strstr(xcrypt::hex2str($redirect), CC_URL_OSDOWNLOADS)) {
// Passwort vergessen
$template->show('sendpassword');
$template->show_cond($client->is_error('email') && $mode == MODE_SENDPASSWORD, 'sendpassword_emailerror');
$template->assign_cond($mode == MODE_SENDPASSWORD, array(
'_error_sendpassword_email' => $client->is_error('email'),
'_sendpassword_email' => post('sendpassword_email'),
));
// Neu anmelden
$template->show('new');
if ($mode == MODE_NEW) {
$template->show_cond($email_in_use, 'new_emailinuse');
$template->show_cond($error, 'new_error');
$template->show_cond($client->is_error('email'), 'new_erroremail');
$template->show_cond($error_email_repeat, 'new_erroremailrepeat');
}
// Optionale Felder einblenden
$template->show_cond(CC_SITE_COMPANYREQUIRED != HIDDEN, 'new_company');
$template->show_cond(CC_SITE_CUSTOM1REQUIRED != HIDDEN, 'new_custom1');
$template->show_cond(CC_SITE_CUSTOM2REQUIRED != HIDDEN, 'new_custom2');
$template->show_cond(CC_SITE_CUSTOM3REQUIRED != HIDDEN, 'new_custom3');
$template->show_cond(CC_SITE_CUSTOM4REQUIRED != HIDDEN, 'new_custom4');
$template->show_cond(CC_SITE_CUSTOM5REQUIRED != HIDDEN, 'new_custom5');
// Anreden
foreach (get_salutations() as $s)
$template->loop('new_salutation', array(
'value' => $s,
'option' => $s,
'selected' => $client->salutation == $s ? ' selected="selected" ' : '',
));
// Länder
foreach (get_countries() as $c)
$template->loop('new_country', array(
'value' => $c,
'option' => substr($c, 11),
'selected' => $client->country == $c ? ' selected="selected" ' : '',
));
// Fehlerfelder und Werte setzen
$template->assign_cond($mode == MODE_NEW, array(
'_error_new_firstname' => $client->is_error('firstname'),
'_error_new_lastname' => $client->is_error('lastname'),
'_error_new_company' => $client->is_error('company'),
'_error_new_street' => $client->is_error('street'),
'_error_new_streetnumber' => $client->is_error('streetnumber'),
'_error_new_zip' => $client->is_error('zip'),
'_error_new_city' => $client->is_error('city'),
'_error_new_phone' => $client->is_error('phone'),
'_error_new_cellphone' => $client->is_error('cellphone'),
'_error_new_fax' => $client->is_error('fax'),
'_error_new_custom1' => $client->is_error('custom1'),
'_error_new_custom2' => $client->is_error('custom2'),
'_error_new_custom3' => $client->is_error('custom3'),
'_error_new_custom4' => $client->is_error('custom4'),
'_error_new_custom5' => $client->is_error('custom5'),
'_error_new_email' => $client->is_error('email'),
'_error_new_emailrepeat' => $error_email_repeat ? 'h' : '',
'_error_new_password' => $client->is_error('password'),
'_new_firstname' =>$client->firstname,
'_new_lastname' => $client->lastname,
'_new_company' => $client->company,
'_new_street' => $client->street,
'_new_streetnumber' => $client->streetnumber,
'_new_zip' => $client->zip,
'_new_city' => $client->city,
'_new_phone' => $client->phone,
'_new_cellphone' => $client->cellphone,
'_new_fax' => $client->fax,
'_new_custom1' => $client->custom1,
'_new_custom2' => $client->custom2,
'_new_custom3' => $client->custom3,
'_new_custom4' => $client->custom4,
'_new_custom5' => $client->custom5,
'_new_email' => $client->email,
'_new_emailrepeat' => $client->emailrepeat,
));
$template->assign(array(
'_required_new_phone' => CC_SITE_PHONEREQUIRED == REQUIRED ? '*' : '',
'_required_new_cellphone' => CC_SITE_CELLPHONEREQUIRED == REQUIRED ? '*' : '',
'_required_new_fax' => CC_SITE_FAXREQUIRED == REQUIRED ? '*' : '',
'_required_new_company' => CC_SITE_COMPANYREQUIRED == REQUIRED ? '*' : '',
'_required_new_custom1' => CC_SITE_CUSTOM1REQUIRED == REQUIRED ? '*' : '',
'_required_new_custom2' => CC_SITE_CUSTOM2REQUIRED == REQUIRED ? '*' : '',
'_required_new_custom3' => CC_SITE_CUSTOM3REQUIRED == REQUIRED ? '*' : '',
'_required_new_custom4' => CC_SITE_CUSTOM4REQUIRED == REQUIRED ? '*' : '',
'_required_new_custom5' => CC_SITE_CUSTOM5REQUIRED == REQUIRED ? '*' : '',
'_checked_new_newsletter' => $client->newsletter ? ' checked="checked" ' : '',
));
$template->show_cond(constant('CC_SITE_NEWSLETTER'), 'new_newsletter');
}
// Keine Anmeldung
if (CC_SITE_LOGINMODE != LOGIN_REQUIRED &&
!strstr(xcrypt::hex2str($redirect), CC_FILENAME_ACCOUNT) &&
!strstr(xcrypt::hex2str($redirect), CC_URL_OSINDEX) &&
!strstr(xcrypt::hex2str($redirect), CC_URL_OSCLIENTS) &&
!strstr(xcrypt::hex2str($redirect), CC_URL_OSORDERS) &&
!strstr(xcrypt::hex2str($redirect), CC_URL_OSDOWNLOADS) && !$is_esd) {
$template->show('continuewithoutlogin');
$template->show_cond(CC_SITE_LOGINMODE == LOGIN_OPTIONAL, 'continuewithoutlogin_optional');
$template->show_cond(CC_SITE_LOGINMODE != LOGIN_OPTIONAL, 'continuewithoutlogin_only');
// Optionale Felder
$template->show_cond(CC_SITE_COMPANYREQUIRED != HIDDEN, 'continuewithoutlogin_company');
$template->show_cond(CC_SITE_CUSTOM1REQUIRED != HIDDEN, 'continuewithoutlogin_custom1');
$template->show_cond(CC_SITE_CUSTOM2REQUIRED != HIDDEN, 'continuewithoutlogin_custom2');
$template->show_cond(CC_SITE_CUSTOM3REQUIRED != HIDDEN, 'continuewithoutlogin_custom3');
$template->show_cond(CC_SITE_CUSTOM4REQUIRED != HIDDEN, 'continuewithoutlogin_custom4');
$template->show_cond(CC_SITE_CUSTOM5REQUIRED != HIDDEN, 'continuewithoutlogin_custom5');
if ($mode == MODE_CONTINUEWITHOUTLOGIN) {
$template->show_cond($email_in_use, 'continuewithoutlogin_emailinuse');
$template->show_cond($error, 'continuewithoutlogin_error');
$template->show_cond($client->is_error('email'), 'continuewithoutlogin_erroremail');
$template->show_cond($error_email_repeat, 'continuewithoutlogin_erroremailrepeat');
}
foreach (get_salutations() as $s)
$template->loop('continuewithoutlogin_salutation', array(
'value' => $s,
'option' => $s,
'selected' => $client->salutation == $s ? ' selected="selected" ' : '',
));
foreach (get_countries() as $c)
$template->loop('continuewithoutlogin_country', array(
'value' => $c,
'option' => substr($c, 11),
'selected' => $client->country == $c ? ' selected="selected" ' : '',
));
$template->assign_cond($mode == MODE_CONTINUEWITHOUTLOGIN, array(
'_error_continuewithoutlogin_firstname' => $client->is_error('firstname'),
'_error_continuewithoutlogin_lastname' => $client->is_error('lastname'),
'_error_continuewithoutlogin_company' => $client->is_error('company'),
'_error_continuewithoutlogin_street' => $client->is_error('street'),
'_error_continuewithoutlogin_streetnumber' => $client->is_error('streetnumber'),
'_error_continuewithoutlogin_zip' => $client->is_error('zip'),
'_error_continuewithoutlogin_city' => $client->is_error('city'),
'_error_continuewithoutlogin_phone' => $client->is_error('phone'),
'_error_continuewithoutlogin_cellphone' => $client->is_error('cellphone'),
'_error_continuewithoutlogin_fax' => $client->is_error('fax'),
'_error_continuewithoutlogin_custom1' => $client->is_error('custom1'),
'_error_continuewithoutlogin_custom2' => $client->is_error('custom2'),
'_error_continuewithoutlogin_custom3' => $client->is_error('custom3'),
'_error_continuewithoutlogin_custom4' => $client->is_error('custom4'),
'_error_continuewithoutlogin_custom5' => $client->is_error('custom5'),
'_error_continuewithoutlogin_email' => $client->is_error('email'),
'_error_continuewithoutlogin_emailrepeat' => $error_email_repeat ? 'h' : '',
'_continuewithoutlogin_firstname' => $client->firstname,
'_continuewithoutlogin_lastname' => $client->lastname,
'_continuewithoutlogin_company' => $client->company,
'_continuewithoutlogin_street' => $client->street,
'_continuewithoutlogin_streetnumber' => $client->streetnumber,
'_continuewithoutlogin_zip' => $client->zip,
'_continuewithoutlogin_city' => $client->city,
'_continuewithoutlogin_phone' => $client->phone,
'_continuewithoutlogin_cellphone' => $client->cellphone,
'_continuewithoutlogin_fax' => $client->fax,
'_continuewithoutlogin_custom1' => $client->custom1,
'_continuewithoutlogin_custom2' => $client->custom2,
'_continuewithoutlogin_custom3' => $client->custom3,
'_continuewithoutlogin_custom4' => $client->custom4,
'_continuewithoutlogin_custom5' => $client->custom5,
'_continuewithoutlogin_email' => $client->email,
'_continuewithoutlogin_emailrepeat' => $client->emailrepeat,
'_checked_continuewithoutlogin_saveonmachine' => $client->password || post('saveonmachine', CHECK_BOOL) ? 'checked="checked" ' : '',
));
$template->assign(array(
'_required_continuewithoutlogin_phone' => CC_SITE_PHONEREQUIRED == REQUIRED ? '*' : '',
'_required_continuewithoutlogin_cellphone' => CC_SITE_CELLPHONEREQUIRED == REQUIRED ? '*' : '',
'_required_continuewithoutlogin_fax' => CC_SITE_FAXREQUIRED == REQUIRED ? '*' : '',
'_required_continuewithoutlogin_company' => CC_SITE_COMPANYREQUIRED == REQUIRED ? '*' : '',
'_required_continuewithoutlogin_custom1' => CC_SITE_CUSTOM1REQUIRED == REQUIRED ? '*' : '',
'_required_continuewithoutlogin_custom2' => CC_SITE_CUSTOM2REQUIRED == REQUIRED ? '*' : '',
'_required_continuewithoutlogin_custom3' => CC_SITE_CUSTOM3REQUIRED == REQUIRED ? '*' : '',
'_required_continuewithoutlogin_custom4' => CC_SITE_CUSTOM4REQUIRED == REQUIRED ? '*' : '',
'_required_continuewithoutlogin_custom5' => CC_SITE_CUSTOM5REQUIRED == REQUIRED ? '*' : '',
));
$template->show_cond($redirect, 'redirect');
}
$template->assign(array(
'_redirect' => $redirect,
'_mode' => $mode ? $mode : (CC_SITE_LOGINMODE == LOGIN_OFF ? MODE_CONTINUEWITHOUTLOGIN : MODE_LOGIN),
'_ressource_repeat_email' => str_replace('[f]', CC_RESSOURCE_EMAIL, CC_RESSOURCE_REPEAT),
));
break;
// Kundenspezifische Bestelloptionen
case CC_FILENAME_CUSTOM:
$template = new template(CC_TPL_CUSTOM);
$template->show(CC_FILENAME_CUSTOM);
if ($order->client->custom_options)
$custom_values = unserialize($order->client->custom_options);
else
$custom_values = array();
foreach ($customoptions as $custom) {
$price = 0;
$is_selectedprice = 0;
$i = 1;
$i_selected = 0;
if ($custom->is_combo)
foreach ($custom->combo_options as $option) {
$price = max($price, $option->price);
if (isset($custom_values[$custom->caption]) && $custom_values[$custom->caption] == $option->caption) {
$is_selectedprice = $option->price;
$i_selected = $i;
}
$i++;
}
$template->loop('special', array(
'_vat' => $custom->vat && $custom->price ? format::vat($custom->vat) : '',
'_price' => $custom->price ? format::price($custom->price, CC_SITE_CURRENCY) : ($price ? '' : CC_RESSOURCE_NOCHARGE),
'_realprice' => $custom->price,
'_value' => $custom->is_text && isset($custom_values[$custom->caption]) ? $custom_values[$custom->caption] : '',
'_checked' => $custom->is_checkbox && isset($custom_values[$custom->caption]) && $custom_values[$custom->caption] == 1 ? ' checked="checked" ' : '',
'_is_price' => $custom->is_checkbox && isset($custom_values[$custom->caption]) ? format::price($custom->price, CC_SITE_CURRENCY) : '',
'_is_selectedprice' => $custom->is_combo ? (isset($custom_values[$custom->caption]) ? ($price ? format::price($is_selectedprice, CC_SITE_CURRENCY) : format::price(0, CC_SITE_CURRENCY)) : '') : '',
'_is_free' => $custom->is_text && isset($custom_values[$custom->caption]) ? format::price(0, CC_SITE_CURRENCY) : '',
'_i_selected' => $i_selected,
), $custom);
if ($custom->is_combo) {
foreach ($custom->combo_options as $option) {
$template->loop('option' . $custom->number, array(
'_caption' => $option->caption . ($price ? ' (' . format::price($option->price, CC_SITE_CURRENCY) . ')' : ''),
'_price' => format::price($option->price, CC_SITE_CURRENCY),
'_realprice' => $option->price,
'_selected' => $custom->is_combo && isset($custom_values[$custom->caption]) && $custom_values[$custom->caption] == $option->caption ? ' selected="selected" ' : '',
), $option);
}
}
}
$template->assign(array(
'_zero' => format::price(0, CC_SITE_CURRENCY),
));
break;
// Lieferadresse
case CC_FILENAME_ADDRESSES:
$template = new template(CC_TPL_ADDRESSES);
$template->show(CC_FILENAME_ADDRESSES);
$template->assign(array(
'_salutation' => $order->client->salutation,
'_firstname' => $order->client->firstname,
'_lastname' => $order->client->lastname,
'_company' => $order->client->company,
'_required_company' => CC_SITE_COMPANYREQUIRED == REQUIRED ? '*' : '',
'_street' => $order->client->street,
'_streetnumber' => $order->client->streetnumber,
'_zip' => $order->client->zip,
'_city' => $order->client->city,
'_country' => substr($order->client->country, 11),
'_editurl' => (!$order->client->has_account() ? CC_URL_LOGIN.'?' : CC_URL_ACCOUNT.'?'.PARAMETER_MODE.'=edit').'&'.PARAMETER_REDIRECT.'='.xcrypt::str2hex(CC_URL_ADDRESSES),
'_deviating_shipping_address' => $order->client->deviating_shipping_address ? 1 : 0,
'_deviating_shipping_address_no' => !$order->client->deviating_shipping_address ? ' checked="checked" ' : '',
'_deviating_shipping_address_yes' => $order->client->deviating_shipping_address ? ' checked="checked" ' : '',
'_shipping_firstname' => $order->client->shipping_firstname,
'_shipping_lastname' => $order->client->shipping_lastname,
'_shipping_company' => $order->client->shipping_company,
'_shipping_street' => $order->client->shipping_street,
'_shipping_streetnumber' => $order->client->shipping_streetnumber,
'_shipping_zip' => $order->client->shipping_zip,
'_shipping_city' => $order->client->shipping_city,
'_backurl' => preg_match('/^#/', $order->client->email) ? CC_FILENAME_LOGIN : CC_FILENAME_BASKET,
'_redirect' => $redirect,
));
$template->show_cond($order->client->company, 'company');
$template->assign_cond($error, array(
'_error_shipping_firstname' => $order->client->is_error('shipping_firstname'),
'_error_shipping_lastname' => $order->client->is_error('shipping_lastname'),
'_error_shipping_company' => $order->client->is_error('shipping_company'),
'_error_shipping_street' => $order->client->is_error('shipping_street'),
'_error_shipping_streetnumber' => $order->client->is_error('shipping_streetnumber'),
'_error_shipping_zip' => $order->client->is_error('shipping_zip'),
'_error_shipping_city' => $order->client->is_error('shipping_city'),
));
// Anreden
foreach (get_salutations() as $s)
$template->loop('salutation', array(
'value' => $s,
'option' => $s,
'selected' => $order->client->shipping_salutation == $s ? ' selected="selected" ' : '',
));
// Länder
foreach (get_countries() as $c)
$template->loop('country', array(
'value' => $c,
'option' => substr($c, 11),
'selected' => $order->client->shipping_country == $c ? ' selected="selected" ' : '',
));
$template->show_cond($error, 'error');
// Optionale Felder einblenden
$template->show_cond(CC_SITE_COMPANYREQUIRED != HIDDEN, 'company');
break;
// Versand
case CC_FILENAME_SHIPPING:
$found = false;
$template = new template(CC_TPL_SHIPPING);
$template->show(CC_FILENAME_SHIPPING);
foreach ($shipping->shippingmethods as $sm) {
if ($sm->actualprice != -1 && $sm->uid != -1) {
$found = true;
// Wenn nichts gewählt, erstes wählen
if ($order->client->shipping_uid === null)
$order->client->shipping_uid = $sm->uid;
$template->loop('sm', array(
'_checked' => $order->client->shipping_uid == $sm->uid ? ' checked="checked" ' : '',
'_actualprice' => $sm->actualprice ? format::price($sm->actualprice, $order->currency) : CC_RESSOURCE_NOCHARGE,
), $sm);
}
}
if ($found) {
$template->show('weight');
$template->assign(array('_weight' => format::weight($order->get_weight())));
$template->show('next');
}
// ESD Meldung einblenden für Artikel im Warenkorb (nicht Merkzettel)?
foreach ($order->items as $item)
if ($item->download_uid && !$item->memo) {
$template->show('esd');
break;
}
$template->assign(array(
'_redirect' => $redirect,
'_url_shipping' => xcrypt::str2hex(CC_URL_SHIPPING),
));
break;
// Bezahlung
case CC_FILENAME_PAYMENT:
$found = false;
$template = new template(CC_TPL_PAYMENT);
$template->show(CC_FILENAME_PAYMENT);
foreach ($payment->paymentmethods as $pm) {
if ($pm->actualprice != -1) {
$found = true;
// Wenn nichts gewählt, erstes wählen
if ($order->client->payment_uid === null)
$order->client->payment_uid = $pm->uid;
$template->loop('pm', array(
'_checked' => $order->client->payment_uid == $pm->uid ? ' checked="checked" ' : '',
'_actualprice' => $pm->actualprice ? format::price($pm->actualprice, $order->currency) : CC_RESSOURCE_NOCHARGE,
'_special' => $pm->parameter[0],
), $pm);
}
}
$pm = $payment->get($order->client->payment_uid);
// Fehler falls Kreditkarte
if ($pm->parameter[0] == 'ccard' || $pm->parameter[0] == 'ccardcvc') {
$template->show_cond($error, 'ccerror');
$template->assign_cond($error, array(
'_error_credit_accountnumber' => $order->client->is_error('credit_accountnumber'),
'_error_credit_validuntil' => $order->client->is_error('credit_validuntil'),
'_error_credit_cvc' => $order->client->is_error('credit_cvc'),
'_error_credit_accountholder' => $order->client->is_error('credit_accountholder'),
));
// Fehler falls Lastschrift
} else if ($pm->parameter[0] == 'debit') {
$template->show_cond($error, 'debiterror');
$template->assign_cond($error, array(
'_error_bank_accountnumber' => $order->client->is_error('bank_accountnumber'),
'_error_bank_name' => $order->client->is_error('bank_name'),
'_error_bank_code' => $order->client->is_error('bank_code'),
'_error_bank_accountholder' => $order->client->is_error('bank_accountholder'),
));
}
// Gewähltes Datum einstellen
if (preg_match('/^(\d+) \/ (\d+)$/', $order->client->credit_validuntil, $parts)) {
$month = $parts[1];
$year = $parts[2];
} else {
$month = date('n');
$year = date('Y');
}
for ($m = 1; $m <= 12; $m++)
$template->loop('month', array(
'month' => $m < 10 ? "0$m" : $m ,
'value' => $m,
'selected' => $m == $month ? 'selected ="selected"' : '',
));
for ($y = min(date('Y'), $year); $y <= date('Y') + 10; $y++)
$template->loop('year', array(
'value' => $y,
'selected' => $y == $year ? 'selected ="selected"' : '',
));
// Formular füllen
$template->assign(array(
'_credit_accountnumber' => $order->client->credit_accountnumber,
'_credit_accountholder' => $order->client->credit_accountholder,
'_credit_cvc' => $order->client->credit_cvc,
'_bank_accountnumber' => $order->client->bank_accountnumber,
'_bank_name' => $order->client->bank_name,
'_bank_code' => $order->client->bank_code,
'_bank_accountholder' => $order->client->bank_accountholder,
'_choosen_special' => $pm->parameter[0],
'_redirect' => $redirect,
'_url_shipping' => xcrypt::str2hex(CC_URL_SHIPPING),
'_url_payment' => xcrypt::str2hex(CC_URL_PAYMENT),
));
if ($found)
$template->show('next');
break;
// Sonstiges (Nachricht und Gutscheine)
case CC_FILENAME_OTHER:
$template = new template(CC_TPL_OTHER);
$template->show(CC_FILENAME_OTHER);
// Gutscheine
if (CC_SITE_COUPONS) {
if (!$order->coupon_id) {
$template->show('entercoupon');
if ($error_coupon == CC_RESSOURCE_COUPONINVALID) {
$template->assign(array(
'_error_coupon' => 'h',
'_coupon_id' => $coupon_id,
));
}
if ($error_coupon) {
$template->assign(array(
'_error_msg' => $error_coupon,
));
$template->show('couponerror');
}
} else {
$template->show('coupon');
$template->loop('coupon', array(
'coupon_id' => $order->coupon_id,
));
}
}
$template->assign(array(
'_message' => $order->client->message,
));
break;
// Zusammenfassung, Bestellung anzeigen, Bestellung drucken
case CC_FILENAME_SUMMARY:
$template = new template(CC_TPL_SUMMARY);
$template->show(CC_FILENAME_SUMMARY);
require(CC_SHOPSCRIPT_OUTPUTFUNCTIONS);
generate_summary($template, $order, false);
$template->show_cond($error, 'error');
$template->show_cond($order->client->client_id < 0, 'continuewithoutlogin');
$template->show('summary');
$template->assign(array(
'_class' => $error ? 'h' : '',
'_message' => $order->client->message,
'_url_summary' => xcrypt::str2hex(CC_URL_SUMMARY),
'_url_shipping' => xcrypt::str2hex(CC_URL_SHIPPING),
));
break;
// Bestellung komplett
case CC_FILENAME_COMPLETE:
$template = new template(CC_TPL_COMPLETE);
$template->show(CC_FILENAME_COMPLETE);
// Hart kodierte Bezahlsysteme
$payment_providers = array(
'clickandbuy',
'saferpay',
'paypal',
'worldpay',
'sofortueberweisung',
'yellowpay',
'moneybookers',
'custom'
);
// Bezahlsysteme
if (in_array($myorder->payment_param, $payment_providers)) {
$template->show('paymentprovider');
$template->show($myorder->payment_param);
$template->assign(get_object_vars($myorder));
$template->assign(get_object_vars($myorder->client));
if ($postpayment == 'success')
$template->show('postpayment_success');
if ($postpayment == 'error')
$template->show('postpayment_error');
if ($pm->autocharge)
$template->show('autocharge');
if ($esd)
$template->show('esd');
$payment_subject = CC_SITE_SHOPNAME.', '.CC_RESSOURCE_DESCRIPTION.' '.$myorder->order_date.', '.CC_RESSOURCE_ORDERID.' '.$myorder->order_id;
$url_success = CC_SITE_HTTPURL.CC_FILENAME_COMPLETE.'?'.PARAMETER_MODE.'=success&'.PARAMETER_ORDER.'='.$myorder->order_id.'&'.PARAMETER_KEY.'='.$myorder->generate_key().'&'.PARAMETER_ID.'='.$pm->uid;
$url_error = CC_SITE_HTTPURL.CC_FILENAME_COMPLETE.'?'.PARAMETER_MODE.'=error&'.PARAMETER_ORDER.'='.$myorder->order_id.'&'.PARAMETER_KEY.'='.$myorder->generate_key().'&'.PARAMETER_ID.'='.$pm->uid;
}
switch($myorder->payment_param) {
// Click&buy
case 'clickandbuy':
if (!$pm->parameter[1])
$template->show('invalidparameters');
$cipher = CC_SITE_ENCRYPTIONKEY;
$rand = mt_rand(1, 22);
$session_cipher = substr(md5($cipher), $rand, 10);
$order_info = md5($myorder->order_id.(floor($myorder->get_totalprice() * 100)).$session_cipher);
$external_bdrid = substr($order_info, 0, 22).($rand < 10 ? '0' : '').$rand.$session_cipher.substr($order_info, 22, 10);
$url = $pm->parameter[1].CC_PAYMENT_CLICKANDBUY.'?'.
'price='.floor($myorder->get_totalprice() * 100).'&'. // Preis in Cent
'cb_content_name='.rawurlencode($payment_subject).'&'. // Betreff
'oid='.$myorder->order_id.'&'. // Bestellnummer
'cid='.$myorder->client->client_id.'&'. // Kundennummer
'pid='.$pm->uid.'&'. // Bezahlmethode ID
'externalBDRID='.$external_bdrid;
$template->assign(array('_clickandbuy_url' => $url));
break;
// Saferpay
case 'saferpay':
if (!$pm->parameter[1])
$template->show('invalidparameters');
if (!preg_match('/^[a-z]{2}$/', $pm->parameter[2])) // Sprache
$template->show('invalidparameters');
if (!preg_match('/^[A-Z]{3}$/', $pm->parameter[3])) // Währungscode
$template->show('invalidparameters');
$mylang = isset($lang_transform[substr($myorder->client->country, 0, 2)]) ? $lang_transform[substr($myorder->client->country, 0, 2)] : null;
$query = 'https://www.saferpay.com/hosting/CreatePayInit.asp?'.
'ACCOUNTID='.rawurlencode($pm->parameter[1]).'&'. // Saferpay Kundennummer Shopbetreiber
'AMOUNT='.floor($myorder->get_totalprice() * 100).'&'. // Preis in Cent
'CURRENCY='.rawurlencode($pm->parameter[3]).'&'. // ISO Währungscode dreistellig
'DESCRIPTION='.rawurlencode($payment_subject).'&'. // Betreff
'ORDERID='.$myorder->order_id.'&'.
'SUCCESSLINK='.rawurlencode($url_success).'&'.
'BACKLINK='.rawurlencode($url_error).'&'.
'FAILLINK='.rawurlencode($url_error).'&'.
'NOTIFYURL='.rawurlencode(CC_SITE_HTTPURL.CC_PAYMENT_SAFERPAY.'?'.PARAMETER_ORDER.'='.$myorder->order_id.'&'.PARAMETER_KEY.'='.$myorder->generate_key().'&'.PARAMETER_ID.'='.$pm->uid).'&'.
'AUTOCLOSE=8&'.
($pm->parameter[2] ? 'LANGID='.rawurlencode($pm->parameter[2]).'&' : '').
'SHOWLANGUAGES=yes';
$template->assign(array(
'_saferpay_url' => join("", file($query))
));
break;
// PayPal
case 'paypal':
if (!$pm->parameter[1])
$template->show('invalidparameters');
if (!preg_match('/^[A-Z]{3}$/', $pm->parameter[3])) // Währungscode
$template->show('invalidparameters');
$template->assign(array(
'_paypal_email' => noentities($pm->parameter[1]), // Paypal Account Email Adresse
'_payment_subject' => noentities($payment_subject), // Name des Artikels
'_subtotal' => sprintf("%1.2f", $myorder->get_subtotalprice()),
'_currency_code' => noentities($pm->parameter[3]), // ISO Währungscode dreistellig
'_shippingcost' => sprintf("%1.2f", $myorder->get_shipping_cost()), // Versandkosten
'_paymentcost' => sprintf("%1.2f", $myorder->get_payment_cost()), // Bezahlkosten
'_tax' => $myorder->b2b ? sprintf("%1.2f", $myorder->get_totalvat()) : '0', // Steuern bei b2b
'_url_success' => $url_success,
'_payment_uid' => $pm->uid,
'_lc' => $pm->parameter[2],
'_url_error' => $url_error,
'_url_notify' => CC_SITE_HTTPURL.CC_PAYMENT_PAYPAL,
'_next_text' => noentities(CC_RESSOURCE_BASKETNEXT), // Text für den Button, der zurück zum Shop führt
'_testurl' => PAYMENT_TESTMODE ? 'sandbox.' : '',
));
break;
// Worldpay
case 'worldpay':
if (PAYMENT_TESTMODE) {
$name = 'AUTHORISED'; #REFUSED, AUTHORISED, ERROR or CAPTURED
$testmode = '101';
$testurl = '-test';
} else {
$name = $order->client->salutation.' '.$order->client->firstname.' '.$order->client->lastname;
$testmode = '0';
$testurl = '';
}
if (!$pm->parameter[1] || !$pm->parameter[2])
$template->show('invalidparameters');
if (in_array($pm->parameter[2], array('101', '100', '0'))) // Wegen Rückwärtskompatibilität zu vorher verwendetem Parameter Testaccount
$template->show('invalidparameters');
if (!preg_match('/^[A-Z]{3}$/', $pm->parameter[3])) // Währungscode
$template->show('invalidparameters');
if (!preg_match('/^[a-z]{2}$/', $pm->parameter[4])) // Sprachcode
$template->show('invalidparameters');
$template->assign(array(
'_inststallation_id' => $pm->parameter[1],
'_currency_code' => noentities($pm->parameter[3]), // Währungscode
'_country' => substr($myorder->client->country, 0, 2),
'_payment_subject' => noentities($payment_subject), // Name des Artikels
'_testmode' => $testmode,
'_name' => $name,
'_lang' => $pm->parameter[4] ? $pm->parameter[4].'-'.substr($myorder->client->country, 0, 2) : '',
'_payment_uid' => $pm->uid,
'_testurl' => $testurl,
'_url_notify' => CC_SITE_HTTPURL.CC_PAYMENT_WORLDPAY,
));
break;
// sofortueberweisung.de
case 'sofortueberweisung':
if (!$pm->parameter[1] || !$pm->parameter[2] || !$pm->parameter[3])
$template->show('invalidparameters');
if (!preg_match('/^[A-Z]{3}$/', $pm->parameter[4])) // Währungscode
$template->show('invalidparameters');
$data = array(
$pm->parameter[1],$pm->parameter[2],
'', '', '', substr($myorder->client->country, 0, 2), sprintf("%1.2f", $myorder->get_totalprice()),
$pm->parameter[4], $myorder->order_id, $myorder->order_date,
$myorder->order_id, $myorder->generate_key(), $pm->uid, '', '', '',$pm->parameter[3]
);
$hash = sha1(implode('|', $data));
$template->assign(array(
'_user_id' => noentities($pm->parameter[1]), // Kundennummer
'_project_id' => noentities($pm->parameter[2]), // Projektnummer
'_payment_subject1' => $myorder->order_id,
'_payment_subject2' => $myorder->order_date,
'_payment_uid' => $pm->uid,
'_country_id' => substr($myorder->client->country, 0, 2),
'_key' => $myorder->generate_key(),
'_currency_id' => noentities($pm->parameter[4]),
'_hash' => $hash,
));
break;
// PostFinance/Yellowpay
case 'yellowpay':
if (!$pm->parameter[1] || !$pm->parameter[2] || !$pm->parameter[3] || !$pm->parameter[4])
$template->show('invalidparameters');
if (!preg_match('/^[A-Z]{3}$/', $pm->parameter[2])) // Währungscode
$template->show('invalidparameters');
if (!preg_match('/^[a-z]{2}$/', $pm->parameter[3])) // Sprachcode
$template->show('invalidparameters');
if (PAYMENT_TESTMODE) {
$url = 'https://e-payment.postfinance.ch/ncol/test/orderstandard.asp';
} else {
$url = 'https://e-payment.postfinance.ch/ncol/prod/orderstandard.asp';
}
$hash = sha1($myorder->order_id . floor($myorder->get_totalprice() * 100).$pm->parameter[2].$pm->parameter[1].$pm->parameter[4]);
$template->assign(array(
'_action' => $url,
'_pspid' => noentities($pm->parameter[1]),
'_totalcent' => floor($myorder->get_totalprice() * 100),
'_currency_code' => noentities($pm->parameter[2]), // Währungscode
'_lang' => $pm->parameter[3] ? $pm->parameter[3].'_'.substr($myorder->client->country, 0, 2) : '',
'_name' => $myorder->client->salutation.' '.$myorder->client->firstname.' '.$myorder->client->lastname,
'_email' => $myorder->client->email,
'_address' => $myorder->client->street.' '.$myorder->client->streetnumber,
'_zip' => $myorder->client->zip,
'_city' => $myorder->client->city,
'_country' => substr($myorder->client->country, 0, 100),
'_phone' => $myorder->client->phone,
'_url_error' => $url_error,
'_url_success' => $url_success,
'_subject' => $myorder->order_id.' '.$myorder->order_date,
'_payment_uid' => $pm->uid,
'_hash' => $hash,
));
break;
// Moneybookers.com
case 'moneybookers':
// Parameter
// 1: Merchant-ID
// 2: Merchant-Email
// 3: Währungscode 3 stellig ISO
// 4: Sprachcode 2 stellig
// 5: Passphrase für md5
// 6: Erlaubte Zahlmethoden (optional)
if (!$pm->parameter[1] || !$pm->parameter[2] || !$pm->parameter[3] || !$pm->parameter[4] || !$pm->parameter[5])
$template->show('invalidparameters');
if (!preg_match('/^[A-Z]{3}$/', $pm->parameter[3])) // Währungscode 3 stellig ISO
$template->show('invalidparameters');
if (!preg_match('/^[A-Z]{2}$/', $pm->parameter[4])) // Sprachcode 2 stellig
$template->show('invalidparameters');
if (!preg_match('/^([A-Z0-9]{3,5}(,[A-Z0-9]{3,5})*)?$/', $pm->parameter[6])) // Erlaubte Zahlmethoden
$template->show('invalidparameters');
$url = 'https://www.moneybookers.com/app/payment.pl';
$template->assign(array(
'_action' => $url,
// Merchant Details
'_pay_to_email' => $pm->parameter[2],
'_recipient_description' => CC_SITE_SHOPNAME,
'_transaction_id' => $myorder->order_id,
'_return_url' => $url_success,
'_cancel_url' => $url_error,
'_status_url' => CC_SITE_HTTPURL.CC_PAYMENT_MONEYBOOKERS.'?'.PARAMETER_KEY.'='.$myorder->generate_key().'&'.PARAMETER_ID.'='.$pm->uid,
'_language' => $pm->parameter[4],
// Customer Details
'_pay_from_email' => $myorder->client->email,
'_title' => $myorder->client->salutation,
'_firstname' => $myorder->client->firstname,
'_lastname' => $myorder->client->lastname,
'_address' => $myorder->client->street.' '.$myorder->client->streetnumber,
'_postal_code' => $myorder->client->zip,
'_city' => $myorder->client->city,
'_country' => substr($myorder->client->country, 2, 3),
// Payment Details
'_amount' => $myorder->get_totalprice(),
'_currency' => noentities($pm->parameter[3]), // Währungscode 3 stellig ISO
'_payment_methods' => $pm->parameter[6], // Erlaubte Zahlmethoden
));
break;
// Generisches Payment Provider Interface
case 'custom':
$template->assign(array(
'_action' => ROOT.$pm->pageout_filename,
'_payment_uid' => $pm->uid,
));
break;
}
$template->assign(array(
'_postgateway' => $pm->postgateway,
'_key' => $myorder->generate_key(),
'_order_id' => $myorder->order_id,
'_client_id' => $myorder->client->client_id,
// Für TrustedShops
'_email' => $myorder->client->email,
'_totalprice' => sprintf("%1.2f", $myorder->get_totalprice()),
'_country' => substr($myorder->client->country, 0, 2),
'_payment' => $pm->uid,
));
// google Analytics E-Commerce
if (CC_SITE_GATRACKECOMMERCE) {
$template->show('trackecommerce');
// Auftrag tracken
$template->assign(array(
'_ga_totalvat' => $myorder->b2b ? sprintf("%1.2f", $myorder->get_totalvat()) : '0', // Steuern bei b2b
'_ga_shippinghandling' => sprintf("%1.2f", $myorder->get_shipping_cost() + $myorder->get_payment_cost()), // Versand- und Bezahlkosten
'_ga_city' => $myorder->client->zip.' '.$myorder->client->city,
'_ga_country' => substr($myorder->client->country, 11),
));
// Artikel tracken
if (CC_SITE_GATRACKECOMMERCE == TRACK_ITEMS)
foreach ($myorder->items as $item)
$template->loop('trackitem', array(), $item);
}
if ($myorder->client->has_account()) {
$template->show('account');
$template->show('accountoremail');
}
break;
// Kundendaten
case CC_FILENAME_ACCOUNT:
$template = new template(CC_TPL_ACCOUNT);
$template->show('account');
switch ($mode) {
// Persönliche Daten ändern
case 'edit':
$template->show('mode_edit');
$template->show('next');
$template->show('prev');
$template->show_cond($edit_error, 'error');
$template->show_cond($edit_emailinuse, 'emailinuse');
$template->show_cond($client->is_error('email'), 'erroremail');
// Optionale Felder einblenden
$template->show_cond(CC_SITE_COMPANYREQUIRED != HIDDEN, 'company');
$template->show_cond(CC_SITE_CUSTOM1REQUIRED != HIDDEN, 'custom1');
$template->show_cond(CC_SITE_CUSTOM2REQUIRED != HIDDEN, 'custom2');
$template->show_cond(CC_SITE_CUSTOM3REQUIRED != HIDDEN, 'custom3');
$template->show_cond(CC_SITE_CUSTOM4REQUIRED != HIDDEN, 'custom4');
$template->show_cond(CC_SITE_CUSTOM5REQUIRED != HIDDEN, 'custom5');
// Anreden
foreach (get_salutations() as $s)
$template->loop('salutation', array(
'value' => $s,
'option' => $s,
'selected' => $client->salutation == $s ? ' selected="selected" ' : '',
));
// Länder
foreach (get_countries() as $c)
$template->loop('country', array(
'value' => $c,
'option' => substr($c, 11),
'selected' => $client->country == $c ? ' selected="selected" ' : '',
));
// Fehlerfelder und Werte setzen
$template->assign(array(
'_error_firstname' => $client->is_error('firstname'),
'_error_lastname' => $client->is_error('lastname'),
'_error_company' => $client->is_error('company'),
'_error_street' => $client->is_error('street'),
'_error_streetnumber' => $client->is_error('streetnumber'),
'_error_zip' => $client->is_error('zip'),
'_error_city' => $client->is_error('city'),
'_error_phone' => $client->is_error('phone'),
'_error_cellphone' => $client->is_error('cellphone'),
'_error_fax' => $client->is_error('fax'),
'_error_custom1' => $client->is_error('custom1'),
'_error_custom2' => $client->is_error('custom2'),
'_error_custom3' => $client->is_error('custom3'),
'_error_custom4' => $client->is_error('custom4'),
'_error_custom5' => $client->is_error('custom5'),
'_error_email' => $client->is_error('email'),
'_error_password' => $client->is_error('password'),
'_client_id' => $client->client_id,
'_firstname' => $client->firstname,
'_lastname' => $client->lastname,
'_company' => $client->company,
'_street' => $client->street,
'_streetnumber' => $client->streetnumber,
'_zip' => $client->zip,
'_city' => $client->city,
'_phone' => $client->phone,
'_cellphone' => $client->cellphone,
'_fax' => $client->fax,
'_custom1' => $client->custom1,
'_custom2' => $client->custom2,
'_custom3' => $client->custom3,
'_custom4' => $client->custom4,
'_custom5' => $client->custom5,
'_email' => $client->email,
'_required_phone' => CC_SITE_PHONEREQUIRED == REQUIRED ? '*' : '',
'_required_cellphone' => CC_SITE_CELLPHONEREQUIRED == REQUIRED ? '*' : '',
'_required_fax' => CC_SITE_FAXREQUIRED == REQUIRED ? '*' : '',
'_required_company' => CC_SITE_COMPANYREQUIRED == REQUIRED ? '*' : '',
'_required_custom1' => CC_SITE_CUSTOM1REQUIRED == REQUIRED ? '*' : '',
'_required_custom2' => CC_SITE_CUSTOM2REQUIRED == REQUIRED ? '*' : '',
'_required_custom3' => CC_SITE_CUSTOM3REQUIRED == REQUIRED ? '*' : '',
'_required_custom4' => CC_SITE_CUSTOM4REQUIRED == REQUIRED ? '*' : '',
'_required_custom5' => CC_SITE_CUSTOM5REQUIRED == REQUIRED ? '*' : '',
'_checked_newsletter' => $client->newsletter ? ' checked="checked" ' : '',
));
break;
// Nachricht an den Shopbetreiber
case 'message':
$template->show('mode_message');
$template->show('next');
$template->show('prev');
break;
// Meine Bestellungen anzeigen
case 'myorders':
$template->show('mode_myorders');
$template->show('prev');
// Auswahl Filter
$showmodes = array(
'pending' => CC_RESSOURCE_PENDINGORDERS,
'1month' => CC_RESSOURCE_ORDERSLASTMONTH,
'3months' => CC_RESSOURCE_ORDERSLAST3MONTHS,
'12months' => CC_RESSOURCE_ORDERSLAST12MONTHS,
'all' => CC_RESSOURCE_ALLORDERS,
);
foreach ($showmodes as $m => $r) {
$template->loop('showmode', array(
'value' => $m,
'option' => $r,
'selected' => $s == $m ? 'selected="selected"' : '',
));
}
if (count($order_ids)) {
foreach ($order_ids as $order_id) {
$myorder = new order($order_id);
$template->loop('order', array(
'_order_date' => date(CC_SITE_DATEFORMAT, strtotime($myorder->order_date)),
'_status' => $orderstatus_ressources[$myorder->status],
'_total' => format::price($myorder->get_totalprice(), $myorder->currency),
), $myorder);
}
} else
$template->show('noorders');
break;
// Eine Bestellung anzeigen
case 'order':
$template = new template(CC_TPL_SUMMARY);
$template->show('mode_order');
$template->show('account');
require(CC_SHOPSCRIPT_OUTPUTFUNCTIONS);
generate_summary($template, $myorder, false);
break;
// Meine Rechnungen anzeigen
case 'mybills':
$template->show('mode_mybills');
$template->show('prev');
$doneorders = 0;
$pendingorders = 0;
foreach ($order_ids as $order_id) {
$myorder = new order($order_id);
if ($myorder->payment_date) {
$template->loop('doneorder', array(
'_order_date' => format::date($myorder->order_date),
'_total' => format::price($total = $myorder->get_totalprice(), $myorder->currency),
'_payment_date' => format::date($myorder->payment_date),
), $myorder);
$doneorders += $total;
$show_done = true;
} else {
$maturity = strtotime($myorder->order_date) + $myorder->client->daystopayment * 60 * 60 * 24;
$template->loop('pendingorder', array(
'_order_date' => format::date($myorder->order_date),
'_total' => format::price($total = $myorder->get_totalprice(), $myorder->currency),
'_red' => $maturity < time() ? 'h' : '',
'_maturity' => format::todate($maturity),
), $myorder);
$pendingorders += $total;
$show_pending = true;
}
}
if (!isset($show_pending))
$template->show('nopendingorders');
if (!isset($show_done))
$template->show('nodoneorders');
if (count($order_ids))
$template->assign(array(
'_totalpending' => format::price($pendingorders, $myorder->currency),
'_totaldone' => format::price($doneorders, $myorder->currency),
));
break;
// Fragen Reklamationen
case 'claim':
$template->show('mode_message');
$template->show('mode_claim');
$template->show('prev');
$template->show('next');
$template->assign(array(
'_order_id' => $myorder->order_id,
'_order_id_prefix' => $myorder->order_id_prefix,
));
foreach ($myorder->items as $item)
$template->loop('orderitem', array('caption' => $item->caption));
break;
// Warenrückgabe online, Artikel wählen
case 'return':
$template->show('mode_return');
if (strtotime("$myorder->order_date $myorder->order_time") + CC_SITE_RETURNDAYS * 86400 < time())
$template->show('timeout');
else {
$template->show('choosereturnitems');
$template->show('next');
foreach ($myorder->items as $item)
$template->loop('returnitem', array('uid' => $item->uid, 'caption' => $item->caption));
$template->assign(array(
'_item_count' => count($myorder->items),
'_order_id' => $myorder->order_id,
'_order_id_prefix' => $myorder->order_id_prefix,
));
}
break;
// Warenrückgabe online, Link zum Druckformular
case 'linkreturnform':
$template->show('mode_return');
$template->show('linkreturnform');
if (post('returnsome', CHECK_BOOL) && is_array(post('items'))) {
$template->show('returnsome');
foreach($myorder->items as $item)
if (in_array($item->uid, post('items')))
$template->loop('returnitem', array(
'caption' => $item->caption,
));
$template->assign(array(
'_items' => implode(',', post('items')),
));
}
$template->assign(array(
'_order_id' => $myorder->order_id,
'_order_id_prefix' => $myorder->order_id_prefix,
));
break;
// Digitale Güter
case 'myesd':
$template->show('mode_myesd');
$template->show('prev');
foreach ($order_ids as $order_id) {
$myorder = new order($order_id);
foreach ($myorder->items as $item)
if ($item->download_uid) {
if ($item->order_status > CC_RESSOURCE_ORDERSTATUSSHORT_WAITINGPAYMENT) {
$item->download_granted = true;
$item->download_notgranted = false;
} else {
$item->download_granted = false;
$item->download_notgranted = true;
}
$template->loop('order', array(
'_order_date' => date(CC_SITE_DATEFORMAT, strtotime($myorder->order_date)),
'_order_id' => $myorder->order_id,
'_order_id_prefix' => $myorder->order_id_prefix,
'_licenses' => $item->download_granted && $item->download_pid ? ''.CC_RESSOURCE_UNLOCKNOW.'' : '-',
), $item);
}
}
break;
// Digitaler Artikel neue Lizenz
case 'newlicense':
$template->show('mode_newlicense');
$template->show('modes_licenses');
// Browserweiche für PD Plugin
if (get(PARAMETER_VIEW) == 'ie')
$template->show('browser_compatible');
else if (get(PARAMETER_VIEW) == 'mz') {
$template->show('browser_compatible');
$template->show('moz');
}
if ($count_all < CC_SITE_ESDMAXLICENSES && !$count_pending) {
$template->show('licenses_possible');
$template->show('next');
}
if ($count_pending)
$template->show('licenses_pending');
if ($count_all)
$template->show('notfirst');
$template->show('prev');
$template->assign(array(
'_download_uid' => $item->download_uid,
'_order_id' => $myorder->order_id,
'_order_id_prefix' => $myorder->order_id_prefix,
'_item_caption' => $item->caption,
'_hk' => isset($hk) && !$error_license ? $hk : '',
'_comment' => isset($comment) && !$error_license ? $comment : '',
'_error_hk' => $error_hk ? 'h' : '',
'_error_comment' => $error_comment ? 'h' : '',
'_ua' => $ua,
));
if ($error_hk || $error_comment)
$template->show('error');
if ($error_license)
$template->show('licenseerror');
break;
// Digitaler Artikel Lizenzen
case 'mylicenses':
// Browserweiche für PD Plugin
if (get(PARAMETER_VIEW) == 'ie')
$template->show('browser_compatible');
else if (get(PARAMETER_VIEW) == 'mz') {
$template->show('browser_compatible');
$template->show('moz');
}
$template->show('mode_mylicenses');
$template->show('modes_licenses');
$template->show('next');
$template->show('prev');
$template->assign(array(
'_download_uid' => $item->download_uid,
'_order_id' => $myorder->order_id,
'_order_id_prefix' => $myorder->order_id_prefix,
'_item_caption' => $item->caption,
'_ua' => $ua,
// Start ESDUB
'_project_id' => $item->download_pid,
// Ende ESDUB
));
if ($count_all) {
$template->show('licenses');
$licenses = new abstractdb(TABLE_ESDLICENSES);
while ($lic = $licenses->get(array('*'), array('order_id' => $myorder->order_id, 'id' => $item->download_uid), array('date asc')))
$template->loop('license', array(
'_date' => date(CC_SITE_DATEFORMAT, strtotime($lic->date)),
'_license_pending' => $lic->license_pending == LICENSE_PENDING ? 1 : 0,
'_license_refused' => $lic->license_pending == LICENSE_REFUSED ? 1 : 0,
), $lic);
}
if ($error_exists)
$template->show('already_exists');
if ($now_pending)
$template->show('now_pending');
break;
// Mein Konto
default:
$template->show('mode_main');
$template->show_cond($mode == 'edit_done', 'edit_done');
$template->show_cond($mode == 'message_done', 'message_done');
$template->show_cond($session->is_shopadmin(), 'shopadmin');
$template->assign(array('_clientwelcome' => str_replace('[n]', $client->salutation.' '.$client->lastname, str_replace('[u]', $client->client_id, CC_RESSOURCE_CLIENTWELCOME))));
}
if ($esd)
$template->show('esd');
$template->assign(array(
'_redirect' => $redirect,
));
break;
// Merkzettel
case CC_FILENAME_MEMO:
$template = new template(CC_TPL_MEMO);
foreach ($allmemos = $memos->get($client->client_id) as $memo)
$template->loop('memo', array(), $memo);
$template->show_cond(count($allmemos), 'memos');
break;
}
$template->out();
?>