Re: Rush/Priority Handling Charge
did you ever find a solution to this? I too have priority handling and fast and easy checkout installed and have the same issue. the update buttons don't work. I would settle for just removing the buttons but I cant figure out how to do that. any help would be appreciated. Thanks
JP
Quote:
Originally Posted by
joeyrocket
I seem to be having trouble with this. I presumed that this would work with the Fast and Easy Checkout add-on, because this (Rush/Priority Handling) was based on another mod created by Numinix (same developer).
Also, on my single page checkout, I get a little update button next to the Priority Handling, which is not present in the standard checkout.
This would lead me to assume that the two are compatible. However, when I choose to accept the handling charge and click the update button, it refreshes the page and the total remains unchanged, while the checkbox becomes unchecked.
This works fine in the standard checkout. It is only having problems with the Fast and Easy checkout enabled. Is Priority Handling incompatible with the newest version of fast and easy checkout, or did I perhaps break something?
Re: Rush/Priority Handling Charge
My client needs two different priority charges so I duplicated this mod and made enough changes to have it show up in admin. However, only one - the original one - shows up at checkout.
I have carefully gone through and removed anything that can be remotely thought to conflict with the first version - and there was more than usual.
I'm posting the new module here in hopes someone can take a quick look and see if I've missed something or if there's something in the mod that makes it impossible to do this. I don't see the problem!
PHP Code:
<?php
/*
Priority Handling Module
ot_express_handling.php, v 1.0 2003/12/03
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 osCommerce
Modified to work with zen cart
Released under the GNU General Public License
*/
class ot_express_handling {
var $title, $output;
function ot_express_handling()
{
$this->code = 'ot_express_handling';
$this->title = MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TITLE;
$this->description = MODULE_ORDER_TOTAL_EXPRESS_HANDLING_DESCRIPTION;
$this->enabled = MODULE_ORDER_TOTAL_EXPRESS_HANDLING_STATUS;
$this->sort_order = MODULE_ORDER_TOTAL_EXPRESS_HANDLING_SORT_ORDER;
$this->credit_class = 'true';
$this->output = array();
}
function process()
{
global $order, $currencies;
if (MODULE_ORDER_TOTAL_EXPRESS_HANDLING_USE == 'true') {
if (! $_SESSION['express_handling']) {
$charge_it = 'false';
} else {
$charge_it = true;
}
// get country/zone id (copy & paste from functions_taxes.php)
if (isset($_SESSION['customer_id'])) {
$cntry_id = $_SESSION['customer_country_id'];
$zn_id = $_SESSION['customer_zone_id'];
} else {
$cntry_id = STORE_COUNTRY;
$zn_id = STORE_ZONE;
}
if ($charge_it == 'true') {
$tax = zen_get_tax_rate(MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TAX_CLASS);
if (MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TYPE =='percent') {
$eh_tax = zen_calculate_tax(($order->info['subtotal'] * MODULE_ORDER_TOTAL_EXPRESS_HANDLING_PER / 100), $tax);
$eh_subtotal = $order->info['subtotal'] * MODULE_ORDER_TOTAL_EXPRESS_HANDLING_PER / 100;
} else {
if ($order->info['subtotal'] > MODULE_ORDER_TOTAL_EXPRESS_HANDLING_OVER) {
$est = MODULE_ORDER_TOTAL_EXPRESS_HANDLING_OVER;
} else {
$est = $order->info['subtotal'];
}
$how_often = ceil($est/MODULE_ORDER_TOTAL_EXPRESS_HANDLING_INCREMENT);
$eh_tax = zen_calculate_tax((MODULE_ORDER_TOTAL_EXPRESS_HANDLING_FEE * $how_often), $tax);
$eh_subtotal = (MODULE_ORDER_TOTAL_EXPRESS_HANDLING_FEE * $how_often);
}
if (MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TAX_INLINE == 'Handling Fee') {
$eh_text = $currencies->format($eh_subtotal+$eh_tax, true, $order->info['currency'], $order->info['currency_value']);
$eh_value = $eh_subtotal+$eh_tax; // nr@sebo addition
} else {
$tax_descrip = zen_get_tax_description(MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TAX_CLASS, $cntry_id, $zn_id);
$order->info['tax_groups'][$tax_descrip]+= $eh_tax;
$eh_text = $currencies->format($eh_subtotal, true, $order->info['currency'], $order->info['currency_value']);
$eh_value = $eh_subtotal; // nr@sebo addition
}
$order->info['tax'] += $eh_tax;
$order->info['total'] += $eh_subtotal + $eh_tax;
$this->output[] = array('title' => $this->title . ':','text' => $eh_text,'value' => $eh_value);
}
} else if ($charge_it == 'false') {
$tax = zen_get_tax_rate(MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TAX_CLASS);
$express_handling = 0;
$order->info['tax'] += zen_calculate_tax($express_handling, $tax);
$order->info['total'] += $express_handling + zen_calculate_tax($express_handling, $tax);
$this->output[] = array('title' => $this->title . ':',
'text' => $currencies->format(zen_add_tax($express_handling, $tax) + zen_calculate_tax($express_handling, $tax), true, $order->info['currency'], $order->info['currency_value']),
'value' => zen_add_tax($express_handling, $tax));
}
}
function pre_confirmation_check($order_total)
{
return 0.0;
}
function get_order_total() {
global $order;
$order_total_tax = $order->info['tax'];
$order_total = $order->info['total'];
if ($this->include_shipping != 'true') $order_total -= $order->info['shipping_cost'];
if ($this->include_tax != 'true') $order_total -= $order->info['tax'];
$orderTotalFull = $order_total;
$order_total = array('totalFull'=>$orderTotalFull, 'total'=>$order_total, 'tax'=>$order_total_tax);
return $order_total;
}
function credit_selection()
{
$selected = (($_SESSION['express_handling'] == '1') ? true : false);
$selection = array(
'id' => $this->code,
'module' => $this->title,
'redeem_instructions' => MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TEXT_DESCR.'<br><br>',
'fields' => array(array(
'field' => zen_draw_checkbox_field('opt_express_handling', '1', $selected),
'title' => MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TEXT_ENTER_CODE
))
);
return $selection;
}
function update_credit_account($i)
{
}
function apply_credit()
{
}
function clear_posts()
{
unset($_SESSION['express_handling']);
}
function collect_posts()
{
global $db, $currencies;
if ($_POST['opt_express_handling']) {
$_SESSION['express_handling'] = $_POST['opt_express_handling'];
} else {
$_SESSION['express_handling'] = '0';
}
}
function check()
{
global $db;
if (!isset($this->check)) {
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_STATUS'");
$this->check = $check_query->RecordCount();
}
return $this->check;
}
function keys()
{
return array('MODULE_ORDER_TOTAL_EXPRESS_HANDLING_STATUS','MODULE_ORDER_TOTAL_EXPRESS_HANDLING_USE', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_SORT_ORDER', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TYPE', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_PER', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_FEE', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_INCREMENT', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_OVER', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TAX_CLASS','MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TAX_INLINE');
}
function install()
{
global $db;
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Priority Handling Module', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_STATUS', 'true', 'Do you want to enable this module? To fully turn this off, both this option and the one below should be set to false.', '6', '1','zen_cfg_select_option(array(\'true\', \'false\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values('Offer Priority Handling?', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_USE', 'true', 'Do you want to offer express handling?', '6', '2', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values('Sort Order', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_SORT_ORDER', '150', 'Sort order of display.', '6', '3', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values('Priority Handling Charge Type', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TYPE', 'percent', 'Specify whether the handling charge should be a percentage of cart subtotal, or specified as tiers below', '6', '4', 'zen_cfg_select_option(array(\'percent\', \'tiered\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, date_added) values('Handling Charge: Percentage', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_PER', '5', 'Enter the percentage of subtotal to charge as handling fee.', '6', '5', '', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, date_added) values('Handling Charge: Fee Tier', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_FEE', '.50', 'Enter the fee tier increment. Handling charge will be: <br> (subtotal/price_tier) * fee_tier', '6', '6', 'currencies->format', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, date_added) values('Handling Charge: Price Tier ', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_INCREMENT', '100', 'Enter the price tier increment. To setup a flat-fee structure, enter a large value here and your flat fee in the fee tier above. For example, if you want to always charge $10 and your orders are typically around $100, enter $5000 here and $10 in the Fee Tier box.', '6', '7', 'currencies->format', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, date_added) values('Handling Charge: Price Tier Ceiling', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_OVER', '1000', 'Enter the price tier maximum. For example, the default values setup a 50 cent charge for every $100 assessed up to $1000 of the cart subtotal, or $5 maximum.', '6', '8', 'currencies->format', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values('Tax Class', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TAX_CLASS', '0', 'If handling fees are taxable, then select the tax class that should apply.', '6', '9', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values('Tax Display', 'MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TAX_INLINE', 'Tax Subtotal', 'Can have tax (see above) be added to the tax subtotal line for the class above or have the it be added to the handling fee line. Which line should it be added to?', '6', '10', 'zen_cfg_select_option(array(\'Tax Subtotal\', \'Handling Fee\'), ', now())");
}
function remove()
{
global $db;
$keys = '';
$keys_array = $this->keys();
for ($i=0; $i<sizeof($keys_array); $i++) {
$keys .= "'" . $keys_array[$i] . "',";
}
$keys = substr($keys, 0, -1);
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")");
}
}
?>
Re: Rush/Priority Handling Charge
I am not seeing anything obvious ...
Could you post the language file for this?
Could you go to the Modules ... Order Total ... and click on this and post what you see in the right hand panel?
Re: Rush/Priority Handling Charge
That makes me feel better!
PHP Code:
define('MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TITLE', 'Express Handling');
define('MODULE_ORDER_TOTAL_EXPRESS_HANDLING_DESCRIPTION', 'Express Handling');
define('MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TEXT_DESCR', 'Rush my order! Select this optional handling by clicking on the box below next to Add Express Handling. A priority handling charge will be added to your total after you click continue.');
define('MODULE_ORDER_TOTAL_EXPRESS_HANDLING_TEXT_ENTER_CODE', 'Add Express Handling:');
Re: Rush/Priority Handling Charge
So far, it is working fine for me ...
Unless you post something weird for the settings in the right panel in the Modules ... Order Total ... for the module ot_express_handling or find any debug logs ... I am not seeing the problem ...
Re: Rush/Priority Handling Charge
Lesson to anyone reading - don't leave the sort order the same - must change one number. Duh. Thanks!
Re: Rush/Priority Handling Charge
Thanks for the update that this was an issue of the Sort Order ...
Duplicate Sort Orders on the modules will usually result in one of them disappearing ...
What version of Zen Cart are you running?
Re: Rush/Priority Handling Charge
1.5.1
One of the reasons why I missed that is because I have rarely ever have a problem - I guess until 1.5.1 - but the last time it came up there was a message in admin about duplicate sorts orders - that was for either payments or shipping - not order totals.
Re: Rush/Priority Handling Charge
I'm using this https://www.zen-cart.com/downloads.php?do=file&id=236 Priority Order Handling add on,
It seems like it stores in orders_total as ot_priorityhandling
Is there any way to have it combined with ot_shipping?
Re: Rush/Priority Handling Charge
First, some clarification... The Priority Handling module works by adding a new class to Zen Cart, called "ot_priority_handling", which encapsulates the processing or code portion that makes the module work. But the class itself does not store anything. The handling the handling charge itself and any preferences are stored in the ZenCart configuration table in MySQL. During a live cart session, whether the user selects this option or not is stored in the $_SESSION variable. Outside of this, the class then uses $_SESSION to see whether to do any processing; if so, then it uses the stored preferences to come up with a value to charge, does the tax calculation appropriately, and finally whatever else so everything shows up correctly in the final order total.
I supposed you could modify the built-in shipping module to accomplish something similar. I'm not sure why this would be preferable. If you want to add a flat-rate shipping charge base, just define your shipping preferences this way. The additional charge would be there, but it would be hidden. If you want to call out the charge specifically and give the user the option to add it or not, then you can use something like Priority Handling, and maybe just modify the language file so the text description is what you want. Therefore, I do not see any semantic reason for modifying the built-in shipping module code, but maybe I don't understand your specific application.
Another thing to consider is that modifying the built-in shipping module changes a component of the base distribution. The main idea with the Priority Handling module is to make the functionality an add-on that does not alter the distribution code base. Therefore, any Zen Cart update would be much easier for you using this module versus you trying to re-apply whatever code changes you did before on the base distribution.
Hope this helps. Good Luck!
-ml