#print sqlStatement dbResult = ecommerce.executeSQL(db, sqlStatement) if dbResult['status'] != 'success': ecommerce.alertsArea(form, "Could not retrieve category values to edit\n" + dbResult['message']); else: result = dbResult['result'] table_data = ecommerce.dbToTableData(table_data, 'product_categories', result[0]) ecommerce.display_form(table_data, 'product_categories', 1, 'useValues', 1, db) ecommerce.alertsArea(form, "Product Categoriess retrieved successfully"); ecommerce.editFunctionButtons(form["key_id"].value, '/' + declarations.store_info['db_name'] + '-cgi-bin/product_categories_admin.pyc?username='******'&password='******'&performDbQuery=1', declarations.store_info['help_file']) ecommerce.editHiddenFields(form["uHidden"].value, form["pHidden"].value) print "</FORM>" ecommerce.trailer(table_data, db) db.close() print "</BODY>"
sqlStatement = ecommerce.selectAllColumnsSqlStatement(table_data,'orders',form["key_id"].value) dbResult = ecommerce.executeSQL(db, sqlStatement) if dbResult['status'] != 'success': ecommerce.alertsArea(form, "Could not retrieve order data to edit\n" + dbResult['message']) else: result = dbResult['result'] table_data = ecommerce.dbToTableData(table_data, 'orders', result[0]) ecommerce.display_form(table_data, 'orders', 1, 'useValues', 1, db) dbResult = ecommerce.executeSQL(db, "SELECT line_item, order_id, product_id, quantity, quantity_shipped, price, line_subtotal FROM order_items WHERE order_id = '" + form['key_id'].value + "'") if dbResult['status'] != 'success': ecommerce.alertsArea(form, "Could not retrieve order data to edit\n" + dbResult['message']) else: print '<HR>' ecommerce.printText('Items In Order') print '<TABLE BORDER=1>' print '<TR><TH>Line Item</TH><TH>Code</TH><TH>Quantity</TH><TH>Shipped</TH><TH>Description</TH><TH>Price</TH><TH>Extension</TH><TH>Message</TH><TH>Functions</TH></TR>' result = dbResult['result']
if dbResult['status'] != 'success': ecommerce.alertsArea( form, "Could not retrieve sales tax data to edit\n" + dbResult['message']) else: result = dbResult['result'] table_data = ecommerce.dbToTableData(table_data, 'sales_tax_by_state', result[0]) ecommerce.display_form(table_data, 'sales_tax_by_state', 1, 'useValues', 1, db) ecommerce.alertsArea(form, "Sales tax data retrieved successfully") ecommerce.editFunctionButtons( form["key_id"].value, '/' + declarations.store_info['db_name'] + '-cgi-bin/sales_tax_admin.pyc?username='******'&password='******'&performDbQuery=1', declarations.store_info['help_file']) ecommerce.editHiddenFields(form["uHidden"].value, form["pHidden"].value) print "</FORM>"
#print sqlStatement dbResult = ecommerce.executeSQL(db, sqlStatement) if dbResult['status'] != 'success': ecommerce.alertsArea(form, "Could not retrieve Payment Methods to edit\n" + dbResult['message']); else: result = dbResult['result'] table_data = ecommerce.dbToTableData(table_data, 'payment_methods', result[0]) ecommerce.display_form(table_data, 'payment_methods', 1, 'useValues', 1, db) ecommerce.alertsArea(form, "Payment Methods retrieved successfully"); ecommerce.editFunctionButtons(form["key_id"].value, '/' + declarations.store_info['db_name'] + '-cgi-bin/payment_methods_admin.pyc?username='******'&password='******'&performDbQuery=1', declarations.store_info['help_file']) ecommerce.editHiddenFields(form["uHidden"].value, form["pHidden"].value) print "</FORM>" ecommerce.trailer(table_data, db) # close db db.close()
#print sqlStatement dbResult = ecommerce.executeSQL(db, sqlStatement) if dbResult['status'] != 'success': ecommerce.alertsArea(form, "Could not retrieve shipping methods to edit\n" + dbResult['message']); else: result = dbResult['result'] table_data = ecommerce.dbToTableData(table_data, 'shipping_methods', result[0]) ecommerce.display_form(table_data, 'shipping_methods', 1, 'useValues', 1, db) ecommerce.alertsArea(form, "Shipping Methodss retrieved successfully"); ecommerce.editFunctionButtons(form["key_id"].value, '/' + declarations.store_info['db_name'] + '-cgi-bin/shipping_methods_admin.pyc?username='******'&password='******'&performDbQuery=1', declarations.store_info['help_file']) ecommerce.editHiddenFields(form["uHidden"].value, form["pHidden"].value) print "</FORM>" ecommerce.trailer(table_data, db) db.close() print "</BODY>" print "</HTML>"
dbResult = ecommerce.executeSQL(db, sqlStatement) if dbResult['status'] != 'success': ecommerce.alertsArea( form, "Could not retrieve product data to edit\n" + dbResult['message']) else: result = dbResult['result'] table_data = ecommerce.dbToTableData(table_data, 'products', result[0]) ecommerce.display_form(table_data, 'products', 1, 'useValues', 1, db) ecommerce.alertsArea(form, "Product data retrieved successfully") ecommerce.editFunctionButtons( form["key_id"].value, '/' + declarations.store_info['db_name'] + '-cgi-bin/product_admin.pyc?username='******'&password='******'&performDbQuery=1', declarations.store_info['help_file']) ecommerce.editHiddenFields(form["uHidden"].value, form["pHidden"].value) print "</FORM>"
sqlStatement = ecommerce.selectAllColumnsSqlStatement(table_data,'market_status_values',form["key_id"].value,'status_of_market') dbResult = ecommerce.executeSQL(db, sqlStatement) if dbResult['status'] != 'success': ecommerce.alertsArea(form, "Could not retrieve market status values to edit\n" + dbResult['message']); else: result = dbResult['result'] table_data = ecommerce.dbToTableData(table_data, 'market_status_values', result[0]) ecommerce.display_form(table_data, 'market_status_values', 1, 'useValues', 1, db) ecommerce.alertsArea(form, "Market Statuses retrieved successfully"); ecommerce.editFunctionButtons(form["key_id"].value, '/' + declarations.store_info['db_name'] + '-cgi-bin/market_status_values_admin.pyc?username='******'&password='******'&performDbQuery=1', declarations.store_info['help_file']) ecommerce.editHiddenFields(form["uHidden"].value, form["pHidden"].value) print "</FORM>" ecommerce.trailer(table_data, db) # close db db.close() print "</BODY>"
dbResult = ecommerce.executeSQL(db, sqlStatement) if dbResult['status'] != 'success': ecommerce.alertsArea( form, "Could not retrieve property data to edit\n" + dbResult['message']) else: result = dbResult['result'] table_data = ecommerce.dbToTableData(table_data, 'properties', result[0]) ecommerce.display_form(table_data, 'properties', 1, 'useValues', 1, db) ecommerce.alertsArea(form, "Property data retrieved successfully") ecommerce.editFunctionButtons( form["key_id"].value, '/' + declarations.store_info['db_name'] + '-cgi-bin/property_admin.pyc?username='******'&password='******'&performDbQuery=1', declarations.store_info['help_file']) ecommerce.editHiddenFields(form["uHidden"].value, form["pHidden"].value) print "</FORM>"
def edit_store_info(performDbQuery=0, onLoad=None, queryFields=None): table_data = declarations.define_tables() print "<HTML>" print "<HEAD>" ecommerce.javaScript("store_admin", 1) ecommerce.title("Store Administration") print "</HEAD>" ecommerce.bodySetup(onLoad) ecommerce.mainHeading('Store Administration') ecommerce.subHeading('Store Info') ecommerce.formSetup("store_admin", "store_admin", "return submitForm(document.store_admin)", declarations.store_info['db_name']) if form.has_key("username"): username = form["username"].value else: if form.has_key("uHidden"): username = form["uHidden"].value else: username = '' if form.has_key("password"): password = form["password"].value else: if form.has_key("pHidden"): password = form["pHidden"].value else: password = '' ecommerce.usernamePasswordDisplay(username, password) if form.has_key("performDbQuery") or performDbQuery == 1: dbResult = ecommerce.connectDB(username, password, declarations.store_info['db_name']) # could not connect to db if dbResult['status'] != 'success': ecommerce.alertsArea( form, "Can not connect to database,\n" + dbResult['message']) # connected to db storeButtons() else: db = dbResult['result'] sqlStatement = ecommerce.selectAllColumnsSqlStatement( table_data, 'store_info', form["key_id"].value) dbResult = ecommerce.executeSQL(db, sqlStatement) if dbResult['status'] != 'success': ecommerce.alertsArea( form, "Could not retrieve store information\n" + dbResult['message']) else: result = dbResult['result'] table_data = ecommerce.dbToTableData(table_data, 'store_info', result[0]) ecommerce.table_data['store_info']['id']['value'] = '1' ecommerce.display_form(table_data, 'store_info', 1, 'useValues', 1, db) ecommerce.alertsArea( form, "Store Information retrieved successfully") storeButtons(button_name='save') ecommerce.editHiddenFields(form["uHidden"].value, form["pHidden"].value) else: storeButtons(button_name='edit') ecommerce.editHiddenFields(username, password, '1') print "</FORM>" try: ecommerce.trailer(table_data, db) db.close() except NameError: pass print "</BODY>" print "</HTML>" if form.has_key("performDbQuery") or performDbQuery == 1: return dbResult else: return { 'status': 'success', 'message': 'query successful', 'result': 0 }
if dbResult['status'] != 'success': ecommerce.alertsArea( form, "Could not retrieve store info to edit\n" + dbResult['message']) else: result = dbResult['result'] table_data = ecommerce.dbToTableData(table_data, 'store_info', result[0]) table_data['store_info']['id']['value'] = '1' ecommerce.display_form(table_data, 'store_info', 1, 'useValues', 1, db) ecommerce.alertsArea(form, "Store Info retrieved successfully") storeButtons('save') ecommerce.editHiddenFields(form["uHidden"].value, form["pHidden"].value) print "</FORM>" ecommerce.trailer(table_data, db) db.close() print "</BODY>" print "</HTML>"