CAO-Faktura für Windows Version 1.2 (http://www.cao-faktura.de) Copyright (C) 2003 Jan Pokrandt / Jan@JP-SOFT.de This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. CAO-Faktura comes with ABSOLUTELY NO WARRANTY Programm : CAO-Faktura Modul : OSC-CAO_install.txt Stand : 15.08.2006 Version : 0.27 Beschreibung : Updateanweisungen für OSC zum Export nach CAO based on: (c) 2000 - 2001 The Exchange Project (c) 2001 - 2003 osCommerce, Open Source E-Commerce Solutions (c) 2003 IN-Solution, Henri Schmidhuber (c) 2003 RV-Design, Raphael Vullriede Released under the GNU General Public License History : - 20.07.2003 HS Änderungen für OSC für - 03.12.2004 RV Erweiterung für 3 Produktbilder - ???? |
Installationsanleitung
zur Anbindung vom CAO Faktura an OsCommerce 2.2 Milestone 2
Zum bessern Verständnis sind die geänderten Dateien im Zip File enthalten. Sofern in Ihrem Webshop keine Contributions installiert wurden, kann man die Files ersetzen und muss keine Code Änderungen in den Webshop Files vornehmen.
- die configure.php (/catalog/includes und /catalog/admin/includes) sollten nicht einfach "drüberkopiert" werden, da diese wichtige Shopeinstellungen beeinhalten. Hier sollte man den Code anpassen, die Dateien (configure-vorlage.php) sind nur als Vorlage gedacht!
- wenn nicht überall medium und large Bilder hochgeladen werden, sollte im Oscommerce Admin Menü->Images->Image required auf "false" gestellt werden, ansonsten werden Platzhalter angezeigt.
- Änderungen im Code sind am Ende mit "// CAO Erweiterung" gekennzeichet.
- in der "popup_image.php" hab ich die medium/ large Bilder vorerst ausgeblendet. Sie können jederzeit eingeblendet werden, wenn man die // vor dem Code entfernt!
Bevor Sie Änderungen vornehmen oder Files ersetzen, sichern Sie bitte ihre CAO Faktura Datenbank, die OsCommerce Datenbank sowie die Webshop Files, welche im Zuge der Installation geändert/ ersetzt werden!
Wenn dies nicht erfolgt ist erhält man in CAO die Fehlermeldung "Klasse nicht registriert".
2.) Die Scripte (Dateien) cao_osc.php und cao_osc_functions.php in den (geschützten) Adminordner (...\catalog\admin) kopieren.
Anmerkung:
Sollte ihr Webshop Admin Verzeichnis bis jetzt noch nicht per htaccess geschützt sein, sollten Sie dies schnellst möglich nachholen.
Informationen zu diesem Thema finden Sie hier:
3.) Anschließend ist die Datei
/catalog/includes/functions/password_funcs.php
nach:
/catalog/admin/includes/functions/password_funcs.php
zu kopieren.
4.) Nun sollte die Funktion des Scriptes festgestellt werden.
Hierzu im Internet Browser das Script aufrufen :
http://www.deinewebseite.de/catalog/admin/cao_osc.php
(www.deinewebseite.de ist natürlich durch die eigene Shopadresse zu ersetzen!)
Nach der Eingabe des Benutzernamens und des Passwortes (vgl. htaccess Schutz), sollte dann folgende Ausgabe folgen:
CAO-Faktura - osCommerce ShopanbindungVersion 1.53 Stand : 2005.08.15mögliche Funktionen : Ausgabe XML Scriptversion Ausgabe XML Manufacturers Ausgabe XML Categories Ausgabe XML Products Ausgabe XML Customers Ausgabe XML Customers-Newsletter Ausgabe XML Orders Ausgabe XML Shop-Config MySQL-Tabellen aktualisieren |
5.) Klicken Sie jetzt auf den Link "MySQL-Tabellen aktualisieren".
Jetzt werden die benötigten Änderungen an der MySQL-Datenbank des Shops ausgeführt.
Diese Aktion kann beliebig oft wiederholt werden, Daten gehen hierbei nicht verloren.
Durch das Anklicken der jeweiligen Ausgabe Funktionen ist es möglich XML Ausgaben der jeweiligen Bereiche zu erzeugen.
6.) Nachdem nun die Funktion des Scriptes sichergestellt ist, muß der Shop noch an diversen Stellen angepaßt werden.
In der Datei cao_osc.php am Anfang die speziellen Order_total Klassen anpassen,
bzw erweitern (also eigene verwendete hinzufügen).
Dies ist nur notwendig, wenn ihr spezielle Contributions im Shop installiert habt.
cao_osc.php ab ~ Zeile 92 anpassen:
| $order_total_class['ot_cod_fee']['prefix'] = '+'; $order_total_class['ot_cod_fee']['tax'] = '16'; $order_total_class['ot_customer_discount']['prefix'] = '-'; $order_total_class['ot_gv']['prefix'] = '-'; $order_total_class['ot_loworderfee']['prefix'] = '+'; $order_total_class['ot_shipping']['prefix'] = '+'; |
Erklärung:
['prefix'] gibt an, ob die Prozent addiert (+) oder subtrahiert (-) werden.
['tax'] gibt die jeweilge Steuerklasse an z.B. für Deutschland 16 für 16%, in Österreich 20 für 20%...
7.) Dann ist folgende Datei zu ändern:
/catalog/checkout_process.php:
folgenden Code suchen (~Zeile 57):
(Anmerkung: der in der Textversion der Anleitung - Anleitung.txt - ist der Code besser (inkl. Leerzeichen) dargestellt und besser für eine etwaige Suche geeignet)
$sql_data_array = array('customers_id' => $customer_id,
'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],
'customers_company' => $order->customer['company'],
'customers_street_address' => $order->customer['street_address'],
'customers_suburb' => $order->customer['suburb'],
'customers_city' => $order->customer['city'],
'customers_postcode' => $order->customer['postcode'],
'customers_state' => $order->customer['state'],
'customers_country' => $order->customer['country']['title'],
'customers_telephone' => $order->customer['telephone'],
'customers_email_address' => $order->customer['email_address'],
'customers_address_format_id' => $order->customer['format_id'],
'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],
'delivery_company' => $order->delivery['company'],
'delivery_street_address' => $order->delivery['street_address'],
'delivery_suburb' => $order->delivery['suburb'],
'delivery_city' => $order->delivery['city'],
'delivery_postcode' => $order->delivery['postcode'],
'delivery_state' => $order->delivery['state'],
'delivery_country' => $order->delivery['country']['title'],
'delivery_address_format_id' => $order->delivery['format_id'],
'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'],
'billing_company' => $order->billing['company'],
'billing_street_address' => $order->billing['street_address'],
'billing_suburb' => $order->billing['suburb'],
'billing_city' => $order->billing['city'],
'billing_postcode' => $order->billing['postcode'],
'billing_state' => $order->billing['state'],
'billing_country' => $order->billing['country']['title'],
'billing_address_format_id' => $order->billing['format_id'],
'payment_method' => $order->info['payment_method'],
'cc_type' => $order->info['cc_type'],
'cc_owner' => $order->info['cc_owner'],
'cc_number' => $order->info['cc_number'],
'cc_expires' => $order->info['cc_expires'],
'date_purchased' => 'now()',
'orders_status' => $order->info['order_status'],
'currency' => $order->info['currency'],
'currency_value' => $order->info['currency_value']);
ersetzen durch folgenden Code oder die FETT dargestellten Zeilen einfügen:
$sql_data_array = array('customers_id' => $customer_id,
'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],
'customers_company' => $order->customer['company'],
'customers_street_address' => $order->customer['street_address'],
'customers_suburb' => $order->customer['suburb'],
'customers_city' => $order->customer['city'],
'customers_postcode' => $order->customer['postcode'],
'customers_state' => $order->customer['state'],
'customers_country' => $order->customer['country']['title'],
'customers_telephone' => $order->customer['telephone'],
'customers_email_address' => $order->customer['email_address'],
'customers_address_format_id' => $order->customer['format_id'],
'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],
'delivery_firstname' => $order->delivery['firstname'],
'delivery_lastname' => $order->delivery['lastname'],
'delivery_company' => $order->delivery['company'],
'delivery_street_address' => $order->delivery['street_address'],
'delivery_suburb' => $order->delivery['suburb'],
'delivery_city' => $order->delivery['city'],
'delivery_postcode' => $order->delivery['postcode'],
'delivery_state' => $order->delivery['state'],
'delivery_country' => $order->delivery['country']['title'],
'delivery_country_iso_code_2' => $order->delivery['country']['iso_code_2'],
'delivery_address_format_id' => $order->delivery['format_id'],
'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'],
'billing_firstname' => $order->billing['firstname'],
'billing_lastname' => $order->billing['lastname'],
'billing_company' => $order->billing['company'],
'billing_street_address' => $order->billing['street_address'],
'billing_suburb' => $order->billing['suburb'],
'billing_city' => $order->billing['city'],
'billing_postcode' => $order->billing['postcode'],
'billing_state' => $order->billing['state'],
'billing_country' => $order->billing['country']['title'],
'billing_country_iso_code_2' => $order->billing['country']['iso_code_2'],
'billing_address_format_id' => $order->billing['format_id'],
'payment_method' => $order->info['payment_method'],
'payment_class' => $order->info['payment_class'],
'shipping_method' => $order->info['shipping_method'],
'shipping_class' => $order->info['shipping_class'],
'cc_type' => $order->info['cc_type'],
'cc_owner' => $order->info['cc_owner'],
'cc_number' => $order->info['cc_number'],
'cc_expires' => $order->info['cc_expires'],
'date_purchased' => 'now()',
'orders_status' => $order->info['order_status'],
'currency' => $order->info['currency'],
'currency_value' => $order->info['currency_value']);
8.) Dann ist folgende Datei zu ändern:
/catalog/includes/classes/order.php
folgenden Code suchen (~Zeile 150):
$this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,
'currency' => $currency,
'currency_value' => $currencies->currencies[$currency]['value'],
'payment_method' => $payment,
'cc_type' => (isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : ''),
'cc_owner' => (isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : ''),
'cc_number' => (isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : ''),
'cc_expires' => (isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : ''),
'shipping_method' => $shipping['title'],
'shipping_cost' => $shipping['cost'],
'subtotal' => 0,
'tax' => 0,
'tax_groups' => array(),
'comments' => (isset($GLOBALS['comments']) ? $GLOBALS['comments'] : ''));
if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {
$this->info['payment_method'] = $GLOBALS[$payment]->title;
if ( isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && ($GLOBALS[$payment]->order_status > 0) ) {
$this->info['order_status'] = $GLOBALS[$payment]->order_status;
}
}
ersetzen durch:
$this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,
'currency' => $currency,
'currency_value' => $currencies->currencies[$currency]['value'],
'payment_method' => $payment,
'payment_class' => $payment,
'cc_type' => $GLOBALS['cc_type'],
'cc_owner' => $GLOBALS['cc_owner'],
'cc_number' => $GLOBALS['cc_number'],
'cc_expires' => $GLOBALS['cc_expires'],
'shipping_method' => $shipping['title'],
'shipping_class' => ( (strpos($shipping['id'],'_') > 0) ? substr( strrev( strchr(strrev($shipping['id']),'_') ),0,-1) : $shipping['id'] ),
'shipping_cost' => $shipping['cost'],
'comments' => $GLOBALS['comments']);
if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {
$this->info['payment_method'] = $GLOBALS[$payment]->title;
$this->info['payment_class'] = $GLOBALS[$payment]->code;
if ( isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && ($GLOBALS[$payment]->order_status > 0) ) {
$this->info['order_status'] = $GLOBALS[$payment]->order_status;
}
}
9. Nun sind im CAO Faktura die Einstellungen für den Shop einzutragen bzw. anzupassen :
a.) CAO Faktura mit dem gewünschten Mandanten öffnen
b.) Im Menü Datei->Shopeinstellungen auf der Seite URL/Proxy ist sowohl bei "URL zum Importscript" als auch bei "URL zum Updatescript" die Datei cao_osc.php mit vollem Pfad einzutragen.
Also z.B. : http://www.deinewebsite.de/catalog/admin/cao_osc.php
(www.deinewebseite.de ist natürlich durch die eigene Shopadresse zu ersetzen!)

c.) Im Feld Benutzername ist der Benutzername des Administrators des Shops (vgl. htaccess) einzutragen.
Beim Paßwort das Paßwort des Admins.
Jetzt noch auf den Button Speichern klicken um die Einstellungen zu speichern.
d.) Prüfen Sie auch auf der Seite "Allgemein" das dort der richtige Shop (OsCommerce) in der Drop-Down-Box "Software" ausgewählt ist. Außerdem kann anhand der Checkboxen eingestellt werden, in welche Richtung Updates möglich sind.
Auch hier müssen Sie auf Speichern klicken !

e.) Nachdem nun die groben Einstellungen vollständig sind, können Sie in der linken Navigation auf Tools->Shoptransfer wechseln und dort auf der Seite "Transfer-Log" unten links auf den Button "Lese Script-Versionen" klicken. Hier sollte Ihnen jetzt die aktuelle Version angezeigt werden.
z.B.
| Script: http://www.deinewebsite.de/catalog/admin/cao_osc.php Code:111 Datum:2005-10-23 Version 1,47 Script: http://www.deinewebsite.de/catalog/admin/cao_osc.php Code:111 Datum:2005-10-23 Version 1,47 |
Wenn dies der Fall ist, funktioniert die Verbindung zwischen CAO Faktura und dem Webshop :)
Sollten hier Fehlermeldungen auftreten nochmals die Anleitung überprüfen bzw. die Fehlercheckliste im Forum durchlesen:
http://www.cao-wawi.de/index.php?option=com_forum&Itemid=44&page=viewtopic&t=5035
Viel Spaß mit CAO Faktura und OsCommerce!
Optional:
10.) drei Produktbilder-Erweiterung:
a) folgende SQL-Anweisungen in der osCommerce-DB ausführen:
ALTER TABLE `products`
ADD `products_image_medium` VARCHAR( 64 ) NOT NULL AFTER `products_image` ,
ADD `products_image_large` VARCHAR( 64 ) NOT NULL AFTER `products_image_medium` ;
oder cao-osc-bilder.sql aufrufen (Ordner SQL).
b.) in der Datei admin/includes/configure.php folgendes nach
define('DIR_FS_CATALOG_IMAGES', DIR_FS_CATALOG . 'images/');
einfügen:
define('DIR_FS_CATALOG_IMAGES_MEDIUM', DIR_FS_CATALOG . 'images/medium/');
define('DIR_FS_CATALOG_IMAGES_LARGE', DIR_FS_CATALOG . 'images/large/');
c.) Folgende Ordner müssen im Webshop angelegt werden und mit vollen Schreibzugriff (777) versehen werden:
/catalog/images/medium und
/catalog/images/large
d.) in der Datei
/catalog/includes/configure.php
folgendes nach
define('DIR_WS_IMAGES', 'images/');
einfügen:
define('DIR_WS_IMAGES_MEDIUM', 'images/medium/');
define('DIR_WS_IMAGES_LARGE', 'images/large/');
e.) in der Datei
/catalog/includes/product_info.php
folgenden Code (~Zeile 72):
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
ersetzen mit:
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_image_medium, p.products_image_large, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
f.) Die Bilder kann man auf der Produktseite dann mit
<?php echo tep_image(DIR_WS_IMAGES_MEDIUM . $product_info['products_image_medium'] , $product_info['products_name']); ?>
bzw.
<?php echo tep_image(DIR_WS_IMAGES_LARGE . $product_info['products_image_large'] , $product_info['products_name']); ?>
anzeigen.
g.) Analog kann man in der Datei popup_image.php vorgehen.