Skip to content
This repository has been archived by the owner on Jun 13, 2019. It is now read-only.

#152109473 validate new product #9

Merged
merged 1 commit into from
Nov 2, 2017

Conversation

aimeedyki
Copy link
Contributor

What does this PR do?

Does not allow blank products to be saved or added to cart

Description of Task to be completed?

Ensure product title, vendor, and description fields are validated and the product grid does not display blank products.

How should this be manually tested?

As a logged in admin go to the add product page and try to add a blank product

Any background context you want to provide?

blank products were saved and displayed on the product grid and added to cart.

What are the relevant pivotal tracker stories?`

https://www.pivotaltracker.com/story/show/152109473

Screenshots (if appropriate)

screen shot 2017-10-30 at 7 17 48 pm

]
}
]
}, { fields: { _id: 1 } });
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can do a .distinct('_id') instead of a separate const blankProductsId = blankProducts.map(products => products._id); Can you give that a shot ans see how it goes?
Docs here: https://docs.mongodb.com/manual/reference/method/db.collection.distinct/

@@ -15,6 +15,7 @@ Template.productGrid.onCreated(function () {
});

Template.productGrid.onRendered(function () {
Meteor.call("products/removeBlankProducts");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like you're deleting the products when rendering the page, uh?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. the way reaction commerce is structured. it creates the product Id immediately you click the add product button. when you enter the changes in the field it updates the products.
So, I delete the blank products from the product grid.

@aimeedyki aimeedyki force-pushed the bug/152109473/no-blank-products-in-cart branch from 909de04 to 0be7170 Compare October 31, 2017 13:47
- validate product title, vendor and description fields
- remove blank products from product grid
[finishes #152109473]

make subtitle field required

make variant price compulsory
@aimeedyki aimeedyki force-pushed the bug/152109473/no-blank-products-in-cart branch from 0be7170 to a10ba22 Compare November 1, 2017 13:27
@femisenjobi femisenjobi merged commit 0c36b04 into development Nov 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants