Jump to content
Latest News: (loading..)
ednique

[Contribution] Ship In Cart

Recommended Posts

@@raiwa

 

Since this won't work with any shipping method while the customer is not logged in, it's becoming obvious that it has something to do with how my store is set up or it's clashing with another module.

 

I'll investigate more.

 

Thanks

Share this post


Link to post
Share on other sites

@@raiwa

 

 

@@discxpress,

 

I found an issue in the module which could produce your problem. The zone id wasn't included in the shipping array.

Please try with the modified attached cm_cart_shipping_estimator.php:

I tried your file and still no luck. I believe there's nothing wrong with your mod but more a problem with my site. Maybe there's a small conflict with another mod somewhere. Like a needle in a haystack.

 

Thanks for your help.

Share this post


Link to post
Share on other sites

Hi,

 

Attention: cm_cart_shipping_estimator.php

 

echo '<br>$selected_address' . $selected_address;
echo '<br>$sendto' . $sendto;
echo '<br>$cart_address_id' . $cart_address_id;

 

Debug-Modus?!?

Edited by rubberfashion

Share this post


Link to post
Share on other sites

Hello @@vampirehunter,

 

You can see it on my demo store:

http://www.sarfotostock.com/osCommerce234bs/

 

The module is placed at the bottom of the shopping cart page below the "Checkout" button or PayPal express payment button.

 

regards

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

@@raiwa

 

Hi Rainer

 

I was playing around again with your addon and was wondering...

 

For example, if you choose United States and click the update button the state drop down will list all states.

But Albania or Gabon don't have zones/states defined and therefore it shows only please select inside the state drop down.

 

Now instead of having an empty state drop down would it not be nicer to have it hidden for countries without zones?

Share this post


Link to post
Share on other sites

@@raiwa

 

Nice! Thank you.

Something else,...

I have a shipping module(swiss post module) that offers 2 shipping methods, Airmail and Express.

Now when i choose one of those options the total gets calculated wrong. It always adds the "previous" selected shipping price additional to it.

 

So lets say

Product price : $5

Airmail : $3

Total : $8

 

Now i switch to express and this comes out

 

Product price : $5

Express : $10

Total : $18

 

Total should be $15

If i refresh the page (F5) it will calculate the express shipping twice so total $25.

If i access the shopping cart page the first time it pre selects airmail (cheapest shipping) and the total calculates product price + airmail + airmail(without tax)

 

I still try o figure out the exact pattern as to when what happens. The behaviour explained above happens when logged in.

It doesn't seem to happen when logged out.

Edited by Tsimi

Share this post


Link to post
Share on other sites

Hello @@Tsimi,

 

This is strange, I couldn't observe this with the standard shipping modules. Maybe your shipping modules use a variable which is not yet included in the globals list. If you wish, you can post your shipping modules and I'll have a look.

 

regards

Rainer

Share this post


Link to post
Share on other sites

@@raiwa

 

Thanks Rainer

 

I am not at home right now. Will post the module code as soon i get home.

And also thanks for the zone code, will try that also asap.

Share this post


Link to post
Share on other sites

@@raiwa

 

So back at home...just tested your state hiding code and it works like a charm. Thank you.

Regarding the other issue. I just tested again and it seems to happen only when I am logged in as customer.

When logged out it shows the correct total.

Here is the code from the shipping module. It is based on the swiss post module I just renamed some stuff to Japan post and that's about it.

<?php
/*
  $Id: jpnp.php,v 1.02 2003/02/18 03:37:00 harley_vb Exp $

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

  Copyright (c) 2002 - 2014 osCommerce

  Released under the GNU General Public License

  Patches:
  - tom 001: Prices changed per 27.7.2006
  - Tsimi: recoded to use as Japan Post Module, Prices from 18.4.2014

*/

/********************************************************************
*	Copyright (C) 2001 - 2003 TheMedia, Dipl.-Ing Thomas Pl舅kers
*       http://www.themedia.at & http://www.oscommerce.at
*
*                    All rights reserved
*
* This program is free software licensed under the GNU General Public License (GPL).
*
*    This program is free software; you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation; either version 2 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with this program; if not, write to the Free Software
*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
*    USA
*
*********************************************************************/

  class jpnp {
    var $code, $title, $description, $icon, $enabled, $num_jpnp, $types;

// class constructor
    function jpnp() {
      global $order;

      $this->code         = 'jpnp';
      $this->title        = MODULE_SHIPPING_JPNP_TEXT_TITLE;
      $this->description  = MODULE_SHIPPING_JPNP_TEXT_DESCRIPTION;
      $this->sort_order   = MODULE_SHIPPING_JPNP_SORT_ORDER;
      $this->icon         = DIR_WS_ICONS . 'yubin.gif';
      $this->tax_class    = MODULE_SHIPPING_JPNP_TAX_CLASS;
      $this->enabled      = ((MODULE_SHIPPING_JPNP_STATUS == 'True') ? true : false);

      if (   ($this->enabled == true)
          && ((int)MODULE_SHIPPING_JPNP_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_JPNP_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 ($check_flag == false) {
          $this->enabled = false;
        }
      }

      $this->types = array('AIR' => 'Airmail',
                           'EMS' => 'EMS');


      // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
      $this->num_jpnp = 7;   // jpn + 6 Zonen
    }

// class methods
    function quote($method = '') {
      global $HTTP_POST_VARS, $order, $shipping_weight, $shipping_num_boxes;

      $dest_country = $order->delivery['country']['iso_code_2'];
      $dest_zone = 0;
      $error = false;

      for ($j=1; $j<=$this->num_jpnp; $j++) {
        $countries_table = constant('MODULE_SHIPPING_JPNP_COUNTRIES_' . $j);
        $country_zones =  preg_split('"[,]"', $countries_table);
        if (in_array($dest_country, $country_zones)) {
          $dest_zone = $j;
          break;
        }
      }

      if ($dest_zone == 0) {
        $error = true;
      } else {
        $shipping = -1;
        $jpnp_cost_air = @[member=constant]('MODULE_SHIPPING_JPNP_COST_AIR_' . $j);
        $jpnp_cost_ems = @[member=constant]('MODULE_SHIPPING_JPNP_COST_EMS_' . $j);


        $methods = array();

        if ($jpnp_cost_air != '') {
          $jpnp_table_air =  preg_split('"[:,]"' , $jpnp_cost_air);

          for ($i=0; $i<sizeof($jpnp_table_air); $i+=2) {
            if ($shipping_weight <= $jpnp_table_air[$i]) {
              $shipping_air = $jpnp_table_air[$i+1];
              break;
            }
          }

          if ($shipping_air == -1) {
            $shipping_cost = 0;
            $shipping_method = MODULE_SHIPPING_JPNP_UNDEFINED_RATE;
          } else {
            $shipping_cost_1 = ($shipping_air + MODULE_SHIPPING_JPNP_HANDLING);
          }

          if ($shipping_air != 0) {
            $methods[] = array('id' => 'AIR',
                               'title' => 'Airmail',
                               'cost' => (MODULE_SHIPPING_JPNP_HANDLING + $shipping_cost_1) * $shipping_num_boxes);
          }
        }

        if ($jpnp_cost_ems != '') {
          $jpnp_table_ems =  preg_split('"[:,]"' , $jpnp_cost_ems);

          for ($i=0; $i<sizeof($jpnp_table_ems); $i+=2) {
            if ($shipping_weight <= $jpnp_table_ems[$i]) {
              $shipping_ems = $jpnp_table_ems[$i+1];
              break;
            }
          }

          if ($shipping_ems == -1) {
            $shipping_cost = 0;
            $shipping_method = MODULE_SHIPPING_JPNP_UNDEFINED_RATE;
          } else {
            $shipping_cost_2 = ($shipping_ems + MODULE_SHIPPING_JPNP_HANDLING);
          }

          if ($shipping_ems != 0) {
            $methods[] = array('id' => 'EMS',
                               'title' => '(EMS) Express Mail Service',
                               'cost' => (MODULE_SHIPPING_JPNP_HANDLING + $shipping_cost_2) * $shipping_num_boxes);
          }
        }
      }

      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_JPNP_TEXT_SECTION_TITLE/* . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . g .')'*/);
      $this->quotes['methods'] = $methods;

      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, $this->title);

      if ($error == true) $this->quotes['error'] = MODULE_SHIPPING_JPNP_INVALID_ZONE;

      if ( (tep_not_null($method)) && (isset($this->types[$method])) ) {

        for ($i=0; $i<sizeof($methods); $i++) {
          if ($method == $methods[$i]['id']) {
            $methodsc = array();
            $methodsc[] = array('id' => $methods[$i]['id'],
                                'title' => $methods[$i]['title'],
                                'cost' => $methods[$i]['cost']);
            break;
          }
        }
        $this->quotes['methods'] = $methodsc;
      }

      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_JPNP_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 ('Japan Post', 'MODULE_SHIPPING_JPNP_STATUS', 'True', 'Do you want to offer Japan Post 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 ('Handling Fee', 'MODULE_SHIPPING_JPNP_HANDLING', '0', 'Handling fee for 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_JPNP_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_JPNP_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 ('Sort Order', 'MODULE_SHIPPING_JPNP_SORT_ORDER', '0', 'Sort order of display.', '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 ('Zone 0 Countries', 'MODULE_SHIPPING_JPNP_COUNTRIES_1', 'JP', 'National Zone', '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 ('Rate table for Zone 0 up to 30 kg AIR', 'MODULE_SHIPPING_JPNP_COST_AIR_1', '', 'Rate table for National Zone, based on <b>\'AIR\'</b> shipping up to 30 kg weight.', '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 ('Rate table for Zone 0 up to 30 kg EMS', 'MODULE_SHIPPING_JPNP_COST_EMS_1', '', 'Rate table for National Zone, based on <b>\'EMS\'</b> shipping up to 30 kg weight.', '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 ('Zone 1 Countries (East Asia)', 'MODULE_SHIPPING_JPNP_COUNTRIES_2', 'GU,KR,TW,CN,PH,HK,MO,MN', 'Comma separated list of two character ISO country codes that are part of Zone 1.', '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 ('Rate table for Zone 1 up to 30 kg AIR', 'MODULE_SHIPPING_JPNP_COST_AIR_2', '50:530,100:580,150:630,200:680,250:730,300:780,400:880,500:980,600:1080,700:1180,800:1280,900:1380,1000:1480,1250:1700,1500:1920,1750:2140,2000:2360,2500:3500,3000:3850,3500:4200,4000:4550,4500:4900,5000:5250,5500:5550,6000:5850,6500:6150,7000:6450,7500:6750,8000:7050,8500:7350,9000:7650,9500:7950,10000:8250,11000:8650,12000:9050,13000:9450,14000:9850,15000:10250,16000:10650,17000:11050,18000:11450,19000:11850,20000:12250,21000:12650,22000:13050,23000:13450,24000:13850,25000:14250,26000:14650,27000:15050,28000:15450,29000:15850,30000:16250', 'Rate table for Zone 1, based on <b>\'AIR\'</b> shipping up to 30 kg weight.', '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 ('Rate table for Zone 1 up to 30 kg EMS', 'MODULE_SHIPPING_JPNP_COST_EMS_2', '300:900,500:1100,600:1240,700:1380,800:1520,900:1660,1000:1800,1250:2100,1500:2400,1750:2700,2000:3000,2500:3500,3000:4000,3500:4500,4000:5000,4500:5500,5000:6000,5500:6500,6000:7000,7000:7800,8000:8600,9000:9400,10000:10200,11000:11000,12000:11800,13000:12600,14000:13400,15000:14200,16000:15000,17000:15800,18000:16600,19000:17400,20000:18200,21000:19000,22000:19800,23000:20600,24000:21400,25000:22200,26000:23000,27000:23800,28000:24600,29000:25400,30000:26200', 'Rate table for Zone 1, based on <b>\'EMS\'</b> shipping up to 30 kg weight.', '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 ('Zone 2 Countries (South-East and South-West Asia)', 'MODULE_SHIPPING_JPNP_COUNTRIES_3', 'ID,KH,SG,TH,BD,BN,VN,MY,MM,LA,IN,LK,NP,PK,BT,MV', 'Comma separated list of two character ISO country codes that are part of Zone 2.', '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 ('Rate table for Zone 2 up to 30 kg AIR', 'MODULE_SHIPPING_JPNP_COST_AIR_3', '50:530,100:580,150:630,200:680,250:730,300:780,400:880,500:980,600:1080,700:1180,800:1280,900:1380,1000:1480,1250:1700,1500:1920,1750:2140,2000:2360,2500:4900,3000:5500,3500:6100,4000:6700,4500:7300,5000:7900,5500:8400,6000:8900,6500:9400,7000:9900,7500:10400,8000:10900,8500:11400,9000:11900,9500:12400,10000:12900,11000:13600,12000:14300,13000:15000,14000:15700,15000:16400,16000:17100,17000:17800,18000:18500,19000:19200,20000:19900,21000:20600,22000:21300,23000:22000,24000:22700,25000:23400,26000:24100,27000:24800,28000:25500,29000:26200,30000:26900', 'Rate table for Zone 1, based on <b>\'AIR\'</b> shipping up to 30 kg weight.', '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 ('Rate table for Zone 2 up to 30 kg EMS', 'MODULE_SHIPPING_JPNP_COST_EMS_3', '300:900,500:1100,600:1240,700:1380,800:1520,900:1660,1000:1800,1250:2100,1500:2400,1750:2700,2000:3000,2500:3500,3000:4000,3500:4500,4000:5000,4500:5500,5000:6000,5500:6500,6000:7000,7000:7800,8000:8600,9000:9400,10000:10200,11000:11000,12000:11800,13000:12600,14000:13400,15000:14200,16000:15000,17000:15800,18000:16600,19000:17400,20000:18200,21000:19000,22000:19800,23000:20600,24000:21400,25000:22200,26000:23000,27000:23800,28000:24600,29000:25400,30000:26200', 'Rate table for Zone 1, based on <b>\'EMS\'</b> shipping up to 30 kg weight.', '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 ('Zone 3 Countries (Oceania, North and Middle America)', 'MODULE_SHIPPING_JPNP_COUNTRIES_4', 'AU,SB,NC,NZ,PG,FJ,US,SV,CA,CU,CR,JM,TT,PA,BB,HN,MX,AE,IL,IQ,IR,OM,CY,QA,KW,SA,SY,TR,BH,JO', 'Comma separated list of two character ISO country codes that are part of Zone 3.', '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 ('Rate table for Zone 3 up to 30 kg AIR', 'MODULE_SHIPPING_JPNP_COST_AIR_4', '50:560,100:635,150:710,200:785,250:860,300:935,400:1085,500:1235,600:1385,700:1535,800:1685,900:1835,1000:1985,1250:2255,1500:2525,1750:2795,2000:3065,2500:6300,3000:7150,3500:8000,4000:8850,4500:9700,5000:10550,5500:11300,6000:12050,6500:12800,7000:13550,7500:14300,8000:15050,8500:15800,9000:16550,9500:17300,10000:18050,11000:19000,12000:19950,13000:20900,14000:21850,15000:22800,16000:23750,17000:24700,18000:25650,19000:26600,20000:27550,21000:28500,22000:29450,23000:30400,24000:31350,25000:32300,26000:33250,27000:34200,28000:35150,29000:36100,30000:37050', 'Rate table for Zone 2, based on <b>\'AIR\'</b> shipping up to 30 kg weight.', '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 ('Rate table for Zone 3 up to 30 kg EMS', 'MODULE_SHIPPING_JPNP_COST_EMS_4', '300:1200,500:1500,600:1680,700:1860,800:2040,900:2220,1000:2400,1250:2800,1500:3200,1750:3600,2000:4000,2500:4700,3000:5400,3500:6100,4000:6800,4500:7500,5000:8200,5500:8900,6000:9600,7000:10700,8000:11800,9000:12900,10000:14000,11000:15100,12000:16200,13000:17300,14000:18400,15000:19500,16000:20600,17000:21700,18000:22800,19000:23900,20000:25000,21000:26100,22000:27200,23000:28300,24000:29400,25000:30500,26000:31600,27000:32700,28000:33800,29000:34900,30000:36000', 'Rate table for Zone 2, based on <b>\'EMS\'</b> shipping up to 30 kg weight.', '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 ('Zone 4 Countries (Europe)', 'MODULE_SHIPPING_JPNP_COUNTRIES_5', 'IE,IS,AZ,IT,UA,GB,EE,AT,NL,GR,HR,SM,CH,SE,ES,SK,SI,CZ,DK,DE,NO,HU,FI,FR,BG,BY,BE,PL,PT,MK,MT,MC,LV,LT,LI,RO,LU,RU', 'Comma separated list of two character ISO country codes that are part of Zone 4.', '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 ('Rate table for Zone 4 up to 30 kg AIR', 'MODULE_SHIPPING_JPNP_COST_AIR_5', '50:560,100:635,150:710,200:785,250:860,300:935,400:1085,500:1235,600:1385,700:1535,800:1685,900:1835,1000:1985,1250:2255,1500:2525,1750:2795,2000:3065,2500:6300,3000:7150,3500:8000,4000:8850,4500:9700,5000:10550,5500:11300,6000:12050,6500:12800,7000:13550,7500:14300,8000:15050,8500:15800,9000:16550,9500:17300,10000:18050,11000:19000,12000:19950,13000:20900,14000:21850,15000:22800,16000:23750,17000:24700,18000:25650,19000:26600,20000:27550,21000:28500,22000:29450,23000:30400,24000:31350,25000:32300,26000:33250,27000:34200,28000:35150,29000:36100,30000:37050', 'Rate table for Zone 3, based on <b>\'AIR\'</b> shipping up to 30 kg weight.', '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 ('Rate table for Zone 4 up to 30 kg EMS', 'MODULE_SHIPPING_JPNP_COST_EMS_5', '300:1500,500:1800,600:2000,700:2200,800:2400,900:2600,1000:2800,1250:3250,1500:3700,1750:4150,2000:4600,2500:5400,3000:6200,3500:7000,4000:7800,4500:8600,5000:9400,5500:10200,6000:11000,7000:12300,8000:13600,9000:14900,10000:16200,11000:17500,12000:18800,13000:20100,14000:21400,15000:22700,16000:24000,17000:25300,18000:26600,19000:27900,20000:29200,21000:30500,22000:31800,23000:33100,24000:34400,25000:35700,26000:37000,27000:38300,28000:39600,29000:40900,30000:42200', 'Rate table for Zone 3, based on <b>\'EMS\'</b> shipping up to 30 kg weight.', '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 ('Zone 5 Countries (South America, Africa)', 'MODULE_SHIPPING_JPNP_COUNTRIES_6', 'AR,UY,EC,CO,CL,PY,BR,VE,PE,DZ,UG,EG,ET,GH,GA,KE,CI,SL,DJ,ZW,SD,SN,TZ,TN,TG,NG,BW,MG,ZA,MU,MA,RW', 'Comma separated list of two character ISO country codes that are part of Zone 5.', '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 ('Rate table for Zone 5 up to 30 kg AIR', 'MODULE_SHIPPING_JPNP_COST_AIR_6', '50:580,100:685,150:790,200:895,250:1000,300:1105,400:1315,500:1525,600:1735,700:1945,800:2155,900:2365,1000:2575,1250:2945,1500:3315,1750:3685,2000:4055,2500:9200,3000:10600,3500:12000,4000:13400,4500:14800,5000:16200,5500:17400,6000:18600,6500:19800,7000:21000,7500:22200,8000:23400,8500:24600,9000:25800,9500:27000,10000:28200,11000:29800,12000:31400,13000:33000,14000:34600,15000:36200,16000:37800,17000:39400,18000:41000,19000:42600,20000:44200,21000:45800,22000:47400,23000:49000,24000:50600,25000:52200,26000:53800,27000:55400,28000:57000,29000:58600,30000:60200', 'Rate table for Zone 4, based on <b>\'AIR\'</b> shipping up to 30 kg weight.', '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 ('Rate table for Zone 5 up to 30 kg EMS', 'MODULE_SHIPPING_JPNP_COST_EMS_6', '300:1700,500:2100,600:2440,700:2780,800:3120,900:3460,1000:3800,1250:4600,1500:5400,1750:6200,2000:7000,2500:8500,3000:10000,3500:11500,4000:13000,4500:14500,5000:16000,5500:17500,6000:19000,7000:21100,8000:23200,9000:25300,10000:27400,11000:29500,12000:31600,13000:33700,14000:35800,15000:37900,16000:40000,17000:42100,18000:44200,19000:46300,20000:48400,21000:50500,22000:52600,23000:54700,24000:56800,25000:58900,26000:61000,27000:63100,28000:65200,29000:67300,30000:69400', 'Rate table for Zone 4, based on <b>\'EMS\'</b> shipping up to 30 kg weight.', '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 ('Zone 6 Countries (No EMS Europe)', 'MODULE_SHIPPING_JPNP_COUNTRIES_7', 'AL,BA,ME,RS', 'Comma separated list of two character ISO country codes that are part of Zone 6.', '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 ('Rate table for Zone 6 up to 30 kg AIR', 'MODULE_SHIPPING_JPNP_COST_AIR_7', '50:560,100:635,150:710,200:785,250:860,300:935,400:1085,500:1235,600:1385,700:1535,800:1685,900:1835,1000:1985,1250:2255,1500:2525,1750:2795,2000:3065,2500:6300,3000:7150,3500:8000,4000:8850,4500:9700,5000:10550,5500:11300,6000:12050,6500:12800,7000:13550,7500:14300,8000:15050,8500:15800,9000:16550,9500:17300,10000:18050,11000:19000,12000:19950,13000:20900,14000:21850,15000:22800,16000:23750,17000:24700,18000:25650,19000:26600,20000:27550,21000:28500,22000:29450,23000:30400,24000:31350,25000:32300,26000:33250,27000:34200,28000:35150,29000:36100,30000:37050', 'Rate table for Zone 5, based on <b>\'AIR\'</b> shipping up to 30 kg weight.', '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 ('Rate table for Zone 6 up to 30 kg EMS', 'MODULE_SHIPPING_JPNP_COST_EMS_7', '', 'Rate table for Zone 4, based on <b>\'EMS\'</b> shipping up to 30 kg weight.', '6', '0', now())");
	  }

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

    function keys() {
      $keys = array('MODULE_SHIPPING_JPNP_STATUS', 'MODULE_SHIPPING_JPNP_HANDLING', 'MODULE_SHIPPING_JPNP_TAX_CLASS', 'MODULE_SHIPPING_JPNP_ZONE', 'MODULE_SHIPPING_JPNP_SORT_ORDER');

      for ($i=1; $i <= $this->num_jpnp; $i++) {
        $keys[count($keys)] = 'MODULE_SHIPPING_JPNP_COUNTRIES_' . $i;
        $keys[count($keys)] = 'MODULE_SHIPPING_JPNP_COST_AIR_' . $i;
        $keys[count($keys)] = 'MODULE_SHIPPING_JPNP_COST_EMS_' . $i;
      }

      return $keys;
    }
  }
?>

Share this post


Link to post
Share on other sites

@@raiwa

 

Of course, here is the package.

I also added a setup.txt file which shows you the current setup. You can just copy & paste the prices and country codes from it.

 

 

Share this post


Link to post
Share on other sites

@@raiwa

 

Just as a side Info. Just installed latest version of Ship in Cart into a fresh osC BS shop

and used the flat rate module as it was set up from the beginning and once logged in the shipping cost gets charged twice.

Or if I activate the Flat rate and Table rate module all kind of weird calculations take place.

Looks like it happens with all shipping modules that I tested (so far 3 different modules)

 

Example:

Frantic DVD : $35

Flat rate : $5

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

Total : $45

 

Here again when logged out all is fine.

 

BTW. why 3 downloads of my shipping module? Who else would have an interest into a custom made for Japan only shipping module? :rolleyes:

Edited by Tsimi

Share this post


Link to post
Share on other sites

Hello @@Tsimi,

 

You are so right. it has nothing to do with your shipping module. It is an error remaining from the original module and no one was aware of this until now.

I had a look and the problem is that the order needs to be resetted on shipping change.

 

Please try this, it fixes the error for me:

Find line 479-480:

		    	}
		    	// EOF get taxes if not logged in (seems like less code than in order class)

Replace with:

		    	} else {
		    		$order = new order;
		    	}
		    	// EOF get taxes if not logged in (seems like less code than in order class)

Please let me know and I'll upload the update together with the state menu fix.

 

Thank you and kind regards.

 

PS: I downloaded the module only once :) , some collectors of all availabel stuff?? :rolleyes:

Share this post


Link to post
Share on other sites

@@raiwa

 

Hi Rainer

 

That seems to do the trick.

It calculates the right total now no matter if logged in or not.

And also if I switch addresses it still calculates the correct total.

So all seems to be working now.

 

Thanks for your time and efforts. Appreciate it. :thumbsup:

Share this post


Link to post
Share on other sites

Extremely minor bug fix (does not pass button class info properly).  Please note that I am working with an Edge version with FontAwesome.  That is why I have "fa fa-sign-in".

$ShipTxt .= '<div class="col-sm-12 estimator-padding">' . MODULE_CONTENT_CART_SHIPPING_ESTIMATOR_SHIPPING_OPTIONS_LOGIN . tep_draw_button(MODULE_CONTENT_CART_SHIPPING_ESTIMATOR_BUTTON_LOGIN, 'fa fa-sign-in', tep_href_link('login.php'), 'btn-success btn-sm') . '</div>';

to

$ShipTxt .= '<div class="col-sm-12 estimator-padding">' . MODULE_CONTENT_CART_SHIPPING_ESTIMATOR_SHIPPING_OPTIONS_LOGIN . tep_draw_button(MODULE_CONTENT_CART_SHIPPING_ESTIMATOR_BUTTON_LOGIN, 'fa fa-sign-in', tep_href_link('login.php'), null, null, 'btn-success btn-sm') . '</div>';
Edited by marcello

Share this post


Link to post
Share on other sites

I'm using this addon, works well and very useful.  I have noticed that if  I login and my account has more than one shipping address I can then select a new address.  Useful, but this then prevents some, not all, shipping options to disappear.

 

Going through the standard checkout process I can select a new shipping address and all shipping options are show.  So there must be something wrong in the ship in cart module.  I cant find the issue.  Has anyone  else noticed this behavior?

 

Mike


osC BS gold live - osC CE in development (awesome)

Share this post


Link to post
Share on other sites

Hello Mike @@Mikepo,

 

I checked and it works for me with different standard shipping modules. Which shipping modules and options disappear?

Can you post the modules if they are not included in standard oscommerce core package.

 

best regards

Rainer

Share this post


Link to post
Share on other sites

@@raiwa Thanks for the quick reply.  yes, the ones which disappear are not standard.  I'm using shipping modules

UK Royal Mail & Overseas Shipping Methods v2.2.2 dated 5 april 2011

http://addons.oscommerce.com/info/4473

 

typical shipping module is attached

 

I thought perhaps these modules were the cause, as zones are not defined.  (I'm not using zones)

 

Hope you can help

 

Mike

rmfirst.php


osC BS gold live - osC CE in development (awesome)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×