4th Commit
This commit is contained in:
parent
6a1e0155b1
commit
71bd264cb2
28
src/a3.nim
28
src/a3.nim
@ -121,6 +121,8 @@ import
|
||||
db3 = newDatabase3()
|
||||
db1 = newDatabase1()
|
||||
|
||||
products: seq[Products]
|
||||
|
||||
try:
|
||||
email = ctx.cookies["email"]
|
||||
password = ctx.cookies["password"]
|
||||
@ -132,7 +134,6 @@ import
|
||||
var
|
||||
userId = db2.getUserId(email, password)
|
||||
cart = db3.getUserCart(userId)
|
||||
products: seq[Products]
|
||||
|
||||
for c, d in cart:
|
||||
var product = db1.getProductById(d.productId)
|
||||
@ -150,6 +151,7 @@ import
|
||||
db1 = newDatabase1()
|
||||
|
||||
availableProducts = db1.availableProducts()
|
||||
products: seq[Products]
|
||||
|
||||
try:
|
||||
email = ctx.cookies["email"]
|
||||
@ -162,7 +164,6 @@ import
|
||||
var
|
||||
userId = db2.getUserId(email, password)
|
||||
cart = db3.getUserCart(userId)
|
||||
products: seq[Products]
|
||||
|
||||
for c, d in cart:
|
||||
var product = db1.getProductById(d.productId)
|
||||
@ -171,13 +172,36 @@ import
|
||||
compileTemplateFile(getScriptDir() / "a3a" / "shop.nimja")
|
||||
|
||||
"/shop-single" -> get:
|
||||
|
||||
var
|
||||
email: string
|
||||
password: string
|
||||
db2 = newDatabase2()
|
||||
db3 = newDatabase3()
|
||||
db1 = newDatabase1()
|
||||
|
||||
productName = ctx.queryParams["prod"]
|
||||
|
||||
product = db1.getProduct(productName)
|
||||
|
||||
products: seq[Products]
|
||||
|
||||
try:
|
||||
email = ctx.cookies["email"]
|
||||
password = ctx.cookies["password"]
|
||||
except:
|
||||
email = ""
|
||||
password = ""
|
||||
|
||||
if email != "" and password != "":
|
||||
var
|
||||
userId = db2.getUserId(email, password)
|
||||
cart = db3.getUserCart(userId)
|
||||
|
||||
for c, d in cart:
|
||||
var product1 = db1.getProductById(d.productId)
|
||||
products.add(product1)
|
||||
|
||||
compileTemplateFile(getScriptDir() / "a3a" / "shop-single.nimja")
|
||||
|
||||
"/thankyou" -> get:
|
||||
|
@ -30,7 +30,9 @@
|
||||
<li>
|
||||
<a href="/cart" class="site-cart">
|
||||
<span class="icon icon-shopping_cart"></span>
|
||||
<span class="count">2</span>
|
||||
{% if products.len > 0 %}
|
||||
<span class="count">{{products.len}}</span>
|
||||
{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
<li class="d-inline-block d-md-none ml-md-0"><a href="#" class="site-menu-toggle js-menu-toggle"><span class="icon-menu"></span></a></li>
|
||||
@ -151,4 +153,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@ -30,7 +30,9 @@
|
||||
<li>
|
||||
<a href="/cart" class="site-cart">
|
||||
<span class="icon icon-shopping_cart"></span>
|
||||
<span class="count">2</span>
|
||||
{% if products.len > 0 %}
|
||||
<span class="count">{{products.len}}</span>
|
||||
{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
<li class="d-inline-block d-md-none ml-md-0"><a href="#" class="site-menu-toggle js-menu-toggle"><span class="icon-menu"></span></a></li>
|
||||
@ -182,4 +184,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
@ -30,7 +30,9 @@
|
||||
<li>
|
||||
<a href="/cart" class="site-cart">
|
||||
<span class="icon icon-shopping_cart"></span>
|
||||
<span class="count">2</span>
|
||||
{% if products.len > 0 %}
|
||||
<span class="count">{{products.len}}</span>
|
||||
{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
<li class="d-inline-block d-md-none ml-md-0"><a href="#" class="site-menu-toggle js-menu-toggle"><span class="icon-menu"></span></a></li>
|
||||
|
Loading…
Reference in New Issue
Block a user