Jump to content
Latest News: (loading..)
PiLLaO

2.3.4 BS - Fast Update Shopping_cart

Recommended Posts

@@raiwa

 

Hi Rainer

 

Just tried this in Google Chrome and find that the Up/Down arrows only appear when you hover inside the quantities box,

or at least mine does.

 

Cheers

 

Grandpa

Share this post


Link to post
Share on other sites

Hello John @@grandpaj,

 

Yes, the same like the core version. It is how Google Chrome renders a standard html5 number input field.

Nothing to do with my coding. Each Browser renders the input fields in a different way.

 

regards

Rainer

Share this post


Link to post
Share on other sites

@@grandpaj and others,

 

Sorry, I'm a bloody javascript beginner.

All that numbering is not needed. It's posible to apply the spinner to the last element before the script : $(this).parent().find(  :)

 

Here the much simlified version:

      $products_name .= '<br>' . tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'style="width: 65px;" min="1" max=""', 'number', true, 'class="form-control text-center"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']) . 
      									' <span class="spinner_icon"><i class="fa fa-refresh fa-spin" style="color:transparent;"></i></span> ' . tep_draw_button('Remove', 'fa fa-trash', tep_href_link(FILENAME_SHOPPING_CART, 'products_id=' . $products[$i]['id'] . '&action=remove_product'), NULL, NULL, 'btn-danger btn-xs btn-remove') . 
'<script>
function update() {
	$("form[name^=\'cart_quantity\']").submit();
	$(this).parent().find(".spinner_icon i").css(\'color\', \'\');
};
$("input[name^=\'cart_quantity\']").change(update);
$("form[name=\'cart_quantity\'] .btn-remove").click(update);
</script>

';

Maybe still to improve: Add input validation for " input is number" and  "input > 0"

Or this is not so important?

There is no validation in core, but we could avoid unnecesary page update and spinner showing if they try to reduce qty to zero.

 

regards

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

@@raiwa

Hi Rainer

 

Was just playing around with the code (which I know nothing about) and removed

 

$(this).parent().find(".spinner_icon i").css(\'color\', \'\');

 

All still seemed to work. Look forward to any comments you may have.

 

Cheers

Share this post


Link to post
Share on other sites

Hello John @@grandpaj,

 

Then you may have duplicate code from an old version still present in your store.

Or you just didn't reload/refresh the page at least once after erasing that line.

Browsers cache shouldn't be the reason, but you could reset it for any case.

 

regards

Rainer

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×