Friday, May 08, 2009

VirtueMart: Shipper Name Limited to 1 Character

Grrr. I’m posting this one to see if maybe I can help others with the same problem I’m having. It’s fixed now, but it was a pain in the arse to track down.

Using Joomla 1.5 and VirtueMart 1.1.3 I was having the problem of trying to add a new shipper to the shipper’s table. The defaults are DHL and UPS, but I needed to add USPS for the new NCBBA site I’m coding. Well, every time I added anything except UPS, it only saved the first letter, shown below:

I found the fix, though it wasn’t the same code string location as I was led to believe. I’ve seen reference to this being an issue with lines 113 and 138 on the ps_shipping.php string, but my errors were on 225 and 275 (Using SCiTe as my editor if that matters)

Anyway, here’ the fix:

Go to:

 administrator/components/com_virtuemart/classes/ps_shipping.php

Edit BOTH locations of the following text: (lines 113, 138 or 225,275, or wherever they are in your config)

OLD CODE: ($fields = array( 'shipping_carrier_name' => vmGet($d["shipping_carrier_name"]),)

NEW CODE: $fields = array( 'shipping_carrier_name' => vmGet($d, 'shipping_carrier_name'),

(Notice the distinctions between the [ characers and the quotes are changed from double to single in the new code.)

Voila! Code Fixed!

Now, when you open the code and type your new value:

You actually get THIS:

NOW I can go back to what I was actually trying to do.. after blowing two hours on 2 single characters of bad code that I didn’t even write!

 

9 comments:

  1. Thanks for saving me hours of work! Perfect Fix.

    ReplyDelete
  2. Thank you too for saving a huge amount of time fixing something that shouldn't be broken in the first place. Cheers!

    ReplyDelete
  3. hmmm... didn't fix mine :(

    the search continues...

    ReplyDelete
  4. Was losing a few hairs on that one; thank you so much for sharing! Alex @ZenElements

    ReplyDelete
  5. Thanks so much. Am a complete novice at this kind of stuff, but it worked so you;ve given me soem confidence as well as sorting out this problem for me!!

    ReplyDelete
  6. Still a great fix. Thanks!

    ReplyDelete
  7. Glad it's still working for ya! I appreciate the kind comments

    ReplyDelete
  8. You absolute legend!!! This fixed it for me!

    ReplyDelete
  9. I believe this was fixed in the latest version.

    ReplyDelete

Thanks for taking a moment to leave a comment! Please keep the language clean. (If you are considering spamming the blog, don't bother. It's going to be deleted anyway.)