Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Ship In Cart


Guest

Recommended Posts

Installed v2.0,, worked,, installed the fix,, which stopped the box from showing when they are not logged in.

However, there was another step that was to display a msg telling them if they log in they would see the estimator,,

When i install this,

I get an error msg.

Parse error: parse error, unexpected $ in /home/rqoxfyks/public_html/includes/modules/shipping_estimator.php on line 349

 

and the code in the area in question was b4 change

 

344     new infoBox($info_box_contents);
345  }
346 } // Use only when cart_contents > 0
347 ?>
348             </td></tr></table>

END OF FILE

and it was to be changed to:

344     new infoBox($info_box_contents);
345 } else {
346  echo '<table align="center"><tr><td class="main"><i>Please login to view shipping and order total estimates.</i></td></tr></table>'; }
348 ?>
349             </td></tr></table>

END OF FILE

 

this was all copy/ pasted actually from the instructions in the fix, and then from the file in question.

 

I like the thoughts of having the message telling them to log in for the estimator.

Anyone have any ideals on fixing this fix?

 

Regards

Tom

Link to comment
Share on other sites

RESOLVED!!

 

I found the problem myself,, <aint someone proud of me>

 

Anyway, I am shocked that no one else posted on this. but I will explain what I found just in case someone else has trouble.

 

The last step of the fix file states:

Optionally, you can also change the last line of the file so that the user is presented with a message, showing yet again why it would be to their benefit to create an account. ;)

 

FIND:

 

  }

} // Use only when cart_contents > 0

 

 

CHANGE TO:

 

} else {

  echo '<table align="center"><tr><td class="main"><i>Please login to view shipping and order total estimates.</i></td></tr></table>'; }

 

however, it should be changed to:

 

  }
} else {
 echo '<table align="center"><tr><td class="main"><i>Please login to view shipping and order total estimates.</i></td></tr></table>'; }

 

so, in essense, there was a missing }

 

Hope this helps someone else.

 

Regards

Tom

Link to comment
Share on other sites

  • 3 weeks later...

I'm got the ultimate SEO Urls contrib installed and I think it is causing me to have problems, it has something to do with the update statements in this contrib using href="_" in them to update when you select another shipping method or address.

 

Anyone know how to work around this so I can fully utilize this excellent contribution?

 

Thanks a ton in advance!

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

I just want to say this contribution is fantastic. It worked straight out the box so to speak. Only took less than 5 minutes to install.

 

I used:

4 Jul 2004 - Ship In Cart v2.00 Author: Acheron

 

I did NOT apply:

7 Jul 2004 - Fix for v2.0 and all other versions Author: Acheron

 

Because in my scenario I have taken out Guest Welcome Text and would you like to register etc.. etc....

 

So unless you choose to 'Sign In' you are a Guest. I also have it setup to use a formula to calculate shipping.. so if products from range 1 to range 2 will be this much ..etc....

 

So to me I like the fact Guest can see the Shipping Estimate without being signed in. Just wanted to point out the fix is not totally neccessary depending on certain situations.

 

However, I got the impression from previous post, that in Admin side there is a way to enable or disable GUEST from viewing the Shipping Estimate, but dont see it. If that was the case, I would apply the fix..and just make sure to Enable.

 

Is that feature available: of enable or disable for GUEST to see Shipping Estimate.

 

Thanks! This is a SWEET contribution.

Link to comment
Share on other sites

  • 2 weeks later...
I also have the SEO Contribution installed and have not been able to get this to work. I tried every contribution available but no luck.

 

Elizabeth

Antiques and Old World Charms

 

I am still having no luck can anyone suggest a fix for this?

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

hello all

i have just install ship in cart v2.0 , it  did not worked. i followed all INSTRUCTIONS as it said in install file. all i got was subtotal at the bottom of the page. but  Shipping Estimator had nothing in it.  what i am doing wrong.

thanks

pj

I seem to be having the same problem as pjsingh.

 

After installing SIC 2.0 (July 4, 2004 by Archeron), when I go to the cart, I get the left column and main area only. In the main area, the products, subtotal, and buttons are listed. Following that is the SIC box, but there is no right column or footer.

 

The page source ends with a </table>, but not the <!-- SIC EOF --> that I put into shopping_cart.php, so it seems to be dying near the end of shipping_estimator.php.

 

If it matters, I am running OSC on my local machine.

 

Does anyone have any ideas?

 

Thanks,

 

Phil :huh:

Edited by seafire
Link to comment
Share on other sites

I had this working fine, but now I've become VAT registered so some of my prices include tax. When the cart includes taxable items the total is adding tax on twice. What do I need to change?

Link to comment
Share on other sites

Hi All,

 

I had installed:

 

4 Jul 2004 - Ship In Cart v2.00

7 Jul 2004 - Fix for v2.0 and all other versions

 

Obviously this will now only work if the customer is logged in. I would like it to work when the customer does NOT have an account.

 

Can anyone tell me what I need to change to get it to work without having an account?

Link to comment
Share on other sites

I got my site to work now.

 

Because I suspected that the CARTSHIP_ONOFF was not being read, I went into Admin and disabled "Shipping and Order Total Estimate".  Then, I enabled it again.

 

Maybe this is my problem... but WHERE in the world is this in Admin?

 

 

My problem is that it works fine in my first test account, and it works fine if the user is NOT logged in. But it DOESN'T work on the rest of my accounts or any new accounts after the user is logged in! This is almost opposite of everyone else's problem!

 

When it doesn't work, it generates this error in the UPS section of the estimator:

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/rnksport/public_html/c/includes/functions/general.php on line 42
Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/rnksport/public_html/c/includes/functions/general.php on line 42

 

Lines 40-45 of that file read:

  function tep_output_string($string, $translate = false, $protected = false) {
   if ($protected == true) {
     return htmlspecialchars($string);
   } else {
     if ($translate == false) {
       return tep_parse_input_field_data($string, array('"' => '"'));

 

I am learning PHP, but I have no idea what this file or this part of code is doing here... so this error message doesn't help me.

 

Feel free to try it out on my site... Here's a link to a product, put it in your cart, you'll see the estimator... now create an account, and go back to the cart and tell me if it works! (It doesn't for me.)

Page for paintball gun

 

Any ideas?

 

Will anyone tell me where that setting is in Admin so I can try that?

Link to comment
Share on other sites

>WHERE in the world is this in Admin

 

In admin > configuration > "click" shopping cart. then you will see the options for this. I was confused for a bit to.

 

good luck

 

 

??? Still confused... in my versin of Admin, there isn't any "shopping cart" to click on! I even did a browser "Search" on the page... not there! It must be renamed something else in my version... where is this link? Is it in the context menu on the left that shows up when you are in "Configuration" or is it in the main section of the page?

Link to comment
Share on other sites

Hi All,

 

I had installed:

 

4 Jul 2004 - Ship In Cart v2.00

7 Jul 2004 - Fix for v2.0 and all other versions

 

Obviously this will now only work if the customer is logged in. I would like it to work when the customer does NOT have an account.

 

Can anyone tell me what I need to change to get it to work without having an account?

 

 

read my post from previous page...

Do NOT Apply:

7 Jul 2004 - Fix for v2.0 and all other versions Author: Acheron

 

Then it will show shipping for Guest as well

Link to comment
Share on other sites

??? Still confused... in my versin of Admin, there isn't any "shopping cart" to click on!  I even did a browser "Search" on the page... not there!  It must be renamed something else in my version... where is this link?  Is it in the context menu on the left that shows up when you are in "Configuration" or is it in the main section of the page?

 

 

From Administration>>Click on 'Configuration'>>Click on 'Shopping Cart'

Link to comment
Share on other sites

From Administration>>Click on 'Configuration'>>Click on 'Shopping Cart'

 

 

Like I said, there isn't any "Shopping Cart" to click on in mine!!! Not on the menu that appears underneath the word "Configuration" and not in the main section either! I even did a browser search with Ctrl-F and it can't find it!

 

These are the links on the left after I click on "Configuration":

My Store

Minimum Values

Maximum Values

Images

Customer Details

Shipping/Packaging

Product Listing

Stock

Logging

Cache

E-Mail Options

Download

GZip Compression

Sessions

 

And this is what's in the middle after I click on Configuration:

Store Name R'n'Ksports.com

Store Owner Steven Peters Retail

E-Mail Address root@localhost

E-Mail From osCommerce <root@localhost>

Country United States

Zone Florida

Expected Sort Order desc

Expected Sort Field date_expected

Switch To Default Language Currency false

Send Extra Order Emails To

Use Search-Engine Safe URLs (still in development) false

Display Cart After Adding Product true

Allow Guest To Tell A Friend true

Default Search Operator and

Store Address and Phone Store Name Address Country Phone

Show Category Counts false

Tax Decimal Places 2

Display Prices with Tax false

 

Do you see any "Shopping Cart" there?

Link to comment
Share on other sites

Well... I'll update anyone who might be following this thread.

 

First... I came to the conclusion that this shopping cart link must be added by a version of Ship in Cart that I don't have. I'm running a mix of 1.7 & 1.83.

 

Second... I guess it doesn't matter because I solved my problem! There are too many pages on this thread, or I would have found it earlier... but back on one of the pages in this thread, someone posted that my issue (which someone else had) had already been covered (which I couldn't find), but thankfully, they posted the fix as well! Basically, the error I was getting was being caused by my mulitple test accounts... my browser was confusing the session ids. The fix is to add this line of code to logoff.php, so that my browser only uses one at a time:

  // added to fix ship in cart oscsid problem...
tep_session_unregister('cart_address_id');

 

So... my Ship in Cart (which is really Shipping Estimate Out of Cart for me, since I've got it on a new page)... is working just about perfect! USPS quotes aren't being pulled for me yet, but they aren't working at all, and I just tried installing it last night, so I'm assuming that once I figure out what's wrong with my installation, it will work both during checkout and in my Shipping Estimate.

 

In case anyone is wondering... no, it doesn't seem possible to make the shipping estimate a pop-up. (I couldn't get it to work in the pop-up, even with the identical code I've got working now.) ... but it is possible to make it a different screen. The steps that I followed, to the best of my knowledge are here, for anyone they may help. Please note that I still know very little PHP and probably can't help anyone out, if this doesn't work for them. I'm just posting it for whomever it does help. If anyone wants to see mine in action, here's a link to a current test product:

Paintball gun

Just put it in your cart, and you'll see the link appear. Click on it and you'll see.

 

1) Get a working version of Ship in Cart, and it's shipping_estimator.php box. I'm using a mix of 1.7 & 1.83. I was having a problem with 1.7 not working for guests, and 1.83's "update" button not working... and I probably didn't "mix" them right... I just finally got it to work so I'm leaving it be.

 

2) Follow the Knowledge Base's instructions for creating a new page... I called it shipping_estimate.php. Here's the link:

Adding a New Page

 

3) In your new page, find:

<?php echo TEXT_INFORMATION; ?>

And insert the shipping_estimator code immediately after:

<?php echo TEXT_INFORMATION; ?>
<?php require(DIR_WS_MODULES . 'shipping_estimator.php'); ?>

 

This inserts the shipping_estimator into your new page. Modify the components of it as needed... I took out the totals, and I also took out the select links, so mine just gives a quote. It took some code searching to find and take out those table cells, but I managed it.

 

4) Open up the shipping_estimator.php and find this code:

$ShipTxt= tep_draw_form('estimator', tep_href_link(FILENAME_ ... )

 

(I think that the default is FILENAME_SHOPPING_CART)

 

Now change that to the filename of your new page... the same that you chose in your #2 steps for creating a new page... in my example, FILENAME_SHIPPING_ESTIMATE.

 

5) Open up includes/boxes/shopping_cart.php and look for this bit of code near the bottom:

                                 'text' => $currencies->format($cart->show_total()));
 }

 

Now replace it with this:

                                 'text' => 'Sub-Total:  ' . $currencies->format($cart->show_total()) );

// adding links for Estimate Shipping, View/Edit Cart, & Checkout

   $info_box_contents[] = array('text' => tep_draw_separator());

   $info_box_contents[] = array('align' => 'right',
                                'text' => '<img src="../c/images/left_arrow.gif" width="12" height="12" border="0"><a href="' . tep_href_link(FILENAME_SHIPPING_ESTIMATE, '', 'NONSSL') . '">' . BOX_SHIPPING_ESTIMATE . '</a>'

                                          . '<br><img src="../c/images/left_arrow.gif" width="12" height="12" border="0"><a href="' . tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '">' . HEADER_TITLE_CART_CONTENTS . '</a>'

                                          . '<br><img src="../c/images/left_arrow.gif" width="12" height="12" border="0"><a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'NONSSL') . '">' . HEADER_TITLE_CHECKOUT . '</a>'
                                               );
 }

 

This adds another line under the Subtotal, and then adds my three links, Estimate Shipping, View/Edit Cart, & Checkout along with my little arrow gif. Feel free to download it and use it if you want... if not, take it out of the code. The image is here if you want to download it and upload it to your images directory:

my little arrow All three only appear when there are items in the shopping cart. If you only want the Estimate Shipping link, then just delete the code for the other two... they're divided up into their three sections. above.

 

6 - Open up logoff.php and add this code... I added it near the top with the other defines:

  // added to fix ship in cart oscsid problem...
tep_session_unregister('cart_address_id');

 

 

Hope this helps someone!

Link to comment
Share on other sites

  • 1 month later...

For some odd reason I cannot get any version of this contribution to work. In any way shape or form. I'm running MS2.2 with BTS1.7. I'm not sure but I think it might have something to do with the Basic Template Structre contribution. But what I can't figure out is why that would be a problem, but it's my only theory.

 

Has anybody else goteen this to work together with BTS?

Samuel Mateo, Jr.

osC 2.2 MS2

Installed Mods:

WYSIWYG HTMLArea 1.7 | Basic Template System 1.0 | osC-Affiliate | OSC-SupportTicket

Featured Products 1.3 | LoginBox 5.2 | LatestNews 1.1.3 | Extras for IE

Link to comment
Share on other sites

  • 3 weeks later...

Tax not calculating for non-registered users

 

When you do an estimate the tax isn't being calculated for a non-registered user.

 

Registered users work no problem.

 

Anyone know how to fix this?

 

Running MS2 with the MS2 shipping estimate.

 

<?php
/*
 $Id: shipping_estimator.php,v 2.00 2004/07/01 15:16:07 eml Exp $

 v2.00 by Acheron
 (see Install.txt for partial version history)

 Copyright (c) 2004

 Released under the GNU General Public License
*/
?>
<!-- shipping_estimator //-->
<script language="JavaScript">
 function shipincart_submit(sid){
   if(sid){
     document.estimator.sid.value=sid;
   }
   document.estimator.submit();
   return false;
 }
</script>
             <table align="center"><tr valign="top"><td>

<?php
// Only do when something is in the cart
if ($cart->count_contents() > 0) {

 require(DIR_WS_LANGUAGES . $language . '/modules/' . FILENAME_SHIPPING_ESTIMATOR);

 // shipping cost
 require('includes/classes/http_client.php'); // shipping in basket

 //if($cart->get_content_type() !== 'virtual') {
   if (tep_session_is_registered('customer_id')) {
     // user is logged in
     if (isset($HTTP_POST_VARS['address_id'])){
       // user changed address
       $sendto = $HTTP_POST_VARS['address_id'];
     }elseif (tep_session_is_registered('cart_address_id')){
       // user once changed address
       $sendto = $cart_address_id;
     }else{
       // first timer
       $sendto = $customer_default_address_id;
     }
     // set session now
     $cart_address_id = $sendto;
     tep_session_register('cart_address_id');
     // set shipping to null ! multipickup changes address to store address...
     $shipping='';
     // include the order class (uses the sendto !)
     require(DIR_WS_CLASSES . 'order.php');
     $order = new order;
   }else{
// user not logged in !
     if (isset($HTTP_POST_VARS['country_id'])){
       // country is selected
       $country_info = tep_get_countries($HTTP_POST_VARS['country_id'],true);
       $order->delivery = array('postcode' => $HTTP_POST_VARS['zip_code'],
                                'country' => array('id' => $HTTP_POST_VARS['country_id'], 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
                                'country_id' => $HTTP_POST_VARS['country_id'],
//add state zone_id
                                'zone_id' => $HTTP_POST_VARS['state'],
                                'format_id' => tep_get_address_format_id($HTTP_POST_VARS['country_id']));
       $cart_country_id = $HTTP_POST_VARS['country_id'];
       tep_session_register('cart_country_id');
//add state zone_id
       $cart_zone = $HTTP_POST_VARS['zone_id'];
       tep_session_register('cart_zone');
       $cart_zip_code = $HTTP_POST_VARS['zip_code'];
       tep_session_register('cart_zip_code');
     }elseif (tep_session_is_registered('cart_country_id')){
       // session is available
       $country_info = tep_get_countries($cart_country_id,true);
       $order->delivery = array('postcode' => $cart_zip_code,
                                'country' => array('id' => $cart_country_id, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
                                'country_id' => $cart_country_id,
                                'format_id' => tep_get_address_format_id($cart_country_id));
     } else {
       // first timer
       $cart_country_id = STORE_COUNTRY;
       tep_session_register('cart_country_id');
       $country_info = tep_get_countries(STORE_COUNTRY,true);
       tep_session_register('cart_zip_code');
       $order->delivery = array(//'postcode' => '',
                                'country' => array('id' => STORE_COUNTRY, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' =>  $country_info['countries_iso_code_3']),
                                'country_id' => STORE_COUNTRY,
                                'format_id' => tep_get_address_format_id($HTTP_POST_VARS['country_id']));
     }
     // set the cost to be able to calculate free shipping
     $order->info = array('total' => $cart->show_total(), // TAX ????
                          'currency' => $currency,
                          'currency_value'=> $currencies->currencies[$currency]['value']);
   }
// weight and count needed for shipping
   $total_weight = $cart->show_weight();
   $total_count = $cart->count_contents();
   require(DIR_WS_CLASSES . 'shipping.php');
   $shipping_modules = new shipping;
   $quotes = $shipping_modules->quote();
   $order->info['subtotal'] = $cart->total;

// set selections for displaying
   $selected_country = $order->delivery['country']['id'];
   $selected_address = $sendto;
 //}
// eo shipping cost

 // check free shipping based on order total
 if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true')) {
   switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
     case 'national':
       if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
     case 'international':
       if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
     case 'both':
       $pass = true; break;
     default:
       $pass = false; break;
   }
   $free_shipping = false;
   if ( ($pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) {
     $free_shipping = true;
     include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php');
   }
 } else {
   $free_shipping = false;
 }
 // begin shipping cost
 if(!$free_shipping && $cart->get_content_type() !== 'virtual'){
   if (tep_not_null($HTTP_POST_VARS['sid'])){
     list($module, $method) = explode('_', $HTTP_POST_VARS['sid']);
     $cart_sid = $HTTP_POST_VARS['sid'];
     tep_session_register('cart_sid');
   }elseif (tep_session_is_registered('cart_sid')){
     list($module, $method) = explode('_', $cart_sid);
   }else{
     $module="";
     $method="";
   }
   if (tep_not_null($module)){
     $selected_quote = $shipping_modules->quote($method, $module);
     if($selected_quote[0]['error'] || !tep_not_null($selected_quote[0]['methods'][0]['cost'])){
       $selected_shipping = $shipping_modules->cheapest();
       $order->info['shipping_method'] = $selected_shipping['title'];
       $order->info['shipping_cost'] = $selected_shipping['cost'];
       $order->info['total']+= $selected_shipping['cost'];
     }else{
       $order->info['shipping_method'] = $selected_quote[0]['module'].' ('.$selected_quote[0]['methods'][0]['title'].')';
       $order->info['shipping_cost'] = $selected_quote[0]['methods'][0]['cost'];
       $order->info['total']+= $selected_quote[0]['methods'][0]['cost'];
       $selected_shipping['title'] = $order->info['shipping_method'];
       $selected_shipping['cost'] = $order->info['shipping_cost'];
       $selected_shipping['id'] = $selected_quote[0]['id'].'_'.$selected_quote[0]['methods'][0]['id'];
     }
   }else{
     $selected_shipping = $shipping_modules->cheapest();
     $order->info['shipping_method'] = $selected_shipping['title'];
     $order->info['shipping_cost'] = $selected_shipping['cost'];
     $order->info['total']+= $selected_shipping['cost'];
   }
 }
// virtual products use free shipping
 if($cart->get_content_type() == 'virtual') {
   $order->info['shipping_method'] = CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS;
   $order->info['shipping_cost'] = 0;
 }
 if($free_shipping) {
   $order->info['shipping_method'] = MODULE_ORDER_TOTAL_SHIPPING_TITLE;
   $order->info['shipping_cost'] = 0;
 }
 $shipping=$selected_shipping;
// end of shipping cost
// end free shipping based on order total

 $info_box_contents = array();
 $info_box_contents[] = array('text' => CART_SHIPPING_OPTIONS);
 new infoBoxHeading($info_box_contents, false, false);

 $ShipTxt= tep_draw_form('estimator', tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'), 'post'); //'onSubmit="return check_form();"'
 $ShipTxt.=tep_draw_hidden_field('sid', $selected_shipping['id']);
 $ShipTxt.='<table>';
 if(sizeof($quotes)) {
   if (tep_session_is_registered('customer_id')) {
     // logged in

 if (CARTSHIP_SHOWWT == 'true') {
   $showweight = ' (' . $total_weight . ' ' . CARTSHIP_WTUNIT . ')';
 } else {
   $showweight = '';
 }

       if(CARTSHIP_SHOWIC == 'true'){
     $ShipTxt.='<tr><td class="main">' . ($total_count == 1 ? ' <b>Item:</b></td><td colspan="2" class="main">' : ' <b>Items:</b></td><td colspan="2" class="main">') . $total_count . $showweight . '</td></tr>';
      }
     $addresses_query = tep_db_query("select address_book_id, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "'");
     // only display addresses if more than 1
     if (tep_db_num_rows($addresses_query) > 1){
       while ($addresses = tep_db_fetch_array($addresses_query)) {
         $addresses_array[] = array('id' => $addresses['address_book_id'], 'text' => tep_address_format(tep_get_address_format_id($addresses['country_id']), $addresses, 0, ' ', ' '));
       }
       $ShipTxt.='<tr><td colspan="3" class="main" nowrap>' .
                 CART_SHIPPING_METHOD_ADDRESS .' '. tep_draw_pull_down_menu('address_id', $addresses_array, $selected_address, 'onchange="return shipincart_submit(\'\');"').'</td></tr>';
     }
     $ShipTxt.='<tr valign="top"><td class="main"><b>' . CART_SHIPPING_METHOD_TO .'</b> </td><td colspan="2" class="main">'. tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>') . '</td></tr>';
   } else {
// not logged in
//      $ShipTxt.=tep_output_warning(CART_SHIPPING_OPTIONS_LOGIN);

       if(CARTSHIP_SHOWIC == 'true'){
     $ShipTxt.='<tr><td class="main">' . ($total_count == 1 ? ' <b>Item:</b></td><td colspan="2" class="main">' : ' <b>Items:</b></td><td colspan="2" class="main">') . $total_count . $showweight . '</td></tr>';
      }

     if($cart->get_content_type() != 'virtual'){

       if(CARTSHIP_SHOWCDD == 'true'){
       $ShipTxt.='<tr><td colspan="3" class="main" nowrap>' .
                 ENTRY_COUNTRY .' '. tep_get_country_list('country_id', $selected_country,'style="width=200"');
       }

//add state zone_id
       $state_array[] = array('id' => '', 'text' => 'Please Select');
       $state_query = tep_db_query("select zone_name, zone_id from " . TABLE_ZONES . " where zone_country_id = '$selected_country' order by zone_country_id DESC, zone_name");
       while ($state_values = tep_db_fetch_array($state_query)) {
         $state_array[] = array('id' => $state_values['zone_id'],
                                'text' => $state_values['zone_name']);
       }

       if(CARTSHIP_SHOWSDD == 'true'){
        $ShipTxt.='  ' .ENTRY_STATE .' '. tep_draw_pull_down_menu('state',$state_array);
       }

       if(CARTSHIP_SHOWZDD == 'true'){
         $ShipTxt.=' '.ENTRY_POST_CODE .' '. tep_draw_input_field('zip_code', $selected_zip, 'size="5"');
       }
//        $ShipTxt.=' <a href="_" onclick="return shipincart_submit(\'\');">'.CART_SHIPPING_METHOD_RECALCULATE.'</a></td></tr>';

       if(CARTSHIP_SHOWUB == 'true'){
$ShipTxt.=' <td><a href="_" onclick="return shipincart_submit(\'\');">'. tep_image_button('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART) . ' </a></td></td></tr>';
       }
       }
   }
   if($cart->get_content_type() == 'virtual'){
     // virtual product-download
     //$ShipTxt.='<tr><td colspan="3" class="main">'.tep_draw_separator().'</td></tr>';
     $ShipTxt.='<tr><td class="main" colspan="3"> </td></tr><tr><td class="main" colspan="3"><i>' . CART_SHIPPING_METHOD_FREE_TEXT . ' ' . CART_SHIPPING_METHOD_ALL_DOWNLOADS . '</i></td></tr>';
   }elseif ($free_shipping==1) {
     // order $total is free
     //$ShipTxt.='<tr><td colspan="3" class="main">'.tep_draw_separator().'</td></tr>';
     $ShipTxt.='<tr><td class="main" colspan="3"> </td></tr><tr><td class="main" colspan="3"><i>' . sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . '</i></td><td> </td></tr>';
   }else{
     // shipping display
     $ShipTxt.='<tr><td colspan="3" class="main"> </td></tr><tr><td class="main"><b>' . CART_SHIPPING_CARRIER_TEXT . '</b></td><td class="main" align="left"><b>' . CART_SHIPPING_METHOD_TEXT . '</b></td><td class="main" align="right"><b>' . CART_SHIPPING_METHOD_RATES . '</b></td></tr>';
     $ShipTxt.='<tr><td colspan="3" class="main">'.tep_draw_separator().'</td></tr>';
     for ($i=0, $n=sizeof($quotes); $i<$n; $i++) {
       if(sizeof($quotes[$i]['methods'])==1){
         // simple shipping method
         $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][0]['id'];
         $ShipTxt.= '<tr class="'.$extra.'">';
         $ShipTxt.='<td class="main">'.$quotes[$i]['icon'].'   </td>';
         if($quotes[$i]['error']){
           $ShipTxt.='<td colspan="2" class="main">'.$quotes[$i]['module'].' ';
           $ShipTxt.= '('.$quotes[$i]['error'].')</td></tr>';
         }else{
           if($selected_shipping['id'] == $thisquoteid){
             $ShipTxt.='<td class="main"><a title="Select this method" href="_"  onclick="return shipincart_submit(\''.$thisquoteid.'\');"><b>'.$quotes[$i]['module'].' ';
             $ShipTxt.= '('.$quotes[$i]['methods'][0]['title'].')</b></a>   </td><td align="right" class="main"><b>'.$currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])).'</b></td></tr>';
           }else{
             $ShipTxt.='<td class="main"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.$quotes[$i]['module'].' ';
             $ShipTxt.= '('.$quotes[$i]['methods'][0]['title'].')</a>   </td><td align="right" class="main">'.$currencies->format(tep_add_tax($quotes[$i]['methods'][0]['cost'], $quotes[$i]['tax'])).'</td></tr>';
           }
         }
       } else {
         // shipping method with sub methods (multipickup)
         for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
           $thisquoteid = $quotes[$i]['id'].'_'.$quotes[$i]['methods'][$j]['id'];
           $ShipTxt.= '<tr class="'.$extra.'">';
           $ShipTxt.='<td class="main">'.$quotes[$i]['icon'].'   </td>';
           if($quotes[$i]['error']){
             $ShipTxt.='<td colspan="2" class="main">'.$quotes[$i]['module'].' ';
             $ShipTxt.= '('.$quotes[$i]['error'].')</td></tr>';
           }else{
             if($selected_shipping['id'] == $thisquoteid){
               $ShipTxt.='<td class="main"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');"><b>'.$quotes[$i]['module'].' ';
               $ShipTxt.= '('.$quotes[$i]['methods'][$j]['title'].')</b></a>   </td><td align="right" class="main"><b>'.$currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])).'</b></td><td class="main">'.tep_image(DIR_WS_ICONS . 'selected.gif', 'Selected').'</td></tr>';
             }else{
               $ShipTxt.='<td class="main"><a title="Select this method" href="_" onclick="return shipincart_submit(\''.$thisquoteid.'\');">'.$quotes[$i]['module'].' ';
               $ShipTxt.= '('.$quotes[$i]['methods'][$j]['title'].')</a>   </td><td align="right" class="main">'.$currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])).'</td><td class="main"> </td></tr>';
             }
           }
         }
       }
     }
   }
 }
 $ShipTxt.= '</table></form>';

 $info_box_contents = array();
 $info_box_contents[] = array('text' => $ShipTxt);
 new infoBox($info_box_contents);

 if (CARTSHIP_SHOWOT == 'true'){
   // BOF get taxes if not logged in
   if (!tep_session_is_registered('customer_id')){
     $products = $cart->get_products();
     for ($i=0, $n=sizeof($products); $i<$n; $i++) {
       $products_tax = tep_get_tax_rate($products[$i]['tax_class_id'], $order->delivery['country_id'],$order->delivery['zone_id']);
       $products_tax_description = tep_get_tax_description($products[$i]['tax_class_id'], $order->delivery['country_id'], $order->delivery['zone_id']);
       if (DISPLAY_PRICE_WITH_TAX == 'true') {
        //Modified by Strider 42 to correct the tax calculation when a customer is not logged in
        // $tax_val = ($products[$i]['final_price']-(($products[$i]['final_price']*100)/(100+$products_tax)))*$products[$i]['quantity'];
         $tax_val = (($products[$i]['final_price']/100)*$products_tax)*$products[$i]['quantity'];
       } else {
         $tax_val = (($products[$i]['final_price']*$products_tax)/100)*$products[$i]['quantity'];
       }
       $order->info['tax'] += $tax_val;
       $order->info['tax_groups']["$products_tax_description"] += $tax_val;
       // Modified by Strider 42 to correct the order total figure when shop displays prices with tax
       if (DISPLAY_PRICE_WITH_TAX == 'true') {
          $order->info['total'];
       } else {
       $order->info['total']+=$tax_val;
              }
     }
   }
   // EOF get taxes if not logged in (seems like less code than in order class)
   require(DIR_WS_CLASSES . 'order_total.php');
   $order_total_modules = new order_total;
   //echo '</td><td align="right">';
   // order total code
   $order_total_modules->process();

   $info_box_contents = array();
   $info_box_contents[] = array('text' => CART_OT);

   new infoBoxHeading($info_box_contents, false, false);
   $otTxt='<table align="right">';
   $otTxt.=$order_total_modules->output().'</table>';

   $info_box_contents = array();
   $info_box_contents[] = array('text' => $otTxt);

   new infoBox($info_box_contents);
 }
} // Use only when cart_contents > 0
?>
            </td></tr></table>

 

After this is fixed it should be posted on the contribution download site.

Link to comment
Share on other sites

  • 1 month later...

Hi all,

Installed this mod and it works great. Just two questions:

 

1. The "Delivery Methods" title is aligned right even though I have it set aligned left in the php file. Is there any way to get the methods title aligned to the left of the infobox?

 

2. I've tried using just the UPS module, and just the USPS module, and both seem to take VERY long (10-20 seconds) to load (happens on the shipping page when someone checks out too). Is there any way for the shipping estimate to not contact the shipper's website until the person inputs their zip code and hits update? Right now, even when someone firsts adds something to their cart, the shipping estimator will contact either UPS or USPS, but not display anything since it doesn't send a zip code. If I change my shipping methods to something static (zones for instance), everything is very fast.

 

Any help would be greatly appreciated. Thanks :)

Link to comment
Share on other sites

I am having a problem with some of my larger items where the item is being split into two boxes even though the item is impossible to split. This is only happening where the totals are displayed.

 

This is also causing the shipping estimate in the total to appear as double. For example rate on top is 10 the rate on the bottom is shown as 20.

 

When customer gets to checkout confirmation the proper rate is cxomming up.

 

This only happens with my UPS module.

I am using UPS XML with dimensions and insurance enabled.

 

Any help would be greatly appriciated.

Link to comment
Share on other sites

I still can't get it to work! I set it to display the country, zip code and the update button. when I put in a zip code and hit the button, it goes to http://mystore.com/_ and that's it. If I remove the button option and just hit the return key, it reloads the shopping cart and shows no shipping options and the zip code is not passed to the <input> field (it is empty).

 

This feature is key, because people don't want to have to create an account just to see shipping rates for a product. Are there any other contributions that could replace this one???

Link to comment
Share on other sites

OK, I settled for the visitor having an account set-up in order for them to see the shipping estimate(s). I also had a fellow programmer (willross) add the estimate box with the "...you must log in, etc." inside it and added a link to 'login.php' so it looks nicer. Thanks willross!!!

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.

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