Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Multi_Vendor_Shipping new thread


blucollarguy

Recommended Posts

Is the file on your server? Is it the same size (approximately) as the one in the distribution? Are the permissions on that file set to allow read and execute?

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

The file, xml_5.php is not in the includes folder, or anywhere else in the script that I can find. I removed the call for it from the usps.php file and it allowed me to install the mod, but if it will work is another question.

Link to comment
Share on other sites

It will work only if your server is running a version of PHP prior to 5.0. Even if it is, it would be better to fix the problem now than to leave it to later. The 3 Mar 2010 version of MVS should have a copy of the file.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi Jim,

 

Sorry I haven't been back sooner. Between work and virus (human variety) I haven't had a chance to work on any of the files.

 

I have a bug report: in both the checkout_confirmation and checkout_process files, there is an if/elseif statement that is a problem

 if (($total_weight &--#62; 0 ) || (SELECT_VENDOR_SHIPPING == 'true') ) {
include_once(DIR_WS_CLASSES . 'vendor_shipping.php');
 } elseif ( ($total_weight &--#62; 0 ) || (SELECT_VENDOR_SHIPPING == 'false') ) {
include_once(DIR_WS_CLASSES . 'shipping.php');
 }

 

As an OR statement in the first condition, the first if will always be true when there is any weight to the order, regardless of whether MVS is enabled or disabled. I removed the weight statement completely, but if you need it in there, then it should be an AND statement

 if (($total_weight &--#62; 0 ) && (SELECT_VENDOR_SHIPPING == 'true') )

 

However the second condition should probably just be an 'else' as osCommerce needs the shipping class to continue the checkout process.

 

That code is added towards the top of both files.

 

And I have a question.

 

I have MVS working just fine on my XAMPP development server on my own computer. Because the client "absolutely" requires this functionality, and MVS is the only addon that does it, this is also on a HostGator server where we've been developing a site for the client. And finally, it is on yet another HostGator server where the site is poised to go live... But we've run into a snafu...

 

The checkout process appears to be adding everything to the database as expected. It is sending the customer email. We do not have it set to send vendor emails. In fact, all the options are set to false. Before redirecting to checkout_success, however, it sends the error "Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /home/username/public_html/catalog/includes/functions/database.php on line 132"

 

I've never seen this error before, and while I understand what it wants, I have no idea where to start looking. As I said, I do not get the error on my XAMPP server with the exact same files. Any light you can shed on this would be greatly appreciated.

 

Thank you again,

-Anita

Edited by Skittles
Link to comment
Share on other sites

Thanks for the bug report. That should be && and not ||. I'll fix that in the next release.

 

Your other bug is something feeding an array to tep_db_input(). It may be showing up only in a newer version of PHP. I don't see where that could be happening in MVS. Could it be something else you've added? Of course I could just be missing something. Anyway, I would start throwing some debug code in to catch where it is happening, then trace the array back from there.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi JIm,

 

Thanks again for the speedy response.

 

MVS is the only addon I used that modified the checkout_process. When I put back the unmodified file, the order goes through without any problems.

 

The PHP on the HG server is actually 5.2.17. My XAMPP server is running 5.3.0. The mysql on the HG server is newer, 5.5.19, whereas I'm still running 5.1.37...

 

As I'm completely self-taught at PHP, (and only proficient with osCommerce,) I have no 'debug code' experience. Do you have a script or something that you could share?

 

Thanks,

-Anita

Link to comment
Share on other sites

Debug is something I've learned the hard way, so there may be better methods. I would start with something like adding to includes/functions/database.php. Find this line:

 

  function tep_db_input($string, $link = 'db_link') {

 

and add after it

 

if(is_array($string)) {
 print 'Array found!<pre>;';
 print_r($string);
 print '</pre>;';
 die;
}

 

That will at least give you the contents of the array that is causing the problem, and the page that it is happening on. Then you have to track down the source from there.

 

Regards

Jim

Edited by kymation

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

An empty array. Not exactly as informative as I expected, and I wasn't expecting much. Well, back to the drawing board code editor. I would then just start putting die; commands at random places in the file that is showing the error. If the error still shows you're past the error location; if it doesn't you're before the error. Eventually you'll get to the right location. Then it's just a matter of figuring out what's generating an empty array.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

As I mentioned before, the code works on my XAMPP server, so I decided to run the debug code there. I get the same thing. So on one server, an empty array is ignored, on another server, it causes an error.

 

So I'm thinking in the long run, it's a good thing it caused the error now, instead of somewhere else down the line. In spite of how annoying it is.

 

Thanks for you help. I'll keep you posted.

 

Still chuckling,

-Anita

Link to comment
Share on other sites

Jim,

 

Thanks to your help, I located the troublesome bit of code and I've created a work-around.

 

Last year, I spent about six months modifying a number of 2.2 contributions for osC 2.3.1 and created my own install version. One of the addons is Order Editor. As you may already know, Order Editor stores the shipping method along with the order. That one line of code was the problem.

 

It wants to put $shipping['id'] into the $sql_data_array for the order table, but with MVS enabled, $shipping['id'] is empty. so I changed

'shipping_module' => $shipping['id'],

to

'shipping_module' => (SELECT_VENDOR_SHIPPING == 'true' ? 'MVS' : $shipping['id']),

and the error is no longer showing up.

 

I've learned an invaluable troubleshooting trick. Die; Something so simple, I feel rather sheepish it never occurred to me. In my defense, I admit, I was pretty frantic... not much of an excuse, but the only one I've got... :)

 

Thanks again for your timely help, and the generosity of your time.

-Anita

Link to comment
Share on other sites

Glad to hear you got it fixed. Errors that involve the database are some of the hardest to find, since they can be just about anywhere. Usually all that is required is to use print or print_r() to take a look at the data.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Just a quick update: thanks to Matt now have the latest USPS working. One item I found was that if you are using geo zones/zones to geo zones you need the following in the class constructor otherwise the zone check will fail:

 

 

$this->delivery_country_id = $order->delivery['country']['id'];

$this->delivery_zone_id = $order->delivery['zone_id'];

 

Then change appropriately in function enabled and function zones. Worked for me....

 

Peter

Link to comment
Share on other sites

There are bugs in the zones part of some of the MVS shipping modules. I need to put up another fix ... when I find the time.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Bug report for checkout_process.php, MVS for osC 2.3.1

 

MVS edits refer to the order ID as $order_id. However, osC is using the variable $insert_id. A quick find and replace, and now the order IDs are being stored correctly.

 

Also, around line 254, $sql_data_array for orders_products has the vendor_id added to the array. However, there is no "//MVS" to help you find it when making mods to existing files by searching on "MVS".

 

I have admin/vendor_email_send.php working: sending emails, and updating the database to show vendor email has been sent. I'll be emailing you that file later today, Jim.

 

Back to the grindstone. :)

-Anita

Link to comment
Share on other sites

MVS uses the line

 

    $order_id = $insert_id;

 

to take care of that problem (Line 302). I don't remember why that was done; possible it was interfering with some other osC variable. Does that code need to be moved up?

 

Line 254 is in the Attributes for downloadable products section. No need for MVS there. Are your line numbers different from the stock file?

 

Thanks again for the bug reports.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I just pulled the checkout_process file from the mvs_1.3_for_osC2.3.1.tar archive, and could not find "$order_id = $insert_id;" any where in the file. Files in the archive are dated early February.

 

Yes, our line numbers are different, sorry... in the file from the archive, it is line 240 where 'vendors_id' => $order->products[$i]['vendors_id'] is added but not commented:

 

// Update products_ordered (for bestsellers list)
   tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
   $sql_data_array = array('orders_id' => $insert_id,
					    'products_id' => tep_get_prid($order->products[$i]['id']),
					    'products_model' => $order->products[$i]['model'],
					    'products_name' => $order->products[$i]['name'],
					    'products_price' => $order->products[$i]['price'],
					    'final_price' => $order->products[$i]['final_price'],
					    'products_tax' => $order->products[$i]['tax'],
					    'products_quantity' => $order->products[$i]['qty'],
					    'vendors_id' => $order->products[$i]['vendors_id']
					   );
   tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
   $order_products_id = tep_db_insert_id();
//------insert customer choosen option to order--------

 

Maybe seeing it in the surrounding code will help. This is only an issue, of course, for people who need to modify the file as they've already modified it for other addons. Anyone just uploading the files won't have the line missing.

 

Is there a later archive than February 5, 2012?

 

-Anita

Link to comment
Share on other sites

No, I was looking at an old version. My version tracking is primitive at best, and sometimes I forget where things are. It appears that line has mutated into (Line 302)

 

    $order_id = $orders_id;

 

Probably a result of me trying to do a global replace and failing miserably. I did find the other line that you mentioned and added a comment. Thanks for putting up with my fumbling here.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 2 weeks later...

Hi Jim,

 

I installed the MVS 1.2.3 on oscommerce 2.3.1. My Hosting sever is PHP 5.3. For some reasons, I get the below error message on the "checkout_shipping" page when I enable the "item" module. Can you please tell me if something can be done? I appreciate for your time.

 

error: Call to a member function enabled() on a non-object in /home/content/93/8907593/html/includes/classes/vendor_shipping.php on line 117

 

Thank you.

Johnny

Link to comment
Share on other sites

Have you set up at least one shipping module for each vendor in your store?

 

Regards

Jim

 

Hi Jim,

 

Thank you for your response. Yes, I have at least 2 shipping modules enabled per each vendor. Most of the Vendors (Federal Express, First Items -- Plus, Flat Rate, & etc...) are working fine except the "Per Item" module is having the error on the "checkout_shipping.php" page. On the "shopping_cart.php" page, when I click on the "Estimated Shppping" button, the "Per Item" module would show up. Am I doing anything wrong? Please help. Thanks in advnace, Jim!

 

Best Regards,

Johnny

Link to comment
Share on other sites

It could be a shipping module with a coding error. First, check the vendors_shipping directory and remove anything that is not a shipping module. If that isn't the problem, remove all modules that you are not using. You might also try removing the Per Item module if it's causing errors.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

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