Jump to content

Update Shipping in Basket Not Working


Claudia M

Recommended Posts

My update basket button is not working when a customer changes their shipping method.

I use AIOS and usually the customer will have three options to choose from.  If they select a different method than what is automatically applied (radio button) nothing happens. It seems to me the cart totals should be updated automatically. What's the purpose if they can't see their updated basket totals. Even when the Update Basket button is clicked nothing happens - no update to the  shipping price. 

The only time it updates is when they select the continue to secure checkout button. The next page shows the selected shipping price.

This happens if a customer is or is not logged in.

 

Here is the code from my skin/checkout/template:

 

<div class="clearfix">

      <div class="show-for-medium-up"><a href="{$STORE_URL}/index.php?_a=basket&empty-basket=true" class="button alert left"><svg class="icon"><use xlink:href="#icon-trash-o"></use></svg> {$LANG.basket.basket_empty}</a></div>

      <div class="show-for-medium-up"><button type="submit" name="update" class="button secondary left" value="{$LANG.basket.basket_update}"><svg class="icon"><use xlink:href="#icon-refresh"></use></svg> {$LANG.basket.basket_update}</button></div>

      <div class="show-for-small-only"><button type="submit" name="update" class="button secondary left" value="{$LANG.basket.basket_update}"><svg class="icon"><use xlink:href="#icon-refresh"></use></svg> {$LANG.common.update}</button></div>

 

I'm getting this error in my log:

[28-Jan-2019 11:55:13 America/Louisville] PHP Warning:  Shipping not setup or allow no shipping not enabled in /home/claudias/public_html/classes/cubecart.class.php on line 1707

 

... And here is the code for that line area:

} else {

                                                                           trigger_error('Shipping not setup or allow no shipping not enabled', E_USER_WARNING);

                                                                           unset($GLOBALS['cart']->basket['shipping'], $GLOBALS['cart']->basket['min_shipping_set']); // past 5.0.9

                                                            }

 

Thanks in advance for any and all help

Link to comment
Share on other sites

Viewing your checkout, I see that the lowest shipping charge was used, but the radio button is not checked. This happens because the HTML code contains two sections of identical form elements. That is, there is the section that gets displayed on medium and large browser screens, and the section that gets displayed on small browser screens.

The controller code that populates $SHIPPING also sets one of the choices to checked="checked". The situation is that the 'small' group of form elements is the last one to be seen by the browser when rendering the page, and so the relevant choice acquires the checked attribute - unchecking the related choice from the 'medium-up; group of form elements.

From content.checkout.php (Foundation):

   <h2>{$LANG.checkout.your_basket}</h2>
   {include file='templates/content.checkout.medium-up.php'}
   {include file='templates/content.checkout.small.php'}

I'm sure this has been solved. I will look for it.

Edit: See: https://github.com/cubecart/v6/issues/1732

We need to determine if this fix is needed for your skin.

Yes, when selecting a new shipping choice, the form is supposed to auto-submit. Probably the reason it is not is because there is javascript that attaches a 'monitor' to this form element - but the javascript is looking for autosubmit select.

From 2.cubecart.js (Foundation near line 96):

$(".autosubmit select").not('.nosubmit').change(function() {

Your skin is using radio buttons - not drop-down select choosers.

Try changing the above statement to:

$(".autosubmit select, .autosubmit input[type=radio]").not('.nosubmit').change(function() {

This adds radio button inputs to what is monitored for changes.

You will need to have CubeCart clear its internal cache.

Link to comment
Share on other sites

Well, Github Issue #1732 isn't going to solve the unchecked radio button situation.

As the browser renders the page, the first checked radio button is checked, but then eventually the second checked radio button is checked, unchecking the first.

Finally, after all this happens, does the javascript run that removes that group that is not to be shown. While this does solve the problem described in Issue #1732 (duplicate form entries), it does not solve making sure checked="checked" radio buttons get rechecked after the duplicated elements are removed.

Will investigate if this is an issue for you.

Link to comment
Share on other sites

Sorry Brian I really don't know what you are talking about. This is what happens.  First go to view basket no radio button is checked (dark full circle) though a shipping price shows. If I select a different method the dark circle shows and the rate automatically changes. But there is no dark circle in the newly selected method. Is this what you are talking about?  If so I'd like the dark circle to always show the selected method if possible. Hope you understand what I'm saying. Thanks

Link to comment
Share on other sites

Yes, I am discussing exactly what you are describing.

Try this:

In 2.cubecart.js, near line 408, find:

    if(Foundation.utils.is_small_only()) {
        grid_view(0);
        $('#content_checkout_medium_up').remove();
    }
    if(Foundation.utils.is_medium_up()) {
        $('#content_checkout_small').remove();
    }

Change to:

    if(Foundation.utils.is_small_only()) {
        grid_view(0);
        $('#content_checkout_medium_up').remove();
        $("[checked]").prop("checked",true);
    }
    if(Foundation.utils.is_medium_up()) {
        $('#content_checkout_small').remove();
        $("[checked]").prop("checked",true);
    }

The new statements look for all form elements that have the checked="checked" attribute, and then tells the browser to make them checked - if not already. (This action happens only once immediately after the page is fully loaded and ready.)

You will need to have CubeCart clear its internal cache.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...