Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Hello everyone,

 

I've been trying to replicate the functionality of the stock USPS module which offers several shipping methods (express, priority, etc) under its module. I need to have the same kind of choices, but in the "item" shipping module, so I can offer different packaging choices to the customer, as well as shipping methods, without having a big jumble of shipping modules!

 

So, I found that in the USPS shipping module, this loop is what sets up the different methods:

 

for ($i=0; $i<$size; $i++) {
           list($type, $cost) = each($uspsQuote[$i]);

           $methods[] = array('id' => $type,
                              'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
                              'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
         }

         $this->quotes['methods'] = $methods;

 

So I replicated this manually in my item2 shipping module file (a copy of the original item file, just for testing, excuse the mess):

 

   function quote($method = '') {
     global $order, $total_count;

     $this->quotes = array('id' => $this->code,
                           'module' => MODULE_SHIPPING_ITEM2_TEXT_TITLE);

           $methods[] = array('id' => $this->code,
                              'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
                              'cost' => (MODULE_SHIPPING_ITEM2_COST * $total_count) + MODULE_SHIPPING_ITEM2_HANDLING);

           $methods[] = array('id' => ems,
                              'title' => 'Express Mail Service',
                              'cost' => (MODULE_SHIPPING_ITEM2_COST * $total_count*2) + MODULE_SHIPPING_ITEM2_HANDLING);


  $this->quotes['methods'] = $methods;

     if ($this->tax_class > 0) {
       $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }

     if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);

     return $this->quotes;
   }

 

So this displays the choice just fine in the catalog shipping checkout page, but when I continue, the checkout confirmation page only shows the original method and cost.

 

Thus it seems to me the problem comes in the way that the checkout_shipping.php page passes on the selected shipping module choice to the checkout_confirmation, and it's really stumped me! Any help would be appreciated!

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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