Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Hello,

First of all thanks a lot for this great contribution.

I installed the Multi vendor shipping functionality but have two errors and cannot figure out how to fix it.

Error (1) If the per item shipping method is installed for a vendor the shipping page gives an error

Fatal error: Call to a member function on a non-object in /includes/classes/vendor_shipping.php on line 89

 

Line 89 is as below

} elseif ($GLOBALS[$class]->enabled($vendors_id)) { //Module is enabled

 

 

Below is the code around it:

 

81 foreach ($this->modules[$vendors_id] as $value) {

82 echo '<br> value is '.$value;

83 $class = substr($value, 0, strrpos($value, '.')); // $class is the filename without the .php

84 echo '<br> module is '.$module;

85 if (tep_not_null($module)) {

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

87 $include_quotes[] = $class;

88 }

89 } elseif ($GLOBALS[$class]->enabled($vendors_id)) { //Module is enabled for this vendor

90 $include_quotes[] = $class;

91 }

92 }

 

Will appreciate any help.

 

Error (2) All the shipping option modules under each vendor show following error if the module is not installed. After i installe the module the error goes away but i am not sure if this might have any indication of a bigger issue somewhere else.

Per Item

Warning: constant(): Couldn't find constant MODULE_SHIPPING_ITEM_SORT_ORDER_3 in includes/modules/vendors_shipping/item.php on line 33

 

Warning: constant(): Couldn't find constant MODULE_SHIPPING_ITEM_SORT_ORDER_3 in includes/modules/vendors_shipping/item.php on line 33

0

 

Thanks

Posted

There's a thread devoted entirely to MVS- you should post any other questions you have about the contribution there. For your second problem, here is the fix from page 37 of the MVS support thread:

 

Incidentally, (chironae in particular, but others might be interested,) I've fixed the sort_order thing in code. Every vendors_shipping module needs to be modified.

 

The easiest way would be to change the calls from constant(x) to @constant(x). But that leaves a '0' in the Sort Order column, which (a) is different from the other osCommerce modules and (cool.gif leaves you without any way to tell which modules are installed and not installed.

 

The better way (in my not-so-humble opinion) is to replace the sort_order functions in each module with something else. Here's what I did in catalog/includes/modules/vendors_shipping/item.php, for example:

 

CODE

    function sort_order($vendors_id='1') {

    $sort_order = constant ('MODULE_SHIPPING_ITEM_SORT_ORDER_' . $vendors_id);

    if (isset ($sort_order)) {

      $this->sort_order = $sort_order;

    } else {

      $this->sort_order = '0';

    }

    return $this->sort_order;

  }

 

 

changed to:

 

CODE

  function sort_order($vendors_id='1') {

    $sort_order = 'MODULE_SHIPPING_ITEM_SORT_ORDER_' . $vendors_id;

    if (defined($sort_order)) {

      $this->sort_order = constant($sort_order);

    } else {

      $this->sort_order = '-';

    }

    return $this->sort_order;

  }

 

 

See, instead of taking constant() blindly, we set up a variable name (so we don't have to do the concatenation multiple times), then check to see if it's defined. If not, we use a non-numeric sort order, which will result in a blank in the Sort Order column, just like the standard modules.

 

It's not a tough change, from a coding standpoint. You've just got to make sure you hit every module.

 

Jude

 

For the first problem, I don't know. In my copy of includes/classes/vendor_shipping.php the code you're showing as being on line 89 is on line 106. My code around line 106 looks like this:

 

 $include_quotes = array();
       reset($this->modules[$vendors_id]);
       foreach ($this->modules[$vendors_id] as $value) {
         $class = substr($value, 0, strrpos($value, '.'));  // $class is the filename without the .php
         if (tep_not_null($module)) {
           if ( ($module == $class) && ($GLOBALS[$class]->enabled($vendors_id)) ) {
             $include_quotes[] = $class;
           }
         } elseif ($GLOBALS[$class]->enabled($vendors_id)) {  //Module is enabled for this vendor
           $include_quotes[] = $class;
         }
       }

 

I notice that you have at least one extra line of code

echo '<br> module is '.$module;

, not to mention whatever is missing above (about 20 lines or so). Are you using the most recent version of this contribution?

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Posted
There's a thread devoted entirely to MVS- you should post any other questions you have about the contribution there.  For your second problem, here is the fix from page 37 of the MVS support thread:

For the first problem, I don't know.  In my copy of includes/classes/vendor_shipping.php the code you're showing as being on line 89 is on line 106.  My code around line 106 looks like this:

 

 $include_quotes = array();
? ? ? ?reset($this->modules[$vendors_id]);
? ? ? ?foreach ($this->modules[$vendors_id] as $value) {
? ? ? ? ?$class = substr($value, 0, strrpos($value, '.')); ?// $class is the filename without the .php
? ? ? ? ?if (tep_not_null($module)) {
? ? ? ? ? ?if ( ($module == $class) && ($GLOBALS[$class]->enabled($vendors_id)) ) {
? ? ? ? ? ? ?$include_quotes[] = $class;
? ? ? ? ? ?}
? ? ? ? ?} elseif ($GLOBALS[$class]->enabled($vendors_id)) { ?//Module is enabled for this vendor
? ? ? ? ? ?$include_quotes[] = $class;
? ? ? ? ?}
? ? ? ?}

 

I notice that you have at least one extra line of code

echo '<br> module is '.$module;

, not to mention whatever is missing above (about 20 lines or so).  Are you using the most recent version of this contribution?

 

Hey Thanks for the info.

My second error is fixed.

As for the error with per item shipping module - Is the per item module in your install working for you? I am using the install from August 5 v.9CR5 . Is it possible for you to share your includes\modules\vendors_shipping\item.php file? May be I have wrong version and if you don?t have any major modifications to it, my problem might get fixed just by replacing that file.

 

Once again thanks.

  • 1 month later...
Posted
Hey Thanks for the info.

My second error is fixed.

As for the error with per item shipping module - Is the per item module in your install working for you? I am using the install from August 5 v.9CR5 . Is it possible for you to share your includes\modules\vendors_shipping\item.php file? May be I have wrong version and if you don?t have any major modifications to it, my problem might get fixed just by replacing that file.

 

Once again thanks.

 

Hello,

 

I was just wondering if you got the MVS working with the individual shipping prices contribution? If you did do, which individual product shipping one did you use? The one that uses the weight field? or the one that adds the extra field to the DB?

 

Thanks

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