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

Resolves issue #976 #1144

Merged
merged 2 commits into from Sep 20, 2016
Merged

Conversation

briansandall
Copy link
Contributor

No description provided.

Allows store owners to specify exactly which products, if any, should be featured, rather than pulling a completely random product.
Works by selecting all product IDs that are featured and then choosing randomly from within that result set, completely removing recursive calls yet getting a valid result on the first try every time in most cases.

Since only the product IDs are fetched, memory overhead should be minimal even in the unlikely scenario that a store has thousands of featured products.

Efficiency could be optimized even further with an index on the `featured` column.
Copy link
Member

@abrookbanks abrookbanks left a comment

Choose a reason for hiding this comment

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

Does this remove the random product functionality or allow for both?

@briansandall
Copy link
Contributor Author

It allows for both. The way it works is thus:

  1. 'Latest' products appear on the store homepage in order of last date modified; this is the old 'featured' column and usually displays 9 or so products in a grid format.
  2. 'Featured' products will appear in the featured product box on the homepage (upper right on Foundation, one product at a time). This product used to be selected randomly from ALL products in the store; now it is selected randomly from all products that have been marked specifically as 'featured', allowing merchants to control which products they wish to promote.

@abrookbanks abrookbanks added this to the 6.1.0 milestone Sep 20, 2016
@abrookbanks abrookbanks self-assigned this Sep 20, 2016
@abrookbanks abrookbanks merged commit 9b5ce31 into cubecart:master Sep 20, 2016
@briansandall
Copy link
Contributor Author

One thing of note: new products are included in 'latest' but not 'featured' by default. If you'd like them to also be featured by default, I can write up a new PR on top of this one that will do so.

@abrookbanks
Copy link
Member

Funny I was just wondering that. I think for the sake of consistency they should be included by default.

@briansandall
Copy link
Contributor Author

Alright, give me a few minutes here and I'll have it up for you.

@abrookbanks
Copy link
Member

What a legend. 👍

@briansandall
Copy link
Contributor Author

See #1247

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.

None yet

2 participants