PDF rausgenommen

This commit is contained in:
aschwarz
2023-01-23 11:03:31 +01:00
parent 82d562a322
commit a6523903eb
28078 changed files with 4247552 additions and 2 deletions

View File

@ -0,0 +1,62 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: also_purchased_products.php,v 1.21 2003/02/12 23:55:58 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
$aPurchased = array();
if (isset($_GET['products_id']) && is_numeric(MAX_DISPLAY_ALSO_PURCHASED)) {
if (!isset($nProductsID)) $nProductsID = oos_get_product_id($_GET['products_id']);
$orders_productstable = $oostable['orders_products'];
$orderstable = $oostable['orders'];
$productstable = $oostable['products'];
$products_descriptiontable = $oostable['products_description'];
$sql = "SELECT p.products_id, p.products_image, pd.products_name
FROM $orders_productstable opa,
$orders_productstable opb,
$orderstable o,
$productstable p LEFT JOIN
$products_descriptiontable pd ON p.products_id = pd.products_id
WHERE opa.products_id = '" . intval($nProductsID) . "'
AND opa.orders_id = opb.orders_id
AND opb.products_id != '" . intval($nProductsID) . "'
AND opb.products_id = p.products_id
AND opb.orders_id = o.orders_id
AND p.products_setting = '2'
AND pd.products_languages_id = '" . intval($nLanguageID) . "'
GROUP BY p.products_id
ORDER BY o.date_purchased DESC";
$orders_result = $dbconn->SelectLimit($sql, MAX_DISPLAY_ALSO_PURCHASED);
$num_products_ordered = $orders_result->RecordCount();
if ($num_products_ordered >= MIN_DISPLAY_ALSO_PURCHASED) {
while ($orders = $orders_result->fields) {
$aPurchased[] = array('products_name' => $orders['products_name'],
'products_id' => $orders['products_id'],
'products_image' => $orders['products_image']);
// Move that ADOdb pointer!
$orders_result->MoveNext();
}
}
}

View File

@ -0,0 +1,85 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
WebMakers.com Added: Discount Quantity
Written by Linda McGrath osCOMMERCE@WebMakers.com
http://www.thewebmakerscorner.com
BOF: WebMakes.com Added: Discount Quantity
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
if (!isset($nProductsID)) $nProductsID = oos_get_product_id($_GET['products_id']);
$the_special = oos_get_products_special_price($nProductsID);
$q0 = $product_info['products_quantity_order_min'];
$q1 = $product_info['products_discount1_qty'];
$q2 = $product_info['products_discount2_qty'];
$q3 = $product_info['products_discount3_qty'];
$q4 = $product_info['products_discount4_qty'];
$col_cnt = 1;
if ( $product_info['products_discount1'] > 0 ) {
$col_cnt = $col_cnt+1;
}
if ( $product_info['products_discount2'] > 0 ) {
$col_cnt = $col_cnt+1;
}
if ( $product_info['products_discount3'] > 0 ) {
$col_cnt = $col_cnt+1;
}
if ( $product_info['products_discount4'] > 0 ) {
$col_cnt = $col_cnt+1;
}
$discount_table = 120*$col_cnt;
if ( $max_product_discount != 0 ) {
$td0 = '<span class="smallText"><s>' . $oCurrencies->display_price($product_info['products_price'], oos_get_tax_rate($product_info['products_tax_class_id'])) . '</s><br />-' . number_format($max_product_discount, 2) . '%</span><br /><span class="productDiscountPrice">' . $oCurrencies->display_price($product_info['products_price']*(100-$max_product_discount)/100, oos_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
$td1 = '<span class="smallText"><s>' . $oCurrencies->display_price($product_info['products_discount1'], oos_get_tax_rate($product_info['products_tax_class_id'])) . '</s><br />-' . number_format($max_product_discount, 2) . '%</span><br /><span class="productDiscountPrice">' . $oCurrencies->display_price($product_info['products_discount1']*(100-$max_product_discount)/100, oos_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
$td2 = '<span class="smallText"><s>' . $oCurrencies->display_price($product_info['products_discount2'], oos_get_tax_rate($product_info['products_tax_class_id'])) . '</s><br />-' . number_format($max_product_discount, 2) . '%</span><br /><span class="productDiscountPrice">' . $oCurrencies->display_price($product_info['products_discount2']*(100-$max_product_discount)/100, oos_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
$td3 = '<span class="smallText"><s>' . $oCurrencies->display_price($product_info['products_discount3'], oos_get_tax_rate($product_info['products_tax_class_id'])) . '</s><br />-' . number_format($max_product_discount, 2) . '%</span><br /><span class="productDiscountPrice">' . $oCurrencies->display_price($product_info['products_discount3']*(100-$max_product_discount)/100, oos_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
$td4 = '<span class="smallText"><s>' . $oCurrencies->display_price($product_info['products_discount4'], oos_get_tax_rate($product_info['products_tax_class_id'])) . '</s><br />-' . number_format($max_product_discount, 2) . '%</span><br /><span class="productDiscountPrice">' . $oCurrencies->display_price($product_info['products_discount4']*(100-$max_product_discount)/100, oos_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
} else {
$td0 = $oCurrencies->display_price($product_info['products_price'], oos_get_tax_rate($product_info['products_tax_class_id']));
$td1 = $oCurrencies->display_price($product_info['products_discount1'], oos_get_tax_rate($product_info['products_tax_class_id']));
$td2 = $oCurrencies->display_price($product_info['products_discount2'], oos_get_tax_rate($product_info['products_tax_class_id']));
$td3 = $oCurrencies->display_price($product_info['products_discount3'], oos_get_tax_rate($product_info['products_tax_class_id']));
$td4 = $oCurrencies->display_price($product_info['products_discount4'], oos_get_tax_rate($product_info['products_tax_class_id']));
}
$col0 = (($q1-1) > $q0 ? $q0 . '-' . ($q1-1) : $q0);
$col1 = ($q2 > 0 ? (($q2-1) > $q1 ? $q1 . '-' . ($q2-1) : $q1) : $q1 . '+');
$col2 = ($q3 > 0 ? (($q3-1) > $q2 ? $q2 . '-' . ($q3-1) : $q2) : $q2 . '+');
$col3 = ($q4 > 0 ? (($q4-1) > $q3 ? $q3 . '-' . ($q4-1) : $q3) : $q3 . '+');
$col4 = ($q4 > 0 ? $q4 . '+' : '');
$smarty->assign(array('discount_table' => $discount_table,
'colspan' => $col_cnt,
'q0' => $q0,
'q1' => $q1,
'q2' => $q2,
'q3' => $q3,
'q4' => $q4,
'col0' => $col0,
'col1' => $col1,
'col2' => $col2,
'col3' => $col3,
'col4' => $col4,
'td0' => $td0,
'td1' => $td1,
'td2' => $td2,
'td3' => $td3,
'td4' => $td4,
'td5' => $td5));

View File

@ -0,0 +1,85 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: downloads.php,v 1.2 2003/02/12 23:55:58 hpdl
----------------------------------------------------------------------
WebMakers.com Added: Added: Downloads Controller
Written by Linda McGrath osCOMMERCE@WebMakers.com
http://www.thewebmakerscorner.com
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
if (oos_var_prep_for_os($sContent) != $aContents['account_history_info']) {
// Get last order id for checkout_success
$orderstable = $oostable['orders'];
$orders_result = $dbconn->Execute("SELECT orders_id FROM $orderstable WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' ORDER BY orders_id desc limit 1");
$orders = $orders_result->fields;
$last_order = $orders['orders_id'];
} else {
$last_order = oos_var_prep_for_os($_GET['order_id']);
}
// Now get all downloadable products in that order
// BOF: WebMakers.com Added: Downloads Controller
// DEFINE WHICH ORDERS_STATUS TO USE IN function_downloads_controller.php
// USE last_modified instead of date_purchased
$orderstable = $oostable['orders'];
$orders_productstable = $oostable['orders_products'];
$orders_products_downloadtable = $oostable['orders_products_download'];
$sql = "SELECT o.orders_status, date_format(o.last_modified, '%Y-%m-%d') AS date_purchased_day,
opd.download_maxdays, op.products_name, opd.orders_products_download_id,
opd.orders_products_filename, opd.download_count, opd.download_maxdays
FROM $orderstable o,
$orders_productstable op,
$orders_products_downloadtable opd
WHERE o.customers_id = '" . intval($_SESSION['customer_id']) . "'
AND o.orders_status >= '" . DOWNLOADS_CONTROLLER_ORDERS_STATUS . "'
AND o.orders_id = '" . intval($last_order) . "'
AND o.orders_id = op.orders_id
AND op.orders_products_id = opd.orders_products_id
AND opd.orders_products_filename != ''";
$downloads_result = $dbconn->Execute($sql);
if ($downloads_result->RecordCount() > 0) {
$downloads_array = array();
while ($downloads = $downloads_result->fields) {
// MySQL 3.22 does not have INTERVAL
list($dt_year, $dt_month, $dt_day) = explode('-', $downloads['date_purchased_day']);
$download_timestamp = mktime(23, 59, 59, $dt_month, $dt_day + $downloads['download_maxdays'], $dt_year);
$download_expiry = date('Y-m-d H:i:s', $download_timestamp);
$show_download_link = 'false';
if ( ($downloads['download_count'] > 0) && (file_exists(OOS_DOWNLOAD_PATH . $downloads['orders_products_filename'])) && ( ($downloads['download_maxdays'] == 0) || ($download_timestamp > time())) ) {
$show_download_link = 'true';
}
$downloads_array[] = array('show_download_link' => $show_download_link,
'last_order' => $last_order,
'id' => $downloads['orders_products_download_id'],
'products_name' => $downloads['products_name'],
'download_expiry' => $download_expiry,
'download_count' => $downloads['download_count']);
// Move that ADOdb pointer!
$downloads_result->MoveNext();
}
// Close result set
$downloads_result->Close();
$smarty->assign('downloads_array',$downloads_array);
}

View File

@ -0,0 +1,93 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
if (!$oEvent->installed_plugin('featured')) return FALSE;
if (!is_numeric(MAX_DISPLAY_FEATURED_PRODUCTS)) return FALSE;
$productstable = $oostable['products'];
$products_descriptiontable = $oostable['products_description'];
$featuredtable = $oostable['featured'];
$sql = "SELECT p.products_id, p.products_image, p.products_price, p.products_tax_class_id,
p.products_units_id, p.products_base_price, p.products_base_unit,
p.products_quantity_order_min, p.products_quantity_order_max,
p.products_product_quantity, pd.products_name,
pd.products_short_description
FROM $productstable p,
$products_descriptiontable pd,
$featuredtable f
WHERE p.products_setting = '2'
AND f.products_id = p.products_id
AND p.products_id = pd.products_id
AND pd.products_languages_id = '" . intval($nLanguageID) . "'
AND f.status = '1'
ORDER BY f.featured_date_added DESC";
$featured_result = $dbconn->SelectLimit($sql, MAX_DISPLAY_FEATURED_PRODUCTS);
// MIN_DISPLAY_FEATURED
if ($featured_result->RecordCount() >= 1) {
$aFeatured = array();
while ($featured = $featured_result->fields) {
$featured_product_price = NULL;
$featured_product_special_price = NULL;
$featured_base_product_price = NULL;
$featured_special_price = NULL;
if ($aUser['show_price'] == 1 ) {
$base_product_price = $featured['products_price'];
$featured_product_price = $oCurrencies->display_price($featured['products_price'], oos_get_tax_rate($featured['products_tax_class_id']));
$featured_special_price = oos_get_products_special_price($featured['products_id']);
if (oos_is_not_null($featured_special_price)) {
$base_product_price = $featured_special_price;
$featured_product_special_price = $oCurrencies->display_price($featured_special_price, oos_get_tax_rate($featured['products_tax_class_id']));
}
if ($featured['products_base_price'] != 1) {
$featured_base_product_price = $oCurrencies->display_price($base_product_price * $featured['products_base_price'], oos_get_tax_rate($featured['products_tax_class_id']));
}
}
$order_min = number_format($featured['products_quantity_order_min']);
$order_max = number_format($listing['products_quantity_order_max']);
$aFeatured[] = array('products_id' => $featured['products_id'],
'products_image' => $featured['products_image'],
'products_name' => $featured['products_name'],
'products_short_description' => $featured['products_short_description'],
'order_min' => $order_min,
'order_max' => $order_max,
'product_quantity' => $featured['products_product_quantity'],
'products_base_price' => $featured['products_base_price'],
'products_base_unit' => $featured['products_base_unit'],
'products_units' => $featured['products_units_id'],
'featured_product_price' => $featured_product_price,
'featured_product_special_price' => $featured_product_special_price,
'featured_base_product_price' => $featured_base_product_price);
// Move that ADOdb pointer!
$featured_result->MoveNext();
}
$smarty->assign('featured', $aFeatured);
}

View File

@ -0,0 +1,35 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
$products_history_block = 'false';
if ($_SESSION['products_history']->count_history() > 0) {
$products_history_block = 'true';
$product_ids = $_SESSION['products_history']->get_product_id_list();
$productstable = $oostable['products'];
$products_descriptiontable = $oostable['products_description'];
$products_sql = "SELECT p.products_id, p.products_image, pd.products_name, pd.products_short_description
FROM $productstable p,
$products_descriptiontable pd
WHERE p.products_id IN (" . $product_ids . ")
AND p.products_id = pd.products_id
AND pd.products_languages_id = '" . intval($nLanguageID) . "'
ORDER BY products_name";
$smarty->assign('history_products', $dbconn->GetAll($products_sql));
}
$smarty->assign('products_history_block', $products_history_block);

View File

@ -0,0 +1,36 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
define('MAX_DISPLAY_MANUFACTURER', 8);
define('MIN_DISPLAY_MANUFACTURER', 1);
if (!$oEvent->installed_plugin('manufacturers')) return FALSE;
if (!is_numeric(MAX_DISPLAY_MANUFACTURER)) return FALSE;
if (!isset($_GET['manufacturers_id'])) {
$manufacturerstable = $oostable['manufacturers'];
$manufacturers_infotable = $oostable['manufacturers_info'];
$query = "SELECT m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url
FROM $manufacturerstable m,
$manufacturers_infotable mi
WHERE m.manufacturers_id = mi.manufacturers_id
AND mi.manufacturers_languages_id = '" . intval($nLanguageID) . "'
ORDER BY m.manufacturers_name";
$manufacturer_result = $dbconn->SelectLimit($query, MAX_DISPLAY_MANUFACTURER);
$nManufacturer = $manufacturer_result->RecordCount();
if ($nManufacturer >= MIN_DISPLAY_MANUFACTURER) {
$smarty->assign('mod_manufacturer_array', $manufacturer_result->GetArray());
}
}

View File

@ -0,0 +1,124 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: new_products.php,v 1.2 2003/01/09 09:40:08 elarifr
orig: new_products.php,v 1.33 2003/02/12 23:55:58 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
if (!is_numeric(MAX_DISPLAY_NEW_PRODUCTS)) return FALSE;
if ( (!isset($nCurrentCategoryID)) || ($nCurrentCategoryID == '0') ) {
$productstable = $oostable['products'];
$products_descriptiontable = $oostable['products_description'];
$specialstable = $oostable['specials'];
$sql = "SELECT p.products_id, pd.products_name, p.products_image, pd.products_short_description, p.products_tax_class_id, p.products_units_id,
p.products_price, p.products_base_price, p.products_base_unit, p.products_product_quantity,
p.products_quantity_order_min, p.products_quantity_order_max,
IF(s.status, s.specials_new_products_price, NULL) AS specials_new_products_price
FROM $productstable p LEFT JOIN
$specialstable s ON p.products_id = s.products_id,
$products_descriptiontable pd
WHERE p.products_setting = '2'
AND p.products_id = pd.products_id
AND pd.products_languages_id = '" . intval($nLanguageID) . "'
ORDER BY p.products_date_added DESC";
} else {
$productstable = $oostable['products'];
$products_descriptiontable = $oostable['products_description'];
$specialstable = $oostable['specials'];
$products_to_categoriestable = $oostable['products_to_categories'];
$categoriestable = $oostable['categories'];
$sql = "SELECT DISTINCT p.products_id, pd.products_name, pd.products_short_description, p.products_image, p.products_tax_class_id, p.products_units_id,
p.products_price, p.products_base_price, p.products_base_unit, p.products_product_quantity,
p.products_quantity_order_min, p.products_quantity_order_max,
IF(s.status, s.specials_new_products_price, NULL) AS specials_new_products_price
FROM $productstable p LEFT JOIN
$specialstable s ON p.products_id = s.products_id,
$products_descriptiontable pd,
$products_to_categoriestable p2c,
$categoriestable c
WHERE p.products_id = p2c.products_id
AND p2c.categories_id = c.categories_id
AND c.parent_id = '" . intval($nCurrentCategoryID) . "'
AND p.products_setting = '2'
AND p.products_id = pd.products_id
AND pd.products_languages_id = '" . intval($nLanguageID) . "'
ORDER BY p.products_date_added DESC";
}
$new_products_result = $dbconn->SelectLimit($sql, MAX_DISPLAY_NEW_PRODUCTS);
$aNewProducts = array();
while ($new_products = $new_products_result->fields) {
$new_product_price = NULL;
$new_product_special_price = NULL;
$new_product_discount_price = NULL;
$new_base_product_price = NULL;
$new_special_price = NULL;
if ($aUser['show_price'] == 1 ) {
$base_product_price = $new_products['products_price'];
$new_product_price = $oCurrencies->display_price($new_products['products_price'], oos_get_tax_rate($new_products['products_tax_class_id']));
$new_special_price = $new_products['specials_new_products_price'];
if (oos_is_not_null($new_special_price)) {
$base_product_price = $new_special_price;
$new_product_special_price = $oCurrencies->display_price($new_special_price, oos_get_tax_rate($new_products['products_tax_class_id']));
}
if ($new_products['products_base_price'] != 1) {
$new_base_product_price = $oCurrencies->display_price($base_product_price * $new_products['products_base_price'], oos_get_tax_rate($new_products['products_tax_class_id']));
}
}
$order_min = number_format($new_products['products_quantity_order_min']);
$order_max = number_format($new_products['products_quantity_order_max']);
$aNewProducts[] = array('products_id' => $new_products['products_id'],
'products_image' => $new_products['products_image'],
'products_name' => $new_products['products_name'],
'products_short_description' => $new_products['products_short_description'],
'order_min' => $order_min,
'order_max' => $order_max,
'product_quantity' => $new_products['products_product_quantity'],
'products_base_price' => $new_products['products_base_price'],
'products_base_unit' => $new_products['products_base_unit'],
'new_product_units' => $new_products['products_units_id'],
'new_product_price' => $new_product_price,
'new_product_special_price' => $new_product_special_price,
'new_product_discount_price' => $new_product_discount_price,
'new_base_product_price' => $new_base_product_price,
'new_special_price' => $new_special_price);
// Move that ADOdb pointer!
$new_products_result->MoveNext();
}
// assign Smarty variables;
$smarty->assign(
array(
'block_heading_new_products' => sprintf($aLang['table_heading_new_products'], strftime('%B')),
'new_products_array' => $aNewProducts
)
);

View File

@ -0,0 +1,155 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: order_details.php,v 1.2 2003/01/09 09:40:08 elarifr
orig: order_details.php,v 1.7 2003/02/13 01:46:54 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
$shopping_cart_detail = '';
$shopping_cart_detail .= ' <tr>' . "\n";
$colspan = 3;
$colspan++;
$shopping_cart_detail .= ' <td align="center" class="smallText"></td>' . "\n";
if ($sContent == $aContents['shopping_cart']) {
$colspan++;
$shopping_cart_detail .= ' <td align="center" class="smallText"><strong>' . $aLang['table_heading_remove'] . '</strong></td>' . "\n";
}
$shopping_cart_detail .= ' <td align="center" class="tableHeading">' . $aLang['table_heading_quantity'] . '</td>' . "\n";
if (PRODUCT_LIST_MODEL > 0) {
if ($sContent == $aContents['shopping_cart']) {
$colspan++;
$shopping_cart_detail .= ' <td class="tableHeading">' . $aLang['table_heading_model'] . '</td>' . "\n";
}
}
$shopping_cart_detail .= ' <td class="tableHeading">' . $aLang['table_heading_products'] . '</td>' . "\n";
if ($sContent != $aContents['shopping_cart']) {
$colspan++;
$shopping_cart_detail .= ' <td align="center" class="tableHeading">' . $aLang['table_heading_tax'] . '</td>' . "\n";
}
$shopping_cart_detail .= ' <td align="right" class="tableHeading">' . $aLang['table_heading_total'] . '</td>' . "\n" .
' </tr>' . "\n" .
' <tr>' . "\n" .
' <td colspan="' . $colspan . '">&nbsp;</td>' . "\n" .
' </tr>' . "\n";
for ($i=0, $n=count($products); $i<$n; $i++) {
$shopping_cart_detail .= ' <tr>' . "\n";
if (SHOPPING_CART_IMAGE_ON == 'true') {
$shopping_cart_detail .= ' <td align="center" valign="top" class="main"><a href="' . oos_href_link($aContents['product_info'], 'products_id=' . $products[$i]['id']) . '">';
$shopping_cart_detail .= oos_image(OOS_IMAGES . 'product/small/' . $products[$i]['image'], $products[$i]['name']) . '</a></td>' . "\n";
}
// Delete box only for shopping cart
if ($sContent == $aContents['shopping_cart']) {
$shopping_cart_detail .= ' <td align="center" valign="top">' . oos_draw_checkbox_field('cart_delete[]', $products[$i]['id']) . '</td>' . "\n";
}
// Quantity box or information as an input box or text
$quantity = number_format($products[$i]['quantity']);
if ($sContent == $aContents['shopping_cart']) {
$shopping_cart_detail .= ' <td align="center" valign="top" class ="main">' . oos_draw_input_field('cart_quantity[]', $quantity, 'size="4"') . oos_draw_hidden_field('products_id[]', $products[$i]['id']) . '<br />' . (oos_get_products_quantity_order_min($products[$i]['id']) > 1 ? $aLang['products_order_qty_min_text_cart_short'] . oos_get_products_quantity_order_min($products[$i]['id']) : '') . (oos_get_products_quantity_order_units($products[$i]['id']) > 1 ? $aLang['products_order_qty_unit_text_cart_short'] . oos_get_products_quantity_order_units($products[$i]['id']) : "") . '</td>' . "\n";
} else {
$shopping_cart_detail .= ' <td align="center" valign="top" class ="main">' . $quantity . '</td>' . "\n";
}
if (PRODUCT_LIST_MODEL > 0) {
if ($sContent == $aContents['shopping_cart']) {
$shopping_cart_detail .= ' <td valign="top" class="main"><a href="' . oos_href_link($aContents['product_info'], 'products_id=' . $products[$i]['id']) . '">' . $products[$i]['model'] . '</a></td>' . "\n";
}
}
// Product name, with or without link
if ($sContent == $aContents['shopping_cart']) {
$shopping_cart_detail .= ' <td valign="top" class="main"><a href="' . oos_href_link($aContents['product_info'], 'products_id=' . $products[$i]['id']) . '"><strong>' . $products[$i]['name'] . '</strong></a>';
} else {
$shopping_cart_detail .= ' <td valign="top" class="main"><strong>' . $products[$i]['name'] . '</strong>';
}
// Display marker if stock quantity insufficient
if (STOCK_CHECK == 'true') {
$shopping_cart_detail .= $stock_check = oos_check_stock($products[$i]['id'], $products[$i]['quantity']);
if ($stock_check) $any_out_of_stock = 1;
}
// Wishlist names
if (oos_is_not_null($products[$i]['towlid'])) {
$shopping_cart_detail .= '<br /><a href="' . oos_href_link($aContents['wishlist'], 'wlid=' . $products[$i]['towlid']) . '">' . oos_image(OOS_IMAGES . 'wl.gif', oos_get_wishlist_name($products[$i]['towlid'])) . '</a>' . "\n";
$shopping_cart_detail .= '<small><i><a href="' . oos_href_link($aContents['wishlist'], 'wlid=' . $products[$i]['towlid']) . '">' . oos_get_wishlist_name($products[$i]['towlid']) . '</a></i></small>';
$shopping_cart_detail .= oos_draw_hidden_field('to_wl_id[]', $products[$i]['towlid']);
}
// Product options names
if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
reset($products[$i]['attributes']);
foreach($products[$i]['attributes'] as $option => $value) {
$shopping_cart_detail .= '<br /><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
}
}
$shopping_cart_detail .= '</td>' . "\n";
// Tax (not in shopping cart, tax rate may be unknown)
if ($sContent != $aContents['shopping_cart']) {
$shopping_cart_detail .= ' <td align="center" valign="top" class="main">' . number_format($products[$i]['tax'], TAX_DECIMAL_PLACES) . '%</td>' . "\n";
}
// Product price
if ($sContent != $aContents['account_history_info']) {
$shopping_cart_detail .= ' <td align="right" valign="top" class="main"><strong>' . $oCurrencies->display_price($products[$i]['price'], oos_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</strong>';
} else {
$shopping_cart_detail .= ' <td align="right" valign="top" class="main"><strong>' . $oCurrencies->display_price($products[$i]['price'], $products[$i]['tax'], $products[$i]['quantity']) . '</strong>';
}
// Product options prices
if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
reset($products[$i]['attributes']);
foreach($products[$i]['attributes'] as $option => $value) {
if ($products[$i][$option]['options_values_price'] != 0) {
if ($sContent != $aContents['account_history_info']) {
$shopping_cart_detail .= '<br /><small><i>' . $products[$i][$option]['price_prefix'] . $oCurrencies->display_price($products[$i][$option]['options_values_price'], oos_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</i></small>';
} else {
$shopping_cart_detail .= '<br /><small><i>' . $products[$i][$option]['price_prefix'] . $oCurrencies->display_price($products[$i][$option]['options_values_price'], $products[$i]['tax'], $products[$i]['quantity']) . '</i></small>';
}
} else {
// Keep price aligned with corresponding option
$shopping_cart_detail .= '<br /><small><i>&nbsp;</i></small>';
}
}
}
$shopping_cart_detail .= '</td>' . "\n" .
' </tr>' . "\n";
}

View File

@ -0,0 +1,160 @@
<?php
/* ----------------------------------------------------------------------
$Id: ot_cmembers.php,v 1.1 2007/06/07 17:30:50 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: ot_cmembers.php,v 1.1 2003/01/08 10:53:04 elarifr
ot_lev_members.php,v 1.0 2002/04/08 01:13:43 hpdl
----------------------------------------------------------------------
Customers_status v3.x / Catalog part
Copyright elari@free.fr
Contribution based on:
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 - 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class ot_cmembers {
var $title, $output, $enabled = FALSE;
public function __construct() {
global $aLang;
$this->code = 'ot_cmembers';
$this->title = $aLang['module_cmembers_title'];
$this->description = $aLang['module_cmembers_description'];
$this->enabled = (defined('MODULE_CMEMBERS_STATUS') && (MODULE_CMEMBERS_STATUS == 'true') ? TRUE : FALSE);
$this->sort_order = (defined('MODULE_CMEMBERS_SORT_ORDER') ? MODULE_CMEMBERS_SORT_ORDER : null);
$this->include_shipping = (defined('MODULE_CMEMBERS_INC_SHIPPING') ? MODULE_CMEMBERS_INC_SHIPPING : null);
$this->include_tax = (defined('MODULE_CMEMBERS_INC_TAX') ? MODULE_CMEMBERS_INC_TAX : null);
$this->calculate_tax = (defined('MODULE_CMEMBERS_CALC_TAX') ? MODULE_CMEMBERS_CALC_TAX : null);
$this->percentage = (defined('MODULE_CMEMBERS_OT_DISCOUNT') ? MODULE_CMEMBERS_OT_DISCOUNT : null);
$this->output = array();
}
function process() {
global $oOrder, $oCurrencies;
$od_amount = $this->calculate_credit($this->get_order_total());
if ($od_amount>0) {
$this->deduction = $od_amount;
$this->output[] = array('title' => '<span class="otDiscount">- ' . $this->title . ' ('. number_format($this->percentage, 2) .'%):</span>',
'text' => '<strong><span class="otDiscount">' . $oCurrencies->format($od_amount) . '</span></strong>',
'value' => $od_amount);
$oOrder->info['total'] = $oOrder->info['total'] - $od_amount;
}
}
function calculate_credit($amount) {
global $oOrder, $customer_id, $customer_status_value;
$od_amount=0;
$od_pc = $this->percentage;
$cart_count = $_SESSION['cart']->count_contents();
if (MODULE_CMEMBERS_CART_COUNT < $cart_count) {
if ($this->calculate_tax == 'true') { // Calculate main tax reduction
$tod_amount = round($oOrder->info['tax']*10)/10*$od_pc/100;
$oOrder->info['tax'] = $oOrder->info['tax'] - $tod_amount; // Calculate tax group deductions
reset($oOrder->info['tax_groups']);
foreach($oOrder->info['tax_groups'] as $key => $value) {
$god_amount = round($value*10)/10*$od_pc/100;
$oOrder->info['tax_groups'][$key] = $oOrder->info['tax_groups'][$key] - $god_amount;
}
}
$od_amount = round($amount*10)/10*$od_pc/100;
$od_amount = $od_amount + $tod_amount;
}
return $od_amount;
}
function get_order_total() {
global $oOrder;
$order_total = $oOrder->info['total'];
// Check if gift voucher is in cart and adjust total
$products = $_SESSION['cart']->get_products();
for ($i=0; $i<count($products); $i++) {
$t_prid = oos_get_product_id($products[$i]['id']);
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$productstable = $oostable['products'];
$query = "SELECT products_price, products_tax_class_id, products_model
FROM $productstable
WHERE products_id = '" . intval($t_prid) . "'";
$gv_result = $dbconn->GetRow($query);
if (preg_match('/^GIFT/', addslashes($gv_result['products_model']))) {
$qty = $_SESSION['cart']->get_quantity($t_prid);
$products_tax = oos_get_tax_rate($gv_result['products_tax_class_id']);
if ($this->include_tax =='false') {
$gv_amount = $gv_result['products_price'] * $qty;
} else {
$gv_amount = ($gv_result['products_price'] + oos_calculate_tax($gv_result['products_price'],$products_tax)) * $qty;
}
$order_total = $order_total - $gv_amount;
}
}
if ($this->include_tax == 'false') $order_total = $order_total-$oOrder->info['tax'];
if ($this->include_shipping == 'false') $order_total = $order_total-$oOrder->info['shipping_cost'];
return $order_total;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_CMEMBERS_STATUS');
}
return $this->_check;
}
function keys() {
return array('MODULE_CMEMBERS_STATUS', 'MODULE_CMEMBERS_SORT_ORDER', 'MODULE_CMEMBERS_CART_COUNT', 'MODULE_CMEMBERS_OT_DISCOUNT', 'MODULE_CMEMBERS_INC_SHIPPING', 'MODULE_CMEMBERS_INC_TAX', 'MODULE_CMEMBERS_CALC_TAX');
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) values ('MODULE_CMEMBERS_STATUS', 'true', '6', '1','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_CMEMBERS_SORT_ORDER', '12', '6', '2', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_CMEMBERS_CART_COUNT', '5', '6', '3', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_CMEMBERS_OT_DISCOUNT', '10', '6', '4', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function ,date_added) values ('MODULE_CMEMBERS_INC_SHIPPING', 'true', '6', '5', 'oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function ,date_added) values ('MODULE_CMEMBERS_INC_TAX', 'true', '6', '6','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function ,date_added) values ('MODULE_CMEMBERS_CALC_TAX', 'false', '6', '7','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}

View File

@ -0,0 +1,165 @@
<?php
/* ----------------------------------------------------------------------
$Id: ot_cod_fee.php,v 1.1 2007/06/07 17:30:50 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: ot_cod_fee.php,v 1.02 2003/02/24 06:05:00 harley_vb
----------------------------------------------------------------------
Copyright (C) 2001 - 2003 TheMedia, Dipl.-Ing Thomas Plänkers
http://www.themedia.at & http://www.oscommerce.at
All rights reserved.
This program is free software licensed under the GNU General Public License (GPL).
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
(at your option) 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
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class ot_cod_fee {
var $title, $output, $enabled = FALSE;
public function __construct() {
global $aLang;
$this->code = 'ot_cod_fee';
$this->title = $aLang['module_order_total_cod_title'];
$this->description = $aLang['module_order_total_cod_description'];
$this->enabled = (defined('MODULE_ORDER_TOTAL_COD_STATUS') && (MODULE_ORDER_TOTAL_COD_STATUS == 'true') ? true : false);
$this->sort_order = (defined('MODULE_ORDER_TOTAL_COD_SORT_ORDER') ? MODULE_ORDER_TOTAL_COD_SORT_ORDER : null);
$this->output = array();
}
function process() {
global $oOrder, $oCurrencies, $cod_cost, $cod_country;
if (MODULE_ORDER_TOTAL_COD_STATUS == 'true') {
//Will become true, if cod can be processed.
$cod_country = FALSE;
//check if payment method is cod. If yes, check if cod is possible.
if ($_SESSION['payment'] == 'cod') {
//process installed shipping modules
if ($_SESSION['shipping']['id'] == 'flat_flat') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_FLAT);
if ($_SESSION['shipping']['id'] == 'item_item') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_ITEM);
if ($_SESSION['shipping']['id'] == 'table_table') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_TABLE);
if ($_SESSION['shipping']['id'] == 'zones_zones') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_ZONES);
if ($_SESSION['shipping']['id'] == 'ap_ap') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_AP);
if ($_SESSION['shipping']['id'] == 'dp_dp') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DP);
if ($_SESSION['shipping']['id'] == 'chp_ECO') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHP);
if ($_SESSION['shipping']['id'] == 'chp_PRI') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHP);
if ($_SESSION['shipping']['id'] == 'chp_URG') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHP);
for ($i = 0; $i < count($cod_zones); $i++) {
if ($cod_zones[$i] == $oOrder->billing['country']['iso_code_2']) {
$cod_cost = $cod_zones[$i + 1];
$cod_country = TRUE;
//print('match' . $i . ': ' . $cod_cost);
break;
} elseif ($cod_zones[$i] == '00') {
$cod_cost = $cod_zones[$i + 1];
$cod_country = TRUE;
//print('match' . $i . ': ' . $cod_cost);
break;
} else {
//print('no match');
}
$i++;
}
} else {
//COD selected, but no shipping module which offers COD
}
if ($cod_country) {
if (MODULE_ORDER_TOTAL_COD_TAX_CLASS > 0) {
$cod_tax = oos_get_tax_rate(MODULE_ORDER_TOTAL_COD_TAX_CLASS, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
// $cod_tax_description = oos_get_tax_description(MODULE_ORDER_TOTAL_COD_TAX_CLASS, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
$cod_tax_description = oos_get_tax_rate(MODULE_ORDER_TOTAL_COD_TAX_CLASS, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
$oOrder->info['tax'] += oos_calculate_tax($cod_cost, $cod_tax);
$oOrder->info['tax_groups']["$cod_tax_description"] += oos_calculate_tax($cod_cost, $cod_tax);
$oOrder->info['total'] += $cod_cost + oos_calculate_tax($cod_cost, $cod_tax);
$this->output[] = array('title' => $this->title . ':',
'text' => $oCurrencies->format(oos_add_tax($cod_cost, $cod_tax), true, $oOrder->info['currency'], $oOrder->info['currency_value']),
'value' => oos_add_tax($cod_cost, $cod_tax));
} else {
$oOrder->info['total'] += $cod_cost;
$this->output[] = array('title' => $this->title . ':',
'text' => $oCurrencies->format($cod_cost, true, $oOrder->info['currency'], $oOrder->info['currency_value']),
'value' => $cod_cost);
}
} else {
//Following code should be improved if we can't get the shipping modules disabled, who don't allow COD
// as well as countries who do not have cod
// $this->output[] = array('title' => $this->title . ':',
// 'text' => 'No COD for this module.',
// 'value' => '');
}
}
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_ORDER_TOTAL_COD_STATUS');
}
return $this->_check;
}
function keys() {
return array('MODULE_ORDER_TOTAL_COD_STATUS', 'MODULE_ORDER_TOTAL_COD_SORT_ORDER', 'MODULE_ORDER_TOTAL_COD_FEE_FLAT', 'MODULE_ORDER_TOTAL_COD_FEE_ITEM', 'MODULE_ORDER_TOTAL_COD_FEE_TABLE', 'MODULE_ORDER_TOTAL_COD_FEE_ZONES', 'MODULE_ORDER_TOTAL_COD_FEE_AP', 'MODULE_ORDER_TOTAL_COD_FEE_DP', 'MODULE_ORDER_TOTAL_COD_TAX_CLASS');
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_COD_STATUS', 'true', '6', '0','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_COD_SORT_ORDER', '6', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_COD_FEE_FLAT', 'AT:3.00,DE:3.58,00:9.99', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_COD_FEE_ITEM', 'AT:3.00,DE:3.58,00:9.99', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_COD_FEE_TABLE', 'AT:3.00,DE:3.58,00:9.99', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_COD_FEE_ZONES', 'CA:4.50,US:3.00,00:9.99', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_COD_FEE_AP', 'AT:3.63,00:9.99', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_COD_FEE_DP', 'DE:3.58,00:9.99', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_COD_FEE_CHP', 'CH:15.00,00:15.00', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_COD_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}

View File

@ -0,0 +1,592 @@
<?php
/* ----------------------------------------------------------------------
$Id: ot_coupon.php,v 1.4 2007/12/23 22:59:27 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: ot_coupon.php,v 1.1.2.36 2003/05/14 22:52:59 wilt
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class ot_coupon {
var $title, $output, $enabled = FALSE;
public function __construct() {
global $aLang;
$this->code = 'ot_coupon';
$this->header = $aLang['module_order_total_coupon_header'];
$this->title =$aLang['module_order_total_coupon_title'];
$this->description = $aLang['module_order_total_coupon_description'];
$this->user_prompt = '';
$this->enabled = (defined('MODULE_ORDER_TOTAL_COUPON_STATUS') && (MODULE_ORDER_TOTAL_COUPON_STATUS == 'true') ? true : false);
$this->sort_order = (defined('MODULE_ORDER_TOTAL_COUPON_SORT_ORDER') ? MODULE_ORDER_TOTAL_COUPON_SORT_ORDER : null);
$this->include_shipping = (defined('MODULE_ORDER_TOTAL_COUPON_INC_SHIPPING') ? MODULE_ORDER_TOTAL_COUPON_INC_SHIPPING : null);
$this->include_tax = (defined('MODULE_ORDER_TOTAL_COUPON_INC_TAX') ? MODULE_ORDER_TOTAL_COUPON_INC_TAX : null);
$this->calculate_tax = (defined('MODULE_ORDER_TOTAL_COUPON_CALC_TAX') ? MODULE_ORDER_TOTAL_COUPON_CALC_TAX : null);
$this->tax_class = (defined('MODULE_ORDER_TOTAL_COUPON_TAX_CLASS') ? MODULE_ORDER_TOTAL_COUPON_TAX_CLASS : null);
$this->credit_class = TRUE;
$this->output = array();
}
function process() {
global $oOrder, $oCurrencies;
$order_total = $this->get_order_total();
$od_amount = $this->calculate_credit($order_total);
$this->deduction = $od_amount;
if ($this->calculate_tax != 'none') {
$tod_amount = $this->calculate_tax_deduction($order_total, $this->deduction, $this->calculate_tax);
}
if ($od_amount > 0) {
$oOrder->info['total'] = $oOrder->info['total'] - $od_amount;
$this->output[] = array('title' => '<font color="#FF0000">' . $this->title . ':' . $this->coupon_code .':</font>',
'text' => '<strong><font color="#FF0000"> - ' . $oCurrencies->format($od_amount) . '</font></strong>',
'value' => $od_amount);
}
}
function selection_test() {
return FALSE;
}
function pre_confirmation_check($order_total) {
return $this->calculate_credit($order_total);
}
function use_credit_amount() {
return $output_string;
}
function credit_selection() {
global $aLang;
global $oCurrencies;
$sTheme = oos_var_prep_for_os($_SESSION['theme']);
$sLanguage = isset($_SESSION['language']) ? $_SESSION['language'] : DEFAULT_LANGUAGE;
$image_submit = '<input type="image" name="submit_redeem" onClick="submitFunction()" src="' . 'themes/' . $sTheme . '/images/buttons/' . $sLanguage . '/redeem.gif" border="0" alt="' . $aLang['image_button_redeem_voucher'] . '" title = "' . $aLang['image_button_redeem_voucher'] . '">';
$selection_string = '';
$selection_string .= '<tr>' . "\n";
$selection_string .= ' <td width="10"></td>';
$selection_string .= ' <td class="main">' . "\n";
$selection_string .= $aLang['text_enter_coupon_code'] . oos_draw_input_field('gv_redeem_code') . '</td>';
$selection_string .= ' <td align="right">' . $image_submit . '</td>';
$selection_string .= ' <td width="10"></td>';
$selection_string .= '</tr>' . "\n";
return $selection_string;
}
function collect_posts() {
global $oCurrencies, $aLang;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$aContents = oos_get_content();
if ($_POST['gv_redeem_code']) {
// get some info from the coupon table
$couponstable = $oostable['coupons'];
$sql = "SELECT coupon_id, coupon_amount, coupon_type, coupon_minimum_order,
uses_per_coupon, uses_per_user, restrict_to_products,
restrict_to_categories
FROM $couponstable
WHERE coupon_code = '" . oos_db_input($_POST['gv_redeem_code']). "'
AND coupon_active = 'Y'";
$coupon_query = $dbconn->Execute($sql);
$coupon_result = $coupon_query->fields;
if ($coupon_result['coupon_type'] != 'G') {
if ($coupon_query->RecordCount() == 0) {
oos_redirect(oos_href_link($aContents['checkout_payment'], 'error_message=' . urlencode($aLang['error_no_invalid_redeem_coupon'])));
}
$couponstable = $oostable['coupons'];
$sql = "SELECT coupon_start_date
FROM $couponstable
WHERE coupon_start_date <= now()
AND coupon_code= '" . oos_db_input($_POST['gv_redeem_code']) . "'";
$date_query = $dbconn->Execute($sql);
if ($date_query->RecordCount() == 0) {
oos_redirect(oos_href_link($aContents['checkout_payment'], 'error_message=' . urlencode($aLang['error_invalid_startdate_coupon'])));
}
$couponstable = $oostable['coupons'];
$sql = "SELECT coupon_expire_date
FROM $couponstable
WHERE coupon_expire_date >= now()
AND coupon_code= '" . oos_db_input($_POST['gv_redeem_code']) . "'";
$date_query = $dbconn->Execute($sql);
if ($date_query->RecordCount() == 0) {
oos_redirect(oos_href_link($aContents['checkout_payment'], 'error_message=' . urlencode($aLang['error_invalid_finisdate_coupon'])));
}
$coupon_redeem_tracktable = $oostable['coupon_redeem_track'];
$sql = "SELECT coupon_id
FROM $coupon_redeem_tracktable
WHERE coupon_id = '" . $coupon_result['coupon_id']."'";
$coupon_count = $dbconn->Execute($sql);
$coupon_redeem_tracktable = $oostable['coupon_redeem_track'];
$sql = "SELECT coupon_id
FROM $coupon_redeem_tracktable
WHERE coupon_id = '" . $coupon_result['coupon_id']."'
AND customer_id = '" . intval($_SESSION['customer_id']) . "'";
$coupon_count_customer = $dbconn->Execute($sql);
if ($coupon_count->RecordCount()>=$coupon_result['uses_per_coupon'] && $coupon_result['uses_per_coupon'] > 0) {
oos_redirect(oos_href_link($aContents['checkout_payment'], 'error_message=' . urlencode($aLang['error_invalid_uses_coupon'] . $coupon_result['uses_per_coupon'] . $aLang['times'] )));
}
if ($coupon_count_customer->RecordCount()>=$coupon_result['uses_per_user'] && $coupon_result['uses_per_user'] > 0) {
oos_redirect(oos_href_link($aContents['checkout_payment'], 'error_message=' . urlencode($aLang['error_invalid_uses_user_coupon'] . $coupon_result['uses_per_user'] . $aLang['times'] )));
}
if ($coupon_result['coupon_type'] == 'S') {
$coupon_amount = $oOrder->info['shipping_cost'];
} else {
$coupon_amount = $oCurrencies->format($coupon_result['coupon_amount']) . ' ';
}
if ($coupon_result['type']=='P') $coupon_amount = $coupon_result['coupon_amount'] . '% ';
if ($coupon_result['coupon_minimum_order']>0) $coupon_amount .= 'on orders greater than ' . $coupon_result['coupon_minimum_order'];
$_SESSION['cc_id'] = $coupon_result['coupon_id'];
}
if ($_POST['submit_redeem_coupon_x'] && !$_POST['gv_redeem_code']) oos_redirect(oos_href_link($aContents['checkout_payment'], 'error_message=' . urlencode($aLang['error_no_invalid_redeem_coupon'])));
}
}
function calculate_credit($amount) {
global $oOrder;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$od_amount = 0;
if (isset($_SESSION['cc_id'])) {
$cc_id = intval($_SESSION['cc_id']);
$couponstable = $oostable['coupons'];
$coupon_query = $dbconn->Execute("SELECT coupon_code FROM $couponstable WHERE coupon_id = '" . intval($cc_id) . "'");
if ($coupon_query->RecordCount() !=0 ) {
$coupon_result = $coupon_query->fields;
$this->coupon_code = $coupon_result['coupon_code'];
$couponstable = $oostable['coupons'];
$coupon_get = $dbconn->Execute("SELECT coupon_amount, coupon_minimum_order, restrict_to_products, restrict_to_categories, coupon_type FROM $couponstable WHERE coupon_code = '". $coupon_result['coupon_code'] . "'");
$get_result = $coupon_get->fields;
$c_deduct = $get_result['coupon_amount'];
if ($get_result['coupon_type'] == 'S') $c_deduct = $oOrder->info['shipping_cost'];
if ($get_result['coupon_minimum_order'] <= $this->get_order_total()) {
if ($get_result['restrict_to_products'] || $get_result['restrict_to_categories']) {
for ($i=0; $i<count($oOrder->products); $i++) {
if ($get_result['restrict_to_products']) {
$pr_ids = preg_split("/[,]/", $get_result['restrict_to_products']);
for ($ii = 0; $ii < count($pr_ids); $ii++) {
if ($pr_ids[$ii] == oos_get_product_id($oOrder->products[$i]['id'])) {
if ($get_result['coupon_type'] == 'P') {
$od_amount = round($amount*10)/10*$c_deduct/100;
$pr_c = $oOrder->products[$i]['final_price']*$oOrder->products[$i]['qty'];
$pod_amount = round($pr_c*10)/10*$c_deduct/100;
} else {
$od_amount = $c_deduct;
}
}
}
} else {
$cat_ids = preg_split("/[,]/", $get_result['restrict_to_categories']);
for ($i=0; $i<count($oOrder->products); $i++) {
$my_path = oos_get_product_path(oos_get_product_id($oOrder->products[$i]['id']));
$sub_cat_ids = preg_split("/[_]/", $my_path);
for ($iii = 0; $iii < count($sub_cat_ids); $iii++) {
for ($ii = 0; $ii < count($cat_ids); $ii++) {
if ($sub_cat_ids[$iii] == $cat_ids[$ii]) {
if ($get_result['coupon_type'] == 'P') {
$od_amount = round($amount*10)/10*$c_deduct/100;
$pr_c = $oOrder->products[$i]['final_price']*$oOrder->products[$i]['qty'];
$pod_amount = round($pr_c*10)/10*$c_deduct/100;
} else {
$od_amount = $c_deduct;
}
}
}
}
}
}
}
} else {
if ($get_result['coupon_type'] !='P') {
$od_amount = $c_deduct;
} else {
$od_amount = $amount * $get_result['coupon_amount'] / 100;
}
}
}
}
if ($od_amount>$amount) $od_amount = $amount;
}
return $od_amount;
}
function calculate_tax_deduction($amount, $od_amount, $method) {
global $oOrder, $cc_id;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$cc_id = intval($_SESSION['cc_id']);
$couponstable = $oostable['coupons'];
$coupon_query = $dbconn->Execute("SELECT coupon_code FROM $couponstable WHERE coupon_id = '" . intval($cc_id) . "'");
if ($coupon_query->RecordCount() !=0 ) {
$coupon_result = $coupon_query->fields;
$coupon_get = $dbconn->Execute("SELECT coupon_amount, coupon_minimum_order, restrict_to_products, restrict_to_categories, coupon_type FROM " . $oostable['coupons'] . " WHERE coupon_code = '". $coupon_result['coupon_code'] . "'");
$get_result = $coupon_get->fields;
if ($get_result['coupon_type'] != 'S') {
if ($get_result['restrict_to_products'] || $get_result['restrict_to_categories']) {
// What to do here.
// Loop through all products and build a list of all product_ids, price, tax class
// at the same time create total net amount.
// then
// for percentage discounts. simply reduce tax group per product by discount percentage
// or
// for fixed payment amount
// calculate ratio based on total net
// for each product reduce tax group per product by ratio amount.
$products = $_SESSION['cart']->get_products();
for ($i=0; $i<count($products); $i++) {
$t_prid = oos_get_product_id($products[$i]['id']);
$productstable = $oostable['products'];
$cc_query = $dbconn->Execute("SELECT products_tax_class_id FROM $productstable WHERE products_id = '" . (int)$t_prid . "'");
$cc_result = $cc_query->fields;
$valid_product = FALSE;
if ($get_result['restrict_to_products']) {
$pr_ids = preg_split("/[,]/", $get_result['restrict_to_products']);
for ($p = 0; $p < count($pr_ids); $p++) {
if ($pr_ids[$p] == $t_prid) $valid_product = TRUE;
}
}
if ($get_result['restrict_to_categories']) {
$cat_ids = preg_split("/[,]/", $get_result['restrict_to_categories']);
for ($c = 0; $c < count($cat_ids); $c++) {
$products_to_categoriestable = $oostable['products_to_categories'];
$cat_query = $dbconn->Execute("SELECT products_id FROM $products_to_categoriestable WHERE products_id = '" . (int)$products_id . "' AND categories_id = '" . (int)$cat_ids[$i] . "'");
if ($cat_query->RecordCount() !=0 ) $valid_product = TRUE;
}
}
if ($valid_product) {
$valid_array[] = array('product_id' => $t_prid,
'products_price' => $products[$i]['final_price'] * $products[$i]['quantity'],
'products_tax_class' => $cc_result['products_tax_class_id']);
$total_price += $products[$i]['final_price'] * $products[$i]['quantity'];
}
}
if ($valid_product) {
if ($get_result['coupon_type'] == 'P') {
$ratio = $get_result['coupon_amount']/100;
} else {
$ratio = $od_amount / $total_price;
}
if ($get_result['coupon_type'] == 'S') $ratio = 1;
if ($method=='Credit Note') {
$tax_rate = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
$tax_desc = oos_get_tax_description($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
if ($get_result['coupon_type'] == 'P') {
$tod_amount = $od_amount / (100 + $tax_rate)* $tax_rate;
} else {
$tod_amount = $oOrder->info['tax_groups'][$tax_desc] * $od_amount/100;
}
$oOrder->info['tax_groups'][$tax_desc] -= $tod_amount;
$oOrder->info['total'] -= $tod_amount;
} else {
for ($p=0; $p<count($valid_array); $p++) {
$tax_rate = oos_get_tax_rate($valid_array[$p]['products_tax_class'], $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
$tax_desc = oos_get_tax_description($valid_array[$p]['products_tax_class'], $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
if ($tax_rate > 0) {
$tod_amount[$tax_desc] += ($valid_array[$p]['products_price'] * $tax_rate)/100 * $ratio;
$oOrder->info['tax_groups'][$tax_desc] -= ($valid_array[$p]['products_price'] * $tax_rate)/100 * $ratio;
$oOrder->info['total'] -= ($valid_array[$p]['products_price'] * $tax_rate)/100 * $ratio;
}
}
}
}
} else {
if ($get_result['coupon_type'] =='F') {
$tod_amount = 0;
if ($method=='Credit Note') {
$tax_rate = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
$tax_desc = oos_get_tax_description($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
$tod_amount = $od_amount / (100 + $tax_rate)* $tax_rate;
$oOrder->info['tax_groups'][$tax_desc] -= $tod_amount;
} else {
$ratio1 = $od_amount/$amount;
reset($oOrder->info['tax_groups']);
foreach($oOrder->info['tax_groups'] as $key => $value) {
$tax_rate = oos_get_tax_rate_from_desc($key);
$net = $tax_rate * $oOrder->info['tax_groups'][$key];
if ($net>0) {
$god_amount = $oOrder->info['tax_groups'][$key] * $ratio1;
$tod_amount += $god_amount;
$oOrder->info['tax_groups'][$key] = $oOrder->info['tax_groups'][$key] - $god_amount;
}
}
}
$oOrder->info['total'] -= $tod_amount;
}
if ($get_result['coupon_type'] =='P') {
$tod_amount=0;
if ($method=='Credit Note') {
$tax_desc = oos_get_tax_description($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
$tod_amount = $oOrder->info['tax_groups'][$tax_desc] * $od_amount/100;
$oOrder->info['tax_groups'][$tax_desc] -= $tod_amount;
} else {
reset($oOrder->info['tax_groups']);
foreach($oOrder->info['tax_groups'] as $key => $value) {
$god_amout=0;
$tax_rate = oos_get_tax_rate_from_desc($key);
$net = $tax_rate * $oOrder->info['tax_groups'][$key];
if ($net>0) {
$god_amount = $oOrder->info['tax_groups'][$key] * $get_result['coupon_amount']/100;
$tod_amount += $god_amount;
$oOrder->info['tax_groups'][$key] = $oOrder->info['tax_groups'][$key] - $god_amount;
}
}
}
$oOrder->info['tax'] -= $tod_amount;
}
}
}
}
return $tod_amount;
}
function update_credit_account($i) {
return FALSE;
}
function apply_credit() {
global $insert_id;
$cc_id = intval($_SESSION['cc_id']);
$remote_addr = oos_server_get_remote();
if ($this->deduction !=0) {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$coupon_redeem_tracktable = $oostable['coupon_redeem_track'];
$dbconn->Execute("INSERT INTO $coupon_redeem_tracktable (coupon_id, redeem_date, redeem_ip, customer_id, order_id) VALUES ('" . oos_db_input($cc_id) . "', now(), '" . oos_db_input($remote_addr) . "', '" . intval($_SESSION['customer_id']) . "', '" . intval($insert_id) . "')");
}
unset($_SESSION['cc_id']);
}
function get_order_total() {
global $oOrder;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$cc_id = $_SESSION['cc_id'];
$order_total = $oOrder->info['total'];
// Check if gift voucher is in cart and adjust total
$products = $_SESSION['cart']->get_products();
for ($i=0; $i<count($products); $i++) {
$t_prid = oos_get_product_id($products[$i]['id']);
$productstable = $oostable['products'];
$gv_query = $dbconn->Execute("SELECT products_price, products_tax_class_id, products_model FROM $productstable WHERE products_id = '" . intval($t_prid) . "'");
$gv_result = $gv_query->fields;
if (preg_match('/^GIFT/', addslashes($gv_result['products_model']))) {
$qty = $_SESSION['cart']->get_quantity($t_prid);
$products_tax = oos_get_tax_rate($gv_result['products_tax_class_id']);
if ($this->include_tax =='false') {
$gv_amount = $gv_result['products_price'] * $qty;
} else {
$gv_amount = ($gv_result['products_price'] + oos_calculate_tax($gv_result['products_price'],$products_tax)) * $qty;
}
$order_total=$order_total - $gv_amount;
}
}
if ($this->include_tax == 'false') $order_total=$order_total-$oOrder->info['tax'];
if ($this->include_shipping == 'false') $order_total=$order_total-$oOrder->info['shipping_cost'];
// OK thats fine for global coupons but what about restricted coupons
// where you can only redeem against certain products/categories.
// and I though this was going to be easy !!!
$couponstable = $oostable['coupons'];
$coupon_query=$dbconn->Execute("SELECT coupon_code FROM $couponstable WHERE coupon_id = '" . oos_db_input($cc_id) . "'");
if ($coupon_query->RecordCount() !=0) {
$coupon_result = $coupon_query->fields;
$couponstable = $oostable['coupons'];
$coupon_get = $dbconn->Execute("SELECT coupon_amount, coupon_minimum_order,restrict_to_products,restrict_to_categories, coupon_type FROM $couponstable WHERE coupon_code = '" . $coupon_result['coupon_code'] . "'");
$get_result = $coupon_get->fields;
$in_cat = TRUE;
if ($get_result['restrict_to_categories']) {
$cat_ids = preg_split("/[,]/", $get_result['restrict_to_categories']);
$in_cat=false;
for ($i = 0; $i < count($cat_ids); $i++) {
if (is_array($this->contents)) {
reset($this->contents);
foreach ( array_keys($this->contents) as $products_id ) {
$products_to_categoriestable = $oostable['products_to_categories'];
$cat_query = $dbconn->Execute("SELECT products_id FROM $products_to_categoriestable WHERE products_id = '" . (int)$products_id . "' AND categories_id = '" . (int)$cat_ids[$i] . "'");
if ($cat_query->RecordCount() !=0 ) {
$in_cat = TRUE;
$total_price += $this->get_product_price($products_id);
}
}
}
}
}
$in_cart = TRUE;
if ($get_result['restrict_to_products']) {
$pr_ids = preg_split("/[,]/", $get_result['restrict_to_products']);
$in_cart=false;
$products_array = $_SESSION['cart']->get_products();
for ($i = 0; $i < count($pr_ids); $i++) {
for ($ii = 1; $ii<=count($products_array); $ii++) {
if (oos_get_product_id($products_array[$ii-1]['id']) == $pr_ids[$i]) {
$in_cart=true;
$total_price += $this->get_product_price($products_array[$ii-1]['id']);
}
}
}
$order_total = $total_price;
}
}
return $order_total;
}
function get_product_price($product_id) {
global $oOrder;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$products_id = oos_get_product_id($product_id);
// products price
$qty = $_SESSION['cart']->contents[$product_id]['qty'];
$productstable = $oostable['products'];
$product_query = $dbconn->Execute("SELECT products_id, products_price, products_tax_class_id, products_weight FROM $productstable WHERE products_id='" . (int)$product_id . "'");
if ($product = $product_query->fields) {
$prid = $product['products_id'];
$products_tax = oos_get_tax_rate($product['products_tax_class_id']);
$products_price = $product['products_price'];
$specialstable = $oostable['specials'];
$specials_query = $dbconn->Execute("SELECT specials_new_products_price FROM $specialstable WHERE products_id = '" . (int)$prid . "' AND status = '1'");
if ($specials_query->RecordCount()) {
$specials = $specials_query->fields;
$products_price = $specials['specials_new_products_price'];
}
if ($this->include_tax == 'true') {
$total_price += ($products_price + oos_calculate_tax($products_price, $products_tax)) * $qty;
} else {
$total_price += $products_price * $qty;
}
// attributes price
if (isset($_SESSION['cart']->contents[$product_id]['attributes'])) {
reset($_SESSION['cart']->contents[$product_id]['attributes']);
foreach($_SESSION['cart']->contents[$product_id]['attributes'] as $option => $value) {
$products_attributestable = $oostable['products_attributes'];
$attribute_price_query = $dbconn->Execute("SELECT options_values_price, price_prefix FROM $products_attributestable WHERE products_id = '" . (int)$prid . "' AND options_id = '" . oos_db_input($option) . "' AND options_values_id = '" . oos_db_input($value) . "'");
$attribute_price = $attribute_price_query->fields;
if ($attribute_price['price_prefix'] == '+') {
if ($this->include_tax == 'true') {
$total_price += $qty * ($attribute_price['options_values_price'] + oos_calculate_tax($attribute_price['options_values_price'], $products_tax));
} else {
$total_price += $qty * ($attribute_price['options_values_price']);
}
} else {
if ($this->include_tax == 'true') {
$total_price -= $qty * ($attribute_price['options_values_price'] + oos_calculate_tax($attribute_price['options_values_price'], $products_tax));
} else {
$total_price -= $qty * ($attribute_price['options_values_price']);
}
}
}
}
}
if ($this->include_shipping == 'true') $total_price += $oOrder->info['shipping_cost'];
return $total_price;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_ORDER_TOTAL_COUPON_STATUS');
}
return $this->_check;
}
function keys() {
return array('MODULE_ORDER_TOTAL_COUPON_STATUS', 'MODULE_ORDER_TOTAL_COUPON_SORT_ORDER', 'MODULE_ORDER_TOTAL_COUPON_INC_SHIPPING', 'MODULE_ORDER_TOTAL_COUPON_INC_TAX', 'MODULE_ORDER_TOTAL_COUPON_CALC_TAX', 'MODULE_ORDER_TOTAL_COUPON_TAX_CLASS');
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_COUPON_STATUS', 'true', '6', '1','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_COUPON_SORT_ORDER', '8', '6', '2', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function ,date_added) VALUES ('MODULE_ORDER_TOTAL_COUPON_INC_SHIPPING', 'true', '6', '5', 'oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function ,date_added) VALUES ('MODULE_ORDER_TOTAL_COUPON_INC_TAX', 'true', '6', '6','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function ,date_added) VALUES ('MODULE_ORDER_TOTAL_COUPON_CALC_TAX', 'None', '6', '7','oos_cfg_select_option(array(\'None\', \'Standard\', \'Credit Note\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_COUPON_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}

View File

@ -0,0 +1,417 @@
<?php
/* ----------------------------------------------------------------------
$Id: ot_gv.php,v 1.2 2007/12/23 22:59:27 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: ot_gv.php,v 1.4.2.12 2003/05/14 22:52:59 wilt
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class ot_gv {
var $title, $output, $enabled = FALSE;
public function __construct() {
global $aLang;
$this->code = 'ot_gv';
$this->title = $aLang['module_order_total_gv_title'];
$this->header = $aLang['module_order_total_gv_header'];
$this->description = $aLang['module_order_total_gv_description'];
$this->user_prompt = $aLang['module_order_total_gv_user_prompt'];
$this->enabled = (defined('MODULE_ORDER_TOTAL_GV_STATUS') && (MODULE_ORDER_TOTAL_GV_STATUS == 'true') ? true : false);
$this->sort_order = (defined('MODULE_ORDER_TOTAL_GV_SORT_ORDER') ? MODULE_ORDER_TOTAL_GV_SORT_ORDER : null);
$this->include_shipping = (defined('MODULE_ORDER_TOTAL_GV_INC_SHIPPING') ? MODULE_ORDER_TOTAL_GV_INC_SHIPPING : null);
$this->include_tax = (defined('MODULE_ORDER_TOTAL_GV_INC_TAX') ? MODULE_ORDER_TOTAL_GV_INC_TAX : null);
$this->calculate_tax = (defined('MODULE_ORDER_TOTAL_GV_CALC_TAX') ? MODULE_ORDER_TOTAL_GV_CALC_TAX : null);
$this->credit_tax = (defined('MODULE_ORDER_TOTAL_GV_CREDIT_TAX') ? MODULE_ORDER_TOTAL_GV_CREDIT_TAX : null);
$this->tax_class = (defined('MODULE_ORDER_TOTAL_GV_TAX_CLASS') ? MODULE_ORDER_TOTAL_GV_TAX_CLASS : null);
$this->show_redeem_box = (defined('MODULE_ORDER_TOTAL_GV_REDEEM_BOX') ? MODULE_ORDER_TOTAL_GV_REDEEM_BOX : null);
$this->credit_class = TRUE;
$this->checkbox = $this->user_prompt . '<input type="checkbox" onClick="submitFunction()" name="' . 'c' . $this->code . '">';
$this->output = array();
}
function process() {
global $oOrder, $oCurrencies;
if (isset ($_SESSION['cot_gv']) && $_SESSION['cot_gv'] == TRUE) {
$order_total = $this->get_order_total();
$od_amount = $this->calculate_credit($order_total);
if ($this->calculate_tax != "none") {
$tod_amount = $this->calculate_tax_deduction($order_total, $od_amount, $this->calculate_tax);
$od_amount = $this->calculate_credit($order_total);
}
$this->deduction = $od_amount;
$oOrder->info['total'] = $oOrder->info['total'] - $od_amount;
if ($od_amount > 0) {
$this->output[] = array('title' => '<font color="#FF0000">' . $this->title . ':</font>',
'text' => '<strong><font color="#FF0000"> - ' . $oCurrencies->format($od_amount) . '</font></strong>',
'value' => $sod_amount);
}
}
}
function selection_test() {
if ($this->user_has_gv_account($_SESSION['customer_id'])) {
return true;
} else {
return FALSE;
}
}
function pre_confirmation_check($order_total) {
$gv_payment_amount = $this->calculate_credit($order_total);
return $gv_payment_amount;
}
function use_credit_amount() {
$_SESSION['cot_gv'] = FALSE;
$output_string = '';
if ($this->selection_test()) {
$output_string .= ' <td colspan="2" align="right" class="main">';
$output_string .= '<strong>' . $this->checkbox . '</strong>' . '</td>' . "\n";
}
return $output_string;
}
function update_credit_account($i) {
global $oOrder, $insert_id;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
if (preg_match('/^GIFT/', addslashes($oOrder->products[$i]['model']))) {
$gv_order_amount = ($oOrder->products[$i]['final_price'] * $oOrder->products[$i]['qty']);
if ($this->credit_tax=='true') $gv_order_amount = $gv_order_amount * (100 + $oOrder->products[$i]['tax']) / 100;
$gv_order_amount = $gv_order_amount * 100 / 100;
if (MODULE_ORDER_TOTAL_GV_QUEUE == 'false') {
// GV_QUEUE is true so release amount to account immediately
$coupon_gv_customertable = $oostable['coupon_gv_customer'];
$gv_query = $dbconn->Execute("SELECT amount FROM $coupon_gv_customertable WHERE customer_id = '" . intval($_SESSION['customer_id']) . "'");
$customer_gv = FALSE;
$total_gv_amount = 0;
if ($gv_result = $gv_query->fields) {
$total_gv_amount = $gv_result['amount'];
$customer_gv = TRUE;
}
$total_gv_amount = $total_gv_amount + $gv_order_amount;
if ($customer_gv) {
$coupon_gv_customertable = $oostable['coupon_gv_customer'];
$gv_update=$dbconn->Execute("UPDATE $coupon_gv_customertable
SET amount = '" . oos_db_input($total_gv_amount) . "'
WHERE customer_id = '" . intval($_SESSION['customer_id']) . "'");
} else {
$coupon_gv_customertable = $oostable['coupon_gv_customer'];
$gv_insert=$dbconn->Execute("INSERT INTO $coupon_gv_customertable
(customer_id,
amount) VALUES ('" . intval($_SESSION['customer_id']) . "',
'" . oos_db_input($total_gv_amount) . "')");
}
} else {
// GV_QUEUE is true - so queue the gv for release by store owner
$remote_addr = oos_server_get_remote();
$coupon_gv_queuetable = $oostable['coupon_gv_queue'];
$gv_insert=$dbconn->Execute("INSERT INTO $coupon_gv_queuetable
(customer_id,
order_id,
amount,
date_created,
ipaddr) VALUES ('" . intval($_SESSION['customer_id']) . "',
'" . intval($insert_id) . "',
'" . oos_db_input($gv_order_amount) . "',
now(),
'" . oos_db_input($remote_addr) . "')");
}
}
}
function credit_selection() {
global $oCurrencies, $aLang;
$selection_string = '';
$sTheme = oos_var_prep_for_os($_SESSION['theme']);
$sLanguage = isset($_SESSION['language']) ? $_SESSION['language'] : DEFAULT_LANGUAGE;
$image_submit = '<input type="image" name="submit_redeem" onClick="submitFunction()" src="themes/' . $sTheme . '/images/buttons/' . $sLanguage . '/redeem.gif" border="0" alt="' . $aLang['image_button_redeem_voucher'] . '" title = "' . $aLang['image_button_redeem_voucher'] . '">';
$selection_string = '';
$selection_string .= '<tr>' . "\n";
$selection_string .= ' <td width="10"></td>';
$selection_string .= ' <td class="main">' . "\n";
$selection_string .= $aLang['text_enter_gv_code'] . oos_draw_input_field('gv_redeem_code') . '</td>';
$selection_string .= ' <td align="right">' . $image_submit . '</td>';
$selection_string .= ' <td width="10"></td>';
$selection_string .= '</tr>' . "\n";
return $selection_string;
}
function apply_credit() {
global $oOrder, $coupon_no;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
if (isset ($_SESSION['cot_gv']) && $_SESSION['cot_gv'] == TRUE) {
$coupon_gv_customertable = $oostable['coupon_gv_customer'];
$gv_query = $dbconn->Execute("SELECT amount FROM $coupon_gv_customertable WHERE customer_id = '" . intval($_SESSION['customer_id']) . "'");
$gv_result = $gv_query->fields;
$gv_payment_amount = $this->deduction;
$gv_amount = $gv_result['amount'] - $gv_payment_amount;
$coupon_gv_customertable = $oostable['coupon_gv_customer'];
$gv_update = $dbconn->Execute("UPDATE $coupon_gv_customertable
SET amount = '" . $gv_amount . "'
WHERE customer_id = '" . intval($_SESSION['customer_id']) . "'");
}
return $gv_payment_amount;
}
function collect_posts() {
global $oCurrencies, $oMessage, $coupon_no, $aLang;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$aContents = oos_get_content();
if ($_POST['gv_redeem_code']) {
$couponstable = $oostable['coupons'];
$gv_query = $dbconn->Execute("SELECT coupon_id, coupon_type, coupon_amount FROM $couponstable WHERE coupon_code = '" . oos_db_input($_POST['gv_redeem_code']) . "'");
$gv_result = $gv_query->fields;
if ($gv_query->RecordCount() != 0) {
$coupon_redeem_tracktable = $oostable['coupon_redeem_track'];
$redeem_query = $dbconn->Execute("SELECT * FROM $coupon_redeem_tracktable WHERE coupon_id = '" . $gv_result['coupon_id'] . "'");
if ( ($redeem_query->RecordCount() != 0) && ($gv_result['coupon_type'] == 'G') ) {
$oMessage->add_session('checkout_payment', $aLang['error_no_invalid_redeem_gv'], 'error');
oos_redirect(oos_href_link($aContents['checkout_payment']));
}
}
if ($gv_result['coupon_type'] == 'G') {
$gv_amount = $gv_result['coupon_amount'];
// Things to set
// ip address of claimant
// customer id of claimant
// date
// redemption flag
// now update customer account with gv_amount
$coupon_gv_customertable = $oostable['coupon_gv_customer'];
$gv_amount_query = $dbconn->Execute("SELECT amount FROM $coupon_gv_customertable WHERE customer_id = '" . intval($_SESSION['customer_id']) . "'");
$customer_gv = FALSE;
$total_gv_amount = $gv_amount;
if ($gv_amount_result = $gv_amount_query->fields) {
$total_gv_amount = $gv_amount_result['amount'] + $gv_amount;
$customer_gv = TRUE;
}
$couponstable = $oostable['coupons'];
$gv_update = $dbconn->Execute("UPDATE $couponstable
SET coupon_active = 'N'
WHERE coupon_id = '" . $gv_result['coupon_id'] . "'");
$remote_addr = oos_server_get_remote();
$coupon_redeem_tracktable = $oostable['coupon_redeem_track'];
$gv_redeem = $dbconn->Execute("INSERT INTO $coupon_redeem_tracktable
(coupon_id,
customer_id,
redeem_date,
redeem_ip) VALUES ('" . $gv_result['coupon_id'] . "',
'" . intval($_SESSION['customer_id']) . "',
now(),
'" . oos_db_input($remote_addr) . "')");
if ($customer_gv) {
$coupon_gv_customertable = $oostable['coupon_gv_customer'];
// already has gv_amount so update
$gv_update = $dbconn->Execute("UPDATE $coupon_gv_customertable
SET amount = '" . $total_gv_amount . "'
WHERE customer_id = '" . intval($_SESSION['customer_id']) . "'");
} else {
// no gv_amount so insert
$coupon_gv_customertable = $oostable['coupon_gv_customer'];
$gv_insert = $dbconn->Execute("INSERT INTO $coupon_gv_customertable
(customer_id,
amount) VALUES ('" . intval($_SESSION['customer_id']) . "',
'" . $total_gv_amount . "')");
}
$oMessage->add_session('checkout_payment', $aLang['error_redeemed_amount'] . $oCurrencies->format($gv_amount), 'error');
oos_redirect(oos_href_link($aContents['checkout_payment']));
}
}
if ($_POST['submit_redeem_x'] && $gv['coupon_type'] == 'G'){
$oMessage->add_session('checkout_payment', $aLang['error_no_redeem_code'], 'error');
}
if ($oMessage->size('checkout_payment') > 0) {
oos_redirect(oos_href_link($aContents['checkout_payment']));
}
}
function calculate_credit($amount) {
global $oOrder;
$gv_payment_amount = 0;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$coupon_gv_customertable = $oostable['coupon_gv_customer'];
$query = "SELECT amount
FROM $coupon_gv_customertable
WHERE customer_id = '" . intval($_SESSION['customer_id']) . "'";
$gv_query = $dbconn->Execute($query);
if ($gv_query->RecordCount()) {
$gv_result = $gv_query->fields;
$gv_payment_amount = $gv_result['amount'];
$save_total_cost = $amount;
$full_cost = $save_total_cost - $gv_payment_amount;
if ($full_cost < 0) {
$full_cost = 0;
$gv_payment_amount = $save_total_cost;
}
}
return round($gv_payment_amount,2);
}
function calculate_tax_deduction($amount, $od_amount, $method) {
global $oOrder;
switch ($method) {
case 'Standard':
$ratio1 = round($od_amount / $amount,2);
$tod_amount = 0;
reset($oOrder->info['tax_groups']);
foreach($oOrder->info['tax_groups'] as $key => $value) {
$tax_rate = oos_get_tax_rate_from_desc($key);
$total_net += $tax_rate * $oOrder->info['tax_groups'][$key];
}
if ($od_amount > $total_net) $od_amount = $total_net;
reset($oOrder->info['tax_groups']);
foreach($oOrder->info['tax_groups'] as $key => $value) {
$tax_rate = oos_get_tax_rate_from_desc($key);
$net = $tax_rate * $oOrder->info['tax_groups'][$key];
if ($net > 0) {
$god_amount = $oOrder->info['tax_groups'][$key] * $ratio1;
$tod_amount += $god_amount;
$oOrder->info['tax_groups'][$key] = $oOrder->info['tax_groups'][$key] - $god_amount;
}
}
$oOrder->info['tax'] -= $tod_amount;
$oOrder->info['total'] -= $tod_amount;
break;
case 'Credit Note':
$tax_rate = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
$tax_desc = oos_get_tax_description($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
$tod_amount = $this->deduction / (100 + $tax_rate)* $tax_rate;
$oOrder->info['tax_groups'][$tax_desc] -= $tod_amount;
// $oOrder->info['total'] -= $tod_amount;
break;
default:
}
return $tod_amount;
}
function user_has_gv_account($c_id) {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$coupon_gv_customertable = $oostable['coupon_gv_customer'];
$query = "SELECT amount
FROM $coupon_gv_customertable
WHERE customer_id = '" . oos_db_input($c_id) . "'";
$gv_result = $dbconn->Execute($query);
if ($gv_result->fields['amount']>0) {
return true;
}
return FALSE;
}
function get_order_total() {
global $oOrder;
$order_total = $oOrder->info['total'];
if ($this->include_tax == 'false') $order_total = $order_total - $oOrder->info['tax'];
if ($this->include_shipping == 'false') $order_total = $order_total - $oOrder->info['shipping_cost'];
return $order_total;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_ORDER_TOTAL_GV_STATUS');
}
return $this->_check;
}
function keys() {
return array('MODULE_ORDER_TOTAL_GV_SORT_ORDER', 'MODULE_ORDER_TOTAL_GV_QUEUE', 'MODULE_ORDER_TOTAL_GV_INC_SHIPPING', 'MODULE_ORDER_TOTAL_GV_INC_TAX', 'MODULE_ORDER_TOTAL_GV_CALC_TAX', 'MODULE_ORDER_TOTAL_GV_TAX_CLASS', 'MODULE_ORDER_TOTAL_GV_CREDIT_TAX');
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("UPDATE $configurationtable SET coupon_active = 'true' WHERE configuration_key = '" . oos_db_input(MODULE_ORDER_TOTAL_GV_STATUS) . "'");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_GV_SORT_ORDER', '9', '6', '2', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_GV_QUEUE', 'true', '6', '3','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function ,date_added) VALUES ('MODULE_ORDER_TOTAL_GV_INC_SHIPPING', 'true', '6', '5', 'oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function ,date_added) VALUES ('MODULE_ORDER_TOTAL_GV_INC_TAX', 'true', '6', '6','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function ,date_added) VALUES ('MODULE_ORDER_TOTAL_GV_CALC_TAX', 'None', '6', '7','oos_cfg_select_option(array(\'None\', \'Standard\', \'Credit Note\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_GV_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function ,date_added) VALUES ('MODULE_ORDER_TOTAL_GV_CREDIT_TAX', 'false', '6', '8','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("UPDATE $configurationtable SET coupon_active = 'false' WHERE configuration_key = '" . oos_db_input(MODULE_ORDER_TOTAL_GV_STATUS) . "'");
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}

View File

@ -0,0 +1,106 @@
<?php
/* ----------------------------------------------------------------------
$Id: ot_loworderfee.php,v 1.1 2007/06/07 17:30:51 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: ot_loworderfee.php,v 1.11 2003/02/14 06:03:32 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class ot_loworderfee {
var $title, $output, $enabled = FALSE;
public function __construct() {
global $aLang;
$this->code = 'ot_loworderfee';
$this->title = $aLang['module_order_total_loworderfee_title'];
$this->description = $aLang['module_order_total_loworderfee_description'];
$this->enabled = (defined('MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS') && (MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS == 'true') ? true : false);
$this->sort_order = (defined('MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER') ? MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER : null);
$this->output = array();
}
function process() {
global $oOrder, $oCurrencies;
if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == 'true') {
switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) {
case 'national':
if ($oOrder->delivery['country_id'] == STORE_COUNTRY) $pass = TRUE; break;
case 'international':
if ($oOrder->delivery['country_id'] != STORE_COUNTRY) $pass = TRUE; break;
case 'both':
$pass = TRUE; break;
default:
$pass = FALSE; break;
}
if ( ($pass == TRUE) && ( ($oOrder->info['total'] - $oOrder->info['shipping_cost']) < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) ) {
$tax = oos_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
// $tax_description = oos_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
$tax_description = oos_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
$oOrder->info['tax'] += oos_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
$oOrder->info['tax_groups']["$tax_description"] += oos_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
$oOrder->info['total'] += MODULE_ORDER_TOTAL_LOWORDERFEE_FEE + oos_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
$this->output[] = array('title' => $this->title . ':',
'text' => $oCurrencies->format(oos_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax), true, $oOrder->info['currency'], $oOrder->info['currency_value']),
'value' => oos_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax));
}
}
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS');
}
return $this->_check;
}
function keys() {
return array('MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS', 'MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER', 'MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE', 'MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER', 'MODULE_ORDER_TOTAL_LOWORDERFEE_FEE', 'MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION', 'MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS');
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS', 'true', '6', '1','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER', '2', '6', '2', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE', 'false', '6', '3', 'oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, date_added) VALUES ('MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER', '50', '6', '4', 'currencies->format', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, date_added) VALUES ('MODULE_ORDER_TOTAL_LOWORDERFEE_FEE', '5', '6', '5', 'currencies->format', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION', 'both', '6', '6', 'oos_cfg_select_option(array(\'national\', \'international\', \'both\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS', '0', '6', '7', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}

View File

@ -0,0 +1,90 @@
<?php
/* ----------------------------------------------------------------------
$Id: ot_netto.php,v 1.1 2007/06/07 17:30:51 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: ot_netto.php,v 1.0.0.0 2004/03/07 19:30:00 Stephan Hilchenbach
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class ot_netto {
var $title, $output, $enabled = FALSE;
public function __construct() {
global $aLang;
$this->code = 'ot_netto';
$this->title = $aLang['module_order_total_netto_title'];
$this->description = $aLang['module_order_total_netto_description'];
$this->enabled = (defined('MODULE_ORDER_TOTAL_NETTO_STATUS') && (MODULE_ORDER_TOTAL_NETTO_STATUS == 'true') ? true : false);
$this->sort_order = (defined('MODULE_ORDER_TOTAL_NETTO_SORT_ORDER') ? MODULE_ORDER_TOTAL_NETTO_SORT_ORDER : null);
$this->output = array();
}
function process() {
global $oOrder, $oCurrencies, $aLang;
$tax_total = 0;
reset($oOrder->info['tax_groups']);
foreach($oOrder->info['tax_groups'] as $key => $value) {
// sum all tax values to calculate total tax:
if ($value > 0) $tax_total += $value;
}
// subtract total tax from total invoice amount to calculate net amount:
$netto = $oOrder->info['total']-$tax_total;
// output net amount:
$this->output[] = array('title' => '(' . $this->title . ':',
'text' => $oCurrencies->format($netto, true, $oOrder->info['currency'], $oOrder->info['currency_value']) . ')',
'value' => $netto);
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_ORDER_TOTAL_NETTO_STATUS');
}
return $this->_check;
}
function keys() {
return array('MODULE_ORDER_TOTAL_NETTO_STATUS', 'MODULE_ORDER_TOTAL_NETTO_SORT_ORDER');
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_NETTO_STATUS', 'true', '6', '1','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_NETTO_SORT_ORDER', '10', '6', '10', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}

View File

@ -0,0 +1,117 @@
<?php
/* ----------------------------------------------------------------------
$Id: ot_shipping.php,v 1.1 2007/06/07 17:30:51 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: ot_shipping.php,v 1.15 2003/02/07 22:01:57 dgw_
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class ot_shipping {
var $title, $output, $enabled = FALSE;
public function __construct() {
global $aLang;
$this->code = 'ot_shipping';
$this->title = $aLang['module_order_total_shipping_title'];
$this->description = $aLang['module_order_total_shipping_description'];
$this->enabled = (defined('MODULE_ORDER_TOTAL_SHIPPING_STATUS') && (MODULE_ORDER_TOTAL_SHIPPING_STATUS == 'true') ? true : false);
$this->sort_order = (defined('MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER') ? MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER : null);
$this->output = array();
}
function process() {
global $oOrder, $oCurrencies, $aUser;
if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
case 'national':
if ($oOrder->delivery['country_id'] == STORE_COUNTRY) $pass = TRUE; break;
case 'international':
if ($oOrder->delivery['country_id'] != STORE_COUNTRY) $pass = TRUE; break;
case 'both':
$pass = TRUE; break;
default:
$pass = FALSE; break;
}
if ( ($pass == TRUE) && ( ($oOrder->info['total'] - $oOrder->info['shipping_cost']) >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
$oOrder->info['shipping_method'] = $this->title;
$oOrder->info['total'] -= $oOrder->info['shipping_cost'];
$oOrder->info['shipping_cost'] = 0;
}
}
$module = substr($_SESSION['shipping']['id'], 0, strpos($_SESSION['shipping']['id'], '_'));
if (oos_is_not_null($oOrder->info['shipping_method'])) {
if ($GLOBALS[$module]->tax_class > 0) {
$shipping_tax = oos_get_tax_rate($GLOBALS[$module]->tax_class, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
$shipping_tax_description = oos_get_tax_rate($GLOBALS[$module]->tax_class, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
$tax = oos_calculate_tax($oOrder->info['shipping_cost'], $shipping_tax);
if ($aUser['price_with_tax'] == 1) $oOrder->info['shipping_cost'] += $tax;
$oOrder->info['tax'] += $tax;
$oOrder->info['tax_groups']["$shipping_tax_description"] += $tax;
$oOrder->info['total'] += $tax;
}
$this->output[] = array('title' => $oOrder->info['shipping_method'] . ':',
'text' => $oCurrencies->format($oOrder->info['shipping_cost'], true, $oOrder->info['currency'], $oOrder->info['currency_value']),
'value' => $oOrder->info['shipping_cost']);
}
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_ORDER_TOTAL_SHIPPING_STATUS');
}
return $this->_check;
}
function keys() {
return array('MODULE_ORDER_TOTAL_SHIPPING_STATUS', 'MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER', 'MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING', 'MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER', 'MODULE_ORDER_TOTAL_SHIPPING_DESTINATION');
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_SHIPPING_STATUS', 'true', '6', '1','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER', '5', '6', '2', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING', 'false', '6', '3', 'oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, date_added) VALUES ('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER', '50', '6', '4', 'currencies->format', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_SHIPPING_DESTINATION', 'national', '6', '5', 'oos_cfg_select_option(array(\'national\', \'international\', \'both\'), ', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}

View File

@ -0,0 +1,78 @@
<?php
/* ----------------------------------------------------------------------
$Id: ot_subtotal.php,v 1.1 2007/06/07 17:30:51 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: ot_subtotal.php,v 1.7 2003/02/13 00:12:04 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class ot_subtotal {
var $title, $output, $enabled = FALSE;
public function __construct() {
global $aLang;
$this->code = 'ot_subtotal';
$this->title = $aLang['module_order_total_subtotal_title'];
$this->description = $aLang['module_order_total_subtotal_description'];
$this->enabled = (defined('MODULE_ORDER_TOTAL_SUBTOTAL_STATUS') && (MODULE_ORDER_TOTAL_SUBTOTAL_STATUS == 'true') ? true : false);
$this->sort_order = (defined('MODULE_ORDER_TOTAL_SUBTOTAL_SORT_ORDER') ? MODULE_ORDER_TOTAL_SUBTOTAL_SORT_ORDER : null);
$this->output = array();
}
function process() {
global $oOrder, $oCurrencies;
$this->output[] = array('title' => $this->title . ':',
'text' => $oCurrencies->format($oOrder->info['subtotal'], true, $oOrder->info['currency'], $oOrder->info['currency_value']),
'value' => $oOrder->info['subtotal']);
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_ORDER_TOTAL_SUBTOTAL_STATUS');
}
return $this->_check;
}
function keys() {
return array('MODULE_ORDER_TOTAL_SUBTOTAL_STATUS', 'MODULE_ORDER_TOTAL_SUBTOTAL_SORT_ORDER');
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_SUBTOTAL_STATUS', 'true', '6', '1','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_SUBTOTAL_SORT_ORDER', '1', '6', '2', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}

View File

@ -0,0 +1,90 @@
<?php
/* ----------------------------------------------------------------------
$Id: ot_tax.php,v 1.1 2007/06/07 17:30:51 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: ot_tax.php,v 1.14 2003/02/14 05:58:35 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class ot_tax {
var $title, $output, $enabled = FALSE;
public function __construct() {
global $aLang;
$this->code = 'ot_tax';
$this->title = $aLang['module_order_total_tax_title'];
$this->description = $aLang['module_order_total_tax_description'];
$this->enabled = (defined('MODULE_ORDER_TOTAL_TAX_STATUS') && (MODULE_ORDER_TOTAL_TAX_STATUS == 'true') ? true : false);
$this->sort_order = (defined('MODULE_ORDER_TOTAL_TAX_SORT_ORDER') ? MODULE_ORDER_TOTAL_TAX_SORT_ORDER : null);
$this->output = array();
}
function process() {
global $oOrder, $oCurrencies, $aUser, $aLang;
reset($oOrder->info['tax_groups']);
if ($aUser['price_with_tax'] == 1) {
$info = $aLang['module_order_total_included_tax'];
} else {
$info = $aLang['module_order_total_ex_tax'];
}
foreach($oOrder->info['tax_groups'] as $key => $value) {
if ($value > 0) {
$this->output[] = array('title' => $info . $this->title . ' (' . number_format($key, 2) . '%):',
'text' => $oCurrencies->format($value, true, $oOrder->info['currency'], $oOrder->info['currency_value']),
'value' => $value);
}
}
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_ORDER_TOTAL_TAX_STATUS');
}
return $this->_check;
}
function keys() {
return array('MODULE_ORDER_TOTAL_TAX_STATUS', 'MODULE_ORDER_TOTAL_TAX_SORT_ORDER');
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_TAX_STATUS', 'true', '6', '1','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_TAX_SORT_ORDER', '4', '6', '2', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}

View File

@ -0,0 +1,78 @@
<?php
/* ----------------------------------------------------------------------
$Id: ot_total.php,v 1.1 2007/06/07 17:30:51 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: ot_total.php,v 1.7 2003/02/13 00:12:04 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class ot_total {
var $title, $output, $enabled = FALSE;
function __construct() {
global $aLang;
$this->code = 'ot_total';
$this->title = $aLang['module_order_total_total_title'];
$this->description = $aLang['module_order_total_total_description'];
$this->enabled = (defined('MODULE_ORDER_TOTAL_TOTAL_STATUS') && (MODULE_ORDER_TOTAL_TOTAL_STATUS == 'true') ? true : false);
$this->sort_order = (defined('MODULE_ORDER_TOTAL_TOTAL_SORT_ORDER') ? MODULE_ORDER_TOTAL_TOTAL_SORT_ORDER : null);
$this->output = array();
}
function process() {
global $oOrder, $oCurrencies;
$this->output[] = array('title' => $this->title . ':',
'text' => '<strong>' . $oCurrencies->format($oOrder->info['total'], true, $oOrder->info['currency'], $oOrder->info['currency_value']) . '</strong>',
'value' => $oOrder->info['total']);
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_ORDER_TOTAL_TOTAL_STATUS');
}
return $this->_check;
}
function keys() {
return array('MODULE_ORDER_TOTAL_TOTAL_STATUS', 'MODULE_ORDER_TOTAL_TOTAL_SORT_ORDER');
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_ORDER_TOTAL_TOTAL_STATUS', 'true', '6', '1','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_ORDER_TOTAL_TOTAL_SORT_ORDER', '7', '6', '2', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}

View File

@ -0,0 +1,159 @@
<?php
/* ----------------------------------------------------------------------
$Id: ot_xmembers.php,v 1.1 2007/06/07 17:30:51 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: ot_xmembers.php,v 1.1 2003/01/08 10:53:04 elarifr
ot_lev_members.php,v 1.0 2002/04/08 01:13:43 hpdl
----------------------------------------------------------------------
Customers_status v3.x / Catalog part
Copyright elari@free.fr
Contribution based on:
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 - 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class ot_xmembers {
var $title, $output, $enabled = FALSE;
public function __construct() {
global $aLang, $aUser;
$this->code = 'ot_xmembers';
$this->title = $aLang['module_xmembers_title'];
$this->description = $aLang['module_xmembers_description'];
$this->enabled = (defined('MODULE_XMEMBERS_STATUS') && (MODULE_XMEMBERS_STATUS == 'true') ? true : false);
$this->sort_order = (defined('MODULE_XMEMBERS_SORT_ORDER') ? MODULE_XMEMBERS_SORT_ORDER : null);
$this->include_shipping = (defined('MODULE_XMEMBERS_INC_SHIPPING') ? MODULE_XMEMBERS_INC_SHIPPING : null);
$this->include_tax = (defined('MODULE_XMEMBERS_INC_TAX') ? MODULE_XMEMBERS_INC_TAX : null);
$this->percentage = $aUser['ot_discount'];
$this->minimum = $aUser['ot_minimum'];
$this->calculate_tax = (defined('MODULE_XMEMBERS_CALC_TAX') ? MODULE_XMEMBERS_CALC_TAX : null);
$this->output = array();
}
function process() {
global $oOrder, $aUser, $oCurrencies;
$od_amount = $this->calculate_credit($this->get_order_total());
if ($od_amount>0) {
$this->deduction = $od_amount;
$this->output[] = array('title' => '<span class="otDiscount">- ' . $this->title . ' ('. number_format($aUser['ot_discount'], 2) .'%):</span>',
'text' => '<strong><span class="otDiscount">' . $oCurrencies->format($od_amount) . '</span></strong>',
'value' => $od_amount);
$oOrder->info['total'] = $oOrder->info['total'] - $od_amount;
}
}
function calculate_credit($amount) {
global $oOrder, $aUser;
$od_amount=0;
$od_pc = $this->percentage;
if ($amount > $this->minimum) {
if ($aUser['ot_discount_flag'] == '1') { // Calculate tax reduction if necessary
if ($this->calculate_tax == 'true') { // Calculate main tax reduction
$tod_amount = round($oOrder->info['tax']*10)/10*$od_pc/100;
$oOrder->info['tax'] = $oOrder->info['tax'] - $tod_amount; // Calculate tax group deductions
reset($oOrder->info['tax_groups']);
foreach($oOrder->info['tax_groups'] as $key => $value) {
$god_amount = round($value*10)/10*$od_pc/100;
$oOrder->info['tax_groups'][$key] = $oOrder->info['tax_groups'][$key] - $god_amount;
}
}
$od_amount = round($amount*10)/10*$od_pc/100;
$od_amount = $od_amount + $tod_amount;
}
}
return $od_amount;
}
function get_order_total() {
global $oOrder;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$order_total = $oOrder->info['total'];
// Check if gift voucher is in cart and adjust total
$products = $_SESSION['cart']->get_products();
for ($i=0; $i<count($products); $i++) {
$t_prid = oos_get_product_id($products[$i]['id']);
$productstable = $oostable['products'];
$query = "SELECT products_price, products_tax_class_id, products_model
FROM $productstable
WHERE products_id = '" . intval($t_prid) . "'";
$gv_result = $dbconn->GetRow($query);
if (preg_match('/^GIFT/', addslashes($gv_result['products_model']))) {
$qty = $_SESSION['cart']->get_quantity($t_prid);
$products_tax = oos_get_tax_rate($gv_result['products_tax_class_id']);
if ($this->include_tax == 'false') {
$gv_amount = $gv_result['products_price'] * $qty;
} else {
$gv_amount = ($gv_result['products_price'] + oos_calculate_tax($gv_result['products_price'],$products_tax)) * $qty;
}
$order_total = $order_total - $gv_amount;
}
}
if ($this->include_tax == 'false') $order_total = $order_total-$oOrder->info['tax'];
if ($this->include_shipping == 'false') $order_total = $order_total-$oOrder->info['shipping_cost'];
return $order_total;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_XMEMBERS_STATUS');
}
return $this->_check;
}
function keys() {
return array('MODULE_XMEMBERS_STATUS', 'MODULE_XMEMBERS_SORT_ORDER', 'MODULE_XMEMBERS_INC_SHIPPING', 'MODULE_XMEMBERS_INC_TAX', 'MODULE_XMEMBERS_CALC_TAX');
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) values ('MODULE_XMEMBERS_STATUS', 'true', '6', '1','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_XMEMBERS_SORT_ORDER', '3', '6', '2', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function ,date_added) values ('MODULE_XMEMBERS_INC_SHIPPING', 'true', '6', '5', 'oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function ,date_added) values ('MODULE_XMEMBERS_INC_TAX', 'true', '6', '6','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function ,date_added) values ('MODULE_XMEMBERS_CALC_TAX', 'false', '6', '5','oos_cfg_select_option(array(\'true\', \'false\'), ', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
}

View File

@ -0,0 +1,185 @@
<?php
/* ----------------------------------------------------------------------
$Id: cash.php,v 1.1 2007/06/07 17:30:51 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: cash.php,v 1.01 2003/02/19 01:59:00 harley_vb
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 - 2003 osCommerce
----------------------------------------------------------------------
Copyright (C) 2001 - 2003 TheMedia, Dipl.-Ing Thomas Plänkers
http://www.themedia.at & http://www.oscommerce.at
All rights reserved.
This program is free software licensed under the GNU General Public License (GPL).
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
(at your option) 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
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class cash {
var $code, $title, $description, $enabled;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'cash';
$this->title = $aLang['module_payment_cash_text_title'];
$this->description = $aLang['module_payment_cash_text_description'];
$this->enabled = (defined('MODULE_PAYMENT_CASH_STATUS') && (MODULE_PAYMENT_CASH_STATUS == 'True') ? TRUE : FALSE);
$this->sort_order = (defined('MODULE_PAYMENT_CASH_SORT_ORDER') ? MODULE_PAYMENT_CASH_SORT_ORDER : NULL);
if ((defined('MODULE_PAYMENT_CASH_ORDER_STATUS_ID') && (int)MODULE_PAYMENT_CASH_ORDER_STATUS_ID > 0)) {
$this->order_status = MODULE_PAYMENT_CASH_ORDER_STATUS_ID;
}
if ( $this->enabled === TRUE ) {
if ( isset($oOrder) && is_object($oOrder) ) {
$this->update_status();
}
}
}
// class methods
function update_status() {
global $oOrder;
if ($_SESSION['shipping']['id'] != 'selfpickup_selfpickup') {
$this->enabled = FALSE;
}
if ( ($this->enabled == TRUE) && ((int)MODULE_PAYMENT_CASH_ZONE > 0) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_PAYMENT_CASH_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
// disable the module if the order only contains virtual products
if ($this->enabled == TRUE) {
if ($oOrder->content_type == 'virtual') {
$this->enabled = FALSE;
}
}
}
// class methods
function javascript_validation() {
return FALSE;
}
function selection() {
return array('id' => $this->code,
'module' => $this->title);
}
function pre_confirmation_check(){
return FALSE;
}
function confirmation() {
return FALSE;
}
function process_button() {
return FALSE;
}
function before_process() {
return FALSE;
}
function after_process() {
return FALSE;
}
function get_error() {
return FALSE;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_PAYMENT_CASH_STATUS');
}
return $this->_check;
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_PAYMENT_CASH_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now());");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_PAYMENT_CASH_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_CASH_SORT_ORDER', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, use_function, date_added) VALUES ('MODULE_PAYMENT_CASH_ORDER_STATUS_ID', '0', '6', '0', 'oos_cfg_pull_down_order_statuses(', 'oos_cfg_get_order_status_name', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_PAYMENT_CASH_STATUS', 'MODULE_PAYMENT_CASH_ZONE', 'MODULE_PAYMENT_CASH_ORDER_STATUS_ID', 'MODULE_PAYMENT_CASH_SORT_ORDER');
}
}

View File

@ -0,0 +1,159 @@
<?php
/* ----------------------------------------------------------------------
$Id: cod.php,v 1.1 2007/06/07 17:30:51 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: cod.php,v 1.28 2003/02/14 05:51:31 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class cod {
var $code, $title, $description, $enabled;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'cod';
$this->title = $aLang['module_payment_cod_text_title'];
$this->description = $aLang['module_payment_cod_text_description'];
$this->enabled = (defined('MODULE_PAYMENT_COD_STATUS') && (MODULE_PAYMENT_COD_STATUS == 'True') ? true : false);
$this->sort_order = (defined('MODULE_PAYMENT_COD_SORT_ORDER') ? MODULE_PAYMENT_COD_SORT_ORDER : null);
$this->order_status = defined('MODULE_PAYMENT_COD_ORDER_STATUS_ID') && ((int)MODULE_PAYMENT_COD_ORDER_STATUS_ID > 0) ? (int)MODULE_PAYMENT_COD_ORDER_STATUS_ID : 0;
if ( $this->enabled === true ) {
if ( isset($oOrder) && is_object($oOrder) ) {
$this->update_status();
}
}
}
// class methods
function update_status() {
global $oOrder;
if ($_SESSION['shipping']['id'] == 'selfpickup_selfpickup') {
$this->enabled = FALSE;
}
if ( ($this->enabled == TRUE) && ((int)MODULE_PAYMENT_COD_ZONE > 0) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_PAYMENT_COD_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
if ($this->enabled == TRUE) {
// disable the module if the order only contains virtual products
if ($oOrder->content_type == 'virtual') {
$this->enabled = FALSE;
}
}
}
function javascript_validation() {
return FALSE;
}
function selection() {
return array('id' => $this->code,
'module' => $this->title);
}
function pre_confirmation_check() {
return FALSE;
}
function confirmation() {
return FALSE;
}
function process_button() {
return FALSE;
}
function before_process() {
return FALSE;
}
function after_process() {
return FALSE;
}
function get_error() {
return FALSE;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_PAYMENT_COD_STATUS');
}
return $this->_check;
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_PAYMENT_COD_STATUS', 'True', '6', '1', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_PAYMENT_COD_ZONE', '0', '6', '2', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_COD_SORT_ORDER', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, use_function, date_added) VALUES ('MODULE_PAYMENT_COD_ORDER_STATUS_ID', '0', '6', '0', 'oos_cfg_pull_down_order_statuses(', 'oos_cfg_get_order_status_name', now())");
}
function remove() {
// Get database information
$oostable =& oosDBGetTables();
$dbconn =& oosDBGetConn();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_PAYMENT_COD_STATUS', 'MODULE_PAYMENT_COD_ZONE', 'MODULE_PAYMENT_COD_ORDER_STATUS_ID', 'MODULE_PAYMENT_COD_SORT_ORDER');
}
}

View File

@ -0,0 +1,168 @@
<?php
/* ----------------------------------------------------------------------
$Id: eubanktransfer.php,v 1.1 2007/06/07 17:30:51 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: eubanktransfer.php,v 1.8 2006/04/22 12:00:00 by Onkel Flo
Thanks to all the developers from the EU-Standard Bank Transfer module
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 - 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class eubanktransfer {
var $code, $title, $description, $enabled;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'eubanktransfer';
$this->title = $aLang['module_payment_eu_banktransfer_text_title'];
$this->description = $aLang['module_payment_eu_banktransfer_text_description'];
$this->enabled = (defined('MODULE_PAYMENT_EU_BANKTRANSFER_STATUS') && (MODULE_PAYMENT_EU_BANKTRANSFER_STATUS == 'True') ? TRUE : FALSE);
$this->sort_order = (defined('MODULE_PAYMENT_EU_BANKTRANSFER_SORT_ORDER') ? MODULE_PAYMENT_EU_BANKTRANSFER_SORT_ORDER : NULL);
if ((defined('MODULE_PAYMENT_EU_BANKTRANSFER_ORDER_STATUS_ID') && (int)MODULE_PAYMENT_EU_BANKTRANSFER_ORDER_STATUS_ID > 0)) {
$this->order_status = MODULE_PAYMENT_EU_BANKTRANSFER_ORDER_STATUS_ID;
}
if ( $this->enabled === true ) {
if ( isset($oOrder) && is_object($oOrder) ) {
$this->update_status();
}
}
$this->email_footer = $aLang['module_payment_eu_banktransfer_email_footer'];
}
// class methodsi
function update_status() {
global $oOrder, $aLang;
if ($_SESSION['shipping']['id'] == 'selfpickup_selfpickup') {
$this->enabled = FALSE;
}
if ( ($this->enabled == TRUE) && ((int)MODULE_PAYMENT_EU_BANKTRANSFER_ZONE > 0) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_PAYMENT_INVOICE_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
// disable the module if the order only contains virtual products
if ($this->enabled == TRUE) {
if ($oOrder->content_type == 'virtual') {
$this->enabled = FALSE;
}
}
}
function javascript_validation() {
return FALSE;
}
function selection() {
return array('id' => $this->code,
'module' => $this->title);
}
function pre_confirmation_check(){
return FALSE;
}
function confirmation() {
global $aLang;
return array('title' => $aLang['module_payment_eu_banktransfer_text_description']);
}
function process_button() {
return FALSE;
}
function before_process() {
return FALSE;
}
function after_process() {
return FALSE;
}
function get_error() {
return FALSE;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_PAYMENT_EU_BANKTRANSFER_STATUS');
}
return $this->_check;
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_PAYMENT_EU_BANKTRANSFER_STATUS', 'True', '6', '1', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now());");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_EU_BANKTRANSFER_BANKNAME', '----', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_EU_BANKTRANSFER_KONTONAME', '----', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_EU_BANKTRANSFER_KONTONUM', '----', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_EU_BANKTRANSFER_IBAN', '----', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_EU_BANKTRANSFER_BIC', '----', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_PAYMENT_EU_BANKTRANSFER_ZONE', '0', '6', '2', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, use_function, date_added) VALUES ('MODULE_PAYMENT_EU_BANKTRANSFER_ORDER_STATUS_ID', '0', '6', '0', 'oos_cfg_pull_down_order_statuses(', 'oos_cfg_get_order_status_name', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_EU_BANKTRANSFER_SORT_ORDER', '0', '6', '0', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_PAYMENT_EU_BANKTRANSFER_STATUS', 'MODULE_PAYMENT_EU_BANKTRANSFER_ORDER_STATUS_ID', 'MODULE_PAYMENT_EU_BANKTRANSFER_SORT_ORDER', 'MODULE_PAYMENT_EU_BANKTRANSFER_BANKNAME', 'MODULE_PAYMENT_EU_BANKTRANSFER_KONTONAME', 'MODULE_PAYMENT_EU_BANKTRANSFER_KONTONUM', 'MODULE_PAYMENT_EU_BANKTRANSFER_IBAN', 'MODULE_PAYMENT_EU_BANKTRANSFER_BIC');
}
}

View File

@ -0,0 +1,155 @@
<?php
/* ----------------------------------------------------------------------
$Id: invoice.php,v 1.1 2007/06/07 17:30:51 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: invoice.php,v 1.25 2003/02/19 02:14:00 harley_vb
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 - 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class invoice {
var $code, $title, $description, $enabled = FALSE;
// class constructor
public function __construct() {
global $aLang, $oOrder;
$this->code = 'invoice';
$this->title = $aLang['module_payment_invoice_text_title'];
$this->description = $aLang['module_payment_invoice_text_description'];
$this->enabled = (defined('MODULE_PAYMENT_INVOICE_STATUS') && (MODULE_PAYMENT_INVOICE_STATUS == 'True') ? TRUE : FALSE);
$this->sort_order = (defined('MODULE_PAYMENT_INVOICE_SORT_ORDER') ? MODULE_PAYMENT_INVOICE_SORT_ORDER : NULL);
if ((defined('MODULE_PAYMENT_INVOICE_ORDER_STATUS_ID') && (int)MODULE_PAYMENT_INVOICE_ORDER_STATUS_ID > 0)) {
$this->order_status = MODULE_PAYMENT_INVOICE_ORDER_STATUS_ID;
}
if ( $this->enabled === TRUE ) {
if ( isset($oOrder) && is_object($oOrder) ) {
$this->update_status();
}
}
}
// class methods
function update_status() {
global $oOrder, $aLang;
if ( ($this->enabled == TRUE) && ((int)MODULE_PAYMENT_INVOICE_ZONE > 0) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_PAYMENT_INVOICE_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
// disable the module if the order only contains virtual products
if ($this->enabled == TRUE) {
if ($oOrder->content_type == 'virtual') {
$this->enabled = FALSE;
}
}
}
// class methods
function javascript_validation() {
return FALSE;
}
function selection() {
return array('id' => $this->code,
'module' => $this->title);
}
function pre_confirmation_check(){
return FALSE;
}
function confirmation() {
return FALSE;
}
function process_button() {
return FALSE;
}
function before_process() {
return FALSE;
}
function after_process() {
return FALSE;
}
function get_error() {
return FALSE;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_PAYMENT_INVOICE_STATUS');
}
return $this->_check;
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_PAYMENT_INVOICE_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now());");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_PAYMENT_INVOICE_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_INVOICE_SORT_ORDER', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, use_function, date_added) VALUES ('MODULE_PAYMENT_INVOICE_ORDER_STATUS_ID', '0', '6', '0', 'oos_cfg_pull_down_order_statuses(', 'oos_cfg_get_order_status_name', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_PAYMENT_INVOICE_STATUS', 'MODULE_PAYMENT_INVOICE_ZONE', 'MODULE_PAYMENT_INVOICE_ORDER_STATUS_ID', 'MODULE_PAYMENT_INVOICE_SORT_ORDER');
}
}

View File

@ -0,0 +1,153 @@
<?php
/* ----------------------------------------------------------------------
$Id: moneyorder.php,v 1.1 2007/06/07 17:30:51 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: moneyorder.php,v 1.10 2003/01/29 19:57:14 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class moneyorder {
var $code, $title, $description, $enabled = FALSE;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'moneyorder';
$this->title = $aLang['module_payment_moneyorder_text_title'];
$this->description = $aLang['module_payment_moneyorder_text_description'];
$this->enabled = (defined('MODULE_PAYMENT_MONEYORDER_STATUS') && (MODULE_PAYMENT_MONEYORDER_STATUS == 'True') ? true : false);
$this->sort_order = (defined('MODULE_PAYMENT_MONEYORDER_SORT_ORDER') ? MODULE_PAYMENT_MONEYORDER_SORT_ORDER : null);
if ((defined('MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID') && (int)MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID > 0)) {
$this->order_status = MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID;
}
if ( $this->enabled === true ) {
if ( isset($oOrder) && is_object($oOrder) ) {
$this->update_status();
}
}
$this->email_footer = $aLang['module_payment_moneyorder_text_email_footer'];
}
// class methods
function update_status() {
global $oOrder;
/*
if ( ($this->enabled == TRUE) && ((int)MODULE_PAYMENT_MONEYORDER_ZONE > 0) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_PAYMENT_MONEYORDER_ZONE . "' AND zone_country_id = '" . $oOrder->billing['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->billing['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
*/
}
function javascript_validation() {
return FALSE;
}
function selection() {
return array('id' => $this->code,
'module' => $this->title);
}
function pre_confirmation_check() {
return FALSE;
}
function confirmation() {
global $aLang;
return array('title' => $aLang['module_payment_moneyorder_text_description']);
}
function process_button() {
return FALSE;
}
function before_process() {
return FALSE;
}
function after_process() {
return FALSE;
}
function get_error() {
return FALSE;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_PAYMENT_MONEYORDER_STATUS');
}
return $this->_check;
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_PAYMENT_MONEYORDER_STATUS', 'True', '6', '1', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now());");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_MONEYORDER_PAYTO', '', '6', '1', now());");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_MONEYORDER_SORT_ORDER', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_PAYMENT_MONEYORDER_ZONE', '0', '6', '2', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, use_function, date_added) VALUES ('MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID', '0', '6', '0', 'oos_cfg_pull_down_order_statuses(', 'oos_cfg_get_order_status_name', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_PAYMENT_MONEYORDER_STATUS', 'MODULE_PAYMENT_MONEYORDER_ZONE', 'MODULE_PAYMENT_MONEYORDER_ORDER_STATUS_ID', 'MODULE_PAYMENT_MONEYORDER_SORT_ORDER', 'MODULE_PAYMENT_MONEYORDER_PAYTO');
}
}

View File

@ -0,0 +1,178 @@
<?php
/* ----------------------------------------------------------------------
$Id: paypal.php,v 1.1 2007/06/07 17:30:51 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: paypal.php,v 1.39 2003/01/29 19:57:15 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class paypal {
var $code, $title, $description, $enabled = FALSE;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'paypal';
$this->title = $aLang['module_payment_paypal_text_title'];
$this->description = $aLang['module_payment_paypal_text_description'];
$this->enabled = (defined('MODULE_PAYMENT_PAYPAL_STATUS') && (MODULE_PAYMENT_PAYPAL_STATUS == 'True') ? TRUE : FALSE);
$this->sort_order = (defined('MODULE_PAYMENT_PAYPAL_SORT_ORDER') ? MODULE_PAYMENT_PAYPAL_SORT_ORDER : NULL);
if ((defined('MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID') && (int)MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID > 0)) {
$this->order_status = MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID;
}
if ( $this->enabled === TRUE ) {
if ( isset($oOrder) && is_object($oOrder) ) {
$this->update_status();
}
}
$this->form_action_url = 'https://www.paypal.com/de/cgi-bin/webscr';
}
// class methods
function update_status() {
global $oOrder;
if ( ($this->enabled == TRUE) && ((int)MODULE_PAYMENT_PAYPAL_ZONE > 0) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_ZONE . "' AND zone_country_id = '" . $oOrder->billing['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->billing['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
}
function javascript_validation() {
return FALSE;
}
function selection() {
return array('id' => $this->code,
'module' => $this->title);
}
function pre_confirmation_check() {
return FALSE;
}
function confirmation() {
return FALSE;
}
function process_button() {
global $oOrder, $oCurrencies;
$my_currency = $_SESSION['currency'];
if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) {
$my_currency = 'EUR';
}
$aContents = oos_get_content();
$process_button_string = oos_draw_hidden_field('cmd', '_xclick') .
oos_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) .
oos_draw_hidden_field('item_name', oos_replace_chars(STORE_NAME)) .
oos_draw_hidden_field('amount', number_format(($oOrder->info['total'] - $oOrder->info['shipping_cost']) * $oCurrencies->get_value($my_currency), $oCurrencies->get_decimal_places($my_currency))) .
oos_draw_hidden_field('first_name', oos_replace_chars($oOrder->billing['firstname'])) .
oos_draw_hidden_field('last_name', oos_replace_chars($oOrder->billing['lastname'])) .
oos_draw_hidden_field('address1', oos_replace_chars($oOrder->billing['street_address'])) .
oos_draw_hidden_field('city', oos_replace_chars($oOrder->billing['city'])) .
oos_draw_hidden_field('state', oos_replace_chars($oOrder->billing['state'])) .
oos_draw_hidden_field('zip', $oOrder->billing['postcode']) .
oos_draw_hidden_field('lc', $oOrder->billing['country']['iso_code_2']) .
oos_draw_hidden_field('email', $oOrder->customer['email_address']) .
oos_draw_hidden_field('shipping', number_format($oOrder->info['shipping_cost'] * $oCurrencies->get_value($my_currency), $oCurrencies->get_decimal_places($my_currency))) .
oos_draw_hidden_field('currency_code', $my_currency) .
oos_draw_hidden_field('rm', '2') .
oos_draw_hidden_field('bn', 'MyOOS [Shopsystem]') .
oos_draw_hidden_field('no_note', '1');
$process_button_string .= '<input type="hidden" name="return" value="' . oos_href_link($aContents['checkout_process']) . '" >';
$process_button_string .= '<input type="hidden" name="cancel_return" value="' . oos_href_link($aContents['checkout_payment']) . '" >';
return $process_button_string;
}
function before_process() {
return FALSE;
}
function after_process() {
return FALSE;
}
function output_error() {
return FALSE;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_PAYMENT_PAYPAL_STATUS');
}
return $this->_check;
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_PAYMENT_PAYPAL_STATUS', 'True', '6', '3', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_PAYPAL_ID', 'you@yourbusiness.com', '6', '4', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_PAYMENT_PAYPAL_SORT_ORDER', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_PAYMENT_PAYPAL_ZONE', '0', '6', '2', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, use_function, date_added) VALUES ('MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID', '0', '6', '0', 'oos_cfg_pull_down_order_statuses(', 'oos_cfg_get_order_status_name', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_PAYMENT_PAYPAL_STATUS', 'MODULE_PAYMENT_PAYPAL_ID', 'MODULE_PAYMENT_PAYPAL_ZONE', 'MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_SORT_ORDER');
}
}

View File

@ -0,0 +1,119 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: product_listing.php,v 1.2 2003/01/09 09:40:08 elarifr
orig: product_listing.php,v 1.41 2003/02/12 23:55:58 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
$nPage = isset($_GET['page']) ? intval( $_GET['page'] ) : 1;
require_once MYOOS_INCLUDE_PATH . '/includes/classes/class_split_page_results.php';
include_once MYOOS_INCLUDE_PATH . '/includes/functions/function_listing.php';
$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS);
/*
if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
$lc_text = oos_create_sort_heading($_GET['sort'], $col+1, $lc_text);
}
*/
if ($listing_split->number_of_rows > 0) {
if (!isset($all_get_listing)) $all_get_listing = oos_get_all_get_parameters(array('action'));
$aListing = array();
$listing_result = $dbconn->Execute($listing_split->sql_query);
while ($listing = $listing_result->fields) {
/*
case 'PRODUCT_LIST_MANUFACTURER':
$lc_text = '&nbsp;<a href="' . oos_href_link($aContents['shop'], 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a>&nbsp;';
break;
*/
$discount = NULL;
$listing_product_price = NULL;
$listing_product_special_price = NULL;
$listing_base_product_price = NULL;
$base_product_price = $listing['products_price'];
if ($aUser['show_price'] == 1 ) {
$listing_product_price = $oCurrencies->display_price($listing['products_price'], oos_get_tax_rate($listing['products_tax_class_id']));
if ( $listing['products_discount4'] > 0 ) {
$discount = $listing['products_discount4'];
} elseif ( $listing['products_discount3'] > 0 ) {
$discount = $listing['products_discount3'];
} elseif ( $listing['products_discount2'] > 0 ) {
$discount = $listing['products_discount2'];
} elseif ( $listing['products_discount1'] > 0 ) {
$discount = $listing['products_discount1'];
}
if ( $discount > 0 ) {
$base_product_price = $discount;
$listing_discount_price = $oCurrencies->display_price($discount, oos_get_tax_rate($listing['products_tax_class_id']));
}
if (oos_is_not_null($listing['specials_new_products_price'])) {
$base_product_price = $listing['specials_new_products_price'];
$listing_product_special_price = $oCurrencies->display_price($listing['specials_new_products_price'], oos_get_tax_rate($listing['products_tax_class_id']));
}
if ($listing['products_base_price'] != 1) {
$listing_base_product_price = $oCurrencies->display_price($base_product_price * $listing['products_base_price'], oos_get_tax_rate($listing['products_tax_class_id']));
}
}
$order_min = number_format($listing['products_quantity_order_min']);
$order_max = number_format($listing['products_quantity_order_max']);
$aListing[] = array('products_id' => $listing['products_id'],
'products_image' => $listing['products_image'],
'products_name' => $listing['products_name'],
'products_model' => $listing['products_model'],
'products_short_description' => $listing['products_short_description'],
'manufacturers_id' => $listing['manufacturers_id'],
'manufacturers_name' => $listing['manufacturers_name'],
'order_min' => $order_min,
'order_max' => $order_max,
'product_quantity' => $listing['products_product_quantity'],
'products_base_price' => $listing['products_base_price'],
'products_base_unit' => $listing['products_base_unit'],
'products_units' => $listing['products_units_id'],
'listing_product_price' => $listing_product_price,
'listing_discount_price' => $listing_discount_price,
'listing_product_special_price' => $listing_product_special_price,
'listing_base_product_price' => $listing_base_product_price);
// Move that ADOdb pointer!
$listing_result->MoveNext();
}
}
$smarty->assign(array('page_split' => $listing_split->display_count($aLang['text_display_number_of_products']),
'display_links' => $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, oos_get_all_get_parameters(array('page', 'info'))),
'numrows' => $listing_split->number_of_rows,
'numpages' => $listing_split->number_of_pages));
$smarty->assign('get_params', $all_get_listing);
$smarty->assign('listing', $aListing);

View File

@ -0,0 +1,258 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: product_info.php,v 1.92 2003/02/14 05:51:21 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
if (isset($_GET['products_id'])) {
if (!isset($nProductsID)) $nProductsID = oos_get_product_id($_GET['products_id']);
if (!isset($sProductsId)) $sProductsId = oos_var_prep_for_os($_GET['products_id']);
$options = '';
$number_of_uploads = 0;
$products_optionstable = $oostable['products_options'];
$products_attributestable = $oostable['products_attributes'];
$attributes_sql = "SELECT COUNT(*) AS total
FROM $products_optionstable popt,
$products_attributestable patrib
WHERE patrib.products_id = '" . intval($nProductsID) . "'
AND patrib.options_id = popt.products_options_id
AND popt.products_options_languages_id = '" . intval($nLanguageID) . "'";
$products_attributes = $dbconn->Execute($attributes_sql);
if ($products_attributes->fields['total'] > 0) {
$options .= '<strong>' . $aLang['text_product_options'] . '</strong><br />' .
'<table border="0" cellpadding="0" cellspacing="0">';
if (PRODUCTS_OPTIONS_SORT_BY_PRICE == 'true') {
$options_sort_by = ' ORDER BY pa.options_sort_order, pa.options_values_price';
} else {
$options_sort_by = ' ORDER BY pa.options_sort_order, pov.products_options_values_name';
}
$products_optionstable = $oostable['products_options'];
$products_attributestable = $oostable['products_attributes'];
$options_name_sql = "SELECT DISTINCT popt.products_options_id, popt.products_options_name,
popt.products_options_type, popt.products_options_length,
popt.products_options_comment
FROM $products_optionstable popt,
$products_attributestable patrib
WHERE patrib.products_id='" . intval($nProductsID) . "'
AND patrib.options_id = popt.products_options_id
AND popt.products_options_languages_id = '" . intval($nLanguageID) . "'
ORDER BY popt.products_options_name";
$products_options_name_result = $dbconn->Execute($options_name_sql);
while ($products_options_name = $products_options_name_result->fields) {
switch ($products_options_name['products_options_type']) {
case PRODUCTS_OPTIONS_TYPE_TEXT:
$options .= '<tr><td class="main">' . $products_options_name['products_options_name'] . ': </td><td class="main">' . "\n";
$products_attributestable = $oostable['products_attributes'];
$products_attribs_sql = "SELECT DISTINCT patrib.options_values_price, patrib.price_prefix
FROM $products_attributestable patrib
WHERE patrib.products_id = '" . intval($nProductsID) . "'
AND patrib.options_id = '" . $products_options_name['products_options_id'] . "'";
$products_attribs_result = $dbconn->Execute($products_attribs_sql);
$products_attribs_array = $products_attribs_result->fields;
$options .= '<input type="text" name ="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" size="' . $products_options_name['products_options_length'] .'" maxlength="' . $products_options_name['products_options_length'] . '" value="' . $_SESSION['cart']->contents[$sProductsId]['attributes_values'][$products_options_name['products_options_id']] .'">' . $products_options_name['products_options_comment'];
if ($products_attribs_array['options_values_price'] > '0') {
if ($aUser['show_price'] == 1 ) {
if ($info_product_discount != 0 ) {
$options .= '(' . $products_attribs_array['price_prefix'] . $oCurrencies->display_price($products_attribs_array['options_values_price'], oos_get_tax_rate($product_info['products_tax_class_id'])) . ' -' . number_format($info_product_discount, 2) . '% )';
} else {
$options .= '(' . $products_attribs_array['price_prefix'] . $oCurrencies->display_price($products_attribs_array['options_values_price'], oos_get_tax_rate($product_info['products_tax_class_id'])) .')';
}
}
}
$options .= '</td></tr>';
break;
case PRODUCTS_OPTIONS_TYPE_RADIO:
$products_attributestable = $oostable['products_attributes'];
$products_options_valuestable = $oostable['products_options_values'];
$products_options_sql = "SELECT pov.products_options_values_id, pov.products_options_values_name,
pa.options_values_price, pa.price_prefix, pa.options_sort_order
FROM $products_attributestable pa,
$products_options_valuestable pov
WHERE pa.products_id = '" . intval($nProductsID) . "'
AND pa.options_id = '" . $products_options_name['products_options_id'] . "'
AND pa.options_values_id = pov.products_options_values_id
AND pov.products_options_values_languages_id = '" . intval($nLanguageID) . "'
" . $options_sort_by;
$products_options_result = $dbconn->Execute($products_options_sql);
$row = 0;
while ($products_options_array = $products_options_result->fields) {
$row++;
$options .= '<tr>';
if ($row == 1) {
$options .= '<td class="main">' . $products_options_name['products_options_name'] . ': </td>';
} else {
$options .= '<td class="main"></td>';
}
$options .= '<td class="main">';
$checked = FALSE;
if ($_SESSION['cart']->contents[$sProductsId]['attributes'][$products_options_name['products_options_id']] == $products_options_array['products_options_values_id']) {
$checked = TRUE;
}
$options .= oos_draw_radio_field('id[' . $products_options_name['products_options_id'] . ']', $products_options_array['products_options_values_id'], $checked);
$options .= $products_options_array['products_options_values_name'];
$options .= $products_options_name['products_options_comment'];
if ($products_attribs_array['options_values_price'] > '0') {
if ($aUser['show_price'] == 1 ) {
if ($info_product_discount != 0 ) {
$options .= ' (' . $products_options_array['price_prefix'] . $oCurrencies->display_price($products_options_array['options_values_price'], oos_get_tax_rate($product_info['products_tax_class_id'])) . ' -' . number_format($info_product_discount, 2) . '% )&nbsp';
} else {
$options .= ' (' . $products_options_array['price_prefix'] . $oCurrencies->display_price($products_options_array['options_values_price'], oos_get_tax_rate($product_info['products_tax_class_id'])) .')&nbsp';
}
}
}
$options .= '</td></tr>';
// Move that ADOdb pointer!
$products_options_result->MoveNext();
}
break;
case PRODUCTS_OPTIONS_TYPE_CHECKBOX:
$options .= '<tr><td class="main">' . "\n";
$options .= $products_options_name['products_options_name'] . ': </td><td class="main">';
$products_attributestable = $oostable['products_attributes'];
$products_options_valuestable = $oostable['products_options_values'];
$products_attribs_sql = "SELECT pov.products_options_values_id, pov.products_options_values_name,
pa.options_values_price, pa.price_prefix, pa.options_sort_order
FROM $products_attributestable pa,
$products_options_valuestable pov
WHERE pa.products_id = '" . intval($nProductsID) . "'
AND pa.options_id = '" . $products_options_name['products_options_id'] . "'
AND pa.options_values_id = pov.products_options_values_id
AND pov.products_options_values_languages_id = '" . intval($nLanguageID) . "'
" . $options_sort_by;
$products_attribs_result = $dbconn->Execute($products_attribs_sql);
$products_attribs_array = $products_attribs_result->fields;
$checked = FALSE;
if ($_SESSION['cart']->contents[$sProductsId]['attributes'][$products_options_name['products_options_id']] == $products_attribs_array['products_options_values_id']) {
$checked = TRUE;
}
$options .= oos_draw_checkbox_field('id[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['products_options_values_id'], $checked);
$options .= $products_attribs_array['products_options_values_name'];
$options .= $products_options_name['products_options_comment'];
if ($products_attribs_array['options_values_price'] > '0') {
if ($aUser['show_price'] == 1 ) {
if ($info_product_discount != 0 ) {
$options .= ' (' . $products_attribs_array['price_prefix'] . $oCurrencies->display_price($products_attribs_array['options_values_price'], oos_get_tax_rate($product_info['products_tax_class_id'])) . ' -' . number_format($info_product_discount, 2) . '% )&nbsp';
} else {
$options .= ' (' . $products_attribs_array['price_prefix'] . $oCurrencies->display_price($products_attribs_array['options_values_price'], oos_get_tax_rate($product_info['products_tax_class_id'])) .')&nbsp';
}
}
}
$options .= '</td></tr>';
break;
case PRODUCTS_OPTIONS_TYPE_FILE:
$number_of_uploads++;
$products_attributestable = $oostable['products_attributes'];
$products_attribs_sql = "SELECT DISTINCT patrib.options_values_price, patrib.price_prefix
FROM $products_attributestable patrib
WHERE patrib.products_id= '" . intval($nProductsID) . "'
AND patrib.options_id = '" . $products_options_name['products_options_id'] . "'";
$products_attribs_result = $dbconn->Execute($products_attribs_sql);
$products_attribs_array = $products_attribs_result->fields;
$options .= '<tr><td class="main">' . "\n";
$options .= $products_options_name['products_options_name'];
$options .= ':&nbsp;';
if ($products_attribs_array['options_values_price'] > '0') {
if ($aUser['show_price'] == 1 ) {
if ($info_product_discount != 0 ) {
$options .= ' (' . $products_attribs_array['price_prefix'] . $oCurrencies->display_price($products_attribs_array['options_values_price'], oos_get_tax_rate($product_info['products_tax_class_id'])) . ' -' . number_format($info_product_discount, 2) . '% )&nbsp';
} else {
$options .= ' (' . $products_attribs_array['price_prefix'] . $oCurrencies->display_price($products_attribs_array['options_values_price'], oos_get_tax_rate($product_info['products_tax_class_id'])) .')&nbsp';
}
}
}
$options .= '</td><td class="main"><input type="file" name="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']"><br />' . $_SESSION['cart']->contents[$sProductsId]['attributes_values'][$products_options_name['products_options_id']] . oos_draw_hidden_field(UPLOAD_PREFIX . $number_of_uploads, $products_options_name['products_options_id']) . oos_draw_hidden_field(TEXT_PREFIX . UPLOAD_PREFIX . $number_of_uploads, $_SESSION['cart']->contents[$sProductsId]['attributes_values'][$products_options_name['products_options_id']]);
$options .= oos_draw_hidden_field('number_of_uploads', $number_of_uploads);
$options .= '</td></tr>';
break;
case PRODUCTS_OPTIONS_TYPE_SELECT:
default:
$options .= '<tr><td class="main">' . $products_options_name['products_options_name'] . ':</td><td class="main">' . "\n";
$selected = 0;
$products_options_array = array();
$products_attributestable = $oostable['products_attributes'];
$products_options_valuestable = $oostable['products_options_values'];
$products_options_sql = "SELECT pov.products_options_values_id, pov.products_options_values_name,
pa.options_values_price, pa.price_prefix, pa.options_sort_order
FROM $products_attributestable pa,
$products_options_valuestable pov
WHERE pa.products_id = '" . intval($nProductsID) . "'
AND pa.options_id = '" . $products_options_name['products_options_id'] . "'
AND pa.options_values_id = pov.products_options_values_id
AND pov.products_options_values_languages_id = '" . intval($nLanguageID) . "'
" . $options_sort_by;
$products_options_result = $dbconn->Execute($products_options_sql);
while ($products_options = $products_options_result->fields) {
$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
if ($products_options['options_values_price'] > '0') {
if ($aUser['show_price'] == 1 ) {
if ($info_product_discount != 0 ) {
$products_options_array[count($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $oCurrencies->display_price($products_options['options_values_price'], oos_get_tax_rate($product_info['products_tax_class_id'])) . ' -' . number_format($info_product_discount, 2) . '% )&nbsp';
} else {
$products_options_array[count($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $oCurrencies->display_price($products_options['options_values_price'], oos_get_tax_rate($product_info['products_tax_class_id'])) .')&nbsp';
}
}
}
// Move that ADOdb pointer!
$products_options_result->MoveNext();
}
$options .= oos_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $_SESSION['cart']->contents[$sProductsId]['attributes'][$products_options_name['products_options_id']]);
$options .= '</td></tr>';
}
// Move that ADOdb pointer!
$products_options_name_result->MoveNext();
}
$options .= '</table>';
}
}

View File

@ -0,0 +1,209 @@
<?php
/* ----------------------------------------------------------------------
$Id: ap.php,v 1.4 2008/08/25 14:28:07 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: ap.php,v 1.05 2003/02/18 03:37:00 harley_vb
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 - 2003 osCommerce
----------------------------------------------------------------------
Copyright (C) 2001 - 2003 TheMedia, Dipl.-Ing Thomas Plänkers
http://www.themedia.at & http://www.oscommerce.at
All rights reserved.
This program is free software licensed under the GNU General Public License (GPL).
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
(at your option) 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
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class ap {
var $code, $title, $description, $icon, $num_ap, $enabled = FALSE;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'ap';
$this->title = $aLang['module_shipping_ap_text_title'];
$this->description = $aLang['module_shipping_ap_text_description'];
$this->sort_order = (defined('MODULE_SHIPPING_AP_SORT_ORDER') ? MODULE_SHIPPING_AP_SORT_ORDER : null);
$this->icon = OOS_ICONS . 'shipping_ap.gif';
$this->tax_class = (defined('MODULE_SHIPPING_AP_TAX_CLASS') ? MODULE_SHIPPING_AP_TAX_CLASS : null);
$this->enabled = (defined('MODULE_SHIPPING_AP_STATUS') && (MODULE_SHIPPING_AP_STATUS == 'True') ? true : false);
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_AP_ZONE > 0) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_AP_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
// Close result set
$check_result->Close();
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
$this->num_ap = 8;
}
// class methods
function quote($method = '') {
global $aLang, $oOrder, $shipping_weight, $shipping_num_boxes;
$dest_country = $oOrder->delivery['country']['iso_code_2'];
$dest_zone = 0;
$error = FALSE;
for ($i=1; $i<=$this->num_ap; $i++) {
$countries_table = constant('MODULE_SHIPPING_AP_COUNTRIES_' . $i);
$country_zones = explode("[,]", $countries_table);
if (in_array($dest_country, $country_zones)) {
$dest_zone = $i;
break;
}
}
if ($dest_zone == 0) {
$error = TRUE;
} else {
$shipping = -1;
$ap_cost = constant('MODULE_SHIPPING_AP_COST_' . $i);
$ap_table = preg_split("/[:,]/" , $ap_cost);
for ($i=0; $i<count($ap_table); $i+=2) {
if ($shipping_weight <= $ap_table[$i]) {
$shipping = $ap_table[$i+1];
$shipping_method = $aLang['module_shipping_ap_text_way'] . ' ' . $dest_country . ' : ' . $shipping_weight . ' ' . $aLang['module_shipping_ap_text_units'];
break;
}
}
if ($shipping == -1) {
$shipping_cost = 0;
$shipping_method = $aLang['module_shipping_ap_undefined_rate'];
} else {
$shipping_cost = ($shipping + MODULE_SHIPPING_AP_HANDLING);
}
}
$this->quotes = array('id' => $this->code,
'module' => $aLang['module_shipping_ap_text_title'],
'methods' => array(array('id' => $this->code,
'title' => $shipping_method . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . $aLang['module_shipping_ap_text_units'] .')',
'cost' => $shipping_cost * $shipping_num_boxes)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
}
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
if ($error == TRUE) $this->quotes['error'] = $aLang['module_shipping_ap_invalid_zone'];
return $this->quotes;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_SHIPPING_AP_STATUS');
}
return $this->_check;
}
function install() {
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_AP_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_HANDLING', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_AP_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_AP_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_SORT_ORDER', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_1', 'DE,IT,SM', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_1', '1:12.35,2:13.80,3:15.25,4:16.70,5:18.15,6:19.60,7:21.05,8:22.50,9:23.95,10:25.40,11:26.85,12:28.30,13:29.75,14:31.20,15:32.65,16:34.10,17:35.55,18:37.00,19:38.45,20:39.90', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_2', 'AD,BE,DK,FO,GL,FI,FR,GR,GB,IE,LI,LU,MC,NL,PT,SE,CH,SK,SI,ES,CZ,HU,VA', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_2', '1:13.08,2:15.26,3:17.44,4:19.62,5:21.80,6:23.98,7:26.16,8:28.34,9:30.52,10:32.70,11:34.88,12:37.06,13:39.24,14:41.42,15:43.60,16:45.78,17:47.96,18:50.14,19:52.32,20:54.50', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_3', 'EG,AL,DZ,AM,AZ,BA,BG,EE,GE,GI,IS,IL,YU,HR,LV,LB,LY,LT,MT,MA,MK,MD,NO,PL,RO,RU,SY,TN,TR,UA,CY', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_3', '1:14.53,2:18.16,3:21.79,4:25.42,5:29.05,6:32.68,7:36.31,8:39.94,9:43.57,10:47.20,11:50.83,12:54.46,13:58.09,14:61.72,15:65.35,16:68.98,17:72.61,18:76.24,19:79.87,20:83.50', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_4', 'ET,BH,BJ,BF,CI,DJ,ER,GM,GH,GU,GN,GW,IQ,IR,YE,JO,CM,CA,CV,KZ,QA,KG,KW,LR,ML,MH,MR,FM,NE,NG,MP,OM,PR,SA,SN,SL,SO,SD,TJ,TG,TD,TM,UZ,AE,US,UM,CF', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_4', '1:17.44,2:23.98,3:30.52,4:37.06,5:43.60,6:50.14,7:56.68,8:63.22,9:69.76,10:76.30,11:82.84,12:89.38,13:95.92,14:102.46,15:109.00,16:115.54,17:122.08,18:128.62,19:135.16,20:141.70', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_5', 'AF,AO,AI,AG,GQ,AR,BS,BD,BB,BZ,BM,BT,BO,BW,BR,BN,BI,KY,CL,CN,CR,DM,DO,EC,SV,FK,GF,GA,GD,GP,GT,GY,HT,HN,HK,IN,ID,TP,JM,JP,KH,KE,CO,KM,CG,KP,KR,CU,LA,LS', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_5', '1:19.62,2:28.34,3:37.06,4:45.78,5:54.50,6:63.22,7:71.94,8:80.66,9:89.38,10:98.10,11:106.82,12:115.54,13:124.26,14:132.98,15:141.70,16:150.42,17:159.14,18:167.86,19:176.58,20:185.30', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_6', 'MO,MG,MW,MY,MV,MQ,MU,MX,MN,MS,MZ,MM,NA,NP,NI,AN,AW,PK,PA,PY,PE,PH,RE,RW,ZM,ST,SC,ZW,SG,LK,KN,LC,PM,VC,ZA,SR,SZ,TZ,TH,TT,TC,UG,UY,VE,VN,VG', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_6', '1:19.62,2:28.34,3:37.06,4:45.78,5:54.50,6:63.22,7:71.94,8:80.66,9:89.38,10:98.10,11:106.82,12:115.54,13:124.26,14:132.98,15:141.70,16:150.42,17:159.14,18:167.86,19:176.58,20:185.30', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_7', 'AU,CK,FJ,PF,KI,NR,NC,NZ,PG,PN,SB,TO,TV,VU,WF,WS', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_7', '1:23.98,2:37.06,3:50.14,4:63.22,5:76.30,6:89.38,7:102.46,8:115.54,9:128.62,10:141.70,11:154.78,12:167.86,13:180.94,14:194.02,15:207.10,16:220.18,17:233.26,18:246.34,19:259.42,20:272.50', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COUNTRIES_8', 'AT', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_COST_8', '2:3.56,4:4.36,8:5.45,12:6.90,20:9.08,31.5:12.72', '6', '0', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
$keys = array('MODULE_SHIPPING_AP_STATUS', 'MODULE_SHIPPING_AP_HANDLING', 'MODULE_SHIPPING_AP_TAX_CLASS', 'MODULE_SHIPPING_AP_ZONE', 'MODULE_SHIPPING_AP_SORT_ORDER');
for ($i = 1; $i <= $this->num_ap; $i ++) {
$keys[count($keys)] = 'MODULE_SHIPPING_AP_COUNTRIES_' . $i;
$keys[count($keys)] = 'MODULE_SHIPPING_AP_COST_' . $i;
}
return $keys;
}
}

View File

@ -0,0 +1,209 @@
<?php
/* ----------------------------------------------------------------------
$Id: apinsured.php,v 1.2 2008/08/25 14:28:07 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: ap.php,v 1.05 2003/02/18 03:37:00 harley_vb
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 - 2003 osCommerce
----------------------------------------------------------------------
Copyright (C) 2001 - 2003 TheMedia, Dipl.-Ing Thomas Plänkers
http://www.themedia.at & http://www.oscommerce.at
All rights reserved.
This program is free software licensed under the GNU General Public License (GPL).
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
(at your option) 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
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class apinsured {
var $code, $title, $description, $icon, $num_ap_insured, $enabled = FALSE;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'apinsured';
$this->title = $aLang['module_shipping_ap_insured_text_title'];
$this->description = $aLang['module_shipping_ap_insured_text_description'];
$this->sort_order = (defined('MODULE_SHIPPING_AP_INSURED_SORT_ORDER') ? MODULE_SHIPPING_AP_INSURED_SORT_ORDER : null);
$this->icon = OOS_ICONS . 'shipping_ap.gif';
$this->tax_class = (defined('MODULE_SHIPPING_AP_INSURED_TAX_CLASS') ? MODULE_SHIPPING_AP_INSURED_TAX_CLASS : null);
$this->enabled = (defined('MODULE_SHIPPING_AP_INSURED_STATUS') && (MODULE_SHIPPING_AP_INSURED_STATUS == 'True') ? true : false);
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_AP_INSURED_ZONE > 0) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_AP_INSURED_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
// Close result set
$check_result->Close();
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
$this->num_ap_insured = 8;
}
// class methods
function quote($method = '') {
global $aLang, $oOrder, $shipping_weight, $shipping_num_boxes;
$dest_country = $oOrder->delivery['country']['iso_code_2'];
$dest_zone = 0;
$error = FALSE;
for ($i=1; $i<=$this->num_ap_insured; $i++) {
$countries_table = constant('MODULE_SHIPPING_AP_INSURED_COUNTRIES_' . $i);
$country_zones = preg_split("/[,]/", $countries_table);
if (in_array($dest_country, $country_zones)) {
$dest_zone = $i;
break;
}
}
if ($dest_zone == 0) {
$error = TRUE;
} else {
$shipping = -1;
$ap_insured_cost = constant('MODULE_SHIPPING_AP_INSURED_COST_' . $i);
$ap_insured_table = preg_split("/[:,]/" , $ap_insured_cost);
for ($i=0; $i<count($ap_insured_table); $i+=2) {
if ($shipping_weight <= $ap_insured_table[$i]) {
$shipping = $ap_insured_table[$i+1];
$shipping_method = $aLang['module_shipping_ap_insured_text_way'] . ' ' . $dest_country . ' : ' . $shipping_weight . ' ' . $aLang['module_shipping_ap_insured_text_units'];
break;
}
}
if ($shipping == -1) {
$shipping_cost = 0;
$shipping_method = $aLang['module_shipping_ap_insured_undefined_rate'];
} else {
$shipping_cost = ($shipping + MODULE_SHIPPING_AP_INSURED_HANDLING);
}
}
$this->quotes = array('id' => $this->code,
'module' => $aLang['module_shipping_ap_insured_text_title'],
'methods' => array(array('id' => $this->code,
'title' => $shipping_method . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . $aLang['module_shipping_ap_insured_text_units'] .')',
'cost' => $shipping_cost * $shipping_num_boxes)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
}
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
if ($error == TRUE) $this->quotes['error'] = $aLang['module_shipping_ap_insured_invalid_zone'];
return $this->quotes;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_SHIPPING_AP_INSURED_STATUS');
}
return $this->_check;
}
function install() {
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_HANDLING', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_SORT_ORDER', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_1', 'DE,IT,SM', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_1', '1:12.35,2:13.80,3:15.25,4:16.70,5:18.15,6:19.60,7:21.05,8:22.50,9:23.95,10:25.40,11:26.85,12:28.30,13:29.75,14:31.20,15:32.65,16:34.10,17:35.55,18:37.00,19:38.45,20:39.90', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_2', 'AD,BE,DK,FO,GL,FI,FR,GR,GB,IE,LI,LU,MC,NL,PT,SE,CH,SK,SI,ES,CZ,HU,VA', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_2', '1:13.08,2:15.26,3:17.44,4:19.62,5:21.80,6:23.98,7:26.16,8:28.34,9:30.52,10:32.70,11:34.88,12:37.06,13:39.24,14:41.42,15:43.60,16:45.78,17:47.96,18:50.14,19:52.32,20:54.50', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_3', 'EG,AL,DZ,AM,AZ,BA,BG,EE,GE,GI,IS,IL,YU,HR,LV,LB,LY,LT,MT,MA,MK,MD,NO,PL,RO,RU,SY,TN,TR,UA,CY', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_3', '1:14.53,2:18.16,3:21.79,4:25.42,5:29.05,6:32.68,7:36.31,8:39.94,9:43.57,10:47.20,11:50.83,12:54.46,13:58.09,14:61.72,15:65.35,16:68.98,17:72.61,18:76.24,19:79.87,20:83.50', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_4', 'ET,BH,BJ,BF,CI,DJ,ER,GM,GH,GU,GN,GW,IQ,IR,YE,JO,CM,CA,CV,KZ,QA,KG,KW,LR,ML,MH,MR,FM,NE,NG,MP,OM,PR,SA,SN,SL,SO,SD,TJ,TG,TD,TM,UZ,AE,US,UM,CF', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_4', '1:17.44,2:23.98,3:30.52,4:37.06,5:43.60,6:50.14,7:56.68,8:63.22,9:69.76,10:76.30,11:82.84,12:89.38,13:95.92,14:102.46,15:109.00,16:115.54,17:122.08,18:128.62,19:135.16,20:141.70', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_5', 'AF,AO,AI,AG,GQ,AR,BS,BD,BB,BZ,BM,BT,BO,BW,BR,BN,BI,KY,CL,CN,CR,DM,DO,EC,SV,FK,GF,GA,GD,GP,GT,GY,HT,HN,HK,IN,ID,TP,JM,JP,KH,KE,CO,KM,CG,KP,KR,CU,LA,LS', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_5', '1:19.62,2:28.34,3:37.06,4:45.78,5:54.50,6:63.22,7:71.94,8:80.66,9:89.38,10:98.10,11:106.82,12:115.54,13:124.26,14:132.98,15:141.70,16:150.42,17:159.14,18:167.86,19:176.58,20:185.30', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_6', 'MO,MG,MW,MY,MV,MQ,MU,MX,MN,MS,MZ,MM,NA,NP,NI,AN,AW,PK,PA,PY,PE,PH,RE,RW,ZM,ST,SC,ZW,SG,LK,KN,LC,PM,VC,ZA,SR,SZ,TZ,TH,TT,TC,UG,UY,VE,VN,VG', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_6', '1:19.62,2:28.34,3:37.06,4:45.78,5:54.50,6:63.22,7:71.94,8:80.66,9:89.38,10:98.10,11:106.82,12:115.54,13:124.26,14:132.98,15:141.70,16:150.42,17:159.14,18:167.86,19:176.58,20:185.30', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_7', 'AU,CK,FJ,PF,KI,NR,NC,NZ,PG,PN,SB,TO,TV,VU,WF,WS', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_7', '1:23.98,2:37.06,3:50.14,4:63.22,5:76.30,6:89.38,7:102.46,8:115.54,9:128.62,10:141.70,11:154.78,12:167.86,13:180.94,14:194.02,15:207.10,16:220.18,17:233.26,18:246.34,19:259.42,20:272.50', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COUNTRIES_8', 'AT', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_AP_INSURED_COST_8', '2:3.56,4:4.36,8:5.45,12:6.90,20:9.08,31.5:12.72', '6', '0', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
$keys = array('MODULE_SHIPPING_AP_INSURED_STATUS', 'MODULE_SHIPPING_AP_INSURED_HANDLING', 'MODULE_SHIPPING_AP_INSURED_TAX_CLASS', 'MODULE_SHIPPING_AP_INSURED_ZONE', 'MODULE_SHIPPING_AP_INSURED_SORT_ORDER');
for ($i = 1; $i <= $this->num_ap_insured; $i ++) {
$keys[count($keys)] = 'MODULE_SHIPPING_AP_INSURED_COUNTRIES_' . $i;
$keys[count($keys)] = 'MODULE_SHIPPING_AP_INSURED_COST_' . $i;
}
return $keys;
}
}

View File

@ -0,0 +1,303 @@
<?php
/* ----------------------------------------------------------------------
$Id: chp.php,v 1.2 2007/08/11 05:59:52 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: chp.php,v 1.02 2003/02/18 03:37:00 harley_vb
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 - 2003 osCommerce
----------------------------------------------------------------------
Copyright (C) 2001 - 2003 TheMedia, Dipl.-Ing Thomas Plänkers
http://www.themedia.at & http://www.oscommerce.at
All rights reserved.
This program is free software licensed under the GNU General Public License (GPL).
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
(at your option) 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
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class chp {
var $code, $title, $description, $icon, $num_chp, $types, $enabled = FALSE;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'chp';
$this->title = $aLang['module_shipping_chp_text_title'];
$this->description = $aLang['module_shipping_chp_text_description'];
$this->sort_order = (defined('MODULE_SHIPPING_CHP_SORT_ORDER') ? MODULE_SHIPPING_CHP_SORT_ORDER : null);
$this->icon = OOS_ICONS . 'shipping_chp.gif';
$this->tax_class = (defined('MODULE_SHIPPING_CHP_TAX_CLASS') ? MODULE_SHIPPING_CHP_TAX_CLASS : null);
$this->enabled = (defined('MODULE_SHIPPING_CHP_STATUS') && (MODULE_SHIPPING_CHP_STATUS == 'True') ? true : false);
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_CHP_ZONE > 0) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_CHP_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
// Close result set
$check_result->Close();
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
$this->types = array('ECO' => 'Economy',
'PRI' => 'Priority',
'URG' => 'Urgent');
// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
$this->num_chp = 7;
}
// class methods
function quote($method = '') {
global $aLang, $oOrder, $shipping_weight, $shipping_num_boxes;
$dest_country = $oOrder->delivery['country']['iso_code_2'];
$dest_zone = 0;
$error = FALSE;
for ($j=1; $j<=$this->num_chp; $j++) {
$countries_table = constant('MODULE_SHIPPING_CHP_COUNTRIES_' . $j);
$country_zones = preg_split("/[,]/", $countries_table);
if (in_array($dest_country, $country_zones)) {
$dest_zone = $j;
break;
}
}
if ($dest_zone == 0) {
$error = TRUE;
} else {
$shipping = -1;
$chp_cost_eco = @constant('MODULE_SHIPPING_CHP_COST_ECO_' . $j);
$chp_cost_pri = @constant('MODULE_SHIPPING_CHP_COST_PRI_' . $j);
$chp_cost_urg = @constant('MODULE_SHIPPING_CHP_COST_URG_' . $j);
$methods = array();
if ($chp_cost_eco != '') {
$chp_table_eco = preg_split("/[:,]/" , $chp_cost_eco);
for ($i=0; $i<count($chp_table_eco); $i+=2) {
if ($shipping_weight <= $chp_table_eco[$i]) {
$shipping_eco = $chp_table_eco[$i+1];
break;
}
}
if ($shipping_eco == -1) {
$shipping_cost = 0;
$shipping_method = $aLang['module_shipping_chp_undefined_rate'];
} else {
$shipping_cost_1 = ($shipping_eco + MODULE_SHIPPING_CHP_HANDLING);
}
if ($shipping_eco != 0) {
$methods[] = array('id' => 'ECO',
'title' => 'Economy',
'cost' => (MODULE_SHIPPING_CHP_HANDLING + $shipping_cost_1) * $shipping_num_boxes);
}
}
if ($chp_cost_pri != '') {
$chp_table_pri = preg_split("/[:,]/" , $chp_cost_pri);
for ($i=0; $i<count($chp_table_pri); $i+=2) {
if ($shipping_weight <= $chp_table_pri[$i]) {
$shipping_pri = $chp_table_pri[$i+1];
break;
}
}
if ($shipping_pri == -1) {
$shipping_cost = 0;
$shipping_method = $aLang['module_shipping_chp_undefined_rate'];
} else {
$shipping_cost_2 = ($shipping_pri + MODULE_SHIPPING_CHP_HANDLING);
}
if ($shipping_pri != 0) {
$methods[] = array('id' => 'PRI',
'title' => 'Priority',
'cost' => (MODULE_SHIPPING_CHP_HANDLING + $shipping_cost_2) * $shipping_num_boxes);
}
}
if ($chp_cost_urg != '') {
$chp_table_urg = preg_split("/[:,]/" , $chp_cost_urg);
for ($i=0; $i<count($chp_table_urg); $i+=2) {
if ($shipping_weight <= $chp_table_urg[$i]) {
$shipping_urg = $chp_table_urg[$i+1];
break;
}
}
if ($shipping_urg == -1) {
$shipping_cost = 0;
$shipping_method = $aLang['module_shipping_chp_undefined_rate'];
} else {
$shipping_cost_3 = ($shipping_urg + MODULE_SHIPPING_CHP_HANDLING);
}
if ($shipping_urg != 0) {
$methods[] = array('id' => 'URG',
'title' => 'Urgent',
'cost' => (MODULE_SHIPPING_CHP_HANDLING + $shipping_cost_3) * $shipping_num_boxes);
}
}
}
$this->quotes = array('id' => $this->code,
'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . $aLang['module_shipping_chp_text_units'] .')');
$this->quotes['methods'] = $methods;
if ($this->tax_class > 0) {
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
}
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
if ($error == TRUE) $this->quotes['error'] = $aLang['module_shipping_chp_invalid_zone'];
if ( (oos_is_not_null($method)) && (isset($this->types[$method])) ) {
for ($i=0; $i<count($methods); $i++) {
if ($method == $methods[$i]['id']) {
$methodsc = array();
$methodsc[] = array('id' => $methods[$i]['id'],
'title' => $methods[$i]['title'],
'cost' => $methods[$i]['cost']);
break;
}
}
$this->quotes['methods'] = $methodsc;
}
return $this->quotes;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_SHIPPING_CHP_STATUS');
}
return $this->_check;
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_CHP_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_HANDLING', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_CHP_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_CHP_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_SORT_ORDER', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COUNTRIES_1', 'CH,LI', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_ECO_1', '2:6.00,5:8.00,10:11.00,20:16.00,30:23.00', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_PRI_1', '2:8.00,5:10.00,10:13.00,20:19.00,30:26.00', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COUNTRIES_2', 'AD,AT,BE,FR,DE,VA,IT,LU,MC,NL', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_ECO_2', '2:29,3:32,4:35,5:38,6:39,7:40,8:41,9:42,10:43,11:44,12:45,13:46,14:47,15:48,16:49,17:50,18:51,19:52,20:53,21:54,22:55,23:56,24:57,25:58,26:59,27:60,28:61,29:62,30:63', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_PRI_2', '2:33,3:37,4:41,5:46,6:49,7:51,8:53,9:55,10:57,11:60,12:61,13:62,14:63,15:64,16:65,17:66,18:67,19:68,20:69,21:70,22:71,23:72,24:73,25:74,26:75,27:76,28:77,29:78,30:79', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_URG_2', '0.5:51,1:57,1.5:62,2:67,2.5:72,3:78,3.5:83,4:89,4.5:95,5:100,6:107,7:115,8:123,9:130,10:138,11:144,12:151,13:158,14:164,15:171,16:177,17:184,18:191,19:197,20:204,21:210,22:217,23:224,24:230,25:237,26:243,27:250,28:256,29:263,30:269', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COUNTRIES_3', 'AL,BA,BG,HR,CZ,DK,EE,FI,GI,GR,HU,IS,IE,LV,LT,MK,MT,MH,NO,PL,PT,RO,SK,SI,ES,SE,GB,YU', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_ECO_3', '2:34,3:38,4:42,5:46,6:49,7:52,8:55,9:58,10:61,11:63,12:65,13:67,14:69,15:71,16:72,17:73,18:74,19:75,20:76,21:77,22:78,23:79,24:80,25:81,26:82,27:83,28:84,29:85,30:86', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_PRI_3', '2:38,3:43,4:48,5:53,6:58,7:62,8:66,9:68,10:71,11:75,12:78,13:81,14:84,15:87,16:90,17:91,18:92,19:93,20:94,21:95,22:96,23:97,24:98,25:99,26:100,27:101,28:102,29:103,30:104', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_URG_3', '0.5:57,1:63,1.5:68,2:73,2.5:78,3:84,3.5:90,4:95,4.5:100,5:106,6:114,7:124,8:132,9:141,10:149,11:158,12:165,13:172,14:180,15:187,16:196,17:203,18:210,19:218,20:226,21:234,22:241,23:248,24:256,25:264,26:272,27:279,28:286,29:295,30:302', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COUNTRIES_4', 'DZ,BY,CA,CY,EG,IL,JO,LB,LY,MD,MA,RU,PM,SY,TN,TR,UA,US', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_ECO_4', '2:38,3:44,4:50,5:56,6:62,7:68,8:74,9:80,10:86,11:92,12:98,13:104,14:110,15:116,16:121,17:126,18:131,19:136,20:141,21:145,22:149,23:153,24:157,25:161,26:165,27:169,28:173,29:177,30:181', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_PRI_4', '2:46,3:55,4:66,5:77,6:86,7:95,8:104,9:113,10:122,11:130,12:138,13:146,14:154,15:162,16:170,17:178,18:186,19:194,20:202,21:209,22:216,23:223,24:230,25:237,26:244,27:251,28:258,29:265,30:272', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_URG_4', '0.5:65,1:72,1.5:79,2:87,2.5:94,3:101,3.5:108,4:115,4.5:123,5:130,6:141,7:152,8:164,9:175,10:186,11:198,12:209,13:220,14:232,15:243,16:254,17:266,18:277,19:288,20:300,21:309,22:318,23:328,24:337,25:346,26:355,27:365,28:374,29:383,30:392', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COUNTRIES_5', 'AF,AO,AI,AG,AM,AZ,BS,BH,BD,BB,BZ,BJ,BM,BT,BW,BF,BI,KY,KH,CM,CV,CF,TD,CN,KM,CG,CR,CI,CU,DJ,DM,DO,SV,GQ,ER,ET,GA,GM,GE,GH,GD,GP,GT,GN,GW,HT,HN,HK,IN,IR,IQ,JM,JP,YE,KZ,KE,KP,KR,KW,KG,LA,LS', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_ECO_5', '2:43,3:50,4:57,5:64,6:71,7:78,8:85,9:92,10:99,11:104,12:109,13:114,14:119,15:124,16:129,17:134,18:139,19:144,20:149,21:153,22:157,23:161,24:165,25:169,26:173,27:177,28:181,29:185,30:189', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_PRI_5', '2:53,3:67,4:80,5:94,6:107,7:120,8:133,9:146,10:159,11:167,12:177,13:187,14:197,15:207,16:215,17:223,18:231,19:239,20:247,21:255,22:263,23:271,24:279,25:287,26:295,27:303,28:311,29:319,30:327', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_URG_5', '0.5:83,1:96,1.5:108,2:121,2.5:133,3:145,3.5:158,4:170,4.5:182,5:195,6:214,7:234,8:253,9:273,10:293,11:311,12:330,13:348,14:367,15:385,16:404,17:422,18:441,19:459,20:478,21:495,22:513,23:530,24:548,25:565,26:583,27:600,28:618,29:636,30:653', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COUNTRIES_6', 'LR,MO,MG,MW,MY,MV,ML,MQ,MR,MU,YT,MX,MN,MS,MZ,MM,NA,NP,NI,NE,NG,OM,PK,PA,QA,RE,RW,KN,LC,VC,SH,ZM,SM,ST,SA,SN,SC,SL,SG,SO,ZA,LK,SD,SZ,TW,TJ,TZ,TH,TG,TM,TC,UG,AE,UZ,VN,VG,VI,ZW', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_ECO_6', '2:43,3:50,4:57,5:64,6:71,7:78,8:85,9:92,10:99,11:104,12:109,13:114,14:119,15:124,16:129,17:134,18:139,19:144,20:149,21:153,22:157,23:161,24:165,25:169,26:173,27:177,28:181,29:185,30:189', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_PRI_6', '2:53,3:67,4:80,5:94,6:107,7:120,8:133,9:146,10:159,11:167,12:177,13:187,14:197,15:207,16:215,17:223,18:231,19:239,20:247,21:255,22:263,23:271,24:279,25:287,26:295,27:303,28:311,29:319,30:327', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_URG_6', '0.5:83,1:96,1.5:108,2:121,2.5:133,3:145,3.5:158,4:170,4.5:182,5:195,6:214,7:234,8:253,9:273,10:293,11:311,12:330,13:348,14:367,15:385,16:404,17:422,18:441,19:459,20:478,21:495,22:513,23:530,24:548,25:565,26:583,27:600,28:618,29:636,30:653', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COUNTRIES_7', 'AR,AW,AU,BO,BR,BN,CL,CO,CK,EC,FK,FJ,GF,PF,GY,ID,KI,NR,AN,NC,NZ,NF,PG,PY,PE,PH,PN,WS,SB,SR,TP,TO,TT,TV,UY,VU,VE,WF', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_ECO_7', '2:47,3:55,4:63,5:71,6:79,7:87,8:95,9:103,10:111,11:118,12:125,13:132,14:139,15:146,16:152,17:160,18:166,19:172,20:178,21:184,22:190,23:196,24:202,25:206,26:211,27:216,28:221,29:226,30:231', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_PRI_7', '2:65,3:83,4:101,5:119,6:136,7:153,8:170,9:187,10:204,11:219,12:234,13:249,14:264,15:279,16:294,17:309,18:324,19:339,20:354,21:367,22:380,23:393,24:406,25:419,26:432,27:445,28:458,29:471,30:484', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_CHP_COST_URG_7', '0.5:92,1:106,1.5:121,2:135,2.5:149,3:164,3.5:178,4:193,4.5:207,5:221,6:241,7:261,8:280,9:300,10:319,11:338,12:356,13:375,14:393,15:412,16:431,17:449,18:468,19:486,20:505,21:522,22:540,23:557,24:575,25:592,26:610,27:627,28:645,29:662,30:680', '6', '0', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
$keys = array('MODULE_SHIPPING_CHP_STATUS', 'MODULE_SHIPPING_CHP_HANDLING', 'MODULE_SHIPPING_CHP_TAX_CLASS', 'MODULE_SHIPPING_CHP_ZONE', 'MODULE_SHIPPING_CHP_SORT_ORDER');
for ($i=1; $i <= $this->num_chp; $i++) {
$keys[count($keys)] = 'MODULE_SHIPPING_CHP_COUNTRIES_' . $i;
$keys[count($keys)] = 'MODULE_SHIPPING_CHP_COST_ECO_' . $i;
$keys[count($keys)] = 'MODULE_SHIPPING_CHP_COST_PRI_' . $i;
$keys[count($keys)] = 'MODULE_SHIPPING_CHP_COST_URG_' . $i;
}
return $keys;
}
}

View File

@ -0,0 +1,188 @@
<?php
/* ----------------------------------------------------------------------
$Id: dp.php,v 1.3 2008/06/04 14:41:38 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: dp.php,v 1.36 2003/03/09 02:14:35 harley_vb
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 - 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class dp {
var $code, $title, $description, $icon, $num_dp, $enabled = FALSE;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'dp';
$this->title = $aLang['module_shipping_dp_text_title'];
$this->description = $aLang['module_shipping_dp_text_description'];
$this->sort_order = (defined('MODULE_SHIPPING_DP_SORT_ORDER') ? MODULE_SHIPPING_DP_SORT_ORDER : null);
$this->icon = OOS_ICONS . 'shipping_dp.gif';
$this->tax_class = (defined('MODULE_SHIPPING_DP_TAX_CLASS') ? MODULE_SHIPPING_DP_TAX_CLASS : null);
$this->enabled = (defined('MODULE_SHIPPING_DP_STATUS') && (MODULE_SHIPPING_DP_STATUS == 'True') ? true : false);
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_DP_ZONE > 0) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_DP_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
// Close result set
$check_result->Close();
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
$this->num_dp = 6;
}
// class methods
function quote($method = '') {
global $aLang, $oOrder, $shipping_weight, $shipping_num_boxes;
$dest_country = $oOrder->delivery['country']['iso_code_2'];
$dest_zone = 0;
$error = FALSE;
for ($i=1; $i<=$this->num_dp; $i++) {
$countries_table = constant('MODULE_SHIPPING_DP_COUNTRIES_' . $i);
$country_zones = preg_split("/[,]/", $countries_table);
if (in_array($dest_country, $country_zones)) {
$dest_zone = $i;
break;
}
}
if ($dest_zone == 0) {
$error = TRUE;
} else {
$shipping = -1;
$dp_cost = constant('MODULE_SHIPPING_DP_COST_' . $i);
$dp_table = preg_split("/[:,]/" , $dp_cost);
for ($i=0; $i<count($dp_table); $i+=2) {
if ($shipping_weight <= $dp_table[$i]) {
$shipping = $dp_table[$i+1];
$shipping_method = $aLang['module_shipping_dp_text_way'] . ' ' . $dest_country . ': ';
break;
}
}
if ($shipping == -1) {
$shipping_cost = 0;
$shipping_method = $aLang['module_shipping_dp_undefined_rate'];
} else {
$shipping_cost = ($shipping + MODULE_SHIPPING_DP_HANDLING);
}
}
$this->quotes = array('id' => $this->code,
'module' => $aLang['module_shipping_dp_text_title'],
'methods' => array(array('id' => $this->code,
'title' => $shipping_method . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . $aLang['module_shipping_dp_text_units'] .')',
'cost' => $shipping_cost * $shipping_num_boxes)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
}
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
if ($error == TRUE) $this->quotes['error'] = $aLang['module_shipping_dp_invalid_zone'];
return $this->quotes;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_SHIPPING_DP_STATUS');
}
return $this->_check;
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_DP_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_HANDLING', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_DP_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_DP_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_SORT_ORDER', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COUNTRIES_1', 'AD,AT,BE,CZ,DK,FO,FI,FR,GR,GL,IE,IT,LI,LU,MC,NL,PL,PT,SM,SK,SE,CH,VA,GB,SP', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COST_1', '5:16.50,10:20.50,20:28.50', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COUNTRIES_2', 'AL,AM,AZ,BY,BA,BG,HR,CY,GE,GI,HU,IS,KZ,LT,MK,MT,MD,NO,SI,UA,TR,YU,RU,RO,LV,EE', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COST_2', '5:25.00,10:35.00,20:45.00', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COUNTRIES_3', 'DZ,BH,CA,EG,IR,IQ,IL,JO,KW,LB,LY,OM,SA,SY,US,AE,YE,MA,QA,TN,PM', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COST_3', '5:29.00,10:39.00,20:59.00', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COUNTRIES_4', 'AF,AS,AO,AI,AG,AR,AW,AU,BS,BD,BB,BZ,BJ,BM,BT,BO,BW,BR,IO,BN,BF,BI,KH,CM,CV,KY,CF,TD,CL,CN,CC,CO,KM,CG,CR,CI,CU,DM,DO,EC,SV,ER,ET,FK,FJ,GF,PF,GA,GM,GH,GD,GP,GT,GN,GW,GY,HT,HN,HK,IN,ID,JM,JP,KE,KI,KG,KP,KR,LA,LS', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COST_4', '5:35.00,10:50.00,20:80.00', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COUNTRIES_5', 'MO,MG,MW,MY,MV,ML,MQ,MR,MU,MX,MN,MS,MZ,MM,NA,NR,NP,AN,NC,NZ,NI,NE,NG,PK,PA,PG,PY,PE,PH,PN,RE,KN,LC,VC,SN,SC,SL,SO,LK,SR,SZ,ZA,SG,TG,TH,TZ,TT,TO,TM,TV,VN,WF,VE,UG,UZ,UY,ST,SH,SD,TW,GQ,LR,DJ,CG,RW,ZM,ZW', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COST_5', '5:35.00,10:50.00,20:80.00', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COUNTRIES_6', 'DE', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_DP_COST_6', '5:6.70,10:9.70,20:13.00', '6', '0', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
$keys = array('MODULE_SHIPPING_DP_STATUS', 'MODULE_SHIPPING_DP_HANDLING', 'MODULE_SHIPPING_DP_TAX_CLASS', 'MODULE_SHIPPING_DP_ZONE', 'MODULE_SHIPPING_DP_SORT_ORDER');
for ($i = 1; $i <= $this->num_dp; $i ++) {
$keys[count($keys)] = 'MODULE_SHIPPING_DP_COUNTRIES_' . $i;
$keys[count($keys)] = 'MODULE_SHIPPING_DP_COST_' . $i;
}
return $keys;
}
}

View File

@ -0,0 +1,308 @@
<?php
/* ----------------------------------------------------------------------
$Id: fedexeu.php,v 1.2 2007/08/11 05:59:52 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: fedexeu.php,v 1.02 2003/02/18 03:37:00 harley_vb
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 - 2003 osCommerce
----------------------------------------------------------------------
Copyright (C) 2001 - 2003 TheMedia, Dipl.-Ing Thomas Pl<50>kers
http://www.themedia.at & http://www.oscommerce.at
All rights reserved.
This program is free software licensed under the GNU General Public License (GPL).
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
(at your option) 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
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class fedexeu {
var $code, $title, $description, $icon, $num_fedexeu, $types, $enabled = FALSE;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'fedexeu';
$this->title = $aLang['module_shipping_fedexeu_text_title'];
$this->description = $aLang['module_shipping_fedexeu_text_description'];
$this->sort_order = (defined('MODULE_SHIPPING_FEDEXEU_SORT_ORDER') ? MODULE_SHIPPING_FEDEXEU_SORT_ORDER : null);
$this->icon = OOS_ICONS . 'shipping_fedexeu.gif';
$this->tax_class = (defined('MODULE_SHIPPING_FEDEXEU_TAX_CLASS') ? MODULE_SHIPPING_FEDEXEU_TAX_CLASS : null);
$this->enabled = (defined('MODULE_SHIPPING_FEDEXEU_STATUS') && (MODULE_SHIPPING_FEDEXEU_STATUS == 'True') ? true : false);
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_FEDEXEU_ZONE > 0) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_FEDEXEU_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
// Close result set
$check_result->Close();
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
$this->types = array('PAK' => 'FedEx Pak',
'BOX' => 'FedEx Box');
// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
$this->num_fedexeu = 8;
}
// class methods
function quote($method = '') {
global $oOrder, $aLang, $shipping_weight, $shipping_num_boxes;
$dest_country = $oOrder->delivery['country']['iso_code_2'];
$dest_zone = 0;
$error = FALSE;
for ($j=1; $j<=$this->num_fedexeu; $j++) {
$countries_table = constant('MODULE_SHIPPING_FEDEXEU_COUNTRIES_' . $j);
$country_zones = preg_split("/[,]/", $countries_table);
if (in_array($dest_country, $country_zones)) {
$dest_zone = $j;
break;
}
}
if ($dest_zone == 0) {
$error = TRUE;
} else {
$shipping = -1;
$fedexeu_cost_pak = @constant('MODULE_SHIPPING_FEDEXEU_COST_PAK_' . $j);
$fedexeu_cost_box = @constant('MODULE_SHIPPING_FEDEXEU_COST_BOX_' . $j);
$methods = array();
if ($fedexeu_cost_pak != '') {
$fedexeu_table_pak = preg_split("/[:,]/" , $fedexeu_cost_pak);
for ($i=0; $i<count($fedexeu_table_pak); $i+=2) {
if ($shipping_weight <= $fedexeu_table_pak[$i]) {
$shipping_pak = $fedexeu_table_pak[$i+1];
break;
}
}
if ($shipping_pak == -1) {
$shipping_cost = 0;
$shipping_method = $aLang['module_shipping_fedexeu_undefined_rate'];
} else {
$shipping_cost_1 = ($shipping_pak + MODULE_SHIPPING_FEDEXEU_HANDLING);
}
if ($shipping_pak != 0) {
$methods[] = array('id' => 'PAK',
'title' => 'FedEx Pak',
'cost' => (MODULE_SHIPPING_FEDEXEU_HANDLING + $shipping_cost_1) * $shipping_num_boxes);
}
}
if ($fedexeu_cost_box != '') {
$fedexeu_table_box = preg_split("/[:,]/" , $fedexeu_cost_box);
if ( ($shipping_weight > 10) and ($shipping_weight <= 20) ) {
$shipping_box = number_format((($shipping_weight - 10)* 2 + 0.5), 0) * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_' .$j) + $fedexeu_table_box[count ($fedexeu_table_box)-1];
} elseif ( ($shipping_weight > 20) and ($shipping_weight <= 40) ) {
$shipping_box = number_format((($shipping_weight - 20)* 2 + 0.5), 0) * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_' .$j) + 20 * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_' .$j) + $fedexeu_table_box[count ($fedexeu_table_box)-1];
} elseif ( ($shipping_weight > 40) and ($shipping_weight <= 70) ) {
$shipping_box = number_format((($shipping_weight - 40)* 2 + 0.5), 0) * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_' .$j) + 20 * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_' .$j) + 40 * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_' .$j) + $fedexeu_table_box[count ($fedexeu_table_box)-1];
} else {
for ($i=0; $i<count($fedexeu_table_box); $i+=2) {
if ($shipping_weight <= $fedexeu_table_box[$i]) {
$shipping_box = $fedexeu_table_box[$i+1];
break;
}
}
}
if ($shipping_box == -1) {
$shipping_cost = 0;
$shipping_method = $aLang['module_shipping_fedexeu_undefined_rate'];
} else {
$shipping_cost_2 = ($shipping_box + MODULE_SHIPPING_FEDEXEU_HANDLING);
}
if ($shipping_box != 0) {
$methods[] = array('id' => 'BOX',
'title' => 'FedEx Box',
'cost' => (MODULE_SHIPPING_FEDEXEU_HANDLING + $shipping_cost_2) * $shipping_num_boxes);
}
}
}
$this->quotes = array('id' => $this->code,
'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . $aLang['module_shipping_fedexeu_text_units'] .')');
$this->quotes['methods'] = $methods;
if ($this->tax_class > 0) {
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
}
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
if ($error == TRUE) $this->quotes['error'] = $aLang['module_shipping_fedexeu_invalid_zone'];
if ( (oos_is_not_null($method)) && (isset($this->types[$method])) ) {
for ($i=0; $i<count($methods); $i++) {
if ($method == $methods[$i]['id']) {
$methodsc = array();
$methodsc[] = array('id' => $methods[$i]['id'],
'title' => $methods[$i]['title'],
'cost' => $methods[$i]['cost']);
break;
}
}
$this->quotes['methods'] = $methodsc;
}
return $this->quotes;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_SHIPPING_FEDEXEU_STATUS');
}
return $this->_check;
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_HANDLING', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SORT_ORDER', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_1', 'AT,AD,BE,DK,DE,FI,FO,FR,GR,GL,GB,IE,IT,LU,MC,NL,PT,SE,SM,ES,VA', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_1', '0.5:41.40,1:48.20,1.5:51.30,2:54.40,2.5:57.50', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_1', '0.5:41.40,1:48.20,1.5:51.30,2:54.40,2.5:57.50,3:60.30,3.5:63.00,4:65.70,4.5:68.50,5:71.20,5.5:75.20,6:77.80,6.5:80.30,7:82.90,7.5:85.50,8:88.10,8.5:90.60,9:93.20,9.5:95.80,10:98.40', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_1', '1.70', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_1', '1.30', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_1', '1.10', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_2', 'GI,IS,LI,NO,CH', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_2', '0.5:51.90,1:58.20,1.5:64.40,2:70.70,2.5:77.00', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_2', '0.5:71.50,1:77.80,1.5:84.20,2:90.40,2.5:96.70,3:103.10,3.5:108.50,4:113.90,4.5:119.40,5:124.80,5.5:129.50,6:134.30,6.5:139.10,7:143.80,7.5:148.50,8:153.30,8.5:158.00,9:162.80,9.5:167.60,10:172.40', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_2', '1.50', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_2', '1.50', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_2', '1.60', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_3', 'AL,BA,BG,EE,HR,LV,LT,MK,MD,PL,RO,RU,SK,SI,CZ,TR,UA,HU,YU,BY', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_3', '0.5:51.10,1:57.60,1.5:64.20,2:70.70,2.5:77.30', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_3', '0.5:70.70,1:79.80,1.5:86.20,2:92.70,2.5:99.10,3:104.50,3.5:109.90,4:115.20,4.5:120.60,5:126.00,5.5:130.70,6:135.30,6.5:140.00,7:144.60,7.5:149.20,8:153.90,8.5:158.50,9:163.20,9.5:167.90,10:172.40', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_3', '2.10', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_3', '1.40', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_3', '1.70', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_4', 'CA,MX,PR,US', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_4', '0.5:50.30,1:58.30,1.5:66.10,2:74.10,2.5:81.90', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_4', '0.5:70.90,1:78.10,1.5:86.00,2:93.80,2.5:101.70,3:109.50,3.5:117.30,4:125.20,4.5:133.10,5:141.00,5.5:148.80,6:156.70,6.5:164.50,7:172.40,7.5:180.20,8:187.10,8.5:194.90,9:202.80,9.5:210.60,10:218.40', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_4', '4.10', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_4', '3.90', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_4', '3.80', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_5', 'AU,CN,HK,ID,JP,KR,MO,MY,NZ,PH,SG,TW,TH,VN', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_5', '0.5:55.80,1:74.60,1.5:93.20,2:111.90,2.5:130.40', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_5', '0.5:72.90,1:91.50,1.5:110.10,2:128.80,2.5:147.40,3:164.60,3.5:181.70,4:198.80,4.5:216.00,5:233.10,5.5:242.40,6:251.80,6.5:261.10,7:270.40,7.5:279.80,8:289.10,8.5:298.40,9:307.60,9.5:317.00,10:326.40', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_5', '4.30', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_5', '4.30', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_5', '3.70', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_6', 'BH,BD,BT,BN,KH,CY,EG,IN,IL,YE,JO,QA,KW,LA,LB,MT,MM,NP,OM,PK,SA,LK,SY,AE', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_6', '0.5:59.60,1:79.00,1.5:96.70,2:114.40,2.5:132.20', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_6', '0.5:81.20,1:100.50,1.5:118.30,2:136.10,2.5:153.90,3:171.70,3.5:189.50,4:207.30,4.5:225.10,5:242.70,5.5:251.70,6:260.70,6.5:269.70,7:278.50,7.5:287.40,8:296.30,8.5:305.10,9:314.10,9.5:322.90,10:331.90', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_6', '4.50', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_6', '4.30', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_6', '3.80', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_7', 'AI,AG,AR,AW,BS,BB,BZ,BM,BO,BR,KY,CL,CR,CO,DM,DO,EC,SV,GF,GD,GP,GT,GY,HT,HN,JM,VG,VI,MQ,MS,NI,AN,PA,PY,PE,KN,LC,VC,ZA,SR,TT,TC,UY,VE', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_7', '0.5:67.00,1:85.60,1.5:104.30,2:122.90,2.5:114.50', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_7', '0.5:84.20,1:102.80,1.5:121.40,2:140.00,2.5:158.70,3:175.70,3.5:192.90,4:210.10,4.5:227.20,5:244.30,5.5:254.40,6:264.50,6.5:274.50,7:284.60,7.5:294.60,8:304.60,8.5:314.70,9:324.80,9.5:334.90,10:344.90', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_7', '4.50', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_7', '4.30', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_7', '4.30', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COUNTRIES_8', 'DZ,AS,AO,AM,AZ,BJ,BW,BF,BI,CM,CV,TD,CK,CG,DJ,GQ,ET,ER,FJ,FM,PF,GA,GM,GN,GW,GE,GH,GU,KZ,KE,KG,LS,LR,MG,MW,MV,ML,MA,MR,MU,MN,MZ,NA,NC,NE,NG,PW,PG,RE,RW,ZM,ZW,SN,SC,SL,SD,SZ,TZ,TG,TN,TM,UG,UZ,VU,WF', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_PAK_8', '0.5:68.50,1:86.90,1.5:105.50,2:124.00,2.5:142.40', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_COST_BOX_8', '0.5:88.60,1:107.10,1.5:125.60,2:144.10,2.5:162.40,3:179.50,3.5:196.50,4:213.40,4.5:230.50,5:247.40,5.5:257.30,6:267.30,6.5:277.30,7:287.20,7.5:297.20,8:307.20,8.5:317.20,9:327.20,9.5:337.20,10:347.20', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_8', '5.50', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_8', '4.70', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_8', '4.70', '6', '0', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
$keys = array('MODULE_SHIPPING_FEDEXEU_STATUS', 'MODULE_SHIPPING_FEDEXEU_HANDLING', 'MODULE_SHIPPING_FEDEXEU_TAX_CLASS', 'MODULE_SHIPPING_FEDEXEU_ZONE', 'MODULE_SHIPPING_FEDEXEU_SORT_ORDER');
for ($i = 1; $i <= $this->num_fedexeu; $i ++) {
$keys[count($keys)] = 'MODULE_SHIPPING_FEDEXEU_COUNTRIES_' . $i;
$keys[count($keys)] = 'MODULE_SHIPPING_FEDEXEU_COST_PAK_' . $i;
$keys[count($keys)] = 'MODULE_SHIPPING_FEDEXEU_COST_BOX_' . $i;
$keys[count($keys)] = 'MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_' . $i;
$keys[count($keys)] = 'MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_' . $i;
$keys[count($keys)] = 'MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_' . $i;
}
return $keys;
}
}

View File

@ -0,0 +1,124 @@
<?php
/* ----------------------------------------------------------------------
$Id: flat.php,v 1.2 2008/08/25 14:28:07 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: flat.php,v 1.40 2003/02/05 22:41:52 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class flat {
var $code, $title, $description, $icon, $enabled = FALSE;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'flat';
$this->title = $aLang['module_shipping_flat_text_title'];
$this->description = $aLang['module_shipping_flat_text_description'];
$this->sort_order = (defined('MODULE_SHIPPING_FLAT_SORT_ORDER') ? MODULE_SHIPPING_FLAT_SORT_ORDER : null);
$this->icon = '';
$this->tax_class = (defined('MODULE_SHIPPING_FLAT_TAX_CLASS') ? MODULE_SHIPPING_FLAT_TAX_CLASS : null);
$this->enabled = (defined('MODULE_SHIPPING_FLAT_STATUS') && (MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_FLAT_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
// Close result set
$check_result->Close();
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
}
// class methods
function quote($method = '') {
global $aLang, $oOrder;
$this->quotes = array('id' => $this->code,
'module' => $aLang['module_shipping_flat_text_title'],
'methods' => array(array('id' => $this->code,
'title' => $aLang['module_shipping_flat_text_way'],
'cost' => MODULE_SHIPPING_FLAT_COST)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
}
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
return $this->quotes;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_SHIPPING_FLAT_STATUS');
}
return $this->_check;
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_FLAT_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FLAT_COST', '5.00', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_FLAT_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_FLAT_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_FLAT_SORT_ORDER', '0', '6', '0', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_SHIPPING_FLAT_STATUS', 'MODULE_SHIPPING_FLAT_COST', 'MODULE_SHIPPING_FLAT_TAX_CLASS', 'MODULE_SHIPPING_FLAT_ZONE', 'MODULE_SHIPPING_FLAT_SORT_ORDER');
}
}

View File

@ -0,0 +1,128 @@
<?php
/* ----------------------------------------------------------------------
$Id: item.php,v 1.2 2008/08/25 14:28:07 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: item.php,v 1.39 2003/02/05 22:41:52 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class item {
var $code, $title, $description, $icon, $enabled = FALSE;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'item';
$this->title = $aLang['module_shipping_item_text_title'];
$this->description = $aLang['module_shipping_item_text_description'];
$this->sort_order = (defined('MODULE_SHIPPING_ITEM_SORT_ORDER') ? MODULE_SHIPPING_ITEM_SORT_ORDER : null);
$this->icon = '';
$this->tax_class = (defined('MODULE_SHIPPING_ITEM_TAX_CLASS') ? MODULE_SHIPPING_ITEM_TAX_CLASS : null);
$this->enabled = (defined('MODULE_SHIPPING_ITEM_STATUS') && (MODULE_SHIPPING_ITEM_STATUS == 'True') ? true : false);
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_ITEM_ZONE > 0) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_ITEM_ZONE . "' and zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
// Close result set
$check_result->Close();
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
}
// class methods
function quote($method = '') {
global $oOrder, $aLang, $total_count;
$this->quotes = array('id' => $this->code,
'module' => $aLang['module_shipping_item_text_title'],
'methods' => array(array('id' => $this->code,
'title' => $aLang['module_shipping_item_text_way'],
'cost' => (MODULE_SHIPPING_ITEM_COST * $total_count) + MODULE_SHIPPING_ITEM_HANDLING)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
}
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
return $this->quotes;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_SHIPPING_ITEM_STATUS');
}
return $this->_check;
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_ITEM_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_ITEM_COST', '2.50', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_ITEM_HANDLING', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_ITEM_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_ITEM_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_ITEM_SORT_ORDER', '0', '6', '0', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_SHIPPING_ITEM_STATUS', 'MODULE_SHIPPING_ITEM_COST', 'MODULE_SHIPPING_ITEM_HANDLING', 'MODULE_SHIPPING_ITEM_TAX_CLASS', 'MODULE_SHIPPING_ITEM_ZONE', 'MODULE_SHIPPING_ITEM_SORT_ORDER');
}
}

View File

@ -0,0 +1,122 @@
<?php
/* ----------------------------------------------------------------------
$Id: selfpickup.php,v 1.2 2008/08/25 14:28:07 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: selfpickup.php,v 1.39 2003/02/05 22:41:52 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class selfpickup {
var $code, $title, $description, $icon, $enabled = FALSE;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'selfpickup';
$this->title = $aLang['module_shipping_selfpickup_text_title'];
$this->description = $aLang['module_shipping_selfpickup_text_description'];
$this->sort_order = (defined('MODULE_SHIPPING_SELFPICKUP_SORT_ORDER') ? MODULE_SHIPPING_SELFPICKUP_SORT_ORDER : null);
$this->icon = '';
$this->enabled = (defined('MODULE_SHIPPING_SELFPICKUP_STATUS') && (MODULE_SHIPPING_SELFPICKUP_STATUS == 'True') ? true : false);
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_SELFPICKUP_ZONE > 0) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_SELFPICKUP_ZONE . "' and zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
// Close result set
$check_result->Close();
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
}
// class methods
function quote($method = '') {
global $oOrder, $aLang, $total_count;
$this->quotes = array('id' => $this->code,
'module' => $aLang['module_shipping_selfpickup_text_title'],
'methods' => array(array('id' => $this->code,
'title' => $aLang['module_shipping_selfpickup_text_way'],
'cost' => 0 )));
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
return $this->quotes;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_SHIPPING_SELFPICKUP_STATUS');
}
return $this->_check;
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_SELFPICKUP_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_SELFPICKUP_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_SELFPICKUP_SORT_ORDER', '0', '6', '0', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_SHIPPING_SELFPICKUP_STATUS', 'MODULE_SHIPPING_SELFPICKUP_ZONE', 'MODULE_SHIPPING_SELFPICKUP_SORT_ORDER');
}
}

View File

@ -0,0 +1,146 @@
<?php
/* ----------------------------------------------------------------------
$Id: table.php,v 1.2 2008/08/25 14:28:07 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: table.php,v 1.27 2003/02/05 22:41:52 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class table {
var $code, $title, $description, $icon, $enabled = FALSE;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'table';
$this->title = $aLang['module_shipping_table_text_title'];
$this->description = $aLang['module_shipping_table_text_description'];
$this->sort_order = (defined('MODULE_SHIPPING_TABLE_SORT_ORDER') ? MODULE_SHIPPING_TABLE_SORT_ORDER : null);
$this->icon = '';
$this->tax_class = (defined('MODULE_SHIPPING_TABLE_TAX_CLASS') ? MODULE_SHIPPING_TABLE_TAX_CLASS : null);
$this->enabled = (defined('MODULE_SHIPPING_TABLE_STATUS') && (MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);
if ( ($this->enabled == TRUE) && ((int)MODULE_SHIPPING_TABLE_ZONE > 0) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$zones_to_geo_zonestable = $oostable['zones_to_geo_zones'];
$check_result = $dbconn->Execute("SELECT zone_id FROM $zones_to_geo_zonestable WHERE geo_zone_id = '" . MODULE_SHIPPING_TABLE_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
// Close result set
$check_result->Close();
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
}
// class methods
function quote($method = '') {
global $oOrder, $aLang, $shipping_weight, $shipping_num_boxes;
if (MODULE_SHIPPING_TABLE_MODE == 'price') {
$oOrder_total = $_SESSION['cart']->show_total();
} else {
$oOrder_total = $shipping_weight;
}
$table_cost = preg_split("/[:,]/" , MODULE_SHIPPING_TABLE_COST);
$size = count($table_cost);
for ($i=0, $n=$size; $i<$n; $i+=2) {
if ($oOrder_total <= $table_cost[$i]) {
$shipping = $table_cost[$i+1];
break;
}
}
if (MODULE_SHIPPING_TABLE_MODE == 'weight') {
$shipping = $shipping * $shipping_num_boxes;
}
$this->quotes = array('id' => $this->code,
'module' =>$aLang['module_shipping_table_text_title'],
'methods' => array(array('id' => $this->code,
'title' => $aLang['module_shipping_table_text_way'],
'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
}
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
return $this->quotes;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_SHIPPING_TABLE_STATUS');
}
return $this->_check;
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_TABLE_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_TABLE_COST', '25:8.50,50:5.50,10000:0.00', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_TABLE_MODE', 'weight', '6', '0', 'oos_cfg_select_option(array(\'weight\', \'price\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_TABLE_HANDLING', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_TABLE_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_TABLE_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_TABLE_SORT_ORDER', '0', '6', '0', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_SHIPPING_TABLE_STATUS', 'MODULE_SHIPPING_TABLE_COST', 'MODULE_SHIPPING_TABLE_MODE', 'MODULE_SHIPPING_TABLE_HANDLING', 'MODULE_SHIPPING_TABLE_TAX_CLASS', 'MODULE_SHIPPING_TABLE_ZONE', 'MODULE_SHIPPING_TABLE_SORT_ORDER');
}
}

View File

@ -0,0 +1,141 @@
<?php
/* ----------------------------------------------------------------------
$Id: weight.php,v 1.1 2007/06/07 17:30:51 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: weight.php,v 1.05 2003/02/18 03:37:00 harley_vb
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 - 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
class weight {
var $code, $title, $description, $icon, $enabled = FALSE;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'weight';
$this->title = $aLang['module_shipping_weight_text_title'];
$this->description = $aLang['module_shipping_weight_text_description'];
$this->sort_order = (defined('MODULE_SHIPPING_WEIGHT_SORT_ORDER') ? MODULE_SHIPPING_WEIGHT_SORT_ORDER : null);
$this->icon = '';
$this->tax_class = (defined('MODULE_SHIPPING_WEIGHT_TAX_CLASS') ? MODULE_SHIPPING_WEIGHT_TAX_CLASS : null);
$this->enabled = (defined('MODULE_SHIPPING_WEIGHT_STATUS') && (MODULE_SHIPPING_WEIGHT_STATUS == 'True') ? true : false);
if ( ($this->enabled == TRUE) && ((defined('MODULE_SHIPPING_WEIGHT_ZONE') && (int)MODULE_SHIPPING_WEIGHT_ZONE > 0)) ) {
$check_flag = FALSE;
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$check_result = $dbconn->Execute("SELECT zone_id FROM " . $oostable['zones_to_geo_zones'] . " WHERE geo_zone_id = '" . MODULE_SHIPPING_WEIGHT_ZONE . "' AND zone_country_id = '" . $oOrder->delivery['country']['id'] . "' ORDER BY zone_id");
while ($check = $check_result->fields) {
if ($check['zone_id'] < 1) {
$check_flag = TRUE;
break;
} elseif ($check['zone_id'] == $oOrder->delivery['zone_id']) {
$check_flag = TRUE;
break;
}
// Move that ADOdb pointer!
$check_result->MoveNext();
}
// Close result set
$check_result->Close();
if ($check_flag == FALSE) {
$this->enabled = FALSE;
}
}
}
// class methods
function quote($method = '') {
global $oOrder, $aLang, $shipping_weight;
$weight_cost = preg_split("/[:,]/" , MODULE_SHIPPING_WEIGHT_COST);
if ($shipping_weight > $weight_cost[count ($weight_cost)-2]) {
$shipping = ($shipping_weight-$weight_cost[count ($weight_cost)-2])* MODULE_SHIPPING_WEIGHT_STEP +$weight_cost[count ($weight_cost)-1];
}
for ($i = 0; $i < count($weight_cost); $i+=2) {
if ($shipping_weight <= $weight_cost[$i]) {
$shipping = $weight_cost[$i+1];
break;
}
}
$this->quotes = array('id' => $this->code,
'module' => $aLang['module_shipping_weight_text_title'],
'methods' => array(array('id' => $this->code,
'title' => $aLang['module_shipping_weight_text_way'],
'cost' => $shipping + MODULE_SHIPPING_WEIGHT_HANDLING)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
}
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
return $this->quotes;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_SHIPPING_WEIGHT_STATUS');
}
return $this->_check;
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_HANDLING', '5', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_ZONE', '0', '6', '0', 'oos_cfg_get_zone_class_title', 'oos_cfg_pull_down_zone_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_SORT_ORDER', '0', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_COST', '31:15,40:28,50:30.5,100:33', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_STEP', '0.28', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_WEIGHT_MODE', 'weight', '6', '0', 'oos_cfg_select_option(array(\'weight\', \'price\'), ', now())");
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_SHIPPING_WEIGHT_STATUS', 'MODULE_SHIPPING_WEIGHT_HANDLING', 'MODULE_SHIPPING_WEIGHT_COST', 'MODULE_SHIPPING_WEIGHT_STEP', 'MODULE_SHIPPING_WEIGHT_TAX_CLASS', 'MODULE_SHIPPING_WEIGHT_ZONE', 'MODULE_SHIPPING_WEIGHT_SORT_ORDER');
}
}

View File

@ -0,0 +1,237 @@
<?php
/* ----------------------------------------------------------------------
$Id: zones.php,v 1.2 2008/08/25 14:28:07 r23 Exp $
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: zones.php,v 1.19 2003/02/05 22:41:53 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
----------------------------------------------------------------------
USAGE
By default, the module comes with support for 1 zone. This can be
easily changed by editing the line below in the zones constructor
that defines $this->num_zones.
Next, you will want to activate the module by going to the Admin screen,
clicking on Modules, then clicking on Shipping. A list of all shipping
modules should appear. Click on the green dot next to the one labeled
zones.php. A list of settings will appear to the right. Click on the
Edit button.
PLEASE NOTE THAT YOU WILL LOSE YOUR CURRENT SHIPPING RATES AND OTHER
SETTINGS IF YOU TURN OFF THIS SHIPPING METHOD. Make sure you keep a
backup of your shipping settings somewhere at all times.
If you want an additional handling charge applied to orders that use this
method, set the Handling Fee field.
Next, you will need to define which countries are in each zone. Determining
this might take some time and effort. You should group a set of countries
that has similar shipping charges for the same weight. For instance, when
shipping from the US, the countries of Japan, Australia, New Zealand, and
Singapore have similar shipping rates. As an example, one of my customers
is using this set of zones:
1: USA
2: Canada
3: Austria, Belgium, Great Britain, France, Germany, Greenland, Iceland,
Ireland, Italy, Norway, Holland/Netherlands, Denmark, Poland, Spain,
Sweden, Switzerland, Finland, Portugal, Israel, Greece
4: Japan, Australia, New Zealand, Singapore
5: Taiwan, China, Hong Kong
When you enter these country lists, enter them into the Zone X Countries
fields, where "X" is the number of the zone. They should be entered as
two character ISO country codes in all capital letters. They should be
separated by commas with no spaces or other punctuation. For example:
1: US
2: CA
3: AT,BE,GB,FR,DE,GL,IS,IE,IT,NO,NL,DK,PL,ES,SE,CH,FI,PT,IL,GR
4: JP,AU,NZ,SG
5: TW,CN,HK
Now you need to set up the shipping rate tables for each zone. Again,
some time and effort will go into setting the appropriate rates. You
will define a set of weight ranges and the shipping price for each
range. For instance, you might want an order than weighs more than 0
and less than or equal to 3 to cost 5.50 to ship to a certain zone.
This would be defined by this: 3:5.5
You should combine a bunch of these rates together in a comma delimited
list and enter them into the "Zone X Shipping Table" fields where "X"
is the zone number. For example, this might be used for Zone 1:
1:3.5,2:3.95,3:5.2,4:6.45,5:7.7,6:10.4,7:11.85, 8:13.3,9:14.75,10:16.2,11:17.65,
12:19.1,13:20.55,14:22,15:23.45
The above example includes weights over 0 and up to 15. Note that
units are not specified in this explanation since they should be
specific to your locale.
CAVEATS
At this time, it does not deal with weights that are above the highest amount
defined. This will probably be the next area to be improved with the
module. For now, you could have one last very high range with a very
high shipping rate to discourage orders of that magnitude. For
instance: 999:1000
If you want to be able to ship to any country in the world, you will
need to enter every country code into the Country fields. For most
shops, you will not want to enter every country. This is often
because of too much fraud from certain places. If a country is not
listed, then the module will add a $0.00 shipping charge and will
indicate that shipping is not available to that destination.
PLEASE NOTE THAT THE ORDER CAN STILL BE COMPLETED AND PROCESSED!
It appears that the osC shipping system automatically rounds the
shipping weight up to the nearest whole unit. This makes it more
difficult to design precise shipping tables. If you want to, you
can hack the shipping.php file to get rid of the rounding.
Lastly, there is a limit of 255 characters on each of the Zone
Shipping Tables and Zone Countries.
---------------------------------------------------------------------- */
class zones {
var $code, $title, $description, $num_zones, $enabled = FALSE;
// class constructor
public function __construct() {
global $oOrder, $aLang;
$this->code = 'zones';
$this->title = $aLang['module_shipping_zones_text_title'];
$this->description = $aLang['module_shipping_zones_text_description'];
$this->sort_order = (defined('MODULE_SHIPPING_ZONES_SORT_ORDER') ? MODULE_SHIPPING_ZONES_SORT_ORDER : null);
$this->icon = '';
$this->tax_class = (defined('MODULE_SHIPPING_ZONES_TAX_CLASS') ? MODULE_SHIPPING_ZONES_TAX_CLASS : null);
$this->enabled = (defined('MODULE_SHIPPING_ZONES_STATUS') && (MODULE_SHIPPING_ZONES_STATUS == 'True') ? true : false);
// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
$this->num_zones = 2;
}
// class methods
function quote($method = '') {
global $oOrder, $aLang, $shipping_weight;
$dest_country = $oOrder->delivery['country']['iso_code_2'];
$dest_zone = 0;
$error = FALSE;
for ($i=1; $i<=$this->num_zones; $i++) {
$countries_table = constant('MODULE_SHIPPING_ZONES_COUNTRIES_' . $i);
$country_zones = preg_split("/[,]/", $countries_table);
if (in_array($dest_country, $country_zones)) {
$dest_zone = $i;
break;
}
}
if ($dest_zone == 0) {
$error = TRUE;
} else {
$shipping = -1;
$zones_cost = constant('MODULE_SHIPPING_ZONES_COST_' . $dest_zone);
$zones_table = preg_split("/[:,]/", $zones_cost);
$size = count($zones_table);
for ($i=0; $i<$size; $i+=2) {
if ($shipping_weight <= $zones_table[$i]) {
$shipping = $zones_table[$i+1];
$shipping_method = $aLang['module_shipping_zones_text_way'] . ' ' . $dest_country . ' : ' . $shipping_weight . ' ' . $aLang['module_shipping_zones_text_units'];
break;
}
}
if ($shipping == -1) {
$shipping_cost = 0;
$shipping_method = $aLang['module_shipping_zones_undefined_rate'];
} else {
$shipping_cost = ($shipping + constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone));
}
}
$this->quotes = array('id' => $this->code,
'module' => $aLang['module_shipping_zones_text_title'],
'methods' => array(array('id' => $this->code,
'title' => $shipping_method,
'cost' => $shipping_cost)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
}
if (oos_is_not_null($this->icon)) $this->quotes['icon'] = oos_image($this->icon, $this->title);
if ($error == TRUE) $this->quotes['error'] = $aLang['module_shipping_zones_invalid_zone'];
return $this->quotes;
}
function check() {
if (!isset($this->_check)) {
$this->_check = defined('MODULE_SHIPPING_ZONES_STATUS');
}
return $this->_check;
}
function install() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) VALUES ('MODULE_SHIPPING_ZONES_STATUS', 'True', '6', '0', 'oos_cfg_select_option(array(\'True\', \'False\'), ', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('MODULE_SHIPPING_ZONES_TAX_CLASS', '0', '6', '0', 'oos_cfg_get_tax_class_title', 'oos_cfg_pull_down_tax_classes(', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_ZONES_SORT_ORDER', '0', '6', '0', now())");
for ($i = 1; $i <= $this->num_zones; $i++) {
$default_countries = '';
if ($i == 1) {
$default_countries = 'US,CA';
}
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_ZONES_COUNTRIES_" . $i ."', '" . $default_countries . "', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_ZONES_COST_" . $i ."', '3:8.50,7:10.50,99:20.00', '6', '0', now())");
$dbconn->Execute("INSERT INTO $configurationtable (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) VALUES ('MODULE_SHIPPING_ZONES_HANDLING_" . $i."', '0', '6', '0', now())");
}
}
function remove() {
// Get database information
$dbconn =& oosDBGetConn();
$oostable =& oosDBGetTables();
$configurationtable = $oostable['configuration'];
$dbconn->Execute("DELETE FROM $configurationtable WHERE configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
$keys = array('MODULE_SHIPPING_ZONES_STATUS', 'MODULE_SHIPPING_ZONES_TAX_CLASS', 'MODULE_SHIPPING_ZONES_SORT_ORDER');
for ($i=1; $i<=$this->num_zones; $i++) {
$keys[] = 'MODULE_SHIPPING_ZONES_COUNTRIES_' . $i;
$keys[] = 'MODULE_SHIPPING_ZONES_COST_' . $i;
$keys[] = 'MODULE_SHIPPING_ZONES_HANDLING_' . $i;
}
return $keys;
}
}

View File

@ -0,0 +1,175 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: product_listing.php,v 1.2 2003/01/09 09:40:08 elarifr
orig: product_listing.php,v 1.41 2003/02/12 23:55:58 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
// create column list
$aDefineList = array();
$aDefineList = array('PRODUCT_LIST_MODEL' => '1',
'PRODUCT_LIST_NAME' => '2',
'PRODUCT_LIST_MANUFACTURER' => '3',
'PRODUCT_LIST_PRICE' => '4',
'PRODUCT_LIST_QUANTITY' => '5',
'PRODUCT_LIST_WEIGHT' => '6',
'PRODUCT_LIST_IMAGE' => '7',
'PRODUCT_SLAVE_BUY_NOW' => '8');
asort($aDefineList);
$column_list = array();
reset($aDefineList);
foreach($aDefineList as $column => $value) {
if ($value) $column_list[] = $column;
}
$select_column_list = '';
for ($col=0, $n=count($column_list); $col<$n; $col++) {
if ( ($column_list[$col] == 'PRODUCT_SLAVE_BUY_NOW')
|| ($column_list[$col] == 'PRODUCT_LIST_PRICE')) {
continue;
}
if (oos_is_not_null($select_column_list)) {
$select_column_list .= ', ';
}
switch ($column_list[$col]) {
case 'PRODUCT_LIST_MODEL':
$select_column_list .= 'p.products_model';
break;
case 'PRODUCT_LIST_NAME':
$select_column_list .= 'pd.products_name';
break;
case 'PRODUCT_LIST_MANUFACTURER':
$select_column_list .= 'm.manufacturers_name';
break;
case 'PRODUCT_LIST_QUANTITY':
$select_column_list .= 'p.products_quantity';
break;
case 'PRODUCT_LIST_IMAGE':
$select_column_list .= 'p.products_image';
break;
case 'PRODUCT_LIST_WEIGHT':
$select_column_list .= 'p.products_weight';
break;
default:
$select_column_list .= "pd.products_name";
break;
}
}
if (oos_is_not_null($select_column_list)) {
$select_column_list .= ', ';
}
if (!isset($nProductsID)) $nProductsID = oos_get_product_id($_GET['products_id']);
$productstable = $oostable['products'];
$products_to_mastertable = $oostable['products_to_master'];
$products_descriptiontable = $oostable['products_description'];
$manufacturerstable = $oostable['manufacturers'];
$specialstable = $oostable['specials'];
$listing_sql = "SELECT " . $select_column_list . " p.products_id, p.products_replacement_product_id, p.manufacturers_id,
p.products_price, p.products_price_list, p.products_base_price, p.products_base_unit,
p.products_quantity_order_min, p.products_quantity_order_max, p.products_product_quantity,
p.products_discount1, p.products_discount2,
p.products_discount3, p.products_discount4, p.products_discount1_qty,
p.products_discount2_qty, p.products_discount3_qty, p.products_discount4_qty,
p.products_tax_class_id, p.products_units_id,
IF(s.status, s.specials_new_products_price, NULL) AS specials_new_products_price,
IF(s.status, s.specials_new_products_price, p.products_price) AS final_price,
pm.master_id, pm.slave_id
FROM $productstable p LEFT JOIN
$manufacturerstable m ON p.manufacturers_id = m.manufacturers_id LEFT JOIN
$specialstable s ON p.products_id = s.products_id,
$products_to_mastertable pm,
$products_descriptiontable pd
WHERE p.products_setting = '2'
AND pd.products_id = p.products_id
AND pd.products_languages_id = '" . intval($nLanguageID) . "'
AND p.products_id = pm.slave_id AND
pm.master_id = '" . intval($nProductsID) . "'";
if ( (!isset($_GET['sort'])) || (!preg_match('/[1-8][ad]/', $_GET['sort'])) || (substr($_GET['sort'], 0, 1) > count($column_list)) ) {
for ($col=0, $n=count($column_list); $col<$n; $col++) {
if ($column_list[$col] == 'PRODUCT_LIST_NAME') {
$_GET['sort'] = $col+1 . 'a';
$listing_sql .= " ORDER BY pd.products_name";
break;
}
}
} else {
$sort_col = substr($_GET['sort'], 0 , 1);
$sort_order = substr($_GET['sort'], 1);
$listing_sql .= ' ORDER BY ';
switch ($column_list[$sort_col-1]) {
case 'PRODUCT_LIST_MODEL':
$listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_NAME':
$listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
break;
case 'PRODUCT_LIST_MANUFACTURER':
$listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_QUANTITY':
$listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_IMAGE':
$listing_sql .= "pd.products_name";
break;
case 'PRODUCT_LIST_WEIGHT':
$listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_PRICE':
$listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
default:
$listing_sql .= "pd.products_name";
break;
}
}
$aOption['slavery_products'] = $sTheme . '/products/_slavery_product_listing.html';
$aOption['slavery_page_navigation'] = $sTheme . '/system/_pagination.htm';
require_once MYOOS_INCLUDE_PATH . '/includes/modules/product_listing.php';
$smarty->assign('slavery_products', $smarty->fetch($aOption['slavery_products']));

View File

@ -0,0 +1,85 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: new_products.php,v 1.33 2003/02/12 23:55:58 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
if (!$oEvent->installed_plugin('spezials')) return FALSE;
if (!is_numeric(MAX_DISPLAY_NEW_SPEZILAS)) return FALSE;
$productstable = $oostable['products'];
$products_descriptiontable = $oostable['products_description'];
$specialstable = $oostable['specials'];
$sql = "SELECT p.products_id, pd.products_name, pd.products_short_description, p.products_price, p.products_tax_class_id,
p.products_units_id, p.products_quantity_order_min, p.products_quantity_order_max,
p.products_product_quantity, p.products_image, p.products_base_price, p.products_base_unit, s.specials_new_products_price
FROM $productstable p,
$products_descriptiontable pd,
$specialstable s
WHERE p.products_setting = '2'
AND s.products_id = p.products_id
AND p.products_id = pd.products_id
AND pd.products_languages_id = '" . intval($nLanguageID) . "'
AND s.status = '1'
ORDER BY s.specials_date_added DESC";
$new_spezials_result = $dbconn->SelectLimit($sql, MAX_DISPLAY_NEW_SPEZILAS);
if ($new_spezials_result->RecordCount() >= MIN_DISPLAY_NEW_SPEZILAS) {
$aSpezials = array();
while ($new_spezials = $new_spezials_result->fields) {
$new_spezials_base_product_price = NULL;
$new_spezials_base_product_special_price = NULL;
if ($aUser['show_price'] == 1 ) {
$new_spezials_product_price = $oCurrencies->display_price($new_spezials['products_price'], oos_get_tax_rate($new_spezials['products_tax_class_id']));
$new_spezials_product_special_price = $oCurrencies->display_price($new_spezials['specials_new_products_price'], oos_get_tax_rate($new_spezials['products_tax_class_id']));
if ($new_spezials['products_base_price'] != 1) {
$new_spezials_base_product_price = $oCurrencies->display_price($new_spezials['products_price'] * $new_spezials['products_base_price'], oos_get_tax_rate($new_spezials['products_tax_class_id']));
$new_spezials_base_product_special_price = $oCurrencies->display_price($new_spezials['specials_new_products_price'] * $new_spezials['products_base_price'], oos_get_tax_rate($new_spezials['products_tax_class_id']));
}
}
$order_min = number_format($new_spezials['products_quantity_order_min']);
$order_max = number_format($new_spezials['products_quantity_order_max']);
$aSpezials[] = array('products_id' => $new_spezials['products_id'],
'products_image' => $new_spezials['products_image'],
'products_name' => $new_spezials['products_name'],
'products_short_description' => $new_spezials['products_short_description'],
'order_min' => $order_min,
'order_max' => $order_max,
'product_quantity' => $new_spezials['products_product_quantity'],
'products_base_unit' => $new_spezials['products_base_unit'],
'products_base_price' => $new_spezials['products_base_price'],
'products_units' => $new_spezials['products_units_id'],
'products_price' => $new_spezials_product_price,
'products_special_price' => $new_spezials_product_special_price,
'base_product_price' => $new_spezials_base_product_price,
'base_product_special_price' => $new_spezials_base_product_special_price);
// Move that ADOdb pointer!
$new_spezials_result->MoveNext();
}
$smarty->assign('spezials', $aSpezials);
}

View File

@ -0,0 +1,44 @@
<?php
/* ----------------------------------------------------------------------
MyOOS [Shopsystem]
https://www.oos-shop.de
Copyright (c) 2003 - 2019 by the MyOOS Development Team.
----------------------------------------------------------------------
Based on:
File: upcoming_products.php,v 1.23 2003/02/12 23:55:58 hpdl
----------------------------------------------------------------------
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
----------------------------------------------------------------------
Released under the GNU General Public License
---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) OR die( 'Direct Access to this location is not allowed.' );
if (!is_numeric(MAX_DISPLAY_UPCOMING_PRODUCTS)) return FALSE;
$productstable = $oostable['products'];
$products_descriptiontable = $oostable['products_description'];
$sql = "SELECT p.products_id, pd.products_name, products_date_available AS date_expected
FROM $productstable p,
$products_descriptiontable pd
WHERE to_days(products_date_available) >= to_days(now()) AND
p.products_id = pd.products_id AND
pd.products_languages_id = '" . intval($nLanguageID) . "'
ORDER BY
" . EXPECTED_PRODUCTS_FIELD . "
" . EXPECTED_PRODUCTS_SORT;
$expected_result = $dbconn->SelectLimit($sql, MAX_DISPLAY_UPCOMING_PRODUCTS);
if ($expected_result->RecordCount() > 0) {
$smarty->assign('expected_array', $expected_result->GetArray());
}