Hallo,
ich habe glaube ich ein Unlösbares Problem, ich bin aber ganz schön am Verzweifeln, das Internet spuckt genauso viel aus wie mein Kopf.
Und zwar geht es um meine Versandkosten in Virtuemart.
Damit ich jeden Produkt und jeder Kategorie Versandkosten einfügen kann habe ich ein VersandModule aus dem Internet geholt.
Es funktioniert Perfekt, ich habe eine shipping_cat.php Datei die wie folgt aussieht.
PHP-Code:
<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
*
* @version $Id: shipping_cat.php 1095 2007-12-19 20:19:16Z soeren_nb $
* @package VirtueMart
* @subpackage shipping
* @copyright Copyright (C) 2004-2007 soeren - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
/**
*
*
* This class will charge a fixed shipping rate for orders under a minimum sales
* threshhold and a percentage of the total order price for orders over that
* threshold.
* @copyright (C) 2009 Denise Hagenow, Christoph Kluge
*
*******************************************************************************
*/
class shipping_cat {
/**
* Lists all available shipping rates
*
* @param array $d
* @return boolean
*/
var $classname = "shipping_cat";
/**************************************************************************
** name: list_rates( $d )
** created by: soeren
***************************************************************************/
function list_rates( &$d ) {
$cat1 = 0;
$cat2 = 0;
$versand = 0;
$shippingId = array();
foreach ($_SESSION['cart'] as $index => $key) {
if ( $key['category_id'] == 1 ) $shippingId[1]['count'] += 1;
if ( $key['category_id'] == 1 ) $shippingId[1]['price'] = 0;
if ( $key['category_id'] == 2 ) $shippingId[2]['count'] += 1;
if ( $key['category_id'] == 2 ) $shippingId[2]['price'] = 0;
if ( $key['category_id'] == 3 ) $shippingId[3]['count'] += 1;
if ( $key['category_id'] == 3 ) $shippingId[3]['price'] = 3.50;
if ( $key['product_id'] == 5 ) $shippingId[3]['price'] = 0;
if ( $key['product_id'] == 6 ) $shippingId[3]['price'] = 0;
if ( $key['product_id'] == 7 ) $shippingId[3]['price'] = 3.50;
}
if ( isset($shippingId[5]['count']) && $shippingId[5]['count'] > 0 && isset($shippingId[6]['count']) && $shippingId[6]['count'] > 0) {
$shippingId[5]['count'] = 0;
$shippingId[6]['count'] += 1;
}
foreach ($shippingId as $index => $key) {
if ( isset ( $shippingId[$index]['count'] ) &&
$shippingId[$index]['count'] > 0 ) {
$versand += $shippingId[$index]['price'];
}
}
$shipping_rate_id = '';
$shipping_rate_id =
urlencode($this->classname."|STD|Standard|".$versand);
echo "<input type=\"radio\" name=\"shipping_rate_id\"
checked=\"checked\" value=\"" . $shipping_rate_id . "\" id=\"" .
$shipping_rate_id . "\" /> <label for=\"" . $shipping_rate_id .
"\">Standard \"" . $versand . "\" €</label>";
$_SESSION[$shipping_rate_id] = 1;
}
/**************************************************************************
** name: get_rate( $d )
** created by: soeren
***************************************************************************/
function get_rate( &$d ) {
$shipping_rate_id = $d["shipping_rate_id"];
$is_arr = explode("|", urldecode(urldecode($shipping_rate_id)) );
$order_shipping = $is_arr[3];
return $order_shipping;
}
/**************************************************************************
** name: get_tax_rate()
** created by: soeren
***************************************************************************/
function get_tax_rate() {
return 0;
}
}
?>
Bei diesen Abschnitt
PHP-Code:
if ( $key['category_id'] == 1 ) $shippingId[1]['count'] += 1;
trage ich meine Versandkosten ein je nach Kategorie und Produkte.
Das ist ja gut und schon wenn man nur ein Produkt kauft, wenn jedoch mehrere Produkte gekauft werden, werden die Versandkosten des ersten Produktes angezeigt wo man ausgewählt hat.
Beispiel
1x Aufkleber - Versandkosten 3.50 Euro
1x T-Shirt - Versandkosten 0.00 Euro
Klickt man zu erst auf den Aufkleber und dann das T-Shirt in den Warenkorb werden als Versandkosten 3.50 Euro angezeigt. Wird es jedoch anders rum in den Warenkorb genommen werden die Versandkosten vom T-Shirt übernommen, also 0.00 .- Euro
Ich möchte jedoch das die Versandkosten vom T-Shirt mit eingefügt werden.
Hat jemand eine Lösung? Bzw. soll ich das Module deaktivieren und ein neues nehmen?
Mit freundl. Grüßen,
Sirius
Lesezeichen