Guest Posted January 24, 2005 Posted January 24, 2005 What im trying to do is add a calculation to the product_info.php page. So people who may be interested in paying in installments can see how much it would cost. Basically the page would look something like this. Pay over 24 months at ** per month (with 3.4% interest) Im trying to do this, but im not getting anywhere. I cant even seem to get the price to work properly. Ive just tried a simple calculation below to get the price and add 10% on so i Know im in the right place, but it aint workin :( THis is as far as I have got. $lease_info_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_status = '1' and products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); $lease_info = tep_db_fetch_array($lease_info_query); $added_var = $lease_info+10%; echo $added_var; any ideas?
etepalusip Posted January 24, 2005 Posted January 24, 2005 try something like this: $lease_info = (($product_info['products_price'])/24)*1.1; $lease_price = $currencies->display_price($lease_info, tep_get_tax_rate($product_info['products_tax_class_id'])); echo $lease_price; of course, the calculation in reality would be more complicated in the first line pete http://www.H2Ocomputers.com
Guest Posted January 24, 2005 Posted January 24, 2005 You aren't referencing the column that you are querying...try this: $lease_info_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_status = '1' and products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); $lease_info = tep_db_fetch_array($lease_info_query); $added_var = ($lease_info['products_price']*.1) + $lease_info['products_price']; echo $added_var; Also, run it through $currencies->display_price() as above recommendation. Bobby
Guest Posted January 24, 2005 Posted January 24, 2005 excellent guys, I had started to include the column, but was not doing it correctly. Thanks for the excellent help, but just one more query. Some of the products, are on special, and I tried calling $products_name; into the equation, but of course this outputs, the full price with the first one crossed through and hte second one the offer price. *crossed out$2,999.00* $2,877.60 So of course the calculation screws up because it has two price fields, how can I just get it to include the offer price, if its available?
oldworldcharms Posted February 20, 2005 Posted February 20, 2005 I installed this contribution but would like to change it to 50% down and payment within 3 months and a 6% finance charge. Or like to change it to 50% down and payment within 2 months and a 0% finance charge. Can someone post the changes needed to get the above and what change does what so I can play around with different options. Thanks very much Elizabeth
oldworldcharms Posted February 20, 2005 Posted February 20, 2005 I would also like to get rid of the comment To apply for this credit line you must have minimum monthly earnings of: 271.18 Thanks Elizabeth
oldworldcharms Posted February 20, 2005 Posted February 20, 2005 I must be missing something because I cant get the languages/english/installment file to change. I am trying to change 2 things Change Installment to Layaway Change Your order will not ship until we receive payment. to Your order will not ship until paid in full. 3)Add the file includes/modules/payment/installment.php to the corresponding folder 4)Add the file includes/languages/language/installment.php to the corresponding folder Thanks Elizabeth
oldworldcharms Posted February 20, 2005 Posted February 20, 2005 Ok I figure it out and figured out how to make a down payment 50% but how do I figure out how to change this to 2 months or 3 months. what is the calculation and how do I change the % interest? Thanks Elizabeth
oldworldcharms Posted February 20, 2005 Posted February 20, 2005 I installed this and was able to figure out the calculation :'( But now I am getting the following error Fatal error: Cannot redeclare class installment in /home/joldworl/public_html/includes/languages/english/modules/payment/interconsumo.php on line 15 Also in the confirmation email this was at the bottom Please Note: Down Payment: 0.00 12 payments of : 0.00 To apply for this credit line, your minimum salary must be at least:0.00 monthly Can someone help me fix this Thanks Elizabeth
oldworldcharms Posted March 3, 2005 Posted March 3, 2005 Can anyone answere this before I remove the contribution. I am unable to do anything with my Payment module in the admin because of this error. I installed the Installment module contribution and I am getting the following error message in the Payment Module of the admin. The code is below Fatal error: Cannot redeclare class installment in /home/joldworl/public_html/includes/languages/english/modules/payment/interconsumo.php on line 15 <?php /* $Id: installment.php,v 1.10 2003/01/29 19:57:14 hpdl Exp $ amended by Edwin Martinez osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ class installment { var $code, $title, $description, $enabled; // class constructor function installment() { global $HTTP_POST_VARS, $order, $currencies, $cart; $this->code = 'installment'; $this->title = MODULE_PAYMENT_INSTALLMENT_TEXT_TITLE; $this->description = MODULE_PAYMENT_INSTALLMENT_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_INSTALLMENT_SORT_ORDER; $this->enabled = ((MODULE_PAYMENT_INSTALLMENT_STATUS == 'True') ? true : false); if ((int)MODULE_PAYMENT_INSTALLMENT_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_INSTALLMENT_ORDER_STATUS_ID; } $this->email_footer = MODULE_PAYMENT_INSTALLMENT_TEXT_EMAIL_FOOTER; if (is_object($order)) $this->update_status(); } // class methods function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_INSTALLMENT_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_INSTALLMENT_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->billing['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } function javascript_validation() { return false; } function selection() { return array('id' => $this->code, 'module' => $this->title); } function pre_confirmation_check() { return false; } function confirmation() { global $HTTP_POST_VARS, $order, $currencies; define('TOTAL_PAYMENT_INT12', microtime()); $down_payment= $currencies->price() * 0.15; $monthly_payment= ($currencies->price() - $down_payment) * 0.10573; $salary = ($monthly_payment / 0.2); $installment12= 'Please note: <br><b> Down Payment: <font color="red"> ' . number_format($down_payment, 2). '</font color><br> 12 Payments of: <font color="red">' . number_format($monthly_payment, 2). ' </b></font color>'. '<br> To apply for this credit line you must have minimum monthly earnings of: <b>' . number_format($salary, 2) . '</b> <br>'; return array('title' => $installment12 . MODULE_PAYMENT_INSTALLMENT_TEXT_DESCRIPTION); } function process_button() { global $HTTP_POST_VARS, $order, $currencies; $process_button_string = tep_draw_hidden_field('payment', $currencies->price()); return $process_button_string; } function before_process() { return false; } function after_process() { return false; } function get_error() { return false; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_INSTALLMENT_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Check/Money Order Module', 'MODULE_PAYMENT_INSTALLMENT_STATUS', 'True', 'Do you want to accept Check/Money Order payments?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now());"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Make Payable to:', 'MODULE_PAYMENT_INSTALLMENT_PAYTO', '', 'Who should payments be made payable to?', '6', '1', now());"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_INSTALLMENT_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_INSTALLMENT_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_INSTALLMENT_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_INSTALLMENT_STATUS', 'MODULE_PAYMENT_INSTALLMENT_ZONE', 'MODULE_PAYMENT_INSTALLMENT_ORDER_STATUS_ID', 'MODULE_PAYMENT_INSTALLMENT_SORT_ORDER', 'MODULE_PAYMENT_INSTALLMENT_PAYTO'); } } ?> Also in the confirmation email this was at the bottom Please Note: Down Payment: 0.00 12 payments of : 0.00 To apply for this credit line, your minimum salary must be at least:0.00 monthly Can someone help me fix this Thanks Elizabeth <{POST_SNAPBACK}>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.