Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Assistance needed with new shipping options module


dmsprelude

Recommended Posts

I've downloaded a couple of contributions and am trying to rewrite them so that they will allow me to choose what is displayed and what is charged. A little about what I want...

 

Shipping options: To charge an additional amount to the customer (examples: Insurance, delivery confirmation,etc.) The current contributions did not allow me to display the different options nor did they allow me to set the price of the different options.

 

I used these modules and have made some progress, I am stuck however on this...

 

I've got functions being called in the checkout_payment.php page and it displays the available options that are stored in the database along with price. I've checked the shipping module and tried to replicate it for this shipping options module, and have this line in the ot_insurance.php file...

 

$this->output[] = array('title' => $order->info['shipping_options_method'] . ':',
                              'text' => $currencies->format($order->info['shipping_options_cost'], true, $order->info['currency'], $order->info['currency_value']),
                              'value' => $order->info['shipping_options_cost']);

 

If I change the "shipping_options_method" to "shipping_method" it displays the correct shipping that is selected in the checkout_payment.php page, but it doesn't show the correct "shipping options method" when the above is used, it actually doesn't display anything. Ultimately my concern is, how is the ot_insurance page supposed to know what the value for $order->info['shipping_options_method'] is? Am I supposed to post the selection to some other page or define some additional fields somewhere? I tried to follow the shipping.php/multi.php/ot_shipping.php files to draw my understanding of this.

 

The functions that are being called are...

 function display() {
    global $cart, $HTTP_GET_VARS, $currencies, $shipping_options_cost, $shipping_options_method, $shipping_options_cheapest, $shipping_options_selected;

$shipping_options_query=tep_db_query("select * from shipping_options order by shipping_options_name, shipping_options_cost asc");//AH
      
while($shipping_options = tep_db_fetch_array($shipping_options_query)) {
        $display_string.= '  <tr>' . "\n" .'    <td class="main">' . (($this->icon) ? tep_image($this->icon, $this->title) : '') . ' ' . $shipping_options['shipping_options_name'] . '</i></small></td>' . "\n" .
        '    <td align="right" class="main">' . $currencies->format($shipping_options['shipping_options_cost']);
        $count++;
          $display_string .= tep_draw_radio_field('shipping_options_selected', $shipping_options['shipping_options_id']);    
        }
        $display_string .= tep_draw_hidden_field('shipping_options_cost['.$shipping_options['shipping_options_id'].']', $shipping_options['shipping_options_cost']) .
                           tep_draw_hidden_field('shipping_options_name['.$shipping_options['shipping_options_id'].']', $shipping_options['shipping_options_name']) . '</td>' . "\n";
        $display_string .= '  </tr>' . "\n";
      }
         
    $display_string .= '</table>' . "\n";
    return $display_string;
  }




function confirm() {
    global $HTTP_POST_VARS, $shipping_options_cost, $shipping_options_method, $shipping_options_selected;

    $ship_options_id = $shipping_options_selected;
    $shipping_options_cost = $HTTP_POST_VARS['shipping_options_cost'][$ship_options_id];
    $shipping_options_method = $HTTP_POST_VARS['shipping_options_name'][$ship_options_id];
}

 

Any help would be appreciated.

 

Thanks!

Link to comment
Share on other sites

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