added checklist

This commit is contained in:
ruchi 2021-02-16 22:34:08 -05:00
parent a153b0032b
commit 7e0ac0f93b
3 changed files with 25 additions and 22 deletions

View file

@ -101,13 +101,13 @@ function getProductImg(productName) {
function restrictListProducts(prods, restriction) {
let product_names = [];
for (let i=0; i<prods.length; i+=1) {
if ((restriction == "Vegetarian") && (prods[i].vegetarian == true)){
if ((restriction === "Vegetarian") && (prods[i].vegetarian == true)){
product_names.push(prods[i].name);
}
else if ((restriction == "GlutenFree") && (prods[i].glutenFree == true)){
product_names.push(prods[i].name);
}
else if ((restriction == "VegetarianANDGluten-Free") && (prods[i].glutenFree == true) && (prods[i].vegetarian == true)){
else if ((restriction == "Vegetarian" && restriction == "GlutenFree") && (prods[i].glutenFree == true) && (prods[i].vegetarian == true)){
product_names.push(prods[i].name);
}
else if ((restriction == "Organic") && (prods[i].organic == true)){

View file

@ -63,7 +63,6 @@ function populateListProductChoices(slct1, slct2) {
// var itemPrice = getItemPrice(productName);
// label.appendChild(document.createTextNode(" $" + itemPrice));
s2.appendChild(label);
// create a breakline node and add in HTML DOM
@ -83,6 +82,7 @@ function populateListProductChoices(slct1, slct2) {
}
}
// This function is called when the "Add selected items to cart" button in clicked
// The purpose is to build the HTML to be displayed (a Paragraph)
// We build a paragraph to contain the list of selected items, and the total price