Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] individual product shipping prices


Recommended Posts

bump for this question thanks!

 

. when i go to admin - modules - shipping , I got

 

 

Fatal error: Cannot redeclare class indvship in /home/.salazar/dreamzst/dreamzstation.com/store/includes/modules/shipping/indvship.php on line 14
Link to comment
Share on other sites

bump for this question  thanks!

 

. when i go to admin - modules - shipping , I got

 

Hi Guys, I got this working within a day or so. I had some issues but they were all fixable. fayenet, I had that too. Your problem is that you are trying to declare the indvship twice. I found my first occurance and deleted it. Everything was gravy after that :D

Link to comment
Share on other sites

Hi Guys, I got this working within a day or so. I had some issues but they were all fixable. fayenet, I had that too. Your problem is that you are trying to declare the indvship twice. I found my first occurance and deleted it. Everything was gravy after that  :D

 

 

 

THanks dfrb26dett.

 

I did try to delete/quote out the "class indvship {var $code, $title, $description, $icon, $enabled, $shiptotal; }" in "includes/modules/shipping/indivship.php.

 

but I got

Fatal error: Cannot instantiate non-existent class: indvship in /home/.salazar/dreamzst/dreamzstation.com/store/adminlcll/modules.php on line 57
after that.

 

where did you find the other "indivship" declaration?

 

 

Thanks for helping .

Link to comment
Share on other sites

Hello to all. Im new to this site. I followed the instructions as it said on the instructions.html file, but when try to add a new product, i get the following:

 

1146 - Table 'jiqqa4f_store.TABLE_SHIPPING_METHODS' doesn't exist

 

select methods_id, methods_name from TABLE_SHIPPING_METHODS

 

[TEP STOP]

 

theres no table by that name when i checked it.

Link to comment
Share on other sites

Hello to all. Im new to this site. I followed the instructions as it said on the instructions.html file, but when try to add a new product, i get the following:

 

1146 - Table 'jiqqa4f_store.TABLE_SHIPPING_METHODS' doesn't exist

 

select methods_id, methods_name from TABLE_SHIPPING_METHODS

 

[TEP STOP]

 

theres no table by that name when i checked it.

 

 

read above

 

Post #173

Post #174

Link to comment
Share on other sites

read above

 

Post #173

Post #174

 

 

i put the define statements in both database_tables.php and i still get this error:

 

1146 - Table 'jandj2_osc1.TABLE_SHIPPING_METHODS' doesn't exist

 

select methods_id, methods_name from TABLE_SHIPPING_METHODS

 

[TEP STOP]

 

 

 

 

 

any other ideas? thank you

 

-todd

Link to comment
Share on other sites

i put the define statements in both database_tables.php and i still get this error:

 

1146 - Table 'jandj2_osc1.TABLE_SHIPPING_METHODS' doesn't exist

 

select methods_id, methods_name from TABLE_SHIPPING_METHODS

 

[TEP STOP]

any other ideas?  thank you

 

-todd

 

same problem here thing is the is no shipping_methods table

Link to comment
Share on other sites

Sorry I haven't been to this thread in a few day.

Ok I will try to anwser each Q

 

1-TABLE_SHIPPING_METHODS

That step in Admin>Categories does not need to be there I am sorry. That was my other Multi shipping project I started. You can delete that part totally (hold on don't do it yet)

//Product shipping

$ship_method_array = array(array('id' => '', 'text' => TEXT_NONE));

$ship_method_query = tep_db_query("select methods_id, methods_name from " . TABLE_SHIPPING_METHODS);

while ($ship_method = tep_db_fetch_array($ship_method_query)) {

$ship_method_array[] = array('id' => $ship_method['methods_id'], 'text' => $ship_method['methods_name']);

}

//end Product shipping

 

But I cannot guarantee you will not get other errors as those values might be called somewhere else. You can add the table TABLE_SHIPPING_METHODS

CREATE TABLE `shipping_methods` (
 `methods_id` int(10) unsigned NOT NULL auto_increment,
 `methods_name` varchar(32) NOT NULL default '',
 `methods_module` varchar(32) NOT NULL default '',
 `methods_handling_charge` decimal(5,2) NOT NULL default '0.00',
 `methods_handling_per_box` tinyint(1) NOT NULL default '0',
 `methods_tare_weight` decimal(4,2) NOT NULL default '0.00',
 `methods_max_box_weight` tinyint(3) unsigned NOT NULL default '0',
 `date_added` datetime default NULL,
 `last_modified` datetime default NULL,
 `ship_zipcode` varchar(32) NOT NULL default '',
 PRIMARY KEY  (`methods_id`)
) TYPE=MyISAM AUTO_INCREMENT=14;

 

and define it in the database files. I guess you can leave it blank or add you methods like so

INSERT INTO `shipping_methods` VALUES (1, 'Fedex', 'fedex1', 0.00, 0, 0.00, 50, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '');
INSERT INTO `shipping_methods` VALUES (2, 'Flat Rate', 'flat', 0.00, 0, 0.00, 50, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '');
INSERT INTO `shipping_methods` VALUES (3, 'Free Shipping', 'freeshipper', 0.00, 0, 0.00, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '');
INSERT INTO `shipping_methods` VALUES (4, 'Individual Shipping', 'indvship', 0.00, 0, 0.00, 50, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '');
INSERT INTO `shipping_methods` VALUES (5, 'Per Item', 'item', 0.00, 0, 0.00, 50, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '');
INSERT INTO `shipping_methods` VALUES (6, 'Percent', 'percent', 0.00, 0, 0.00, 50, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '');
INSERT INTO `shipping_methods` VALUES (7, 'Table Rates', 'table', 0.00, 0, 0.00, 50, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '');
INSERT INTO `shipping_methods` VALUES (8, 'UPS', 'ups', 0.00, 0, 0.00, 50, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '');
INSERT INTO `shipping_methods` VALUES (9, 'UPSXML', 'upsxml', 0.00, 0, 0.00, 50, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '');
INSERT INTO `shipping_methods` VALUES (10, 'USPS', 'usps', 0.00, 0, 0.00, 50, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '');
INSERT INTO `shipping_methods` VALUES (11, 'Zone Based', 'zones', 0.00, 0, 0.00, 50, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '');
INSERT INTO `shipping_methods` VALUES (12, 'Zonesworld', 'zonesworld', 0.00, 0, 0.00, 50, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '');
INSERT INTO `shipping_methods` VALUES (13, 'Regions', 'regions', 0.00, 0, 0.00, 50, '0000-00-00 00:00:00', '0000-00-00 00:00:00', '');

 

If you do decide to delete that part of code check for other error that appear because of removing it. Please post here so I can fix instructrions

Thanks

q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| )

Link to comment
Share on other sites

I am having the same error as above

 

and 173 and 174 do not address

 

1146 - Table 'elle1_data.TABLE_SHIPPING_METHODS' doesn't exist

select methods_id, methods_name from TABLE_SHIPPING_METHODS

[TEP STOP

 

they talk about TABLE_SHIPPING not being fount..s o I added the d

define('TABLE_PRODUCTS_SHIPPING', 'products_shipping'); //e

 

to both database_tables.php

 

thank you for your help

Noppie

Link to comment
Share on other sites

I did try to delete/quote out the "class indvship {var $code, $title, $description, $icon, $enabled, $shiptotal; }" in "includes/modules/shipping/indivship.php.

 

DO NOT DELETE THAT That is what tells the script this is the class. deleting it or commenting out is like removing the whole file.

 

the problem is either in classes shipping.php shopping_cart.php or order.php..depending on where you are getting the

Cannot redeclare class indvship

Make sure you do not have or comment out these lines

require(DIR_WS_CLASSES . 'shipping.php');
$shipping_modules = new shipping;

 

they should only be in application_top.php now

 

I hope that answers all the problems

q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| )

Link to comment
Share on other sites

crashwave your help worked, but i have another problem now. :'( when i goto checkout i get the following:

 

Fatal error: Call to a member function on a non-object in /home/jiqqa4f/public_html/catalog/checkout_shipping.php on line 139

 

This is my code in checkout_shipping.php

 

Line 139 contains is $quotes = $shipping_modules->quote();

 }

// get all available shipping quotes
 $quotes = $shipping_modules->quote();

// if no shipping method has been selected, automatically select the cheapest method.
// if the modules status was changed when none were available, to save on implementing
// a javascript force-selection method, also automatically select the cheapest shipping
// method if more than one module is now enabled
 if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest();

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SHIPPING);

 

sorry to be bothering...

Link to comment
Share on other sites

ok i checked that and it was missing in some areas now i get this

 

Fatal error: Call to a member function on a non-object in /home/jiqqa4f/public_html/catalog/includes/classes/order.php on line 153

 

line 153 is else {$shipping_cost = $shipping['cost'] + $shipping_modules->get_shiptotal();}//end

 

//phpmom.com indv shipping
if($shipping['id']==indvship_indvship){
$shipping_cost = $shipping['cost']; }
else {$shipping_cost = $shipping['cost'] + $shipping_modules->get_shiptotal();}//end

Link to comment
Share on other sites

DO NOT DELETE THAT That is what tells the script this is the class. deleting it or commenting out is like removing the whole file.

 

the problem is either in classes  shipping.php shopping_cart.php or order.php..depending on where you are getting the

 

Make sure you do not have or comment out these lines

require(DIR_WS_CLASSES . 'shipping.php');
$shipping_modules = new shipping;

 

they should only be in application_top.php now

 

I hope that answers all the problems

 

 

Thanks crashwave

 

I checked out my shipping.php , didn't find anything...

 

the

Fatal error: Cannot redeclare class indvship in /home/.salazar/dreamzst/dreamzstation.com/store/includes/modules/shipping/indvship.php on line 14

 

happens when I go to admin - > modules -> shipping.

 

 

so I assume there's a error in shipping.php under /includes/classes/ , right ?

 

 

here's the code, i didnt find the "indvship" was declared ....

 

 

<?php

/*

  $Id: shipping.php,v 1.23 2003/06/29 11:22:05 hpdl Exp $

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright © 2003 osCommerce

 

  Released under the GNU General Public License

*/

 

  class shipping {

    var $modules;

 

// class constructor

    function shipping($module = '') {

      global $language, $PHP_SELF, $cart;

// BOF: Individual Shipping Prices//phpmom.com

$products = $cart->get_products();

 

$shiptotal = $this->get_shiptotal();

$indvcount = $this->get_indvcount();

// EOF: Individual Shipping Prices

 

      if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) {

        $this->modules = explode(';', MODULE_SHIPPING_INSTALLED);

 

        $include_modules = array();

 

        if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) ) {

          $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)));

        } else {

          reset($this->modules);

        // BOF: Individual Shipping Prices//phpmpm.com

// Show either normal shipping modules or Individual shipping module when Individual Shipping Module is On

// Show Individual Shipping Only

if($indvcount==sizeof($products)){ //hadir

if ((tep_get_configuration_key_value('MODULE_SHIPPING_INDVSHIP_STATUS')) && $shiptotal) {

$include_modules[] = array('class'=> 'indvship', 'file' => 'indvship.php');

}}

// BOF: WebMakers.com Added: Downloads Controller - Free Shipping and Payments

// Show either normal shipping modules or free shipping module when Free Shipping Module is On

// Free Shipping Only

if ((tep_get_configuration_key_value('MODULE_SHIPPING_FREESHIPPER_STATUS')) && $cart->show_weight()==0 && ($shiptotal == '0' || !$shiptotal)) {

$include_modules[] = array('class'=> 'freeshipper', 'file' => 'freeshipper.php');

} else {

// All Other Shipping Modules

if(sizeof($products)>$indvcount){

while (list(, $value) = each($this->modules)) { //try foreach is faster//hadir

$class = substr($value, 0, strrpos($value, '.'));

// Don't show Free Shipping Module

if (($class !='freeshipper')/* && ($class != 'indvship')*/) {

$include_modules[] = array('class' => $class, 'file' => $value);

}

}

}}

// EOF: Free Shipping and Payments// EOF: Individual Shipping Prices

}

 

 

        for ($i=0, $n=sizeof($include_modules); $i<$n; $i++) {

          include(DIR_WS_LANGUAGES . $language . '/modules/shipping/' . $include_modules[$i]['file']);

          include(DIR_WS_MODULES . 'shipping/' . $include_modules[$i]['file']);

 

          $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'];

        }

      }

    }

 

    function quote($method = '', $module = '') {

      global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;

 

      $quotes_array = array();

 

      if (is_array($this->modules)) {

        $shipping_quoted = '';

        $shipping_num_boxes = 1;

        $shipping_weight = $total_weight;

 

        if (SHIPPING_BOX_WEIGHT >= $shipping_weight*SHIPPING_BOX_PADDING/100) {

          $shipping_weight = $shipping_weight+SHIPPING_BOX_WEIGHT;

        } else {

          $shipping_weight = $shipping_weight + ($shipping_weight*SHIPPING_BOX_PADDING/100);

        }

 

        if ($shipping_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes

          $shipping_num_boxes = ceil($shipping_weight/SHIPPING_MAX_WEIGHT);

          $shipping_weight = $shipping_weight/$shipping_num_boxes;

        }

 

        $include_quotes = array();

 

        reset($this->modules);

        while (list(, $value) = each($this->modules)) {

          $class = substr($value, 0, strrpos($value, '.'));

          if (tep_not_null($module)) {

            if ( ($module == $class) && ($GLOBALS[$class]->enabled) ) {

              $include_quotes[] = $class;

            }

          } elseif ($GLOBALS[$class]->enabled) {

            $include_quotes[] = $class;

          }

        }

 

        $size = sizeof($include_quotes);

        for ($i=0; $i<$size; $i++) {

          $quotes = $GLOBALS[$include_quotes[$i]]->quote($method);

          if (is_array($quotes)) $quotes_array[] = $quotes;

        }

      }

 

      return $quotes_array;

    }

//phpmom.com// find shiptotoal and indvcount(# of products with indv shipping//

function get_shiptotal() {

global $cart;

$this->shiptotal = '';

$products = $cart->get_products();

for ($i=0, $n=sizeof($products); $i<$n; $i++) {

// mod indvship//modified hadir

// if ($products[$i]['products_ship_price']) {

$products_ship_price = $products[$i]['products_ship_price'];//}

$products_ship_price_two = $products[$i]['products_ship_price_two'];

$products_ship_zip = $products[$i]['products_ship_zip'];

$qty = $products[$i]['quantity'];

if(($products_ship_price) ||($products_ship_price_two)){

$this->shiptotal += ($products_ship_price);

if ($qty > 1) {

if ($products_ship_price_two) {

$this->shiptotal += ($products_ship_price_two * ($qty-1));

} else {

$this->shiptotal += ($products_ship_price * ($qty-1));

}

} }

} // first mod ok $this->shiptotal += ($products_ship_price * $qty);

// mod indvship//modified hadir

// first mod ok $this->shiptotal += ($products_ship_price * $qty);

// end indvship

return $this->shiptotal;

}

 

function get_indvcount() {

global $cart;

$this->indvcount = '';

$products = $cart->get_products();

for ($i=0, $n=sizeof($products); $i<$n; $i++) {

// mod indvship//modified hadir

// if ($products[$i]['products_ship_price']) {

$products_ship_price = $products[$i]['products_ship_price'];//}

$products_ship_price_two = $products[$i]['products_ship_price_two'];

if(is_numeric($products_ship_price)){

$this->indvcount += '1';

}

} // first mod ok $this->shiptotal += ($products_ship_price * $qty);

// mod indvship//modified hadir

// first mod ok $this->shiptotal += ($products_ship_price * $qty);

// end indvship

return $this->indvcount;

} //end phpmom.com

 

    function cheapest() {

      if (is_array($this->modules)) {

        $rates = array();

 

        reset($this->modules);

        while (list(, $value) = each($this->modules)) {

          $class = substr($value, 0, strrpos($value, '.'));

          if ($GLOBALS[$class]->enabled) {

            $quotes = $GLOBALS[$class]->quotes;

            for ($i=0, $n=sizeof($quotes['methods']); $i<$n; $i++) {

              if (isset($quotes['methods'][$i]['cost']) && tep_not_null($quotes['methods'][$i]['cost'])) {

                $rates[] = array('id' => $quotes['id'] . '_' . $quotes['methods'][$i]['id'],

                                'title' => $quotes['module'] . ' (' . $quotes['methods'][$i]['title'] . ')',

                                'cost' => $quotes['methods'][$i]['cost']);

              }

            }

          }

        }

 

        $cheapest = false;

        for ($i=0, $n=sizeof($rates); $i<$n; $i++) {

          if (is_array($cheapest)) {

            if ($rates[$i]['cost'] < $cheapest['cost']) {

              $cheapest = $rates[$i];

            }

          } else {

            $cheapest = $rates[$i];

          }

        }

 

        return $cheapest;

      }

    }

  }

?>

Link to comment
Share on other sites

email I got

Hi,

 

I am getting this weird error

Call to a member function on a non-object in

c:\phpdev\www\includes\classes\order.php on line 153

 

line 153 is

else {$shipping_cost = $shipping['cost'] +

$shipping_modules->get_shiptotal();}//end

 

part of the

//phpmom.com indv shipping

if($shipping['id']==indvship_indvship){

$shipping_cost = $shipping['cost']; }

else {$shipping_cost = $shipping['cost'] +

$shipping_modules->get_shiptotal();}//end

 

I was wondering if you had any idea where I could look to see what the

problem was?

 

Many thanks for your time.

 

my answer

That is telling us it does not know what $shipping_modules->get_shiptotal()

is

1-Make sure you have the newest one in the contribution page.

2-Make sure you placed the "function get_shiptotal()" in the

classes/shipping.php.

3-make sure you added the line in application_top.php.

4-make sure inder function cart() { you have ONE line that starts with

global and has ,$shipping_modules.

 

answer I got back

Thanks for that, I couldnt see the problem for looking. It was in the function cart() line, i had a ; before the shipping_modules!!
Edited by crashwave

q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| )

Link to comment
Share on other sites

fayenet

make sure you do not have those 2 lines I posted in any other file other than what the instructions say..only in application_top.php.

I will check some more to try and figure out where that could be coming from.

q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| )

Link to comment
Share on other sites

fayenet

I cannot find anywhere where you would get

Fatal error: Cannot redeclare class indvship in /home/.salazar/dreamzst/dreamzstation.com/store/includes/modules/shipping/indvship.php on line 14

 

in the admin area. No one has had that problem as far as I can tell. PLEASE go through instructions again on clean files. Make sure you replaced your indvship.php file with the one in the download. it is different than original release.

Edited by crashwave

q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| )

Link to comment
Share on other sites

I know you said admin but also make sure you read this http://www.oscommerce.com/forums/index.php?sho...ndpost&p=564012

 

 

i searched

 

checkout_confirmation.php

checkout_payment.php

includes/classes/shipping.php

includes/classes/shopping_cart.php

includes/classes/order.php

 

there's either no

require(DIR_WS_CLASSES . 'shipping.php');
$shipping_modules = new shipping;

or it's been quoted out.

 

 

Sorry i m new to php. Post a screen copy, maybe it could help....

 

test.gif[

Edited by fayenet
Link to comment
Share on other sites

fayenet

I cannot find anywhere where you would get

Fatal error: Cannot redeclare class indvship in /home/.salazar/dreamzst/dreamzstation.com/store/includes/modules/shipping/indvship.php on line 14

 

in the admin area. No one has had that problem as far as I can tell. PLEASE go through instructions again on clean files. Make sure you replaced your indvship.php file with the one in the download. it is different than original release.

 

 

alright then.. thanks

Link to comment
Share on other sites

i finally got it to work! thanks for all your help crashwave.

 

i was getting an error:

 

 

Fatal error: Call to undefined function: get_shiptotal() in /home/jiqqa4f/public_html/catalog/includes/classes/shipping.php on line 23

 

my mistake was i had

// EOF: Individual Shipping Prices if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) {

 

instead of

// EOF: Individual Shipping Prices

if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) {

Link to comment
Share on other sites

1146 - Table 'everspeedb.TABLE_ADMIN_FILES' doesn't exist

select admin_files_name from TABLE_ADMIN_FILES where FIND_IN_SET( '1', admin_groups_id) and admin_files_name = 'categories.php'

[TEP STOP]

 

This is what im getting after adding

 

define('TABLE_PRODUCTS_SHIPPING', 'products_shipping'); //eof

 

into both database files

 

any help is appreciated

Link to comment
Share on other sites

1146 - Table 'everspeedb.TABLE_ADMIN_FILES' doesn't exist

select admin_files_name from TABLE_ADMIN_FILES where FIND_IN_SET( '1', admin_groups_id) and admin_files_name = 'categories.php'

[TEP STOP]

 

This is what im getting after adding

 

define('TABLE_PRODUCTS_SHIPPING', 'products_shipping'); //eof

 

into both database files

 

any help is appreciated

 

 

FIXED!!!!!!!!! it was not a problem with the contrib but a conflict with mr admin panel login contrib

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.
Note: Your post will require moderator approval before it will be visible.

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...