kazkas Posted May 10, 2010 Share Posted May 10, 2010 Hi,I'm developing a shop, I'll sell unique posters and want to add Framing option to each of them, with additional charge for every framed poster (if customer choose framing option).I tried to do that with attributes, works fine, but quantity is wrong now - presta thinks I have 1 framed version and 1 unframed version of product, which is not correct :/ Any ideas how to solve that? Link to comment Share on other sites More sharing options...
tomerg3 Posted May 10, 2010 Share Posted May 10, 2010 I have a client with the same issue, I have modified the code for him so when you purchase an item with attributes, the quantity for all the attributes goes down.I think I posted the code here somewhere, try searching for it, I will try to find it later if you cannot. Link to comment Share on other sites More sharing options...
kazkas Posted May 11, 2010 Author Share Posted May 11, 2010 But even then, customer could both versions of product in his cart before checkout? Link to comment Share on other sites More sharing options...
kazkas Posted May 11, 2010 Author Share Posted May 11, 2010 Yes, I fixed Product.php as per post, but still customer is able to add both versions of unique product to his cart before buying any of them :/ Link to comment Share on other sites More sharing options...
tomerg3 Posted May 11, 2010 Share Posted May 11, 2010 You mean the same product with two different frames?Is a customer limited to buying only 1 product? Link to comment Share on other sites More sharing options...
kazkas Posted May 11, 2010 Author Share Posted May 11, 2010 well, the items are unique, so in theory he can buy either framed OR unframed version of the item (because there is only 1 copy of item). But Presta (even with your solution) still thinks, that there is one framed AND one unframed version of item. Your fix fixes the problem fixing quantity after customer buys the product (which is great), but he still can add to basket both versions of item before paying for them :/ Link to comment Share on other sites More sharing options...
tomerg3 Posted May 11, 2010 Share Posted May 11, 2010 so you set the quantity of the product to 1, and presta adds more for each attribute? Link to comment Share on other sites More sharing options...
kazkas Posted May 11, 2010 Author Share Posted May 11, 2010 you cannot add quantity to the products that have attributes, only quantities to each attribute. Thus you cannot set overall quantity less then 2 (unless I mistaken somewhere along the line Link to comment Share on other sites More sharing options...
tomerg3 Posted May 11, 2010 Share Posted May 11, 2010 You are not mistaken, I'm just trying to make sure that you have only 1 copy of the same item. Link to comment Share on other sites More sharing options...
kazkas Posted May 18, 2010 Author Share Posted May 18, 2010 OK, I changed some code and now it works fine for me. Thanks tomerg3 for fist bit of code, that changes amounts of products left disregarding attributes.And I changed function in Cart class to public function containsProduct($id_product, $id_product_attribute, $id_customization) { return Db::getInstance()->getRow('SELECT quantity FROM '._DB_PREFIX_.'cart_product WHERE id_product = '.intval($id_product));}Now my customers cannot add more than one instance of the product to their carts, even if they try to add framed and unframed versions of the product. Link to comment Share on other sites More sharing options...
tomerg3 Posted May 18, 2010 Share Posted May 18, 2010 Great, glad I could help.Please add SOLVED at the start of the title. 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