Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shipping


Michael2007

Recommended Posts

Posted

Is it possible to inactivate an shipping method at an certain weight of the order.

I want to have different kinds of shipping cost for different kind of items.

 

Example

 

Orders < $100 - shipping costs $10

Orders > $100 - shippig costs $5

Orders > $200 - free shippinh

 

But orders containing bicycle should cost $35

 

Maby if setting a high weight for bicycle items I could separate them from other items.

I want to set something like:

 

if ($total_weight > 49) {

MODULE_SHIPPING_TABLE_MODE == 'weight';

MODULE_SHIPPING_TABLE_COST == '49:0.00,50:349.00,10000:349.00';

} else {

MODULE_SHIPPING_TABLE_MODE == 'price';

MODULE_SHIPPING_TABLE_COST == '999:149.00,1999:99.00,2000:0.00';

}

 

Where can I do this, I tried in the shipping module table.php but it didn't work---

 

Any ideas?

Posted

yes it will work and try in the checkout_shipping.php

 

Is it possible to inactivate an shipping method at an certain weight of the order.

I want to have different kinds of shipping cost for different kind of items.

 

Example

 

Orders < $100 - shipping costs $10

Orders > $100 - shippig costs $5

Orders > $200 - free shippinh

 

But orders containing bicycle should cost $35

 

Maby if setting a high weight for bicycle items I could separate them from other items.

I want to set something like:

 

if ($total_weight > 49) {

MODULE_SHIPPING_TABLE_MODE == 'weight';

MODULE_SHIPPING_TABLE_COST == '49:0.00,50:349.00,10000:349.00';

} else {

MODULE_SHIPPING_TABLE_MODE == 'price';

MODULE_SHIPPING_TABLE_COST == '999:149.00,1999:99.00,2000:0.00';

}

 

Where can I do this, I tried in the shipping module table.php but it didn't work---

 

Any ideas?

Posted

Ok, good!

 

But I can't get it to work.. Could you tell me more specific where I should put the code?

 

Thanks!

Posted

without looking at your configuration I would say in this area you are going to have to play with it a bit

 

// process the selected shipping method

if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') ) {

if (!tep_session_is_registered('comments')) tep_session_register('comments');

if (tep_not_null($HTTP_POST_VARS['comments'])) {

$comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);

}

 

if (!tep_session_is_registered('shipping')) tep_session_register('shipping');

 

if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) {

if ( (isset($HTTP_POST_VARS['shipping'])) && (strpos($HTTP_POST_VARS['shipping'], '_')) ) {

$shipping = $HTTP_POST_VARS['shipping'];

 

list($module, $method) = explode('_', $shipping);

if ( is_object($$module) || ($shipping == 'free_free') ) {

if ($shipping == 'free_free') {

$quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;

$quote[0]['methods'][0]['cost'] = '0';

} else {

$quote = $shipping_modules->quote($method, $module);

}

if (isset($quote['error'])) {

tep_session_unregister('shipping');

} else {

if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {

$shipping = array('id' => $shipping,

'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),

'cost' => $quote[0]['methods'][0]['cost']);

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

}

}

} else {

tep_session_unregister('shipping');

}

}

} else {

$shipping = false;

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

}

}

 

 

 

Ok, good!

 

But I can't get it to work.. Could you tell me more specific where I should put the code?

 

Thanks!

Posted

I am stupid try looking in the

 

 

// load all enabled shipping modules

require(DIR_WS_CLASSES . 'shipping.php');Most likely in there.

Posted

Yeah that's where I put it but no result.

 

Tried to put it in classes/shipping.php

 

And also tried

 

if ($total_weight > 49) {

define('MODULE_SHIPPING_TABLE_MODE','weight');

define('MODULE_SHIPPING_TABLE_COST','49:0.00,50:349.00,10000:349.00');

} else {

define('MODULE_SHIPPING_TABLE_MODE','price');

define('MODULE_SHIPPING_TABLE_COST','999:149.00,1999:99.00,2000:0.00');

}

 

 

Because the use of double = was not right in the code before?

And when I use one =, it returned some error

Posted

whats the error ?

 

Yeah that's where I put it but no result.

 

Tried to put it in classes/shipping.php

 

And also tried

 

if ($total_weight > 49) {

define('MODULE_SHIPPING_TABLE_MODE','weight');

define('MODULE_SHIPPING_TABLE_COST','49:0.00,50:349.00,10000:349.00');

} else {

define('MODULE_SHIPPING_TABLE_MODE','price');

define('MODULE_SHIPPING_TABLE_COST','999:149.00,1999:99.00,2000:0.00');

}

Because the use of double = was not right in the code before?

And when I use one =, it returned some error

Posted

It's "Parse error: syntax error, unexpected '=' in ..."

 

Because none of MODULE_SHIPPING_TABLE_MODE or MODULE_SHIPPING_TABLE_COST is variables with $ before.. Am I right?

 

I have now created 2 shippingmodules, table.php and table2.php

They are set separatly like I want them.

Maby I could put something like

 

if ($shipping_weight > 49) {$this->enabled = false;}

 

in table.php so that only table2.php will be visible.

 

But the problem is that It seems that $shipping_weight is not the right variable. Seems to be zero all the time..

If i write $shipping_weight = 50; before the code it works..

Posted

It's "Parse error: syntax error, unexpected '=' in ..."

 

Because none of MODULE_SHIPPING_TABLE_MODE or MODULE_SHIPPING_TABLE_COST is variables with $ before.. Am I right?

 

I have now created 2 shippingmodules, table.php and table2.php

They are set separatly like I want them.

Maby I could put something like

 

if ($shipping_weight > 49) {$this->enabled = false;}

 

in table.php so that only table2.php will be visible.

 

But the problem is that It seems that $shipping_weight is not the right variable. Seems to be zero all the time..

If i write $shipping_weight = 50; before the code it works..

Posted

It's "Parse error: syntax error, unexpected '=' in ..."

 

Because none of MODULE_SHIPPING_TABLE_MODE or MODULE_SHIPPING_TABLE_COST is variables with $ before.. Am I right?

 

I have now created 2 shippingmodules, table.php and table2.php

They are set separatly like I want them.

Maby I could put something like

 

if ($shipping_weight > 49) {$this->enabled = false;}

 

in table.php so that only table2.php will be visible.

 

But the problem is that It seems that $shipping_weight is not the right variable. Seems to be zero all the time..

If i write $shipping_weight = 50; before the code it works..

Posted

It's "Parse error: syntax error, unexpected '=' in ..."

 

Because none of MODULE_SHIPPING_TABLE_MODE or MODULE_SHIPPING_TABLE_COST is variables with $ before.. Am I right?

 

I have now created 2 shippingmodules, table.php and table2.php

They are set separatly like I want them.

Maby I could put something like

 

if ($shipping_weight > 49) {$this->enabled = false;}

 

in table.php so that only table2.php will be visible.

 

But the problem is that It seems that $shipping_weight is not the right variable. Seems to be zero all the time..

If i write $shipping_weight = 50; before the code it works..

Posted

It's "Parse error: syntax error, unexpected '=' in ..."

 

Because none of MODULE_SHIPPING_TABLE_MODE or MODULE_SHIPPING_TABLE_COST is variables with $ before.. Am I right?

 

I have now created 2 shippingmodules, table.php and table2.php

They are set separatly like I want them.

Maby I could put something like

 

if ($shipping_weight > 49) {$this->enabled = false;}

 

in table.php so that only table2.php will be visible.

 

But the problem is that It seems that $shipping_weight is not the right variable. Seems to be zero all the time..

If i write $shipping_weight = 50; before the code it works..

Posted

Solved it by adding MODULE_SHIPPING_TABLE2_COST to the database and replacing

 

<?php

$table_cost = split("[:,]" , MODULE_SHIPPING_TABLE_COST);

?>

 

with

 

<?php

if ($shipping_weight > 49) {

$order_total = $shipping_weight;

$table_cost = split("[:,]" , MODULE_SHIPPING_TABLE2_COST);

} else {

$table_cost = split("[:,]" , MODULE_SHIPPING_TABLE_COST);

}

?>

 

in modules/shipping/table.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...