Esempio n. 1
0
def list_items_in_checkoutcart(cart):
    cprint("\n Items in cart : \n", 'red', 'on_white')
    items = cart.items
    for item in items:
        dynamodb_service.get_item_from_dynamodb(item)
        # print (item)
    if len(cart.saveditems):
        for saveditem in cart.saveditems:
            dynamodb_service.get_item_from_dynamodb(saveditem[0])
Esempio n. 2
0
 def retrieve_saved_items(self):
     with self.conx as cursor:
         savedcart_items = "select ci.sku from cartitems ci join cart c on c.cartid = ci.cartid where c.ordered = 0 and c.username = %(usrnm)s"
         itemcount = cursor.execute(savedcart_items, {'usrnm': self.user})
         if itemcount:
             items = cursor.fetchall()
             self.saveditems = items
             cprint('products in the cart', 'red', 'on_white')
             for item in items:
                 dynamodb_service.get_item_from_dynamodb(item[0])
         else:
             self.saveditems = ()
         cursor.close()
Esempio n. 3
0
def get_complete_history(username):
    conx = awsdbconnect.connecttodb()
    conx1 = awsdbconnect.connecttodb()
    with conx as cursor:
        sql = "select cartid from cart where username = %s and ordered = 1"
        rowcount = cursor.execute(sql, username)
        for item in cursor:
            print("\n Items in order no : %s") % item[0]
            with conx1 as cursor1:
                sql1 = "select sku from cartitems where cartid = %s"
                skucount = cursor1.execute(sql1, item[0])
                for sku in cursor1:
                    dynamodb_service.get_item_from_dynamodb(sku[0])
            cursor1.close()
        cursor.close()
Esempio n. 4
0
def get_recent_order(username):
    conx = awsdbconnect.connecttodb()
    conx1 = awsdbconnect.connecttodb()
    with conx as cursor:
        sql = "select max(cartid) from cart where username = %s and ordered = 1"
        rowcount = cursor.execute(sql, username)
        for item in cursor:
            print('\n Items in recent order ')  #%(str(item[0]))
            with conx1 as cursor1:
                sql1 = "select sku from cartitems where cartid = %s"
                skucount = cursor1.execute(sql1, item[0])
                for sku in cursor1:
                    dynamodb_service.get_item_from_dynamodb(sku[0])
            cursor1.close()
        cursor.close()
Esempio n. 5
0
def review_purchase_history(conx, username):
    with conx as cursor:
        sql = "select cartid from cart where username = %(usrnm)s and ordered = 1 order by dts desc;"
        cursor.execute(sql, {'usrnm': username})
        recentorder = cursor.fetchone()
    cursor.close()
    if recentorder is not None:
        with conx as cursor:
            sql = "select sku from cartitems where cartid = %s"
            cursor.execute(sql, recentorder)
            cprint("\n recently purchased products : \n", 'red', 'on_white')
            for item in cursor:
                # print(item)
                dynamodb_service.get_item_from_dynamodb(item[0])
        cursor.close()