Product Quantity in configure product page whmcs - configuration

Is there any way to add a field to enter the quantity of the product in configureproduct.tpl file ? Like the one in Cart page ? And I need the same using ajax. The Quantity provided in this new field should be updated in the cart page also.
Thanks

Check Configurable Option in WHMCS, there is quantity field.
Open Configurable Options, from Setup > Products/Services.
Add group for the product (Group of fields).
Assign products to have this group of Configurable Options.
Add Configurable Option and select type as Quantity.

Related

How to enter a value in a text box controlled with a Dlookup in MS Access

I have a Form the fields are UPC, PurDate and Price.
The Price is controlled by a Dlookup to get the most recent price from the Price Table. It works by the user scanning the barcode of the product that fills the UPC field and the Price is automatically filled. This works good so far.
The problem is that some products do not have barcodes so I want to be able to manually fill the price for that item. Is there anyway to 'override' the Dlookup function or use some vba code to fill the Price field with user input?
Or maybe setup a UPC code eg. 0001 and when that code is selected the user can enter a price?
A control with an expression in ControlSource does not allow edit by user. Instead, use code (macro or VBA) to lookup price and populate field. Bind textbox to field. Now user can type over value retrieved. The real trick is figuring out what event to put code into.

MS-Access - DLookup using values entered on form

I am a complete novice with no experience of building a database. I have been following a few online tutorials to help with a little project I want to work on.
Here is a pic of my current table relationships:
I have a form where I want to enter invoice details. I want to be able to select a product from a drop-down and for it to automatically populate a text box with the cost. The problem i have is, depending on the customer, the cost can be different.
Here is a pic of my form:
I have tried using DLookUp in the Unit Price field but i just can't seem to get the hang of it.
Basically, in pseudo code, i want the unit price field to:
Select From tblPrices Where PriceID =
I've tried:
=DLookUp([Product],"tblPrices","PriceID = " & [Forms]![tblInvoice]![SalesTypeID])
but it is returning the ID of the selected from product in the form from the Products table ?!

MS ACCESS - Adding items to Lookup Tables from a Master Query

A seemingly simple question that has me stumped.
I have a table [Inventory] with the following fields: [Category], [ItemName], [Price].
ex: "Plumbing", "ACME Showerhead", $43
I have a table [Categories] with the fields [Category], [SubCategory]
ex. "Plumbing", "Hardware" or
ex. "Flooring", "Wood"
I wish to have a form (ideally a standard grid) that allows me to enter new Inventory Records.
On this form would be the fields Inventory.Category, Categories.SubCategory, ItemName, Price.
When navigating to the field Inventory.Category, a drop down should allow me to select from Unique Categories.Category values. Once selected, the Subcategory field should allow me to select from valid subcategories of that Categories.Category. For example, if I chose "Plumbing" in the category field, I would only be presented with teh subcategory "Hardware" and not the subcategory "Wood".
I would also like the ability to add new Category Records while in this form, so I am not limited to whats in the dropdown. So for example, when adding a record to Inventory, if I want to create a new Category/SubCategory pair of say, "Plumbing", "Pipes", I should be able to do that without having to switch to another form/table or whatever.

How to update a field with information from a table based on another fields option

I'm building a database using Access 2007. I don't have a lot of experience with Access, and I'm not sure how to accomplish this task.
I've built an entry form, and have a field called "Product" which is a drop down that pulls the information from the Product table. The Product table is set up like this:
Product Name Commodity
--------------------------------------------
Product #1 Soybean
Product #2 Soybean Meal
Product #3 Corn
I have another field in the form called "HTS Commodity" which is a drop down that pulls the information from the HTSUS table. This field is locked, and I would like the value to be automatically updated once someone selects a Product from the Product field. Here's the HTSUS table:
Commodity HTSUS Value
--------------------------------------------
Soybean 1.1.1
Soybean Meal 2.2.2
Corn 3.3.3
When a person selects an item in the "Products" field, it shows the Product Name. Once they select the item, I'd like the field "HTS Commodity" to auto update based on the Commodity column from the tables, but display the HTSUS Value column.
Product: Product #2 (Soybean Meal)
HTS Commodity: 2.2.2 (Soybean Meal)
I hope this makes sense. I understand how to create Macro's using the different builders, but I'm just not sure how to accomplish this. I've been attempting to use an AfterUpdate() macro. Thanks for any help in advance.
Here is one way to do it:
Start by creating a saved query named HTSUS_by_Product whose SQL code is
SELECT Product.[Product Name], HTSUS.[HTSTS Value]
FROM Product INNER JOIN HTSUS ON Product.Commodity = HTSUS.Commodity;
It will produce results like this
Product Name HTSUS Value
------------ -----------
Product #1 1.1.1
Product #2 2.2.2
Product #3 3.3.3
Now, on your Form let's assume that you have a combo box named cbxProductName that gets its values from the [Product Name] field in the [Product] table. When you choose "Product #1" from the list then cbxProductName.Text will be "Product #1".
Now create a text box on the form and name it txtHtsus. Set its Locked property to Yes, and enter the following as its Control Source property:
=DLookUp("[HTSUS Value]","HTSUS_by_Product","[Product Name]=""" & [cbxProductName].[Text] & """")
Now, in the After Update event for the cbxProductName combo box control, click the ellipsis button [...], choose "Code Builder", then add a .Requery statement to the cbxProductName_AfterUpdate() procedure, like this
Private Sub cbxProductName_AfterUpdate()
Me.txtHtsus.Requery
End Sub
Give that a try and see if it works for you.
You need to use my favorite: dlookup
http://allenbrowne.com/casu-07.html

Selecting data from a table and auto-filling fields

I'm working on a small little project, at the moment just a test for a larger project, but I've hit a block that I can't find a solution too.
I have a list of items in a table, and they contain information such as the item name and the price. I have another table with sales. I have a form that will allow you to select a item name, however, then I would like the rest of the form to be auto-filled with information from the items table.
I can make a message box appear when the item name field has been changed, however, through my searching, I am unable to find a way to search the items table for the value of the field, then read the price value, then insert the price value into a field in this form.
First table "items":
itemname: text
price: currency
Second Table "sales":
itemname: text
price: currency
date: time/date
I hope I have explained myself well enough, if not, just ask and I will try to clarify.
Have a look at the Northwind datatabase (northwind.mdb) that ships with Access. They have several examples of how to update a form based upon a combobox changing values.
Also, you might want to look at the table design in the Northwind Database as well. Generally speaking, it is a bad idea to use the product name as the key field in both of your tables. What will happen (and it will eventually) is that the product name is going to change for one of the products and you'll have to update all of the tables that reference that product name.
The better design is to use a key field (I'd recommend an AutonumberField) in your products table and then reference the key field in the sales table. This way, if the product name changes you only have to make the change in one location, not many.
Here's a sample table layout to illustrate my point:
Table Items:
ItemID (Autonumber - Primary Key on the table)
ItemName (Text - Name of product)
Price (Currency)
Table: Sales
ItemID (Integer - Foreign Key to Items.ItemID)
Quantity (Integer - # of units ordered)
Price (Currency)
OrderDate (Date/Time)
Most answers here are posting way too much code and all kinds of SQL statements. As such, these answers are creating world poverty.
The most simple approach is to let the wizard build a combo box on your form to select a given item. This combo box will thus based on the items table. The first column of the combo box will be the PK (autonumber ID) of the items table. This combo box will thus be bound to the ItemID column in sales. The wizard will also “hide” the id, but you WANT to include the other columns in this combo box such as price etc. And you likely should have the 2nd column of this combo box the description of the item from the item table. As noted, you ALSO want to include the price column.
Thus, after you select a item, then to have auto matic fill out the price column, use this code:
This code goes in the AFTER update event of the item combo box:
Me.Price = me.ItemComboBox.column(2)
So when you select a item, the price field will to auto filled for you. And note how you only had to write one line of code.
So all of this can be done using built in wizards and one line of code.
Add an event procedure (code builder) to the dropdown box's onchange event. Right click the dropdown in design view and choose properties. then on the event tab in the properties window click in the on change line and click the '...' button.
In the code for this event you'll need to query the DB (using the dropdown box's index or ID field) to pull the items details into a recordset. The query would look somethign like
"SELECT * FROM Items WHERE ItemID = " & dropdownboxname.value
theres plenty of examples of how to do this on the web
Then you can update the various textboxes in the form with the required fields in the recordset. again theres plenty of examples of this on the web
EDIT:in response to comments below
you'll need to do somethign along the lines of...
Dim rsItems AS DAO.Recordset
Set rsItems = CurrentDB.OpenRecordset("SELECT * FROM Items WHERE ItemID = " & dropdownboxname.value)
If not rsItems.EOF Then
textbox1.text = rsItems![fieldname1]
textbox2.text = rsItems![fieldname2]
end if
Set rsItems = nothing
let me know if thats any help ;-)