Hallo,
verstehe jetz wie es theoretisch geht nur weiß ich leider nicht wirklich wie ich es im Shop anwenden muss.
ich habe zwei unterschiedliche Lösungswege aufgezeigt. Einmal habe ich mit
der notwendigen Datenbank-Abfrage Änderung begonnen und auf der
anderen Seite habe ich mit Notwenigen Erweiterung der Klasse begonnen.
Für die ersten Schritte würde ich mir in
~/shop/includes/oos_nice_exit.php
den Warenkorb ausgeben
<!--c1--><div class='codetop'>QUELLTEXT[/align]<div class='codemain'><!--ec1--> echo '<pre>';
print_r($_SESSION['cart]);
echo '</pre>';<!--c2-->[/align]<!--ec2-->
eine mögliche Ausgabe
<!--c1--><div class='codetop'>QUELLTEXT[/align]<div class='codemain'><!--ec1-->shoppingCart Object
(
[contents] => Array
(
[1] => Array
(
[qty] => 1
[towlid] =>
)
)
[total] => 15.000009
[weight] => 0.2
[cartID] => 64935
[content_type] =>
[total_virtual] => 15.000009
[weight_virtual] => 0.2
)<!--c2-->[/align]<!--ec2-->
Die PHP Klasse ist
~/shop/includes/classes/class_shopping_cart.php
Diese
[contents]
[total]
[weight]
[cartID]
[content_type]
[total_virtual]
[weight_virtual]
kennen noch keinen Counter für die Hersteller. Ergo eben einbauen
<!--c1--><div class='codetop'>QUELLTEXT[/align]<div class='codemain'><!--ec1--> class shoppingCart {
var $contents;
var $total;
var $weight;
var $cartID;
var $content_type;
var $count_manufacturers;<!--c2-->[/align]<!--ec2-->
Die Seite neu laden und schon kennt der Warenkorb einen Counter für Manufacturer
leider noch ohne Funktion
<!--c1--><div class='codetop'>QUELLTEXT[/align]<div class='codemain'><!--ec1-->shoppingCart Object
(
[contents] => Array
(
[1] => Array
(
[qty] => 1
[towlid] =>
)
)
[total] => 15.000009
[weight] => 0.2
[cartID] => 64935
[content_type] =>
[count_manufacturers] =>
[total_virtual] => 15.000009
[weight_virtual] => 0.2
)<!--c2-->[/align]<!--ec2-->
Ergo sucht man nun die Methode, die die "Summen" bildet und fügt für den Anfang einen
Wert (null = zahl) ein
Zeile 403
<!--c1--><div class='codetop'>QUELLTEXT[/align]<div class='codemain'><!--ec1--> function calculate() {
$this->total_virtual = 0; // Gift Voucher System
$this->weight_virtual = 0;
$this->total = 0;
$this->weight = 0;
$this->count_manufacturers= 0;<!--c2-->[/align]<!--ec2-->
Man ruft den Shop auf, und hat jetzt NULL Hersteller!
Diese Erweiterung hätte selbstverständlich nur dann SINN, wenn man die Anzahl der Hersteller
im Warenkorb benötigt.
Der Ausgang war aber im Kassenbereich.
Die Klasse class_order.php holt sich mit
<!--c1--><div class='codetop'>QUELLTEXT[/align]<div class='codemain'><!--ec1--> $products = $_SESSION['cart]->get_products();<!--c2-->[/align]<!--ec2-->
die Produkte aus dem Warenkorb.
ergo muss function get_products() { in Shop class_shopping_cart erweitert werden
(Hersteller aus der Datenbank Abfragen und in den Array schreiben.
Da die o.g. erweiterung verstanden wurde, fügen wir nun unter
<!--c1--><div class='codetop'>QUELLTEXT[/align]<div class='codemain'><!--ec1--> print_r($_SESSION['cart]);<!--c2-->[/align]<!--ec2-->
ein
print_r($order);
<!--c1--><div class='codetop'>QUELLTEXT[/align]<div class='codemain'><!--ec1--> print_r($_SESSION['cart]);
print_r($order);<!--c2-->[/align]<!--ec2-->
und erhält im Kassenbereich
<!--c1--><div class='codetop'>QUELLTEXT[/align]<div class='codemain'><!--ec1-->order Object
(
[info] => Array
(
[order_status] => 1
[currency] => EUR
[currency_value] => 1.00000000
[payment_method] =>
[cc_type] =>
[cc_owner] =>
[cc_number] =>
[cc_expires] =>
[cc_cvv] =>
[shipping_method] =>
[shipping_cost] =>
[comments] =>
[shipping_class] =>
[payment_class] =>
[subtotal] => 14.0187
[tax] => 0
[tax_groups] => Array
(
[0] => 0
)
[total] => 14.0187
)
[totals] => Array
(
)
[products] => Array
(
[0] => Array
(
[qty] => 1
[name] => dfasdfdasf
[model] =>
[ean] =>
[tax] => 0
[tax_description] => Unbekannter Steuersatz
[price] => 14.0187
[final_price] => 14.0187
[weight] => 0.20
[towlid] =>
[id] => 1
)
)
[customer] => Array
(
[firstname] => Ralf
[lastname] => Zschemisch
[company] =>
[street_address] => Thüringenenstr. 20
[suburb] => haspe
[city] => Hagen
[postcode] => 58135
[state] => NRW
[zone_id] => 0
[country] => Array
(
[id] => 81
[title] => Germany
[iso_code_2] => DE
[iso_code_3] => DEU
)
[format_id] => 5
[telephone] => 02331 44 511
[email_address] =>
info@r23.de
)
[delivery] => Array
(
[firstname] => Ralf
[lastname] => Zschemisch
[company] =>
[street_address] => Thüringenenstr. 20
[suburb] => haspe
[city] => Hagen
[postcode] => 58135
[state] => NRW
[zone_id] => 0
[country] => Array
(
[id] => 81
[title] => Germany
[iso_code_2] => DE
[iso_code_3] => DEU
)
[country_id] => 81
[format_id] => 5
)
[content_type] => physical
[billing] => Array
(
[firstname] =>
[lastname] =>
[company] =>
[street_address] =>
[suburb] =>
[city] =>
[postcode] =>
[state] =>
[country] => Array
(
[id] =>
[title] =>
[iso_code_2] =>
[iso_code_3] =>
[moneybookers] =>
)
[country_id] =>
[format_id] =>
)
)<!--c2-->[/align]<!--ec2-->
Wenn jetzt noch Probleme sind - kann ich nur noch bei *konkreten* Fragen hefen.
cu
ralf