Max order price

zoo33@drupal.org's picture
Offline
Joined: 08/23/2007
Juice: 13
Max order price

I can't find any parts of the uc_worldquote_quote() that deals with the Max order price setting. I added these snippets of code to make it work:

<?php

 

//get order weight and price
 
$pkgweight = 0;
 
$pkgprice = 0; // << addition
 
foreach ($products as $product) {
   
$units = $product->units;
   
//make everything into kg
   
$kg = $product->weight;// * constant(strtoupper($units) .'_TO_KG');
    // ^^ by the way, the line above gave me errors so I commented it out
   
$kg = $kg * $product->qty;
   
$pkgweight += $kg;
   
$pkgprice += $product->qty * $product->sell_price; // << addition
 
}

<

snip>

  foreach(

$rules as $rule) {
   
    if (
$pkgprice <= $rule->max_amount) { // << addition
     
switch ($rule->flat_weight) {
        case
'flat':
         
$rate += $rule->rate;
          break;
        case
'weight':
         
$units = $rule->units;
         
$rate += $rule->rate * $pkgweight;
          break;
      }
    }
?>

Guess this module needs some work. I needed this functionality now, so I settled for these hackish changes for now.

World Quotes By: arbel (79 replies) Wed, 09/26/2007 - 20:45