Problem with shipping module (help!!)

Posts: 4
Joined: 03/18/2008

I seem to be having a problem with all things related to shipping in ubercart. Originally, we were trying to set up UPS as the only shipping option but it was impossible to generate shipping quotes after we set up the UPS module. When you clicked "calculate shipping" during checkout, the status bar flashed for a microsecond and an error message immediately popped up saying that there was an error calculating the shipping quote and to call to complete the order.

I realized we hadn't yet set up a default origin address for the store, and figured that was the problem. No dice. I double, triple and quadruple checked our UPS account info... still no luck. The only thing that allows you to actually process the order at this point is a flat rate, but then when you try to process the shipping manually on the backend, we're still getting errors.

In fact, pretty much anywhere on the site that has to do with a shipping address, we get one or many errors that all look like this (these are the errors returned when you choose to manually set up shipping for an order):

"warning: in_array(): Wrong datatype for first argument in /home/sexy/html/modules/ubercart/shipping/uc_shipping/uc_shipping.module on line 1123.
warning: in_array(): Wrong datatype for first argument in /home/sexy/html/modules/ubercart/shipping/uc_shipping/uc_shipping.module on line 836.
warning: in_array(): Wrong datatype for first argument in /home/sexy/html/modules/ubercart/shipping/uc_shipping/uc_shipping.module on line 1334."

Similar errors pop up sometimes when updating the UPS module info, and I believe sometimes on the checkout page. Every single line of code that these errors refer to looks like this:

if (!in_array($address, $addresses)){
or
if (!in_array($store_address, $addresses)){

I feel like this has to be an indication of why none of the shipping options are working but I cannot figure out what's wrong. I'm more of a designer than a web developer so troubleshooting this sort of problem is not necessarily my forte. Please help ASAP as our store is basically crippled until we can figure out what's wrong.

Thanks!!

Posts: 14
Joined: 03/18/2008

I too am a Musician/Designer/Marketing person but not a real programmer. All though I do a little and understand some about programming. This is very similar to the problem I am having as well. My product is in there and when I fill in all of the information to process the order I get to the same point you do and it returns the same message for the shipping quote you mentioned above. I am using only the USPS shipping portion in the modules and My USPS account is not live server yet. I am waiting for them to send me a confirmation email to try it again. If I get the same errors after that I believe maybe it has something to do with the versions I am using possibly, not sure. I too have to have this working very soon or I will have to move on and try another Ecommerce system. Time is money and production. Need help on this fast. I am using ver 5.1 of Drupal,Mysql 4.1.22-standard,PHP version 4.4.4,ubercart-5.x-1.0-beta6. My web site is http://jamacast.com. Go to my site and click on the product under the product menu on the left if you try to process the order it will not let you go through to the end because of this shipping error. Just loops. Also why would a shopping cart system allow you to even purchase a product that has 0 quantity. This product I am selling is just one used album, so the quantity is initially set to one and after that the cart should not allow anybody to add that product a second time. what am I missing with the overall setup I have went over it a hundred times, cant find anything to stop this adding of a second album when there only exists one album in stock. Help is very appreciated with this matter.

thanks
Eric

Posts: 1290
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

tempurpedic, what version of PHP are you using? My first guess would be it's the version of PHP you are on, but I could be wrong. It could be something with simplexml in that case. If you can upgrade PHP versions I'd recommend it.

IGTB, I would do this too - and I'd also upgrade to the latest version of Drupal. 5.1 is a little bit stale.

There may also be an issue with being in the sandbox USPS API, I'm not sure. You might even get different results once that is the case.. for some reason I remember having issues on our site with them as well (at first). Good luck!

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 4
Joined: 03/18/2008

hi torgos,
thanks for responding so quickly, much appreciated. actually i just noticed we're running php 4.3.9 which is kind of outdated so i'm going to upgrade that and see if that helps... i'll let you know how it goes.

Posts: 4
Joined: 03/18/2008

ok, so our other developer insists that the code he's written will not run on php 5 and might have some problems on php 4.4+... so i guess an upgrade isn't the ideal solution.

is there something specific that makes you think that the php version is to blame? is there anything else that could be causing it/something else i can do to solve the problem?

any suggestions you guys have would be amazingly helpful.

Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

temurpedic wrote:
ok, so our other developer insists that the code he's written will not run on php 5 and might have some problems on php 4.4+... so i guess an upgrade isn't the ideal solution.

<rant>
PHP 5 is three years old already.
After August 8, PHP 4 will no longer be supported by the PHP development team.
Drupal will not support PHP 4 at all in the next release, no matter what happens with Ubercart.
</rant>

Ubercart development is done under PHP 5. While PHP 5 specific features aren't intentionally used, it is inevitable that some of these will creep in. That's probably the case here. Even if this bit of code was changed to be PHP 4 compatible, I'm sure there will be other things that fail now or in the future.

While I understand not wanting to mess with something that works, you're heading for bigger problems if you continue down the PHP 4 path. I suggest you get a new developer, if he won't keep up with things.

temurpedic wrote:
is there something specific that makes you think that the php version is to blame? is there anything else that could be causing it/something else i can do to solve the problem?

Yeah, the "wrong argument type" error, it's a symptom that shows when PHP 5 code is run under PHP 4. And because shipping does work for most people, it's probably not just a simple coding error.

--

<tr>.

Posts: 4
Joined: 03/18/2008

thanks for the reply, that's very helpful to know. obviously you've had some personal frustrations surrounding this issue Smiling

unfortunately it's not within my power to get a new developer, and the apps he's written are pretty sophisticated/took months to code, so having him redo them under php5 isn't feasible or practical since they're much more complicated than drupal itself.

we may have to move the drupal install to a different device running php5, but this isn't an ideal solution since rackspace already charges us about 1k a month for managed hosting on 2 devices, so i imagine adding a third would jack up that cost even more. also, i've never moved an entire drupal site before, but it seems as though it would be slightly painful.

is there really no other workaround anyone can think of for this issue? we'll do what we have to do to get shipping to function, but hopefully we don't have to do anything drastic or super-costly...

Posts: 14
Joined: 03/18/2008

Hello very helpful people, both of you guys are great for responding. Actually the thought of upgrading a site that is live with some users scares the hell out of me. I'm just not sure if the current existing Drupal Modules I am using will work with the new version 6. Most of my modules are 5.x versions and some are even beta's. I think that PHP upgrade is held back by my hosting service because of Mysql reasons maybe not sure why they are behind with this exactly. A lot of subscribers would probably be forced to have to upgrade and that could cost site owners considerable amounts of cash to get it done as well as down time they probably would not like to have to go through. I think you are right about the down the road thing though. This could be very problematic for everybody if they don't upgrade. I guess the real problem is with security as well as more efficient coding for the future ideally should not be under estimated. I think the best approach would be to build a second site with the latest greatest versions and then slowly move over a piece at a time and then when it is all ready, go for it live with that new version. Keep the current site live and well as you work out the new one and then domain point to the new server when the time is right. Maybe I am just paranoid haha.

The problem I was having has gone away now that the USPS server is the live one. However now every time I click on the review order button I get this error msg across the top of the next page that is the page that you then continue on to make your purchase, the one where it shows all of the totals and stuff. That error is as follows

warning: array_search() [function.array-search]: Wrong datatype for first argument in /home/hugafish/public_html/sites/all/modules/ubercart/shipping/uc_usps/uc_usps.module on line 539.

is this the kind of errors you guys mean when you are talking about the wrong versions of PHP possibly?

Thanks very much
IGTB

Posts: 1290
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

Just to be clear, when I (or we) say "Latest version of Drupal" we should probably say "Drupal 5." Ubercart doesn't support D6 yet (and as you are aware, most modules that are out there don't either - at the moment).

So you can leave your D5 installation alone, but you'll most definitely want to upgrade to PHP5. It's a better system and hopefully your provider will be able to upgrade you. Assuming they know what they're doing, the installation is quick and relatively painless. You might just want to insure that they install it with openssl and mysql support. (Can't think of any others besides defaults right now).

With php5 the "wrong datatype" error will go away.

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 2243
Joined: 08/07/2007
AdministratoreLiTe!

I thought I was getting around that error by casting the addresses into arrays before stuffing them into the $addresses variable. It'll be just my luck that that technique doesn't work in PHP4 like I expect it to.

Posts: 14
Joined: 03/18/2008

Well I put in a request for an upgrade to PHP Ver 5 on my Server Host. I will wait to see what they tell me. I will look for more help on the stock level question I asked about, it may be covered somewhere else already. Thanks for all of the help up to this point guys. At least I am getting somewhere now and the items can be purchased thats a plus. I am liking the layout and Drupal approach as far as creating product content. I think I will stick it out with Ubercart and see where it takes me.

Posts: 14
Joined: 03/18/2008

Hi guys I appreciate your help with getting me up and going with this Ubercart. I am patiently waiting for my host to respond to my emails about the PHP upgrade. While I am waiting for that on my other issues if I could get some help I will be there I think and smooth sailing with Ubercart. On my concerns above about the stock levels being a used album where I have only 1. I would like to know how I set this up where when I put in the stock quantity of 1, a person purchases it, it then decrements to 0 and then will not allow anyone else to purchase that item. Instead it should just show 0 items available and just not let them put it into their cart. How do I go about setting this up like that. Right now I would have to monitor my sight continuously and then manually remove the item after it has been sold to prevent a second purchase of an item I have already sold to someone. My second issue that still remains is with my international shipments giving me the same errors as above as like the server is no longer live again, but it does still work with U.S shipments not Canada. I have added UK another country and shipping quotes show the international shipment choice boxes and I have clicked on two of them as a method for shipment but it does not work also. It seems like no international shipping works at all. I also contacted the USPS people on this to see if it is something on their end with this but I haven't heard back from them yet. Any further help is so appreciated.

Thanks
IGTB

Posts: 2243
Joined: 08/07/2007
AdministratoreLiTe!

I did some testing, and eventually I had to empty out the cache_workflow_ng table. I get the feeling it's not invalidated when it should be, so I'll look into fixing that anyway.