@swguy, there are two EO-specific (and optionally-installed) order-total modules -- Misc. Cost and Onetime Discount -- that you can use to add or subtract a value from the order's current total.
@swguy, there are two EO-specific (and optionally-installed) order-total modules -- Misc. Cost and Onetime Discount -- that you can use to add or subtract a value from the order's current total.
OK - onetime discount is packaged with Edit Orders but where is misc cost?
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
There are two files associated with the "Misc Cost" order-total:
1) /includes/languages/english/modules/order_total/ot_misc_cost.php:
2) /includes/modules/order_total/ot_misc_cost.php:Code:<?php // ----- // Gather any Miscellaneous Cost for an order, an order-total created by lat9 // define('MODULE_ORDER_TOTAL_MISC_COST_TITLE', 'Misc. Cost'); define('MODULE_ORDER_TOTAL_MISC_COST_DESCRIPTION', 'A miscellaneous cost associated with the order.');
Code:<?php // ----- // An order-total module to gather any miscellaneous cost associated with an order, created by lat9. // class ot_misc_cost { /** * The unique "code" identifying this Order Total Module * @var string */ var $code; /** * The title shown for this Order Total Module * @var string */ var $title; /** * The description shown for this Order Total Module * @var string */ var $description; /** * The sort order at which to apply this Order Total Module * @var string */ var $sort_order; /** * Indicates if this module is enabled * @var unknown */ var $enabled; /** * The output from this Order Total Module * @var array */ var $output; /** * Enter description here... * * @return ot_coupon */ function __construct() { $this->code = 'ot_misc_cost'; $this->title = MODULE_ORDER_TOTAL_MISC_COST_TITLE; $this->description = MODULE_ORDER_TOTAL_MISC_COST_DESCRIPTION; $this->sort_order = MODULE_ORDER_TOTAL_MISC_COST_SORT_ORDER; $this->output = array(); } function process() { global $db, $currencies, $order; if(IS_ADMIN_FLAG === true && isset($_GET['oID'])) { $query = $db->Execute( 'SELECT `title`, `text`, `value` ' . 'FROM `' . TABLE_ORDERS_TOTAL . '` ' . 'WHERE orders_id = \'' . (int)$_GET['oID'] . '\' ' . 'AND class = \'' . zen_output_string($this->code, false, true) . '\'' ); if(!$query->EOF) { // Do we allow changing the "title"? if(MODULE_ORDER_TOTAL_MISC_COST_CHANGE_TITLE === 'true') $this->title = rtrim($query->fields['title'], ':'); // Apply the discount to the order. $discount = (float) $query->fields['value']; $order->info['total'] += $discount; $products_id = $order->products[0]['id']; $products_info = $db->Execute ("SELECT products_tax_class_id FROM " . TABLE_PRODUCTS . " WHERE products_id = $products_id LIMIT 1"); $products_tax_rate = zen_get_tax_rate ($products_info->fields['products_tax_class_id']); $order->info['total'] -= $order->info['tax']; $order->info['tax'] = zen_calculate_tax ($order->info['total'], $products_tax_rate); $order->info['total'] += $order->info['tax']; foreach ($order->info['tax_groups'] as $tax_description => $tax_value) { $order->info['tax_groups'][$tax_description] = $order->info['tax']; } // Output the order total information $this->output[] = array( 'title' => $this->title . ':', 'text' => $currencies->format($discount, true, $order->info['currency'], $order->info['currency_value']), 'value' => (string) $discount, ); unset($discount); } } } function check() { global $db; if (!isset($this->enabled)) { $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_MISC_COST_STATUS'"); $this->enabled = $check_query->RecordCount(); } return $this->enabled; } function keys() { return array('MODULE_ORDER_TOTAL_MISC_COST_STATUS', 'MODULE_ORDER_TOTAL_MISC_COST_SORT_ORDER', 'MODULE_ORDER_TOTAL_MISC_COST_CHANGE_TITLE'); } 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 ('This module is installed', 'MODULE_ORDER_TOTAL_MISC_COST_STATUS', 'true', '', '6', '1','zen_cfg_select_option(array(\'true\'), ', 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_MISC_COST_SORT_ORDER', '411', 'Sort order of display.', '6', '2', 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 ('Allow changing the title', 'MODULE_ORDER_TOTAL_MISC_COST_CHANGE_TITLE', 'false', 'Allow changing the title of the module while editing an order', '6', '3','zen_cfg_select_option(array(\'true\',\'false\'), ', 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 . ")"); } }
Last edited by swguy; 23 Mar 2016 at 12:59 AM. Reason: updated path to language file, sort order on module.
Thanks. Because some of my OT's weren't working, I was thinking you had to do something special to add Cost to the order. (Turns out the issue was I was doing checks of session variables that would have been set during normal checkout on the catalog side but are absent during admin edit.)
When you get a minute, would you please update the download with the Misc Cost optional module and the recent patches you mentioned? Thanks.
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
Hi guys,
I hope it's okay for me to post this here. If not, please move it to the appropriate area in the forum.
I use Zen Cart as POS software using several plugins including Edit Orders. Because we have a membership store, it works quite well. However, I am wondering if there is any way someone can add a field on the edit_orders.php for the 'amount tendered by customer' and a button to push that will show correct change.
Long shot? I'm more than happy to pay someone to create the code to add to edit_orders.php.
Again, I hope it's okay to post this here, and please move it if it's in the wrong place.
Thanks!
If you are using any of the following modules, please see the help files on my home page for patches required for interoperability with Edit Orders 4.
Zen Cart Better Together Admin
Zen Cart Combination Discounts Admin
Zen Cart Big Chooser
Zen Cart Free Gift Chooser
Zen Cart Free Gift Spender
Zen Cart Manufacturer Discount
Zen Cart Coupon Restrictions Chooser
Zen Cart Table Discounts
Last edited by swguy; 24 Mar 2016 at 01:37 PM.
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
Just wondering if there are any plans to update this module to be compatible with the new admin sanitizer, as per this thread:
https://www.zen-cart.com/showthread.php?219747
Thanks!
Danielle
I reckon we'd better!
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
OK, for now still on 1.3.9h and using that EO mod. I use it to add products to various customers (prizes actually) when the members win a prize I go into their account--click the add button--choose from the drop menus what is needed then make it so.
I then go to the part where things are listed and in a blank line provided I list it as prizes with the negative amount to deduct it -- jot down a note in the other section and finalize it. Everything works beautifully *except for an error in the cache folder each time so need to clear cache often*
In the 1.5+ zen cart this is not happening anymore so will there be a way to fix that to work as before OR Onetime Discount (does it need installing too), will it work as needed?
Another thing I could try if it works is once the item(s) are added to the order, changing the price from whatever it is to 0.00 --will this accomplish the need I have for it to do after making it so? As you can see I am still testing this mod so hopefully before the versions of this cart get too far ahead of me I have hopes that the majority of the mods I have installed will all work right...LOL
Oh I forgot to mention my store is all virtual downloads, if that makes a difference.
![]()
Bookmarks