redCOMPONENT-COM / redSHOP

redSHOP - a powerful e-commerce for Joomla
http://redcomponent.com/
GNU General Public License v2.0
25 stars 24 forks source link

Fix state display none #5608

Closed Rmh1978 closed 1 year ago

Rmh1978 commented 2 years ago

I corrected the display:none functions for when a country does not have states, it didnt work for years.

The function in redshop.js does work and display:none the State TR on change of country. But it does not hide id="div_state_txt" on initial load.

There is a issue in admin Addorder. If the BT country has states and you add shipping and choose a country that has no states redshop.js function also hides the BT state. I guess this effects only big international shop and happens rarely. Not a issue for me. My commits has not fixed or created this issue.

@lunguyenhat @NguyenBao10

NguyenBao10 commented 2 years ago

thank you @Rmh1978 , we will check and process your PR

VanTrieuThanh commented 2 years ago

Admin user has hiden (user, create new order) image image

but select the Shipping address it not hide image

Create new acc at FE it not hide image Edit Billing has show on the State field image but when user select the Country it has hiden image

anh @NguyenBao10 , @Rmh1978 help me check it again

Rmh1978 commented 2 years ago

Hi @VanTrieuThanh

Your comment: "but select the Shipping address it not hide" Is related to the issue I described in the PR: "There is a issue in admin Addorder. If the BT country has states and you add shipping and choose a country that has no states redshop.js function also hides the BT state. I guess this effects only big international shop and happens rarely. Not a issue for me. My commits has not fixed or created this issue."

So i did not add the id="div_state_txt" in ST because then it would effect the BT user.

The rest of the comments are is also described in my PR because of the function: // Now let's hide state list by default in https://github.com/redCOMPONENT-COM/redSHOP/blob/develop/media/com_redshop/js/redshop.js does not hide the state list by default (on page load) and if there is a pre-selected country that has States then is should display state list. That is why i added this old core code more places: <script type="text/javascript" language="javascript"> if (document.getElementById('rs_state_state_code')) { if (document.getElementById('rs_state_state_code').options[1] == undefined) { document.getElementById('div_state_txt').style.display = 'none'; } } </script> This was not needed if the js check worked on initial load.

I have not added this code for the FE you commentet about because my FE dont work in my 3.0.3 test version. @NguyenBao10 is working on it, so i can test in FE as well.

My fixes have not broken, but enhanced the "state hide" some places but not all. The state hide function has not worked for years. I just hardcoded "display:none" on the state fields untill now.

VanTrieuThanh commented 2 years ago

Admin

  1. Select the country don't have State Account image Order image
  2. Select the country have the states Account image Order image FE Create new user image Create shipping/ edit shipping has fine image

It fine for me on the my local site. @Rmh1978 so we can continue the next step

Rmh1978 commented 2 years ago

@anhredweb please merge.