Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shipping Quote in Cart 2.3.3.4 - Support Thread


Recommended Posts

couple of minor fixes:

 

 

1. when you first click "Get Quotes", the listed shipping options weren't highlighting when you mouseover them

 

1st FIX:

remove the " tr-click" (x2) from the following code in the catalog\shipping_quotes.php file, not sure why they were there and aren't in any other similar oscommerce code:

 

if ( ($checked == true) || ($n == 1 && $n2 == 1) ) {

$quote_output .= ' <tr id="defaultSelected" class="moduleRowSelected tr-click" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";

} else {

$quote_output .= ' <tr class="moduleRow tr-click" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";

}

 

 

2. if you click "Get Quotes" a second/third time etc and then click a non selected/non-highlighted shipping option, both the newly selected shipping option and the already highlighted option are both highlighted

 

2nd FIX:

remove the line "var selected;" inside the javascript code from catalog\includes\modules\shipping_in_cart.php and put this:

 

$quote_output .= '<script type="text/javascript"><!--

var selected = false;

//--></script>';

 

inside the catalog\shipping_quotes.php file, after the following (around line 176):

 

$quote_output .= '</table>

</div>';

 

 

3. when you have only one shipping module and click "Get Quotes", the single shipping option appears OK but doesn't appear as a seperate item in the totals

 

3. WORKAROUND:

put the following inside the catalog\shipping_quotes.php file:

 

$_GET['shipping'] = $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'];

 

 

after the following line (line 163):

 

$quote_output .= '<td align="right" colspan="2">' . $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']) . '</td>';

 

 

 

4. (working on a fix for this)

tax is not being included in the totals when DISPLAY_PRICE_WITH_TAX == 'true'

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

in addition to number 4.

4. (working on a fix for this)

tax is not being included in the totals when DISPLAY_PRICE_WITH_TAX == 'true'

 

This only happens when you're not signed in to the store. Tax is inlcuded OK when signed in but It would be good to also have tax included in the totals when not signed in, since the shopping cart items can display prices with tax included when not signed in

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

@

 

1. Good catch. That was code left over from something that ended up not being implemented.

 

2. in includes/modules/shipping_in_cart.php around line 115 find:

$(document).on("changeShipping", function( event, shippingMethod ){

directly AFTER that add:

var selected = false;

 

3. Looks like that should work. Something could probably be done on the client side as well if someone wanted to take the time to sort through it.

 

4. I'll have to look into that.

Matt

Link to comment
Share on other sites

@

 

1. Good catch. That was code left over from something that ended up not being implemented.

 

2. in includes/modules/shipping_in_cart.php around line 115 find:

$(document).on("changeShipping", function( event, shippingMethod ){

directly AFTER that add:

var selected = false;

 

3. Looks like that should work. Something could probably be done on the client side as well if someone wanted to take the time to sort through it.

 

4. I'll have to look into that.

 

thanks for your reply Matt

 

tried your suggestion for point 2 but it didn't work

had to leave the js code for "var selected = false;" in catalog\shipping_quotes.php for it to work

 

thanks

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

  • 1 month later...

Thanks for the feedback, glad you like it. Yes it should work well for any 2.3+ shop.

 

Any chance a 2.2 shop owner has tested this? just curious if it works with 2.2.

 

The bug fixes above this post have been incorporated in the latest version, v1.1

updated: http://addons.oscommerce.com/info/9036

-Dave

Link to comment
Share on other sites

  • 5 months later...

Bootstrap Modal Version

 

 

 

Package includes:

2x new files

1x install.txt

1x screenshot

 

This does the same thing as the original add-on but instead of being embedded into the shopping cart page this version shows a modal. (screenshot included)

This version works only with osCommerce Bootstrap version (community build)!

Edited by Tsimi
Link to comment
Share on other sites

Forgot to add the spinner.gif inside the package, my apologies.

You can either download it from here or take it from any osC 2.3.3.x package. Look inside the catalog/ext/jquery/bxGallery/ folder.

And put it inside the images/icons/ folder.

 

 

 

One more thing, this add-on seems to have it's trouble with the KissER Error message Add-on. So you have to turn the KissER off for it to work.

 

(Thanks Malcolm :thumbsup: )

Edited by Tsimi
Link to comment
Share on other sites

I have installed @@Tsimi 's version in my 234bs store, and it works great! Thank you!

 

I also have the Active Countries add-on installed, in order to control what countries (and States) we sell to. Since it made no sense to quote shipping costs to countries we won't ship to, I modified Tsimi's code to include Active Countries. This way, we will only provide a shipping quote to those countries we ship to.

 

It's a simple modification ...

in: shipping_in_cart.php
(around line 14)

 

*** Replace ***

$countries = tep_get_countries();

for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
    $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);
}

*** With ***

$countries = tep_get_active_countries();

for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
    $countries_array[] = array('id' => $countries[$i]['id'], 'text' => $countries[$i]['text']);
}

Once again, thank you, Tsimi!

 

Malcolm

Link to comment
Share on other sites

@@De Dokta

 

No i didn't. I was not aware of that issue. I will need to look more into it...

I wonder how the system would know from what country the "guest" is browsing to calculate the correct tax? Or would it just go by the selected country inside the quotes modal? Kinda tricky....isn't it?

Link to comment
Share on other sites

@@Tsimi

 

Unfortunately I have not found the time to deal with it. I guess that just a session "customer_country_id" is missing that osc "knows", on the basis of which country the tax is to be calculated. But so far only a guess.... :unsure:

 

J.J.

Link to comment
Share on other sites

I view this as ... the module is supposed to quote the "shipping cost", not the "total cost, including shipping and/or tax".

 

Once a customer views the shipping quote, they can choose whether or not to proceed to checkout, where the final total (including tax) will be calculated.

 

Most customers should know if they have to pay a tax, so it shouldn't be that much of a surprise. And, if the addition of the tax in checkout is too much, the customer can (but hopefully won't) abandon the cart. Don't say that we haven't all done this before, because that was the only way to get a shipping quote.

 

I bought something from an online store recently that charged a "small-order fee", since the purchase was under $50 USD. This wasn't displayed until the very last page during checkout. Surprise!

 

Lastly, it shouldn't be too difficult to add a line of text near the bottom of the shipping quote modal stating something like, "All orders shipped to the state of XXXXX, or country of YYYY, will be charged the appropriate state sales tax or VAT."

 

Malcolm

Link to comment
Share on other sites

@@ArtcoInc

 

Sorry, but it sucks to display just everywhere in the shop prices including tax and to operate only in the shipping estimator suddenly with net prices. In the admin, you can set whether you want to display prices net or gross. A properly programmed tool must be able to reflect that then.
Apart from the legal aspect, that burt mentioned!
 
J.J.
Link to comment
Share on other sites

@@De Dokta @@burt  I agree with both of you. It is not my intent to deceive my customers, nor do a 'bait and switch'. I also do not mean this to be argumentative, but rather an open discussion on what's the best way to address this concern.

 

If the argument is that the 'quote' made in the "Shipping Quote" includes the products and shipping, but not the tax, and if the exclusion of the tax may be viewed as deceitful, or as a 'bait and switch', than perhaps the "Shipping Quote" should *not* include the products, but rather quote only the available shipping options and prices?

 

Malcolm

Link to comment
Share on other sites

I agree with whitehat, remove the sub-total part and just keep the shipping prices. At least for now until someone can find a solution.

Or show the get quotes button only to customers that are logged in.

Not ideal for those who have guest checkout function installed though.

Edited by Tsimi
Link to comment
Share on other sites

I don't know if it is Bait and Switch - the thought occured to me and I wanted to ensure that you all had thought of it (and maybe dismissed it), or had maybe not thought of it.    Common sense suggests to me that if a shopowner puts "estimated quote", no buyers would expect that quote to be exactly the same once they begin a real checkout.  

 

However, I think all shopowners know that customers sometimes display a lack of common sense...

Link to comment
Share on other sites

@@Tsimi

 

Did you find a fix for the tax issue where the order totals are displayed without tax when the custom is not logged in?

 

J.J.

 

 

@De Dokta

 

I did look into this a while back and found a way to get tax to be included in the order totals when the custom is not logged in.

 

It worked OK except that it required changes to quite a few files, including the shipping modules. For this reason I didn't suggest this in the forum since it didn't seem a viable solution, because every time someone adds another shipping module to their shop the modifications explained below need to be applied to that shipping module. Unless this can be included to the core of osCommerce, but just for this addon????? Maybe you guys might suggest otherwise or can find an easier way.

 

Basically the tax that is added to products when the customer is browsing the store (whether the customer is logged in or not), as you probably already know, is calculated in the function tep_get_tax_rate() within the store general.php file. ie when not logged in the store location is used to calculate tax on products, when logged in the customer location is used to apply tax if applicable.

 

What I did was make use of the 2 session variables $customer_country_id and $customer_zone_id and applied them to the "Shipping Quote in Cart" addon as follows:

 

in shipping_quotes.php

 

after

 

  if ( isset($HTTP_GET_VARS['country']) && isset( $HTTP_GET_VARS['postcode'] ) && isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ) {

 

I added

 

    if (!tep_session_is_registered('customer_id')) {

      if (!tep_session_is_registered('customer_country_id')) tep_session_register('customer_country_id');

      if (!tep_session_is_registered('customer_zone_id')) tep_session_register('customer_zone_id');

      $customer_country_id = STORE_COUNTRY;

      $customer_zone_id = STORE_ZONE;

    }

 

so that the store location would be assigned to these session variables until the customer signs in.

 

Consequently you would have to test these variables aren't already registered when the customer logs in or creates an account.

 

ie. in store login.php and create_account.php (where the registration of each one already exists)

 

          if (!tep_session_is_registered('customer_country_id')) tep_session_register('customer_country_id');

          if (!tep_session_is_registered('customer_zone_id')) tep_session_register('customer_zone_id');

 

then in the store order.php class within the cart() function need to change (where the test for $this->content_type is - but modify the else code):

 

      if ($this->content_type == 'virtual') {

        $tax_address = array('entry_country_id' => $billing_address['entry_country_id'],

                             'entry_zone_id' => $billing_address['entry_zone_id']);

      } else {

        $tax_address = array('entry_country_id' => $shipping_address['entry_country_id'],

                             'entry_zone_id' => $shipping_address['entry_zone_id']);

      }

 

TO:

 

      if ($this->content_type == 'virtual') {

        $tax_address = array('entry_country_id' => $billing_address['entry_country_id'],

                             'entry_zone_id' => $billing_address['entry_zone_id']);

      } else {

        $tax_address = array('entry_country_id' => (isset($HTTP_GET_VARS['country']) ? $customer_country_id : $shipping_address['entry_country_id']),

                             'entry_zone_id' => (isset($HTTP_GET_VARS['country']) ? $customer_zone_id :  : $shipping_address['entry_zone_id']));

      }

 

Need to also add $HTTP_GET_VARS, $customer_country_id, $customer_zone_id as global variables to the cart() function.

 

The changes above in the order class only apply tax to the products in the cart (order), not the shipping costs.

 

Therefore, for example in the store table.php shipping module change within the quote() function:

 

      if ($this->tax_class > 0) {

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

      }

 

TO:

 

      if ($this->tax_class > 0) {

        if (isset($HTTP_GET_VARS['country'])) {

          $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $customer_country_id, $customer_zone_id);

        } else {

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

        }

      }

 

also add $HTTP_GET_VARS, $customer_country_id, $customer_zone_id as global variables to the quote() function.

 

This needs to be done to all the shipping modules. Similar changes are required to the order total modules ot_shipping.php and ot_loworderfee.php

The idea is that $customer_country_id and $customer_zone_id will be populated with something (logged in or not), and when the customer completes the checkout then the shipping address will be used for tax calculations.

 

But some explanation will need to be placed in the “Shipping Quotes in Cart” for the customer to be aware that the order totals may change at the confirmation screen during checkout, due to taxes applied or not applied according to the shipping address they use in their order which may be different to their account primary address. (This is normal osCommerce functionality correct???)

 

cheers

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

Ive been looking at this. @@Tsimi I downloaded your package, I like the screenshots showing how it looks. I only browsed the code and my initial thoughts were it could get better and be less intrusive.

 

My thoughts :

 

Most of the code that pulls the logic should be able to move into a header tag module

 

-OR-

 

All the code could be put into a content module and then place the markup to grab it in the shopping cart file.

 

There's no need to show order totals, just shipping quotes. These type of things have to be as simple as possible, not necessarily because of all the different outcomes depending on totals, tax, weight, distance, etc; but as Gary mentioned "customers sometimes display a lack of common sense." That's a big time reason.

Follow the community build:

BS3 to osCommerce Responsive from the Get Go!

Check out the new construction:

Admin Gone to Total BS!

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