Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue where sortable is trying to load when not needed #84

Merged
merged 1 commit into from
May 17, 2023

Conversation

Prestaworks
Copy link
Contributor

@Prestaworks Prestaworks commented Mar 30, 2023

Questions Answers
Description? Fix for issue where sortable is trying to load when not needed.
Type? bug fix
BC breaks? no
Deprecations? no
Fixed ticket? Fixes PrestaShop/PrestaShop#31980.
How to test? Follow instructions in ticket.

Copy link
Contributor

@leemyongpakvn leemyongpakvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think combining with existing condition is better

        if (Tools::getValue('controller') !== 'AdminModules' 
            || Tools::getValue('configure') !== $this->name 
            || Tools::getValue('id_slide')) {
                return;
        }

@kpodemski
Copy link
Contributor

Hi @Prestaworks

I agree with @leemyongpakvn suggestion :-)

Tools::getValue('configure') !== $this->name ||
Tools::getIsset('id_slide')) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like lack of 1 space at line 625

Update ps_imageslider.php

Update ps_imageslider.php
Copy link
Contributor

@leemyongpakvn leemyongpakvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have Tools:: on both sides now ;)

Copy link

@HanaRebaiQA HanaRebaiQA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @Prestaworks

I have checked your PR.

Check on PS8.0.3 : An error is displayed which is related to permission. It's Ok when giving permission to the shop

  • Check on BO : OK
  • Check on FO : OK
8.0.3_permission.probl.mp4

Check on PS1.7.8.8 : The JS error is still displayed when editing the slide

image

pr84._.1788.mp4

Could you please check it ?

Thank You!

@Prestaworks
Copy link
Contributor Author

Hi @HanaRebaiQA ,
if the PR is applied properly, no javascripts are added from the module on the "edit slide" page. So that JS error should be from something else.

@leemyongpakvn
Copy link
Contributor

I guess HanaRebaiQA need fresh installs of PS 8.0.3, PS 1.7.8.8, and ps_imageslider dev to make sure this PR is not affected by other PR. I rarely test other contributors' PR, then I see this PR works as supposed on my nearly fresh PS 8.1 :)

Copy link

@djoelleuch djoelleuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @Prestaworks ,

Tested WITH PS 8.0.3 : OK ✔️

803imageslider.webm

WITH PS 1.7.8.8 : OK ✔️

1788imageslider.webm

LGTM ,it's QA approved

Thank you 🚀 !

@Progi1984 Progi1984 added this to the 3.1.3 milestone May 17, 2023
@Progi1984 Progi1984 changed the title Update ps_imageslider.php Fix for issue where sortable is trying to load when not needed May 17, 2023
@nicosomb nicosomb merged commit f24d2bf into PrestaShop:dev May 17, 2023
@nicosomb
Copy link
Contributor

Thank you @Prestaworks !

@samilmarekrygula
Copy link

samilmarekrygula commented May 19, 2023

I have added this extra condition also, because it was problem when you wanted to add new slider Tools::getIsset('addSlide') ;

This condition has worked well till error messages shows up. When there is an error message in URL you don't gave any GET variable, so the best option is check if var $mySlides = $("#slides"); this $("#slides") element exists.

@florine2623 florine2623 mentioned this pull request Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

javascript error prevents upload of images
10 participants