Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

discounted_count shipping contribution...help!


Guest

Recommended Posts

Hello!

I haved downloaded and installed this shipping module on my site, following the instructions. Everything shows up fine on the admin side, allowing me to activate/deactivate, set rates, etc.. but on the catalog side, it never shows up, whether I have only it activated or it and others. I'm totally confused.

Here's the code from the catalog/includes/modules/shipping/discounted_count.php file:

 

<?php

/*

 $Id: discounted_count.php,v 1.0 Exp $



 The Exchange Project - Community Made Shopping!

 http://www.theexchangeproject.org



 Copyright (c) 2000,2001 The Exchange Project



 Released under the GNU General Public License

 --------------------------------------------------------

 rlf - 09/05/2002 - modified to allow discounted shipping  

                    for each additional item ordered over

                    a certain number of items

 --------------------------------------------------------

 dwk - 01/24/2002 - created to allow free shipping if 

       order contains more than a certain number of items

 --------------------------------------------------------

*/



class discounted_count 

{

   var $code, $title, $description, $icon, $enabled;



   // class constructor



   function discounted_count() 

   {

       $this->code = 'discounted_count';

       $this->title = MODULE_SHIPPING_DISCOUNTED_COUNT_TEXT_TITLE;

       $this->description = MODULE_SHIPPING_DISCOUNTED_COUNT_TEXT_DESCRIPTION;

       $this->icon = '';

       $this->enabled = MODULE_SHIPPING_DISCOUNTED_COUNT_STATUS;

   }



   // Display this in Shipping Options / Change Address pages



   function selection() 

   {

       $selection_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "n" .

                           '  <tr>' . "n" .

                           '    <td class="main">' . (($this->icon) ? tep_image($this->icon . ' ', $this->title) : '') . MODULE_SHIPPING_DISCOUNTED_COUNT_TEXT_TITLE . ' <small><i>(' . MODULE_SHIPPING_DISCOUNTED_COUNT_TEXT_WAY . ')</i></small></td>' . "n" .

                           '    <td align="right" class="main">' . tep_draw_checkbox_field('shipping_quote_discounted_count', '1', true) . '</td>' . "n" .

                           '  </tr>' . "n" .

                           '</table>' . "n";



       return $selection_string;

   }



   // Determine shipping cost for this module



   function quote() 

   {

       global $shipping_quoted, $shipping_discounted_count_cost, $shipping_discounted_count_method, $total_count;



       if (($GLOBALS['shipping_quote_all'] == '1') || ($GLOBALS['shipping_quote_discounted_count'] == '1')) 

       {

           $shipping_quoted = 'discounted_count';

	 $srate = MODULE_SHIPPING_DISCOUNTED_COUNT_SRATE;

	 $drate = MODULE_SHIPPING_DISCOUNTED_COUNT_DRATE;

	 $cnt_items = MODULE_SHIPPING_DISCOUNTED_COUNT_ITEMS;

      

        if ($total_count >= $cnt_items) 

        {

            $shipping_discounted_count_cost = (($srate * ($cnt_items - 1)) + ($drate * ($total_count - ($cnt_items - 1))));

           } 

     else 

     {

         $shipping_discounted_count_cost = ($srate * $total_count);

        }

       

     $shipping_discounted_count_method = MODULE_SHIPPING_DISCOUNTED_COUNT_TEXT_WAY;

       }

   }



   // Determine the cheapest shipping method



   function cheapest() 

   {

       global $shipping_count, $shipping_cheapest, $shipping_cheapest_cost, $shipping_discounted_count_cost;



       if (($GLOBALS['shipping_quote_all'] == '1') || ($GLOBALS['shipping_quote_discounted_count'] == '1'))

    {

           if ($shipping_count == 0) 

        {

               $shipping_cheapest = 'discounted_count';

              $shipping_cheapest_cost = $shipping_discounted_count_cost;

      	 } 

     else 

     {

              if ($shipping_discounted_count_cost < $shipping_cheapest_cost) 

         {

                $shipping_cheapest = 'discounted_count';

                $shipping_cheapest_cost = $shipping_discounted_count_cost;

               }

           }

 

           $shipping_count++;

       }

   }



   // Display on Payment Method page



   function display() 

   {

       global $HTTP_GET_VARS, $currencies, $shipping_cheapest, $shipping_discounted_count_method, $shipping_discounted_count_cost, $shipping_selected, $total_count;



       // set a global for the radio field (auto select cheapest shipping method)

  

       if (!$HTTP_GET_VARS['shipping_selected']) 

    {

        $shipping_selected = $shipping_cheapest;

    }



       if (($GLOBALS['shipping_quote_all'] == '1') || ($GLOBALS['shipping_quote_discounted_count'] == '1'))

    {

           $display_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0">' . "n" .

                             '  <tr>' . "n" .

                             '    <td class="main">' . (($this->icon) ? tep_image($this->icon . ' ', $this->title) : '') . MODULE_SHIPPING_DISCOUNTED_COUNT_TEXT_DESCRIPTION . ' <small><i>(' . $shipping_discounted_count_method . ')</i></small></td>' . "n";

     

        $display_string .= '    <td align="right" class="main">' . $currencies->format($shipping_discounted_count_cost);

      

 

           if (tep_count_shipping_modules() > 1) 

     {

               $display_string .= tep_draw_radio_field('shipping_selected', 'discounted_count') .

                                                   tep_draw_hidden_field('shipping_discounted_count_cost', $shipping_discounted_count_cost) .

                                                   tep_draw_hidden_field('shipping_discounted_count_method', $shipping_discounted_count_method) . '</td>' . "n";

        	 } 

     else 

     {

               $display_string .= tep_draw_hidden_field('shipping_selected', 'discounted_count') .

                                                   tep_draw_hidden_field('shipping_discounted_count_cost', $shipping_discounted_count_cost) .

                                                   tep_draw_hidden_field('shipping_discounted_count_method', $shipping_discounted_count_method) . '</td>' . "n";

           }         

       

     $display_string .= '  </tr>' . "n" .

                              '</table>' . "n";

       }



       return $display_string;

   }

   

   function confirm() 

   {

       global $HTTP_POST_VARS, $shipping_cost, $shipping_method;



       if ($HTTP_POST_VARS['shipping_selected'] == 'discounted_count') 

    {

           $shipping_cost = $HTTP_POST_VARS['shipping_discounted_count_cost'];

           $shipping_method = $HTTP_POST_VARS['shipping_discounted_count_method'];

       }

   }



   function check() 

   {

       $check = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_DISCOUNTED_COUNT_STATUS'");

       $check = tep_db_num_rows($check);



       return $check;

   }



   function install() 

   {

       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Enable Discounted Shipping', 'MODULE_SHIPPING_DISCOUNTED_COUNT_STATUS', '1', 'Do you want to offer discounted shipping?', '6', '7', now())");

       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Number Of Items', 'MODULE_SHIPPING_DISCOUNTED_COUNT_ITEMS', '2', 'How many items must be purchased before shipping is offered at the discounted rate?', '6', '8', now())");

  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Standard Rate', 'MODULE_SHIPPING_DISCOUNTED_COUNT_SRATE', '25.00', 'Standard shipping rate PER item before discounted number reached?', '6', '9', now())");

  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Discounted Rate', 'MODULE_SHIPPING_DISCOUNTED_COUNT_DRATE', '5.00', 'Discounted shipping rate PER item after discounted number reached?', '6', '10', now())");

   }



   function remove() 

   {

       tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_DISCOUNTED_COUNT_STATUS'");

       tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_DISCOUNTED_COUNT_ITEMS'");

  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_DISCOUNTED_COUNT_SRATE'");

  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_DISCOUNTED_COUNT_DRATE'");    

   }



   function keys() 

   {

       $keys = array('MODULE_SHIPPING_DISCOUNTED_COUNT_STATUS', 'MODULE_SHIPPING_DISCOUNTED_COUNT_ITEMS', 'MODULE_SHIPPING_DISCOUNTED_COUNT_SRATE', 'MODULE_SHIPPING_DISCOUNTED_COUNT_DRATE');



       return $keys;

   }

}

?>

 

If anyone could point me in the right direction I would appreciate it. I've been attempting to fix it myself but have hit a dead end.

Thanks! :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...