Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Missing .css in order -> edit / only shipping method


Recommended Posts

Hi all, whats better write less topics for help and ask two question in one or post two topics?

Two questions in this one :)

1. Looking at the below picture have I broken the styling or is this how orders -> Edit looks on Frozen CE as the old 2.3 looks better

image.thumb.png.04fe2b8bbd8b43146175ef885b040491.png

2. I have used flat.php to create extra set fee shipping methods with min and max weights in them
But even thou the screen clearly show more than one shipping method it says "This is currently the only shipping method......"
If I put the unmodified flat.php back in then is goes back to saying "Please select the preferred shipping method to use on this order.:

image.png.6f7fe5cbd92e8cdb3a969f95c4aeff53.png

Thank you for reading

 

Link to comment
Share on other sites

1. Your admin/orders.php is missing the tabs - probably a javascript error.

2. If you haven't changed checkout_shipping then your modules aren't returning a properly structured quotes array. The quick fix (assuming selecting one works) is to edit the language file and change the text. The better thing is to edit checkout_shipping and exit with a print_r of the quotes array at about the place the message comes out, and post back the array.

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

2. Are you using 1 flat.php with min/max weights or have you copied flat.php to give you two shipping methods never mind you said you replaced the original flat.php so 1 file

do you have separate id for each in the quotes array

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

13 hours ago, supercheaphobb said:

Hi all, whats better write less topics for help and ask two question in one or post two topics?

Unless the two questions appear to be very closely related, it's better to open two topics. That minimizes confusion over who is answering which question, and keeps it cleaner for someone in the future looking for an answer to one of the questions.

Link to comment
Share on other sites

@BrockleyJohn
1. You will have to explain a heap further on how to check this / fix this
2. Confused on this one, As the shipping fee is fixed so no quote array I don't think? The files for each is a modified flat.php. The Language file for each is different
      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_PARCELPOST500_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                            'title' => MODULE_SHIPPING_PARCELPOST500_TEXT_WAY,
                             'cost' => MODULE_SHIPPING_PARCELPOST500_COST)));

@241

2. I have copied flat.php to give me 6 shipping methods along with 6 matching language files which get offered depending on the min and max weights set in the file. separate id ??? do you mean
$this->code = 'parcelpost500';
$this->quotes = array('id' => $this->code,
then yes, each file has it's own name and each file has a different code


@MrPhil Thanks MrPhil, I will make sure in future to post in two topics

Link to comment
Share on other sites

<?php
/*
  $Id$

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

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  class parcelpost500 {
    var $code, $title, $description, $icon, $enabled;

// class constructor
    function __construct() {
      global $order, $total_weight;

      $this->code = 'parcelpost500';
      $this->title = MODULE_SHIPPING_PARCELPOST500_TEXT_TITLE;
      $this->description = MODULE_SHIPPING_PARCELPOST500_TEXT_DESCRIPTION;
      
      if ( defined('MODULE_SHIPPING_PARCELPOST500_STATUS') ) {
        $this->sort_order = MODULE_SHIPPING_PARCELPOST500_SORT_ORDER;
        $this->icon = '';
        $this->tax_class = MODULE_SHIPPING_PARCELPOST500_TAX_CLASS;
        $this->enabled = ((MODULE_SHIPPING_PARCELPOST500_STATUS == 'True') ? true : false);
      }
      
      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_PARCELPOST500_ZONE > 0) ) {
        $check_flag = false;
        $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_PARCELPOST500_ZONE . "' and zone_country_id = '" . $order->delivery['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->delivery['zone_id']) {
            $check_flag = true;
            break;
          }
        }
        if ($total_weight > MODULE_SHIPPING_PARCELPOST500_MAX_WEIGHT or $total_weight < MODULE_SHIPPING_PARCELPOST500_MIN_WEIGHT) {
          $check_flag = false;  
        }
        if ($check_flag == false) {
          $this->enabled = false;
        }
      }
    }

// class methods
    function quote($method = '') {
      global $order;

      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_PARCELPOST500_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                            'title' => MODULE_SHIPPING_PARCELPOST500_TEXT_WAY,
                             'cost' => MODULE_SHIPPING_PARCELPOST500_COST)));

      if ($this->tax_class > 0) {
        $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
      }

      if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, htmlspecialchars($this->title));

      return $this->quotes;
    }

    function check() {
      if (!isset($this->_check)) {
        $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_PARCELPOST500_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 Parcel Post 500g Shipping', 'MODULE_SHIPPING_PARCELPOST500_STATUS', 'True', 'Do you want to offer parcel post 500g shipping?', '6', '0', '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 ('Shipping Cost', 'MODULE_SHIPPING_PARCELPOST500_COST', '5.00', 'The shipping cost for all orders using this shipping method.', '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 ('Tax Class', 'MODULE_SHIPPING_PARCELPOST500_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', 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 ('Shipping Zone', 'MODULE_SHIPPING_PARCELPOST500_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', '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, date_added) values ('Minimum Weight (Kgs)', 'MODULE_SHIPPING_PARCELPOST500_MIN_WEIGHT', '0.1', 'Minimum weight (Kgs) that can be shipped with this method. This method will not be displayed if shipping weight is below it.', '6', '0', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Maximum Weight (Kgs)', 'MODULE_SHIPPING_PARCELPOST500_MAX_WEIGHT', '0.1', 'Maximum weight (Kgs) that can be shipped with this method. This method will not be displayed if shipping weight is above it.', '6', '0', 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_SHIPPING_PARCELPOST500_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
    }

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

    function keys() {
      return array('MODULE_SHIPPING_PARCELPOST500_STATUS', 'MODULE_SHIPPING_PARCELPOST500_COST', 'MODULE_SHIPPING_PARCELPOST500_TAX_CLASS', 'MODULE_SHIPPING_PARCELPOST500_ZONE', 'MODULE_SHIPPING_PARCELPOST500_MIN_WEIGHT','MODULE_SHIPPING_PARCELPOST500_MAX_WEIGHT', 'MODULE_SHIPPING_PARCELPOST500_SORT_ORDER');
    }
  }

Parcel Post 500 Express

 

 

<?php
/*
  $Id$

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

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  class parcelpost500express {
    var $code, $title, $description, $icon, $enabled;

// class constructor
    function __construct() {
      global $order, $total_weight;

      $this->code = 'parcelpost500express';
      $this->title = MODULE_SHIPPING_PARCELPOST500EXPRESS_TEXT_TITLE;
      $this->description = MODULE_SHIPPING_PARCELPOST500EXPRESS_TEXT_DESCRIPTION;
      
      if ( defined('MODULE_SHIPPING_PARCELPOST500EXPRESS_STATUS') ) {
        $this->sort_order = MODULE_SHIPPING_PARCELPOST500EXPRESS_SORT_ORDER;
        $this->icon = '';
        $this->tax_class = MODULE_SHIPPING_PARCELPOST500EXPRESS_TAX_CLASS;
        $this->enabled = ((MODULE_SHIPPING_PARCELPOST500EXPRESS_STATUS == 'True') ? true : false);
      }
      
      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_PARCELPOST500EXPRESS_ZONE > 0) ) {
        $check_flag = false;
        $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_PARCELPOST500EXPRESS_ZONE . "' and zone_country_id = '" . $order->delivery['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->delivery['zone_id']) {
            $check_flag = true;
            break;
          }
        }
        if ($total_weight > MODULE_SHIPPING_PARCELPOST500EXPRESS_MAX_WEIGHT or $total_weight < MODULE_SHIPPING_PARCELPOST500EXPRESS_MIN_WEIGHT) {
          $check_flag = false;  
        }
        if ($check_flag == false) {
          $this->enabled = false;
        }
      }
    }

// class methods
    function quote($method = '') {
      global $order;

      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_PARCELPOST500EXPRESS_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                            'title' => MODULE_SHIPPING_PARCELPOST500EXPRESS_TEXT_WAY,
                             'cost' => MODULE_SHIPPING_PARCELPOST500EXPRESS_COST)));

      if ($this->tax_class > 0) {
        $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
      }

      if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, htmlspecialchars($this->title));

      return $this->quotes;
    }

    function check() {
      if (!isset($this->_check)) {
        $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_PARCELPOST500EXPRESS_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 Parcel Post 500g Shipping', 'MODULE_SHIPPING_PARCELPOST500EXPRESS_STATUS', 'True', 'Do you want to offer parcel post 500g shipping?', '6', '0', '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 ('Shipping Cost', 'MODULE_SHIPPING_PARCELPOST500EXPRESS_COST', '5.00', 'The shipping cost for all orders using this shipping method.', '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 ('Tax Class', 'MODULE_SHIPPING_PARCELPOST500EXPRESS_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', 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 ('Shipping Zone', 'MODULE_SHIPPING_PARCELPOST500EXPRESS_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', '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, date_added) values ('Minimum Weight (Kgs)', 'MODULE_SHIPPING_PARCELPOST500EXPRESS_MIN_WEIGHT', '0.1', 'Minimum weight (Kgs) that can be shipped with this method. This method will not be displayed if shipping weight is below it.', '6', '0', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Maximum Weight (Kgs)', 'MODULE_SHIPPING_PARCELPOST500EXPRESS_MAX_WEIGHT', '0.1', 'Maximum weight (Kgs) that can be shipped with this method. This method will not be displayed if shipping weight is above it.', '6', '0', 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_SHIPPING_PARCELPOST500EXPRESS_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
    }

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

    function keys() {
      return array('MODULE_SHIPPING_PARCELPOST500EXPRESS_STATUS', 'MODULE_SHIPPING_PARCELPOST500EXPRESS_COST', 'MODULE_SHIPPING_PARCELPOST500EXPRESS_TAX_CLASS', 'MODULE_SHIPPING_PARCELPOST500EXPRESS_ZONE', 'MODULE_SHIPPING_PARCELPOST500EXPRESS_MIN_WEIGHT','MODULE_SHIPPING_PARCELPOST500EXPRESS_MAX_WEIGHT', 'MODULE_SHIPPING_PARCELPOST500EXPRESS_SORT_ORDER');
    }
  }

 

Link to comment
Share on other sites

One for the PHP experts I think! The Flat Rate 2 works as far as showing up and beeing selectable, However would not show up in the invoice. That kept showing the stock Flat rate shipping.

Had to change the name from flat_two  to Cusflat for the class to get it to work properly. I assume this is just PHP not happy with 2 classes with the same first part in the name?

So if you have a number of shipping files with the same names you may be seeing the same problem.

 

image.png.cff775c90518b3c6570251137c235c9f.png

 

image.png.6c36538508118cd2a181838afad98064.png

 

Link to comment
Share on other sites

Well I shorten the file names, removed the 500 from the filename id etc and still the same results....

And no resolve for issue 1.

I will install another copy of frozen in another dir and see what happens

This php coding and me don't get along

 

Link to comment
Share on other sites

2 hours ago, JcMagpie said:

All your code is missing the closing ?> at the end of the files. It's the only diferance with my files I can see.

Proper, perfect legal PHP should have a closing ?> at the end of the file, if PHP code runs right up to the end (no HTML following it). Some people and organizations advocate eliminating the closing tag, on grounds that an editor might leave some trash (whitespace) after the closing tag. This gets interpreted as HTML text, and may cause problems if that file comes too early in processing (before all headers have been sent). While PHP both seems to accept that missing ?> without error, and consumes some whitespace after one "just in case", I'm not sure how official it is, and that it won't be deprecated at some point in the future. So, use this construct at your own risk -- some day you may find yourself going through your files to re-add the closing PHP tag.

Link to comment
Share on other sites

@MrPhil Yep fixed that earlier no difference on my my system but on a fresh install I am not having that issue yet. So slowly stepping threw my files with winmerge to see where I stuffed up...

Been working on this new setup all week <sigh>

Link to comment
Share on other sites

" If a file contains only PHP code, it is preferable to omit the PHP closing tag at the end of the file. This prevents accidental whitespace or new lines being added after the PHP closing tag, which may cause unwanted effects because PHP will start output buffering when there is no intention from the programmer to send any output at that point in the script " 😊

https://www.php.net/manual/en/language.basic-syntax.phptags.php

 

Link to comment
Share on other sites

I am thinking when I used the .sql file from AustPOST3.02 that might have screwed up my zones and geo zones would this cuz these issue?

I am reading up on how to export from one data base to another table `geo_zones` and  table `zones_to_geo_zones`

will let you know

Link to comment
Share on other sites

10 minutes ago, supercheaphobb said:

screwed up my zones and geo zones would this cuz these issue?

Having the wrong zone set would stop you beeing able to select a shipping method that did not apply to that zone. If it's your problem ? not sure.

 

Link to comment
Share on other sites

Nope did not resolve it. I might have to start again with this fresh install as I can not get it to error on the fresh install and may take longer checking all the files than moving forward and re-installing add ons arrrrrrrrrrrrrr

 

Link to comment
Share on other sites

No, no errors at all in the cpanel Metrics errors area which I think is weird

Some where core changes :( but I made backup and commented all the files

But putting them all back to the backed up versions, I might as well just add the addons back a fresh install

Link to comment
Share on other sites

In english.php made this change as we don't use city here. Could this be responsible

// BOF start of change from city to suburb due to disabling suburb field
define('ENTRY_CITY', 'Suburb'); //was previously City
define('ENTRY_CITY_ERROR', 'Your Suburb must contain a minimum of ' . ENTRY_CITY_MIN_LENGTH . ' characters.'); // was previously Your City...
// EOF start of change from city to suburb due to disabling suburb field

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...