ecommerce.mainHeading('Product Categories Administration')
		
		ecommerce.subHeading('Edit Product Categories Values')

		ecommerce.formSetup("product_categories_admin","product_categories_admin","return submitForm(document.product_categories_admin)",declarations.store_info['db_name'])

		dbResult = ecommerce.connectDB(form["uHidden"].value, form["pHidden"].value,declarations.store_info['db_name'])
		
		if dbResult['status'] != 'success':
			ecommerce.alertsArea(form, "Could not connect to the database\n" + dbResult['message']);

		else:
			db = dbResult['result']

			sqlStatement = ecommerce.selectAllColumnsSqlStatement(table_data,'product_categories',form["key_id"].value,'category')

			#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])
Esempio n. 2
0
			table_data = declarations.define_tables()
			
			ecommerce.title("Order Administration")
				
			print "</HEAD>" 
				
			ecommerce.bodySetup()
				
			ecommerce.mainHeading('Order Administration')
				
			ecommerce.subHeading('Edit Order')
				
			ecommerce.formSetup("order_admin","order_admin","return submitForm(document.order_admin)",declarations.store_info['db_name'])
				
			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)
Esempio n. 3
0
                            declarations.store_info['db_name'])

        dbResult = ecommerce.connectDB(form["uHidden"].value,
                                       form["pHidden"].value,
                                       declarations.store_info['db_name'])

        if dbResult['status'] != 'success':
            ecommerce.alertsArea(
                form,
                "Could not connect to the database\n" + dbResult['message'])

        else:
            db = dbResult['result']

            sqlStatement = ecommerce.selectAllColumnsSqlStatement(
                table_data, 'sales_tax_by_state', form["key_id"].value,
                'state_abbreviation')

            #print sqlStatement

            dbResult = ecommerce.executeSQL(db, sqlStatement)

            if dbResult['status'] != 'success':

                ecommerce.alertsArea(
                    form, "Could not retrieve sales tax data to edit\n" +
                    dbResult['message'])

            else:

                result = dbResult['result']
		ecommerce.mainHeading('Order Status Administration')
		
		ecommerce.subHeading('Edit Order Statuss')

		ecommerce.formSetup("order_status_values_admin","order_status_values_admin","return submitForm(document.order_status_values_admin)",declarations.store_info['db_name'])

		dbResult = ecommerce.connectDB(form["uHidden"].value, form["pHidden"].value,declarations.store_info['db_name'])
		
		if dbResult['status'] != 'success':
			ecommerce.alertsArea(form, "Could not connect to the database\n" + dbResult['message']);

		else:
			db = dbResult['result']

			sqlStatement = ecommerce.selectAllColumnsSqlStatement(table_data,'order_status_values',form["key_id"].value,'status_of_order')

			#print sqlStatement

			dbResult = ecommerce.executeSQL(db, sqlStatement)

			if dbResult['status'] != 'success':

				ecommerce.alertsArea(form, "Could not retrieve order status values to edit\n" + dbResult['message']);

			else:

				result = dbResult['result']

				table_data = ecommerce.dbToTableData(table_data, 'order_status_values', result[0])
Esempio n. 5
0
    dbResult = ecommerce.connectDB(declarations.store_info['browser_username'],
                                   declarations.store_info['browser_password'],
                                   declarations.store_info['db_name'])

    if dbResult['status'] != 'success':

        print '<HTML><HEAD><TITLE>ERROR: Can not connect to db.</TITLE><BODY>'
        print 'Can not connect to database.'
        print '</BODY></HTML>'
        sys.exit(1)

    else:

        db = dbResult['result']

        sqlStatement = ecommerce.selectAllColumnsSqlStatement(
            table_data, 'store_info', '1')

        dbResult = ecommerce.executeSQL(db, sqlStatement)

        if dbResult['status'] != 'success':

            email = '*****@*****.**'

        else:

            result = dbResult['result']

            table_data = ecommerce.dbToTableData(table_data, 'store_info',
                                                 result[0])

            email = table_data['store_info']['email']['value']
		ecommerce.mainHeading('Shipping Methods Administration')
		
		ecommerce.subHeading('Edit Shipping Methods')

		ecommerce.formSetup("shipping_methods_admin","shipping_methods_admin","return submitForm(document.shipping_methods_admin)",declarations.store_info['db_name'])

		dbResult = ecommerce.connectDB(form["uHidden"].value, form["pHidden"].value,declarations.store_info['db_name'])
		
		if dbResult['status'] != 'success':
			ecommerce.alertsArea(form, "Could not connect to the database\n" + dbResult['message']);

		else:
			db = dbResult['result']

			sqlStatement = ecommerce.selectAllColumnsSqlStatement(table_data,'shipping_methods',form["key_id"].value,'method')

			#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])
Esempio n. 7
0
		ecommerce.mainHeading('Payment Method Administration')
		
		ecommerce.subHeading('Edit Payment Methods')

		ecommerce.formSetup("payment_methods_admin","payment_methods_admin","return submitForm(document.payment_methods_admin)",declarations.store_info['db_name'])

		dbResult = ecommerce.connectDB(form["uHidden"].value, form["pHidden"].value,declarations.store_info['db_name'])
		
		if dbResult['status'] != 'success':
			ecommerce.alertsArea(form, "Could not connect to the database\n" + dbResult['message']);

		else:
			db = dbResult['result']

			sqlStatement = ecommerce.selectAllColumnsSqlStatement(table_data,'payment_methods',form["key_id"].value,'payment_type')

			#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])
Esempio n. 8
0
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
        }