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

Allow store owners to specify featured products #976

Closed
briansandall opened this issue Jan 19, 2016 · 16 comments
Closed

Allow store owners to specify featured products #976

briansandall opened this issue Jan 19, 2016 · 16 comments
Assignees
Milestone

Comments

@briansandall
Copy link
Contributor

This is a feature requested by a client that I think makes a lot of sense. Currently the 'featured product' box just displays a random product out of the entire inventory, but I imagine most store owners would actually want to choose which products are featured, as that box is prime screen real estate.

I've uploaded a branch of my implementation that I'd be happy to create a PR for if acceptable, as well as another branch with a tweak to make the selection code much more efficient.

@veromary
Copy link

veromary commented Jul 7, 2016

It looks like the featured product should not come from those marked not to appear on the homepage, but I've twice seen such products up in the featured product box, but this solution of having a more select pool to draw from seems good.

@briansandall
Copy link
Contributor Author

Products marked as 'featured' can appear in the featured product box whether or not they are marked to appear on the homepage. In other words, the featured products are completely independent from those that appear on the homepage, and this is intentional. If you only want products that are marked as both featured and homepage to appear, you can change the following line:

$where = $GLOBALS['catalogue']->outOfStockWhere(array('status' => '1', 'featured' => '1'));

// add 'latest'=>'1' to the array:
$where = $GLOBALS['catalogue']->outOfStockWhere(array('status' => '1', 'featured' => '1', 'latest'=>'1'));

abrookbanks added a commit that referenced this issue Sep 20, 2016
@abrookbanks abrookbanks added this to the 6.1.0 milestone Sep 20, 2016
@abrookbanks abrookbanks self-assigned this Sep 20, 2016
@abrookbanks
Copy link
Member

Implemented with 9b5ce31.

Lets see how we get on with this. Thanks Brian! :)

@abrookbanks
Copy link
Member

Seem to work well from my testing. Awesome. :)

@briansandall
Copy link
Contributor Author

Glad to help! :)

briansandall added a commit to briansandall/v6 that referenced this issue Sep 20, 2016
briansandall added a commit to briansandall/v6 that referenced this issue Sep 20, 2016
briansandall added a commit to briansandall/v6 that referenced this issue Sep 20, 2016
abrookbanks added a commit that referenced this issue Sep 20, 2016
Issue #976 - new products 'featured' by default
@Dirty-Butter
Copy link

With this code in place - are ALL items supposed to be marked by default as Featured in database? Mine are.

@Dirty-Butter
Copy link

Also, the current Latest Products are NOT marked as such in the admin Product listing page.

@abrookbanks
Copy link
Member

With this code in place - are ALL items supposed to be marked by default as Featured in database? Mine are.

Yes because thats how it worked before. All products were featured in the random product. Now on add you can choose to uncheck and not feature.

Also, the current Latest Products are NOT marked as such in the admin Product listing page.

I'll check this.

Did you make the database changes or just update the files?

@abrookbanks
Copy link
Member

From my testing it works fine.

Make sure you run these SQL changes:

ALTER TABLE `CubeCart_inventory` CHANGE COLUMN `featured` `featured` tinyint(1) unsigned NOT NULL DEFAULT 1 COMMENT 'Featured product'; #EOQ
ALTER TABLE `CubeCart_inventory` ADD COLUMN `latest` tinyint(1) unsigned NOT NULL DEFAULT 1 COMMENT 'Included on Homepage' AFTER `featured`; #EOQ
UPDATE `CubeCart_inventory` SET `latest`=`featured`; #EOQ

@Dirty-Butter
Copy link

OK - I had already run some of the SQL changes for 6.1.0, so just added the "new" ones on the bottom of the list - but now I see the new Featured ones are at the top of the list now. After running the latest-featured one, it does have the Latest marked now as it should.

But as far as having ALL marked as Featured automatically, I'm not sure I agree with your logic. Yes, that's the way it was before - but that's the very thing that was wrong with it the old way. We have close to 5k listings. If I didn't know how to change the 1 to 0 via cPanel I'd be tearing my hair out to get just the ones I wanted to be Featured.

I actually quit using the Featured stock code a long time ago because it didn't allow me to feature what I wanted to feature. I made my own side box.

@briansandall
Copy link
Contributor Author

@Dirty-Butter My initial implementation had 'featured' set to 0 by default for the very reasons you state, but Al requested that we not change the default behavior.

To achieve your desired results, revert the changes made in commit 828e277, either manually or via git command git revert 828e277. Note that you wouldn't really need to run the upgrade SQL again as the stored value is always explicitly set to either 0 or 1 based on the checkbox when adding a new product.

@abrookbanks
Copy link
Member

My initial implementation had 'featured' set to 0 by default for the very reasons you state

Yup. Historically CubeCart has always taken the featured products as a random one that is enabled. It's great to have this feature but it should still work the old way until the merchant chooses otherwise.

@Dirty-Butter
Copy link

I see your reasoning that you want to leave it as it was - otherwise a store owner would have an empty Featured box and not necessarily understand why.
But would it be possible to provide a checkbox on the Layout tab of Settings to set all initially to zero, so the admin could then check only the ones they want?

@abrookbanks
Copy link
Member

abrookbanks commented Sep 21, 2016

You can run a database query;

UPDATE CubeCart_inventorySETfeatured = 0;

@briansandall
Copy link
Contributor Author

briansandall commented Sep 21, 2016

You can run a database query

Perhaps this is something we can include in the release notes along with an explanation of how featured vs latest works?

And yeah, I totally agree with your decision to maintain consistency - I was just being selfish with my first implementation ;)

@Dirty-Butter
Copy link

Since I don't actually use the Featured box, it's not a problem for me - but I think providing an explanation of how Featured works in 6.1.0 would be very helpful, with the database query suggested for those who want to zero all out to begin with.
Who knows, with this new version of Featured I might go back to using it!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants