VirtueMart Forum

VirtueMart General => Commercial Jobs => Topic started by: oscar.colon on October 30, 2010, 22:44:09 PM

Title: Help with quantity
Post by: oscar.colon on October 30, 2010, 22:44:09 PM
I really need helps with an issue.

I need to find how to put a limit when a customer buy a item, for example:

In one categorie the customer can buy only one product of all, in the anohter category he can buy only one of each (this is simple i limited 1 to 1 in max min quantity) but i cant find where or how can i limit to one off all products in the same category.

i cant find a solution, someone can help me? Please post the cost and how can i contact.

Thank you
Title: Re: Help with quantity
Post by: John M on October 30, 2010, 23:20:25 PM
You can do it in the database under your products table column is product_order_levels  A bit of SQL to set all to 1,1

***SELECT STATEMENT TO GATHER PRODUCTS AND IDS OF CATS ASSOCIATED WITH IT
SELECT * FROM jml_vm_product_category_xref
INNER JOIN jml_vm_product ON jml_vm_product_category_xref.product_id = jml_vm_product.product_id

**SET STATEMENT TO SET THE LIMITS
UPDATE jml_vm_product
INNER JOIN jml_vm_product_category_xref ON jml_vm_product_category_xref.product_id = jml_vm_product.product_id
SET product_order_levels='1,1'
WHERE jml_vm_product_category_xref.product_id='the ID of the category you want to change'

Title: Re: Help with quantity
Post by: oscar.colon on November 01, 2010, 00:07:17 AM
Hello john M., thnaks by the answer.

I try your SQL code, and this only set 1,1 and the customer can buy 1 of all item in one category. This is not wath i want. I try to explain:

--- category 1
      base1
      base2
      base3

Here you can buy only one base1 if you try to buy another virtuemart must show "You cant buy another".

--- category 2
     add1
     add2
     add3

Here you can buy one of any product (this is fixed now, i set min and max to 1)

The problem is in the first category, i set 1,1 but you can add the 3 products to the cart, this isn't rigth.

I'm use ajax option to add products to the cart. May be its over there the solution, modify this code before close the cart. I'm not find where is this code or wath chage, i'm not a java programmer ;-).

Thank you again!

Oscar.