Skip to content

Commit

Permalink
Merge pull request #111 from kumpeapps/PreProd
Browse files Browse the repository at this point in the history
added coming soon for products
  • Loading branch information
justinkumpe authored Nov 22, 2024
2 parents 8f2352c + 4d73eca commit 8aa2883
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions js/shop.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,21 @@ function buildProducts() {
const img = document.createElement("img");
img.setAttribute("src", element.default_photo);
const imgLink = document.createElement("a");
imgLink.setAttribute("href", "product?sku=" + element.sku);
if (element.is_coming_soon) {

} else {
imgLink.setAttribute("href", "product?sku=" + element.sku);
}
const content = document.createElement("class");
content.setAttribute("class", "dz-content");
const title = document.createElement("h5");
title.setAttribute("class", "title");
const titleLink = document.createElement("a");
titleLink.setAttribute("href", "product?sku=" + element.sku);
if (element.is_coming_soon) {

} else {
titleLink.setAttribute("href", "product?sku=" + element.sku);
}
titleLink.innerHTML = element.title;
title.appendChild(titleLink);
const priceLabel = document.createElement("h6");
Expand All @@ -65,16 +73,24 @@ function buildProducts() {
const newTag = document.createElement("div");
newTag.setAttribute("class", "ribbon ribbon-top-right");
const newSpan = document.createElement("span");
newSpan.setAttribute("class", "badge badge-success");
newSpan.innerHTML = "NEW";
if (element.is_coming_soon) {
newSpan.setAttribute("class", "badge badge-warning");
newSpan.innerHTML = "Coming Soon";
} else {
newSpan.setAttribute("class", "badge badge-success");
newSpan.innerHTML = "NEW";
}
newTag.appendChild(newSpan);
onSaleTag.appendChild(onSaleSpan);
if (element.is_on_sale) {
priceLabel.innerHTML = "<del>$" + element.original_price + "</del> $" + element.price;
} else {
priceLabel.innerHTML = "$" + element.price;
}
if (element.is_new) {

if (element.is_coming_soon) {
card.appendChild(newTag);
} else if (element.is_new) {
card.appendChild(newTag);
}
content.appendChild(title);
Expand All @@ -88,6 +104,8 @@ function buildProducts() {
}
if (element.is_new) {
card.appendChild(newTag);
} else if (element.is_coming_soon) {
card.appendChild(newTag);
}
return card
}
Expand Down

0 comments on commit 8aa2883

Please sign in to comment.