Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

add data with module orders_table


zeberrun

Recommended Posts

Posted

box size is 7 inch (size), newprice is %10 (interest) more of total order. module takes box size and adds %10 percent to total.

shows in checkout confirmation but after confirmed, it does not add % 10 to orders_total table, even do not send % 10 with confirmation mail.

 

what can be the reason ?where do i seach the mistake.

 

 

$size = $HTTP_POST_VARS['size'];

 

$interest = @ constant('MODULE_ORDER_TOTAL_SIZE_' . $size);

if ($interest == '0' || !$interest){

$cond_clac = false;

} else {

$cond_calc = true;

}

}

 

$calcinterest= ($order->info['total'] * $interest/ 100);

 

if ($cond_calc) {

 

$order->info['tax'] += tep_calculate_tax($calcinterest, $tax);

$order->info['tax_groups'][$taxname] += tep_calculate_tax($calcinterest, $tax);

$order->info['total'] += $calcinterest+ tep_calculate_tax($calcinterest, $tax);

 

 

 

$this->output[] = array('title' => $this->title . ' (size% ' . $interest. ') :',

'text' => $currencies->format(tep_add_tax($calcinterest, $tax), true, $order->info['currency'], $order->info['currency_value']),

'value' => tep_add_tax($calcinterest, $tax));

 

 

}

}

}

Posted

i create a modul, it looks the weight of product and adds %10, %12, %15 etc. i mean if the weight is 7 it adds %10 order_total. i can see this calculation in checkout confirmation. i mean the rest is working correct.

 

but after checkout process, i can not see ths calculation in orders (admin),

 

subtotal 7

shipping 5

... (there must be here if %10) 0,12

 

i checked the orders_total table, ot_subtotal, ot_shipping are there but ot_weight_fee.

 

i think this code does not add ot_weight_fee to orders_table. what is wrong with this???

 

 

class ot_weight_fee {

var $title, $output;

 

function ot_weight_fee() {

$this->code = 'ot_weight_fee';

$this->title = MODULE_ORDER_TOTAL_WEIGHT_TITLE;

$this->description = MODULE_ORDER_TOTAL_WEIGHT_DESCRIPTION;

$this->enabled = ((MODULE_ORDER_TOTAL_WEIGHT_STATUS == 'YES') ? true : false);

$this->sort_order = MODULE_ORDER_TOTAL_WEIGHT_SORT_ORDER;

 

$this->output = array();

}

 

function process() {

global $payment, $order, $currencies, $cod_cost, $cod_country, $HTTP_POST_VARS, $class_id, $country_id, $zone_id;

 

 

if (MODULE_ORDER_TOTAL_WEIGHT_STATUS == 'YES') {

 

$tax = tep_get_tax_rate(MODULE_ORDER_TOTAL_WEIGHT_TAX_CLASS);

$taxname = tep_get_tax_description(MODULE_ORDER_TOTAL_WEIGHT_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);

if ($GLOBALS['payment'] == 'weightspecial') {

 

$size = $HTTP_POST_VARS['size'];

 

$interest = @ constant('MODULE_ORDER_TOTAL_SIZE_' . $size);

if ($interest == '0' || !$interest){

$cond_clac = false;

} else {

$cond_calc = true;

}

}

 

$calcinterest= ($order->info['total'] * $interest/ 100);

 

if ($cond_calc) {

 

$order->info['tax'] += tep_calculate_tax($calcinterest, $tax);

$order->info['tax_groups'][$taxname] += tep_calculate_tax($calcinterest, $tax);

$order->info['total'] += $calcinterest+ tep_calculate_tax($calcinterest, $tax);

 

 

 

$this->output[] = array('title' => $this->title . ' (size% ' . $interest. ') :',

'text' => $currencies->format(tep_add_tax($calcinterest, $tax), true, $order->info['currency'], $order->info['currency_value']),

'value' => tep_add_tax($calcinterest, $tax));

 

 

}

}

}

function check() {

if (!isset($this->_check)) {

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_WEIGHT_STATUS'");

$this->_check = tep_db_num_rows($check_query);

}

 

return $this->_check;

}

 

function keys() {

return array('MODULE_ORDER_TOTAL_WEIGHT_STATUS', 'MODULE_ORDER_TOTAL_WEIGHT_SORT_ORDER', 'MODULE_ORDER_TOTAL_WEIGHT_02_STATUS', 'MODULE_ORDER_TOTAL_WEIGHT_SIZE_02', 'MODULE_ORDER_TOTAL_WEIGHT_03_STATUS', 'MODULE_ORDER_TOTAL_WEIGHT_SIZE_03', 'MODULE_ORDER_TOTAL_WEIGHT_04_STATUS', 'MODULE_ORDER_TOTAL_WEIGHT_SIZE_04', 'MODULE_ORDER_TOTAL_WEIGHT_05_STATUS', 'MODULE_ORDER_TOTAL_WEIGHT_SIZE_05', 'MODULE_ORDER_TOTAL_WEIGHT_06_STATUS', 'MODULE_ORDER_TOTAL_WEIGHT_SIZE_06', 'MODULE_ORDER_TOTAL_WEIGHT_07_STATUS', 'MODULE_ORDER_TOTAL_WEIGHT_SIZE_07', 'MODULE_ORDER_TOTAL_WEIGHT_08_STATUS', 'MODULE_ORDER_TOTAL_WEIGHT_SIZE_08', 'MODULE_ORDER_TOTAL_WEIGHT_09_STATUS', 'MODULE_ORDER_TOTAL_WEIGHT_SIZE_09', 'MODULE_ORDER_TOTAL_WEIGHT_10_STATUS', 'MODULE_ORDER_TOTAL_WEIGHT_SIZE_10', 'MODULE_ORDER_TOTAL_WEIGHT_11_STATUS', 'MODULE_ORDER_TOTAL_WEIGHT_SIZE_11', 'MODULE_ORDER_TOTAL_WEIGHT_12_STATUS', 'MODULE_ORDER_TOTAL_WEIGHT_SIZE_12', 'MODULE_ORDER_TOTAL_WEIGHT_TAX_CLASS');

}

Posted

This sounds like you are adding a Tare weight to all orders. Why not use the Tare weight settings in osCommerce?

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Posted

it seems tare weight is standart, does not related with total price.

 

for

mattjt83

 

but if i did not post size, i did not see in calculation in checkout confirmation page ?

 

in checkout confirmation i can see this difference,

 

 

subtotal 10

shipping 2

difference 1

total 13

 

charges to customer by online credit card 13 but seen in orders 12, i mean it is not in return.

also mailing to customer as 12

$HTTP_POST_VARS['size'];

Posted

@@zeberrun

 

I was saying you DID post the data to checkout_confirmation but then you would also need to post the data to the checkout_process file.

 

Just totally guessing here since I haven't seen your code... You could try to add this somewhere within the <form></form> tags on checkout_confirmation:

 

if ( isset($HTTP_POST_VARS['size']) && tep_not_null($HTTP_POST_VARS['size']) ){
echo tep_draw_hidden_field('size', tep_output_string_protected($HTTP_POST_VARS['size']));
}

 

Then when you submit that page it will also post that data...

Matt

Archived

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

×
×
  • Create New...