Jump to content

[SOLVED] Allow customer to choose framing option


Recommended Posts

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

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...