Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Setup fee


21 replies to this topic

#21 wazu

  • Community Member
  • 36 posts
  • Real Name:wazu
  • Location:3rd rock from the sun

Posted 06 April 2005, 22:16

I stated with a ot_loworderfee.php. The thought was to run a re-named
version of the hacked script for each color. Looked for and did not/
cannot find any reference in “classes” or modules.php regarding
ot_loworderfee.php. I eliminated all the statements regarding minimum
values and renamed ot_forestgreen_colorfee.php. Then added the color
forestgreen to the color option menu.
Running ot_loworderfee.php and ot_forestgreen_colorfee.php together did
not seem to pose a problem, both worked in many combinations. However, a
setup fee was assigned to EVERY order of forestgreen. Here is the hack
<?php
/*
  $Id: ot_forestgreen_colorfee.php,v 1.11 2003/02/14 06:03:32 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License

	forestgreen_colorfee=108

*/

  class ot_forestgreen_colorfee {
    var $title, $output;

    function ot_forestgreen_colorfee() {
      $this->code = 'ot_forestgreen_colorfee';
      $this->title = MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_TITLE;
      $this->description = MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_DESCRIPTION;
      $this->enabled = ((MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_STATUS == 'true') ? true : false);
      $this->sort_order = MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_SORT_ORDER;

      $this->output = array();
    }

    function process() {
      global $order, $currencies;

      if (MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_LOW_ORDER_FEE == 'true') {
        switch (MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_DESTINATION) {
          case 'national':
            if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
          case 'international':
            if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
          case 'both':
            $pass = true; break;
          default:
            $pass = false; break;
        }

        if ( ($pass == true) && ($order->info['products_options_values'] == '(optional color)Forest green') ){
          $tax = tep_get_tax_rate(MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
          $tax_description = tep_get_tax_description(MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);

          $order->info['tax'] += tep_calculate_tax(MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_FEE, $tax);
          $order->info['tax_groups']["$tax_description"] += tep_calculate_tax(MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_FEE, $tax);
          $order->info['total'] += MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_FEE + tep_calculate_tax(MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_FEE, $tax);

          $this->output[] = array('title' => $this->title . ':',
                                  'text' => $currencies->format(tep_add_tax(MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_FEE, $tax), true, $order->info['currency'], $order->info['currency_value']),
                                  'value' => tep_add_tax(MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_FEE, $tax));
        }
      }
    }

    function check() {
      if (!isset($this->_check)) {
        $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_STATUS'");
        $this->_check = tep_db_num_rows($check_query);
      }

      return $this->_check;
    }

    function keys() {
      return array('MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_STATUS', 'MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_SORT_ORDER', 'MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_LOW_ORDER_FEE', 'MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_FEE', 'MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_DESTINATION', 'MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_TAX_CLASS');
    }

    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 ('Display FORESTGREEN_COLORFEE', 'MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_STATUS', 'true', 'Do you want to display the FORESTGREEN_COLORFEE?', '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 ('Sort Order', 'MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_SORT_ORDER', '4', 'Sort order of display.', '6', '2', now())");
      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 ('Allow FORESTGREEN_COLORFEE', 'MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_LOW_ORDER_FEE', 'false', 'Do you want to allow FORESTGREEN_COLORFEE?', '6', '3', '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, use_function, date_added) values ('FORESTGREEN_COLORFEE', 'MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_FEE', '5', 'Low order fee.', '6', '5', 'currencies->format', now())");
      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 ('Attach FORESTGREEN_COLORFEE On Orders Made', 'MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_DESTINATION', 'both', 'Attach FORESTGREEN_COLORFEE for orders sent to the set destination.', '6', '6', 'tep_cfg_select_option(array(\'national\', \'international\', \'both\'), ', 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 ('Tax Class', 'MODULE_ORDER_TOTAL_FORESTGREEN_COLORFEE_TAX_CLASS', '0', 'Use the following tax class on the FORESTGREEN_COLORFEE.', '6', '7', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
    }

    function remove() {
      tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }
  }
?>

I have also tried
  if ( ($pass == true) && ($order->info['products_options_values_id'] == '('108') ){
with the same results. Anybody, any ideas? Once this was figured out correctly, it would have the ability to apply a one time fee (setup fee) to any attribute associated with a product (color, size, material, lettering, grafix, etc.)
:rolleyes:
wazu

#22 wazu

  • Community Member
  • 36 posts
  • Real Name:wazu
  • Location:3rd rock from the sun

Posted 06 April 2005, 22:44

This mod would also prove useful for services -
You sell blinds and have an install fee
You sell stationary and have a logo setup charge
You sell wood moldings by the foot and have a setup charge
You do mail order repair or modifications and have a trouble shoot (look at) fee
You sell gold chain by the inch and charge a clasp and assemble fee
You sell photography and you charge a matte or frame fee
You are a plastic mold injector and you charge a setup fee
You sell re-manufactured parts (auto, appliance, computer) and charge a core (old part to replace your stock) fee
I’m sure there are dozens of other uses.

Just a thought…….
:-" wazu