Skip to content

Conversation

@san-coding
Copy link
Contributor

@san-coding san-coding commented Sep 3, 2021

Added text to be displayed when invalid data is entered into the search input field and no search results found
in WooCommerce-> Marketplace , fixes issue #30588

All Submissions:

Changes proposed in this Pull Request:

Closes # .

How to test the changes in this Pull Request:

  1. Create any test site using JN site.
  2. Install and activate all the required plugins.
  3. Install and activate WooCommerce 5.7.0 Beta-1.
  4. Complete the setup wizard.
  5. Go to WooCommerce->Marketplace.
  6. Search invalid data (non-existing) in search field.
  7. Screen displays Sorry, could not find anything. Try searching again using a different term.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?

Changelog entry

Tweak - Show a search again message when marketplace results are empty.

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

Added text to be displayed when no search results found , fixes issue woocommerce#30588
@san-coding san-coding changed the title Added text to be displayed when no search results Added text to be displayed when invalid data is entered into search input field and no search results are found Sep 3, 2021
@san-coding
Copy link
Contributor Author

Hey @vedanshujain @andfinally @kloon , I have added this PR #30641 , please review it , thank you

@san-coding
Copy link
Contributor Author

Ok , now I see that the changes I have made are wrong, but how do I know that no search results are being returned

@san-coding
Copy link
Contributor Author

now I see that the changes I have made are wrong, but how do I know that no search results are being returned , is any variable storing the number of results returned, please help me out @vedanshujain @andfinally @kloon , thanks

@vedanshujain
Copy link
Contributor

@san-coding you should be able to use $addon to see if there are search results. Can you check if the presence of both $search and more than one in $addon gives you expected behavior?

@san-coding
Copy link
Contributor Author

san-coding commented Sep 7, 2021

@san-coding you should be able to use $addon to see if there are search results. Can you check if the presence of both $search and more than one in $addon gives you expected behavior?

Thanks @vedanshujain , I have made the changes , instead of checking if(empty($search)) , I am now checking if(sizeof($addons)==0)

I have also added 0` ) : ?> , so that the message that the message search results for "" is displayed only when && sizeof($addons)>0

please verify and review if my changes are correct, thanks @vedanshujain

Checking  sizeof($addons>0) along with !empty($search) to display search results if addons found
@san-coding
Copy link
Contributor Author

Hey @vedanshujain , could you please review this

@san-coding
Copy link
Contributor Author

Have added required space and replaced sizeof() with count()

@san-coding
Copy link
Contributor Author

@vedanshujain , looks like all checks have passed, you may review and merge

@san-coding
Copy link
Contributor Author

@vedanshujain @rodelgc @andfinally someone please review this

@kloon kloon added the needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. label Sep 29, 2021
<?php if ( ! empty( $search ) ) : ?>
<?php if ( count( $addons ) == 0 ) : ?>
<h1 class="search-form-title">
<?php // translators: search keyword. ?>
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove this since there is no placeholder in the string below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What exactly should I remove

Copy link

Choose a reason for hiding this comment

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

He is talking about this <?php // translators: search keyword. ?>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

have made the changes

@san-coding
Copy link
Contributor Author

Thank you , I have made the changes, please review this PR

@san-coding san-coding requested a review from kloon October 2, 2021 18:01
@github-actions github-actions bot added needs: triage feedback Issues for which we requested feedback from the author and received it. and removed needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. labels Oct 2, 2021
@san-coding
Copy link
Contributor Author

san-coding commented Oct 2, 2021

can you please add a label hacktoberfest-accepted to this PR, thank you @eopws @kloon

@san-coding
Copy link
Contributor Author

@kloon @eopws @vedanshujain please review this

Copy link
Contributor

@kloon kloon left a comment

Choose a reason for hiding this comment

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

Changes look good to me now, thanks!

@san-coding
Copy link
Contributor Author

@kloon thanks

@peterfabian
Copy link
Contributor

Requesting a review from the core team before merging just to double check, should be a quick one.

Copy link
Contributor

@vedanshujain vedanshujain left a comment

Choose a reason for hiding this comment

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

LGTM!

@vedanshujain vedanshujain merged commit c710cb8 into woocommerce:trunk Oct 13, 2021
@github-actions github-actions bot added this to the 5.9.0 milestone Oct 13, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Oct 13, 2021

Hi @vedanshujain, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the status: needs changelog label
  • Add the status: needs testing instructions label

@vedanshujain vedanshujain added release: add changelog Mark all PRs that have not had their changelog entries added. [auto] and removed needs: triage feedback Issues for which we requested feedback from the author and received it. labels Oct 13, 2021
@san-coding
Copy link
Contributor Author

Thanks you 👍🏻

@Konamiman Konamiman added the release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] label Oct 14, 2021
@peterfabian
Copy link
Contributor

peterfabian commented Oct 15, 2021

A pull request is considered approved once it has an overall approving review from maintainers, or has been merged by maintainers, or has been given the 'hacktoberfest-accepted' label.

My reading of the rules is that the label is not necessary, but please let us know if you think we need to add it. Thx!

@Konamiman Konamiman added changelog added and removed release: add changelog Mark all PRs that have not had their changelog entries added. [auto] labels Oct 15, 2021
@drjamesj
Copy link
Contributor

Hi @san-coding @vedanshujain - there is a slight issue for this PR when there is no search term the error message still displays (ie. on the landing page when you first access Marketplace).

To reproduce:

  • login to wp-admin
  • navigate to WooCommerce -> Marketplace
  • you will see the error message Sorry, could not find anything. Try searching again using a different term. on this page when it should not show here

image

I am happy to open a PR to correct this if you like. Just let me know.

@san-coding
Copy link
Contributor Author

san-coding commented Oct 15, 2021

Ohh i will look into this and get back to you soon, can you revert the merge, adding a condition to check if search term exists would be enough i guess

@san-coding
Copy link
Contributor Author

san-coding commented Oct 15, 2021

@drjamesj , checkout this file in the trunk branch, maybe it has been solved

<?php if ( ! empty( $search ) && 0 === count( $addons ) ) : ?>

@tammullen tammullen added testing instructions added and removed release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] labels Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants