If this is your first visit, check our documentation. To post, register or login.

Bank Transfer Discount Display SQL

Started by andreas1211 on 12 Mar 2013, 6:05 PM · Views: 1,692

Results 1 to 6 of 6
12 Mar 2013, 6:05 PM
#1
andreas1211 avatar

andreas1211

New Zenner

Join Date:
Sep 2012
Posts:
27
Plugin Contributions:
0

Bank Transfer Discount Display SQL

Hi,

I inserted this into the ot_total.php, but it does not send the discount price to the database or the e-mail.

What file should I edit, if I want that the new price shows in the database and email.

<?php /** * ot_total order-total module * * @package orderTotal * @copyright Copyright 2003-2007 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: ot_total.php 6725 2007-08-19 03:48:28Z drbyte $ */ class ot_total2 { var $title, $output; function ot_total2() { $this->code = 'ot_total2'; $this->title = MODULE_ORDER_TOTAL_TOTAL_TITLE2; $this->description = MODULE_ORDER_TOTAL_TOTAL_DESCRIPTION2; $this->sort_order = MODULE_ORDER_TOTAL_TOTAL_SORT_ORDER2; $this->output = array(); } function process() { global $order, $currencies, $discount_total, $discount_initial; $discount_initial = $order->info['total']*0.02; $discount_total = $order->info['total'] - $discount_initial; $this->output[] = array('title' => $this->title . ':', 'text' => $currencies->format($discount_total, true, $order->info['currency'], $order->info['currency_value']), 'value' => $discount_total); } function check() { global $db; if (!isset($this->_check)) { $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_TOTAL_STATUS2'"); $this->_check = $check_query->RecordCount(); } return $this->_check; } function keys() { return array('MODULE_ORDER_TOTAL_TOTAL_STATUS2', 'MODULE_ORDER_TOTAL_TOTAL_SORT_ORDER2'); } 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_TOTAL_STATUS2', '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_TOTAL_SORT_ORDER2', '1000', 'Sort order of display.', '6', '2', now())"); } function remove() { global $db, $messageStack; if (!isset($_GET['override']) && $_GET['override'] != '1') { $messageStack->add('header', ERROR_MODULE_REMOVAL_PROHIBITED . $this->code); return false; } $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } } ?>

Thanks for the help in advance!

13 Mar 2013, 7:55 AM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Bank Transfer Discount Display SQL

Andreas1211:

I inserted this into the ot_total.php,

Was there a reason why you did this rather than making it as a new/separate module? (which is what it is).

Andreas1211:

but it does not send the discount price to the database or the e-mail.,

How are you calling/accessing this module/code?

I'm guessing that you're not.

Will you be using your modified code AND the original code? If so, how are you determining which one needs to be used with any given order?
If you only need to use your modified code, then you should undo your code changes, then just replace
function process() {
original code
}

With
function process() {
modified code
}

No other changes needed. Anywhere.

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

13 Mar 2013, 11:31 AM
#3
andreas1211 avatar

andreas1211

New Zenner

Join Date:
Sep 2012
Posts:
27
Plugin Contributions:
0

Re: Bank Transfer Discount Display SQL

Hi,

Thanks for the answer.
I found this code in a forum, could you send me an address where I could download this module. I am an amateur zenner I would really need this module, unfortunately my english is not the best. :)

13 Mar 2013, 11:44 AM
#4
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Bank Transfer Discount Display SQL

Andreas1211:

Hi,
Thanks for the answer.
I found this code in a forum,

If you could provide a link I'll be happy to take a look to see what you are 'missing'.
It seems to me you only have a part of the solution.

Andreas1211:

could you send me an address where I could download this module. I am an amateur zenner I would really need this module, unfortunately my english is not the best. :)

I don't even know if it is a module.

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

13 Mar 2013, 1:55 PM
#6
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Bank Transfer Discount Display SQL

Andreas1211:

I found it here:

http://www.zen-cart.com/showthread.php?163757-Bank-Transfer-Discount-Display&highlight=bank+transfer+discount

OK, two things.

  1. That code wasn't added to the existing ot_total.php file. It is/was a 'clone' (copy) of this code (with the modifications).
    It needs to be created and saved as a new file called "ot_total2.php" (the same as the 'class' name near the beginning of the file)

  2. This modification makes no attempt to select which of the two 'ot_total'' will be used at any given time. Instead it will output both the original order total AND the discounted order total (as per the the output example in post#2 of that thread).

I have no idea what to expect from the final output if/when both modules are activated at the same time. I'm guessing that Zencart will use the one with the highest sort order number.

Simply put, the code as presented is still only a partial solution to what you are hoping to achieve.
It is also the easy part.

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.