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

Add promoted card to in-App marketplace page #30861

Merged
merged 112 commits into from
Oct 21, 2021
Merged

Conversation

corsonr
Copy link
Contributor

@corsonr corsonr commented Oct 1, 2021

All Submissions:

Changes proposed in this Pull Request:

The search on WooCommerce > Marketplace page that shows product from the WooCommerce.com marketplace as cards. During previous re-design phase we added updated product cards in #30410.

This PR adds a new style of "promoted" product cards by:

  • adding a new style card
  • adding a top border to the card (the color is defined in the JSON feed)
  • adding a colored button (the color is defined in the JSON feed)
  • adding an automated logic that changes the button text color base on the button background-color

Closes Automattic/woocommerce.com#10885

Screenshots

How to test the changes in this Pull Request:

  • Check out this branch.
  • Edit includes/admin/class-wc-admin-addons.php.
  • On line 66, change $featured = get_transient( 'wc_addons_featured' ); to bypass the transient check:
$featured = false; // TODO - REMOVE THIS
  • On line 83, change https://woocommerce.com/wp-json/wccom-extensions/2.0/featured' . $parameter_string to point to our mock WCCOM featured API data: https://gist.githubusercontent.com/corsonr/6ac9a36583dce3a2d2d9e97f4ddf7847/raw/60a38e52de705566bdb74b2059d6acc6a086379b/featured.json.
$raw_featured = wp_safe_remote_get(
	'https://gist.githubusercontent.com/andfinally/be6f6caae34f3f3c1c5de1df0ba30681/raw/featured.json',
	array(
		'headers'    => $headers,
		'user-agent' => 'WooCommerce Addons Page',
	)
);

the headers could have to be removed from the wp_safe_remote_get call.

  • On line 142, change 'https://woocommerce.com/wp-json/wccom-extensions/1.0/search' . $parameters, to point to another mock JSON endpoint: https://gist.githubusercontent.com/andfinally/cdea0c85da10bc037dad6aaa8bf28d0e/raw/search.json.
$raw_extensions = wp_safe_remote_get(
	'https://gist.githubusercontent.com/andfinally/cdea0c85da10bc037dad6aaa8bf28d0e/raw/search.json',
	array( 'headers' => $headers )
);
  • View the Featured page of WooCommerce > Marketplace on your WooCommerce site wp-admin/admin.php?page=wc-addons&section=_featured.
  • In the Discover our favorites group you should see the two new styles of card shown in this screenshot:

image

  • View a category page like wp-admin/admin.php?page=wc-addons&section=marketing-extensions or search results page. You should see the two styles of card shown here at the top:

image

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 - Add promoted cards styling to marketplace section. #30861

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.

@corsonr corsonr added the needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. label Oct 1, 2021
@corsonr corsonr added this to the In-App Marketplace milestone Oct 1, 2021
@andfinally andfinally marked this pull request as ready for review October 4, 2021 13:21
@andfinally
Copy link
Contributor

I'm currently having trouble getting the API request to work locally with my Woo Core development environment site – I'm getting cURL error 7: Failed to connect to woocommerce.test port 443: Connection refused despite having a filter to set the correct HTTP options. I'll try again later!

@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 4, 2021
@corsonr
Copy link
Contributor Author

corsonr commented Oct 5, 2021

@andfinally I'm testing from the test customer site if that helps 😉

@tgglv tgglv added needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. and removed needs: triage feedback Issues for which we requested feedback from the author and received it. labels Oct 8, 2021
Copy link
Contributor

@madeincosmos madeincosmos left a comment

Choose a reason for hiding this comment

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

Thank you for the PR @corsonr! Everything looks good to me except for the test site URL that accidentally made its way to the commit, we'll need to replace it with the original feed before merging. Other than that, the cards are looking great on all screen sizes 🌟

includes/admin/class-wc-admin-addons.php Outdated Show resolved Hide resolved
assets/css/admin.scss Outdated Show resolved Hide resolved
Copy link
Contributor

@tgglv tgglv left a comment

Choose a reason for hiding this comment

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

Thanks, @corsonr!

It works like a charm! 🍀

I've made it as a comment rather than approval to ask you to apply Maria's and mine suggestions first.

includes/admin/class-wc-admin-addons.php Outdated Show resolved Hide resolved
includes/admin/class-wc-admin-addons.php Outdated Show resolved Hide resolved
@andfinally andfinally added needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. and removed needs: triage feedback Issues for which we requested feedback from the author and received it. labels Oct 20, 2021
@andfinally
Copy link
Contributor

Hi @Konamiman, I've set the base to release/5.9, resolved the conflicts and tested again – this is good for review again, thank you!

@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 20, 2021
andfinally and others added 2 commits October 20, 2021 20:23
…App Marketplace template page, which was accidentally omitted when fixing conflicts.
@Konamiman Konamiman self-requested a review October 21, 2021 08:57
@Konamiman Konamiman merged commit e995fbf into release/5.9 Oct 21, 2021
@Konamiman Konamiman deleted the add/wccom-10885 branch October 21, 2021 08:58
@github-actions
Copy link
Contributor

Hi @Konamiman, 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

@Konamiman Konamiman added release: add testing instructions PRs that have not had testing instructions added to the wiki. [auto] release: add changelog Mark all PRs that have not had their changelog entries added. [auto] release: cherry-pick Commits from this PR also needs to be added to current release branch. labels Oct 21, 2021
@Konamiman
Copy link
Contributor

Merged into release/5.9 for inclusion in WooCommerce 5.9 RC. Needs to be cherry-picked into trunk.

@corsonr corsonr added changelog added and removed release: add changelog Mark all PRs that have not had their changelog entries added. [auto] labels Oct 21, 2021
@Konamiman Konamiman modified the milestones: In-App Marketplace, 5.9.0 Oct 21, 2021
@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 24, 2021
@Konamiman
Copy link
Contributor

Additional pull request to incorporate these changes in WooCommerce 6.0: #31090

@Konamiman Konamiman removed the release: cherry-pick Commits from this PR also needs to be added to current release branch. label Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: triage feedback Issues for which we requested feedback from the author and received it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet