PDA

View Full Version : Custom Shipping Mod...Shipping choice not saving.



superdad_05
10-30-2005, 09:57 PM
I have built a custom shipping mod to pull quotes from DHL. I added the code to do this in includes\modules\shipping\table.php. I'm kind of new to OSC and I think that's not the place it should have gone, but I'm not sure where to change what file it uses to pull shipping info. I didn't think it looked like it mattered as far as functionality goes. Anyway, I have everything working, it goes out gets the right quotes and puts them as radio buttons on the checkout_shipping.php page.

The problem I'm having is regardless of which radio button is selected, when I continue with the checkout process on the confirmation page, the shipping method that shows up is the first item in the list. I haven't altered any of the code that does this, it seems silly to think the code would just work, but when I read through it, it seems like it should. Am I missing something? I hope there is someone out there who has some experience with this, I have been working on this for several days with no luck. I have very little hair left to pull out!

Thanks for your time! If you need anything else to help please let me know.

superdad_05
11-03-2005, 10:22 PM
wow, 4 days and not a single person has a clue?

I've moved the entire custom shipping code and moved it to the correct place (the DHL module)

I'm still not getting the shipping option saved. No matter if I choose Ground or next day or whatever, it just uses the first option...

superdad_05
11-04-2005, 10:09 AM
Ok, I've come a long way over the last week. I'm getting close. I am working in Checkout_Shipping.php right now in the "process the selected shipping method" part.

My problem I'm running into is that in the Checkout_Shipping.php, I need to know which of the shipping methods were chosen from a list of radio buttons (ground, next day, express, etc.). Can I access this list somehow from the Checkout_Shipping page?

This is what I tried but it apparently isn't working...lol...I'm guessing I can't access the form object from this page?

var radio = form.elements['shipping'];

for (var x=0; x<radio.length; x++)
{
if (radio[x].checked == true)
{
$shipping = array('id' => $shipping,
'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][x]['title'] . ')'),
'cost' => $quote[0]['methods'][x]['cost']);

}
}

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYME NT, '', 'SSL'));