News:

Support the VirtueMart project and become a member

Main Menu

Phpshop shipping module (flex)

Started by tonysbt, June 03, 2005, 17:08:19 PM

Previous topic - Next topic

tonysbt

sorry but don't speek english

Phpshop shipping module (flex)

Ho trovato sul sito ufficiale un modulo aggiuntivo per il calcolo delle spese di spedizione.
In pratica dovrebbe calcolare le spese di trasporto in base al valore della merce acquistata.
Solo che a me non funziona e essendo proprio a digiiuno di php non riesco a risolvere il problema (che credo aver individfuato )
Dall'esame del listato e da alcuni esperimenti in locale ho notasto che la variabile $order_total รจ sempre vuota.
vi posto una parte del file cosi da permettervi di capire meglio

<?php
defined
('_VALID_MOS') or die('Direct Access to this location is not allowed.');
/*
* @version $Id: flex.php,v .2 2005/02/16 M_Shawn Exp $
* @package Mambo_4.5.1
* @subpackage mambo-phpShop
* @copyright (C) 2004 Micah Shawn
*
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* mambo-phpShop is Free Software.
* mambo-phpShop comes with absolute no warranty.
* www.mambo-phpshop.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
* threshhold.
*
************************************************** *****************************
*/
class flex {



var 
$classname "flex";

function 
list_rates( &$d ) {
$db =& new ps_DB;
$dbv =& new ps_DB;

$cart $_SESSION['cart'];

/** Read current Configuration ***/
require_once(CLASSPATH ."shipping/".$this->classname.".cfg.php");



$order_total $d['total'];


//Charge minimum up to this value in cart
$base_ship BASE_AMOUNT;

//Flat rate shipping charge up to minimum value
$flat_charge MIN_CHG;

//Charge this percentage if cart value is greater than base amount
$ship_rate_perc = (SHIP_PERC 100);

//Flat rate handling fee
$handling_fee HAND_FEE;



if(
$order_total $base_ship) {
$flex_rate = ($flat_charge $handling_fee);
$flex_rate number_format ($flex_rate,2);
$shipping_rate_id urlencode("STD|Standard Shipping under ".$base_ship."|".$flex_rate);
$html "";
$html .= "\n<input type=\"radio\" name=\"shipping_rate_id\" $checked value=\"$shipping_rate_id\" />\n";
$html .= " Standard Shipping: ".$flex_rate;

$_SESSION[$shipping_rate_id] = 1;
}
else {
$shipping_temp1 = (($order_total $ship_rate_perc)+ $handling_fee);
$shipping_temp1 number_format ($shipping_temp1,2);
$shipping_rate_id urlencode("STD|Standard Shipping over ".$base_ship."|".$shipping_temp1);
$html "";
$html .= "\n<input type=\"radio\" name=\"shipping_rate_id\" $checked value=\"$shipping_rate_id\" />\n";
$html .= "(supera il minimo) Standard Shipping: $";
$html .= $shipping_temp1;
$_SESSION[$shipping_rate_id] = 1;
}
echo 
$html;
return 
true;

Soeren

Whatever you said, here's an updated version of this module:

flex.php

ciao, Soeren
The future of eCommerce: VirtueMart & Joomla!
http://virtuemart.net

tonysbt

sorry but don't work because the variabile $order_total is null or blank why? this
You test the problem in my demo site http://www.bannershop.it/shop1 use user "test" password "test"
please help me

rworton

#3
Hi, could someone just outline how to install the flex.php file please.

Where do you save the plex.php file?
Do you configure it inside the VirtueMart interface?
Are there any other files needed?

Also is this for VirtueMart or MamboPHP Shop?

Thank you so much.