News:

Support the VirtueMart project and become a member

Main Menu

Shipping module dev - Basic questions

Started by blackhatbrigade, March 24, 2010, 06:06:53 AM

Previous topic - Next topic

blackhatbrigade

I need to make a proprietary shipping module for VM.  I'm still new to VM and only partially familiar with Joomla!.  I understand Joomla! questions are out of scope here, but I'm thinking my questions will be pertinent to only VM.

1) I found shipping modules (forgive me if I'm using the wrong word for that) in /administrator/components/com_virtuemart/plugins/shipping/    I'm mostly concerned with the USPS module because it's functionality is very close to what I need.  Is this the only place for shipping mod files?

2) Is there any online documentation to what product information I can access from within the shipping mod scope?  I obviously need to pull weight, size, etc., but I also need to pull custom product attributes (for LTL shipping).  Any redirection to a good online doc would be appreciated (The VM API seems to be a little out of date... that or I'm not seeing the whole picture with it).

I apologize if this is a redundant post.  I tried to search for the info before posting.  I didn't have much luck.  I would be grateful if someone has any links to resources that may help.

blackhatbrigade

Figured it'd be in the wiki, but it was somewhere else.  For anyone else looking for the online documentation for shipping development...  http://virtuemart.net/documentation/Developer_Manual/Shipping_Modules.html

blackhatbrigade

I've been working with this for a while now and wanted to do a follow up, plus ask another question.

The best documentation I've found on Shipping Module development to date is: http://virtuemart.net/documentation/Developer_Manual/Shipping_Module_API.html  Which is part of the on-site manual.  It does specify the locations of the pertinent files to be added.  The other link I posted had some terribly out of date information.

My second question I ended up having to do a little bit of experimentation to find what I was needing.  I added the desired field to the product table and then mirrored that on the product pages.  It seems to work great (side note:  I love the DB interface in the VM code.  It's wonderously easy to use).

My new question is related to a problem I'm having.  I've got my module displaying the information I want and everything appears to work great, until you get to step 3 of the checkout.  Then I get a message saying: Error: Please select another Shipping Method.  I've gone over the validate and get_rate functions.  I don't see anything wrong with them.  My list_rates function does nearly the same thing as the USPS module in that it lists radio inputs with the name="shipping_rate_id" and the correct formatted value (minus the rate_id part, as it was listed as optional).   I'm not fully understanding the importance of the id="" field and was thinking that perhaps that was an issue...

Thinking that maybe the problem is with how I'm listing the radio inputs, here is the actual code:

<input type="radio" name="shipping_rate_id" value="priorityone%7CPriorityOne%7CSaia%7C183.76" id="SAIA" />
<label for="priorityone%7CPriorityOne%7CSaia%7C183.76">LTL - Saia <strong>(183.76)</strong><br>


My module generates more than just one entry like this, but they all follow this layout.

If that looks good, then I guess I'm just not sure what would cause the checkout to fail when this shipping option is checked.

Any help would be appreciated.

blackhatbrigade

After some digging (a lot actually), I found that that error is due to a failure for the Shipping Modules validate function (it returns false on validation attempt).

The validation method needs to validate that "shipping_rate_id" is set on the $d variable passed to it.  (I was trying to validate a SESSION element, which oddly enough the USPS module does do something with the SESSION variable)