Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Hi !!!!!! :)

 

how to invoice the highest value only with individual shipping contribution ???

 

exemple :

I have 3 products ,

A >> shipping cost is 5 $

B >> shipping cost is 10 $

C >> shipping cost is 15 $

 

If a customer buy A + B, the shipping cost is 10 ?

If a customer buy A + C, the shipping cost is 15 ?

 

Thanks ;)

Posted
Hi !!!!!! :)

 

how to invoice the highest value only with individual shipping contribution ???

 

exemple :

I have 3 products ,

A >> shipping cost is 5 $

B >> shipping cost is 10 $

C >> shipping cost is 15 $

 

If a customer buy A + B, the shipping cost is 10 ?

If a customer buy A + C, the shipping cost is 15 ?

 

Thanks ;)

 

As I do, inside of my country, to distribute for states the price of the freight.

 

And in the international languages as I do to do the distribution of prices and taxes customs

 

In different options.

:angry:
Posted (edited)

hello

 

I have modified the function calculate in class " shopping_cart.php" like that :

 

function calculate() {

$this->total = 0;

$this->weight = 0;

$highest_weight = 0;

// mod indvship

$this->shiptotal = 0;

// end indvship

if (!is_array($this->contents)) return 0;

 

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

$qty = $this->contents[$products_id]['qty'];

 

// products price

$product_query = tep_db_query("select products_id, products_price, products_ship_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

if ($product = tep_db_fetch_array($product_query)) {

$prid = $product['products_id'];

$products_tax = tep_get_tax_rate($product['products_tax_class_id']);

$products_price = $product['products_price'];

$products_weight = $product['products_weight'];

 

// mod indvship

$products_ship_price = $product['products_ship_price'];

// end indvship

 

$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");

if (tep_db_num_rows ($specials_query)) {

$specials = tep_db_fetch_array($specials_query);

$products_price = $specials['specials_new_products_price'];

}

 

$this->total += tep_add_tax($products_price, $products_tax) * $qty;

// mod indvship

//$this->shiptotal += ($products_ship_price * $qty);

// end indvship

 

if ($products_weight > $highest_weight) {

$this->weight = $products_weight;

$this->shiptotal = $products_ship_price;

}

// attributes price

if (isset($this->contents[$products_id]['attributes'])) {

reset($this->contents[$products_id]['attributes']);

while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {

$attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");

$attribute_price = tep_db_fetch_array($attribute_price_query);

if ($attribute_price['price_prefix'] == '+') {

$this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);

} else {

$this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);

}

}

}

}

}

}

What you think about this modifications ? Is not very good, i have some bugs

Can you help me please ? I need really assistance and I want to publish this contribution for OSC community

Edited by feyesh
Posted

hey jccmenezes, you are crazy man !

 

I dont says

 

"Can you tell me about your life "

 

You are a BOULET .

 

I just want answers for my question

Posted
Hi !!!!!! :)

 

how to invoice the highest value only with individual shipping contribution ???

 

exemple :

I have 3 products ,

A >> shipping cost is 5 $

B >> shipping cost is 10 $

C >> shipping cost is 15 $

 

If a customer buy A + B, the shipping cost is 10 ?

If a customer buy A + C, the shipping cost is 15 ?

 

Thanks ;)

 

One way is within the shipping module code you could modify function quote() so you retrieve the shipping cost for each product in the order. You iterate through the products each time storing the max shipping cost. Then you return the max as the final quote of shipping.

  • 1 year later...
Posted
One way is within the shipping module code you could modify function quote() so you retrieve the shipping cost for each product in the order. You iterate through the products each time storing the max shipping cost. Then you return the max as the final quote of shipping.

Hi there, has anyone put this into practice? In theory I'm completely with you, bus as I am one of these bloody newbies to PHP (and errr - call it lazy ...;-)), I would like to save this hassle...

I'd be very happy if anyone could share the code for that please. Cheers in advance.

rgds,

jogi.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...