@dp.callback_query_handler(lambda c: c.data.startswith('add_'))
async def add_to_cart(call: types.CallbackQuery):
operation = call.data.split('_')[0]
current_item = int(call.data.split('_')[-1])
item = items[current_item]
prices = price[current_item]
[[key, value ]]= data.items()
print(value)
print(operation, current_item, item, prices)
cur = con.cursor()
cur.execute("UPDATE users SET user_item = items, user_price = prices WHERE user_name = value")
sqlite3.OperationalError: no such column: value(кстати такое же пишет и про item/prices)
@dp.callback_query_handler(lambda c: c.data.startswith('next_'))
async def send_next_item(call: types.CallbackQuery):
current_item = int(call.data.split('_')[-1])
operation = call.data.split('_')[0]
print(current_item,operation)
kb = InlineKeyboardMarkup(row_width=2)
next = InlineKeyboardButton(text = 'Следующий', callback_data = f'next_{current_item+1}')
previous = InlineKeyboardButton(text= 'Предыдущий',callback_data= 'previous_1')
add = InlineKeyboardButton(text= 'Добавить в корзину',callback_data= f'add_{current_item+1}')
kb.add(previous,next,add)
bac = InlineKeyboardButton(text= 'Назад',callback_data= 'bac')
kb.add(bac)
await bot.send_photo(
chat_id=call.message.chat.id,
photo=photos[current_item],
caption ='Название: '+ items[current_item] +'\n\nЦена: '+ price[current_item] + '\n\nId: '+ id[current_item],
reply_markup= kb)