assets/s2dioufu.php
/// Art: Shop Ausgabe Funktionen
/// Inhalt: Funktionen
/// Beschreibung: Funktionen zum Rendern der Shop Seite
/// Benötigt: config.php
/// CML-Parsing: nein
///
//////////////////////////////////////////////////////////////////////////////////////////
///
/// Letzte Änderungen:
/// 16.02.2009 Gutscheine angepasst
/// 20.03.2009 Bezahlkosten ergänzt
/// 20.03.2009 Rücksendeformular erweitert
/// 06.04.2009 Entcryption für Bank/Karten entfernt
/// 28.07.2009 Kleiner Schönheitsfehler Bezahlkosten
/// 22.09.2009 split -> explode
/// 09.12.2009 Rabattsperre hinzugefügt
/// 06.03.2010 Grafiken im Warenkorb / Email
/// 10.03.2010 Bestelloptionen
/// 05.08.2010 CRLF für Text Mails
/// 11.08.2010
nicht in Text Mails
/// 11.08.2010 colspan in summary mit/ohne warenkorbilder
///
//////////////////////////////////////////////////////////////////////////////////////////
///<11.08.2010/7.0.1.12/>
if (!defined('SHOP_TO_DATE'))
die('Forbidden');
// Zusammenfassung, Bestellung ansehen, Bestellung drucken, Bestellbestätigung
function generate_summary(&$template, $order, $email) {
global $orderstatus_ressources;
$template->assign(get_object_vars($order->client));
$template->assign(array(
'_country' => substr($order->client->country, 11),
'_shipping_country' => substr($order->client->shipping_country, 11),
));
$template->show_cond($email, 'email');
$template->show_cond($email, 'accountoremail');
$template->show_cond(CC_SITE_LINKCONSUMER, 'linkconsumer');
$template->show_cond(CC_SITE_LINKAGB, 'linkagb');
// 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');
$template->show_cond($order->client->deviating_shipping_address, 'deviating_shipping_address');
$template->show_cond(CC_SITE_BASKETPICTURES && !$email || CC_SITE_MAILPICTURES && $email, 'showbasketpictures');
// Positionen
$notrebatable = false;
$enditems = 0;
$endoptions = 0;
$endeditems = false;
foreach ($order->items as $item) {
if ($item->uid == 'custom')
$endeditems = true;
if (!$endeditems)
$enditems++;
$endoptions++;
}
$i = 0;
foreach ($order->items as $item) {
$i++;
// Nicht Artikel auf der Merkliste
if ($item->memo)
continue;
if ($item->status == 1)
$status = CC_RESSOURCE_STATUSA;
else if ($item->status == 2)
$status = CC_RESSOURCE_STATUSB;
else if ($item->status == 3)
$status = CC_RESSOURCE_STATUSC;
if ($item->download_uid)
$downloads = true;
$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) {
$parts = explode('=', $z);
$specialinfo .= urldecode($parts[0]).": ".urldecode($parts[1])."
\r\n";
}
$item->download_protected = false;
if ($item->download_uid && $item->order_status > CC_RESSOURCE_ORDERSTATUSSHORT_WAITINGPAYMENT) {
$item->download_granted = true;
if ($item->download_pid)
$item->download_protected = true;
} else
$item->download_granted = false;
// Bilder im Warenkorb
///MO46+
///MO46-<
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', array(
'_status' => isset($status) ? $status : '',
'_vat' => format::vat($item->vat),
'_quantity' => format::quantity($item->quantity, $item->qprecision),
'_actualpriceone' => format::price($item->price, $order->currency),
'_actualpriceall' => format::price($item->price * $item->quantity, $order->currency),
'_specialinfo' => $specialinfo,
'_basketpicurl' => CC_SITE_BASKETPICTURES && !$email || CC_SITE_MAILPICTURES && $email ? $product_data->basketpicture : '',
'hasbasketpic' => (CC_SITE_BASKETPICTURES && !$email || CC_SITE_MAILPICTURES && $email)
&& $product_data->basketpicture ? true : false,
'showbasketpictures' => (CC_SITE_BASKETPICTURES && !$email || CC_SITE_MAILPICTURES && $email) ? true : false,
'enditems' => $i == $enditems ? 1 : 0,
'endoptions' => CC_SITE_HASORDERSPECIALS && $i == $endoptions ? 1 : 0,
'nooption' => $item->uid == 'custom' ? 0 : 1,
), $item);
///MO46>
if (!$item->rebatable)
$notrebatable = true;
}
// Zwischensumme, Rabatte, Versand, Steuern, Endsummen
$template->show_cond($notrebatable, 'notrebatable');
$template->show_cond($order->get_rebate(), 'rebate');
$template->show_cond($order->client->novat, 'novat');
$template->show_cond($order->b2b, 'b2b');
$template->show_cond($order->client->shipping_uid == -1, 'download');
$template->assign(array(
'_subtotal' => format::price($order->get_subtotal(), $order->currency),
'_rebate' => format::price($order->get_rebate(), $order->currency),
'_shippingcost' => format::price($order->get_shipping_cost(), $order->currency),
'_paymentcost' => format::price($order->get_payment_cost(), $order->currency),
'_gross' => format::price($order->get_subtotal() - $order->get_rebate() + $order->get_shipping_cost() + $order->get_payment_cost() + $order->get_totalvat(), $order->currency),
'_total' => format::price($order->get_subtotal() - $order->get_rebate() + $order->get_shipping_cost() + $order->get_payment_cost(), $order->currency),
'_weight' => format::weight($order->get_weight()),
'_shippingmethod_caption' => $order->sm->caption,
'_paymentmethod_caption' => $order->pm->caption,
'_paymentmethod_email' => isset($order->pm->email) ? $order->pm->email : '',
'_credit_accountnumber' => $email ? '[...]'.substr($order->client->credit_accountnumber, -4) : $order->client->credit_accountnumber,
'_credit_cvc' => $order->client->credit_cvc,
'_bank_accountnumber' => $email ? '[...] '.substr($order->client->bank_accountnumber, -4) : $order->client->bank_accountnumber,
'_message' => $order->client->message,
'_order_status' => $orderstatus_ressources[$order->status],
'_esd_explain' => isset($downloads) ? CC_RESSOURCE_POSTPAYMENTSUCCESSAUTOESD : '',
'_colspan5' => CC_SITE_BASKETPICTURES && !$email || CC_SITE_MAILPICTURES && $email ? 6 : 5,
'_colspan4' => CC_SITE_BASKETPICTURES && !$email || CC_SITE_MAILPICTURES && $email ? 5 : 4,
'_httpurl' => CC_SITE_MAILPICTURES && $email ? CC_SITE_HTTPURL : '',
));
$template->show_cond(floatval($order->get_payment_cost()), 'paymentcost');
if (isset($downloads))
$template->show('is_esd');
foreach ($order->vatarray->vatarray as $vat)
$template->loop('vat', array(
'percent' => format::vat($vat->percent),
'amount' => format::price($vat->amount, $order->currency),
));
// Bestellung, Gewicht
if ($order->order_date) {
$template->show_cond(CC_SITE_RETURN && $order->status == 'f', 'return');
$template->show_cond(CC_SITE_INFOTEXT, 'infotext');
$template->show_cond($order->message, 'shopmessage');
$template->show_cond($order->expected_date, 'expected');
$template->assign(get_object_vars($order));
$template->assign(array(
'_order_date' => format::date($order->order_date),
'_shipping_date' => format::date($order->shipping_date),
'_payment_date' => format::date($order->payment_date),
'_expected_date' => format::date($order->expected_date),
'_shopmessage' => $order->message,
'_infotext' => str_replace('
', "
\r\n", CC_SITE_INFOTEXT),
'_infotext_plain' => str_replace('
', "\r\n", CC_SITE_INFOTEXT),
));
// Link für PDF Rechnung
if (CC_SITE_PDF_ACCOUNT && !CC_SITE_BILLHASLEFTTHEBUILDING) {
if ($order->pdf_creation == PDF_CREATION_ONORDER ||
$order->pdf_creation == PDF_CREATION_ONSHIPP && $order->shipping_date)
$template->show('pdf_bill_exists');
else if ($order->pdf_creation == PDF_CREATION_ONSHIPP && !$order->shipping_date)
$template->show('pdf_order_exists');
}
$template->show_cond($order->tracking_id, 'tracking');
$template->show_cond($order->shipping_date, 'shipped');
$template->show_cond($order->payment_date, 'payed');
if ($order->shipping_trackingurl)
$template->show('simple_tracking');
}
$template->show_cond($order->get_weight(), 'weight');
// Kreditkarten, Bankeinzug, Nachricht an Shopbetreiber
$template->show_cond($order->pm->parameter[0] == 'ccardcvc' || $order->pm->parameter[0] == 'ccard', 'ccard');
$template->show_cond($order->pm->parameter[0] == 'debit', 'debit');
$template->show_cond($order->client->message, 'showmessage');
// Gutschein
if ($order->coupon_id) {
$template->assign(array(
'_couponcode' => $order->coupon_id,
));
$template->show('coupon');
}
}
// Bestellung drucken
function print_order(&$order) {
$template = new template(CC_TPL_SUMMARY);
generate_summary($template, $order, false);
$template->show('print');
$template->show('account');
$template->show_cond($order->pm->parameter[0] == 'printdebit' , 'printdebit');
$template->show_cond($order->pm->parameter[0] == 'printcreditcard' , 'printcreditcard');
$template->show_cond($order->pm->parameter[0] == 'printcreditcardcvc' , 'printcreditcardcvc');
switch ($order->pm->parameter[0]) {
case "printdebit":
case "printcreditcard":
case "printcreditcardcvc":
$template->show('printpayment');
case "printcheque":
case "printremittance":
case "printinvoice":
case "printcod":
$template->show('sign');
}
$template->out();
}
// Rücksendeformular drucken
function print_returnform(&$order) {
$template = new template(CC_TPL_RETURNPAGE);
$template->show('mode_printreturnform');
$template->show('print');
$template->assign(get_object_vars($order));
$template->assign(get_object_vars($order->client));
$template->assign(array(
'_order_date' => date(CC_SITE_DATEFORMAT, strtotime($order->order_date)),
'_return_date' => date(CC_SITE_DATEFORMAT, time()),
'_payment_date' => date(CC_SITE_DATEFORMAT, strtotime($order->payment_date)),
'_shipping_date' => date(CC_SITE_DATEFORMAT, strtotime($order->shipping_date)),
'_country' => substr($order->client->country, 11),
));
$template->show_cond(CC_SITE_COMPANYREQUIRED != HIDDEN, 'company');
if (count(explode(',', get(PARAMETER_ID, CHECK_ALPHANUMCOMMA))) && get(PARAMETER_ID, CHECK_ALPHANUMCOMMA)) {
$template->show('returnsome');
foreach ($order->items as $item)
if (in_array($item->uid, explode(',', get(PARAMETER_ID, CHECK_ALPHANUMCOMMA))))
$template->loop('printitem', array(), $item);
} else
foreach ($order->items as $item)
$template->loop('printitem', array(), $item);
$template->out();
}
?>