LuisMP Posted August 19, 2016 Share Posted August 19, 2016 HelloI work in a company that wants the following caracteristics on their webshop:Suppose that there are 10 itens to sell. Each costumer in each year can only by 1 item of each product.He can by, for an year, item1,item2,item3...item10, but he cannot by, for exemple, item2 two times in the same year.When the year ends, everything resets and starts over.This is because this group of costumers has very special prices, so the restrition.Can you help please?Best Regards Luis Link to comment Share on other sites More sharing options...
sandipchandela Posted August 19, 2016 Share Posted August 19, 2016 Strange requirement. Yet acceptable. I like it. May be try with customer group with catalogue rules. Link to comment Share on other sites More sharing options...
LuisMP Posted August 19, 2016 Author Share Posted August 19, 2016 Can´t figure out how to do this. Already tried with groups and rules, can´t make it happen. This is really important for us...any help is welcome:) Thanks Link to comment Share on other sites More sharing options...
sandipchandela Posted August 20, 2016 Share Posted August 20, 2016 prestashop doesn't allow restriction on product selling on its quantity. need to fully customize feature. Although you can achieve by overriding cart controller and add conditions in add and update methods of Cart class. Quick - Override Cart class - Add and update method of Cart.php, put own logic in to check whether customer is eligible or not ? - If eligible then grant customer to add item to cart otherwise throw error or something . try vekia page https://mypresta.eu/en/art/developer/prestashop-hook-list.html Link to comment Share on other sites More sharing options...
vekia Posted August 20, 2016 Share Posted August 20, 2016 i've got maximum product quantity module that works similar to this, i think that development of option to allow product only one time per year will be very easy Link to comment Share on other sites More sharing options...
LuisMP Posted August 22, 2016 Author Share Posted August 22, 2016 Ok I tried this: Created a column in DB in ps_customer called "article_a" In this field I put "1" if customer can by the article, "0" if not. Now the bad parte is the code... I´m thinking of something like... get product reference (lets make this reference also "article_a") check if column named "article_a" has a 0 or 1 in customer DB If it has a 0 give error. I really don´t know how to program is php code, so go get a wishy befores reading the code below. Drink afterwards in a row:) $a=$this->reference (get the product reference) If ($this->->context->product->$a==0) (get value from column with the same name as reference, if it equals 0...) {$this->errors[] = Tools::displayError('Resuktou!!', !Tools::getValue('ajax')); } I know, it´s dreadfull... My questions are: how to get the value of reference of product? how to get value of new column in customer DB ith the same name as reference? Sorry, I have some notions of old code but this is all to me... Best regards! Luis Link to comment Share on other sites More sharing options...
LuisMP Posted August 22, 2016 Author Share Posted August 22, 2016 oh by the way vekia, if you are thinking to implemente this here are some suggestions: Ability the quantity each client can by per item. It could be one or two or whatever. Ability to edit that quantity. For exemple now I want to let the cliente get one more item, I go there and change 0 to 1. Best regards Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now