Jump to content

order a maximum of one product at a time


Recommended Posts

Hi,

does anyone know if it is possible to specify that the customer can order a maximum of one product at a time.

I do believe that there is an option to set a maximum quantity of products per customer, but that's not the intention. the customer may order as many as he wants, But he has to go true the orders street for each product he ordered. the reason why I want this is, is that I don't sell products but I give them away for free, I only charge shipment costs and if people can order more than 1 product it cost me money.

I hope someone can help me a bit to solve this for me.

Sorry for my english I hope you understand my question.
 
SOLVED!

i decided to use vekias module maximum product quantity

Link to comment
Share on other sites

Do you 'sell' more products, or really only one?

If more, can the customer order 1 OF EACH max per checkout, or maximum of 1 product, regardless of which one?

I.e if you have product A,B,C,D,... can the customer order say:

Product A 1x max

AND

Product C 1x max

AND

Product D 1x max

 

 

or can he only say

Product C 1 x max

and nothing else?

 

What version of Prestashop do you use?

 

Pascal

Link to comment
Share on other sites

Hi,

 

does anyone know if it is possible to specify that the customer can order a maximum of one product at a time.

 

I do believe that there is an option to set a maximum quantity of products per customer, but that's not the intention. the customer may order as many as he wants, But he has to go true the orders street for each product he ordered. the reason why I want this is, is that I don't sell products but I give them away for free, I only charge shipment costs and if people can order more than 1 product it cost me money.

 

I hope someone can help me a bit to solve this for me.

 

Sorry for my english I hope you understand my question.

 

Have you checked the http://addons.prestashop.com for a minimum/maximum quantity module yet? I believe you can restrict how many items a customer can purchase based on your specific maximum quantity requirement. I think you should make the customer pay for any additional item they may wish to order from your online Prestashop so as you said, "you don't have to eat the additional shipping fees" of paying for shipping for each additional item they purchase from your online shop if that makes any sense. You may want to restrict the maximum weight that the customer can ship to their delivery address since the item's weight influences the freight cost to ship to customer's address depending upon which courier service you're going to use for shipping.

Link to comment
Share on other sites

@pascal

I offer more than 1 item, but the customer can only get 1 item each time. If the customers want more products they have to come back and order the product again.

just like this:

Product C 1 x max

and nothing else

 

The raison why I want it this way is because I offer the products for free and only charge some shipping fee. when people can take more than 1 product I can't charge the shipping fee for each product.

 

I use PrestaShop™ 1.5.3.1

Edited by misja (see edit history)
Link to comment
Share on other sites

@gogomo

I checked some modules but can find what I need, I don't want to restrict customers to buy or restrict the weight I only want that any customer only can make 1 order for 1 product each time, but they can order this product as much they want.

Link to comment
Share on other sites

  • 11 months later...
  • 2 weeks later...

Hi med6,

try this:

 

in file: /controllers/front/CartController.php (make backup, just in case):

 

in function:       protected function processChangeProductInCart()
 

Somewhere half way the function, add these red pieces of code  (sample code of P.S. 1.5.5.0)

 

                  ...

        // If no errors, process product addition
        if (!$this->errors && $mode == 'add')
        {

            if ($this->context->cart->id)  // Check if already a product in cart. Check for only one product per order...
            {
                if ($this->context->cart->nbProducts() > 0) // change 0 to higher number if needed
                    $this->errors[] = Tools::displayError('Only one product per order is allowed. Please continue to checkout');
            }


            // Add cart if no cart found
            if (!$this->errors)
            {

                if (!$this->context->cart->id)
                {
                    if (Context::getContext()->cookie->id_guest)
                    {
                        $guest = new Guest(Context::getContext()->cookie->id_guest);
                        $this->context->cart->mobile_theme = $guest->mobile_theme;
                    }
                    $this->context->cart->add();
                    if ($this->context->cart->id)
                        $this->context->cookie->id_cart = (int)$this->context->cart->id;
                }

                // Check customizable fields
                if (!$product->hasAllRequiredCustomizableFields() && !$this->customization_id)
                    $this->errors[] = Tools::displayError('Please fill in all of the required fields, and then save your customizations.');
            }   // <- close if statement as well!

 

            if (!$this->errors)
            {
                $cart_rules = $this->context->cart->getCartRules();
                ...

 

 

 

That should do it, I think.

 

pascal.

  • Like 2
Link to comment
Share on other sites

Hi med6,

try this:

 

in file: /controllers/front/CartController.php (make backup, just in case):

 

in function:       protected function processChangeProductInCart()

 

Somewhere half way the function, add these red pieces of code  (sample code of P.S. 1.5.5.0)

 

                  ...

        // If no errors, process product addition

        if (!$this->errors && $mode == 'add')

        {

 

            if ($this->context->cart->id)  // Check if already a product in cart. Check for only one product per order...

            {

                if ($this->context->cart->nbProducts() > 0) // change 0 to higher number if needed

                    $this->errors[] = Tools::displayError('Only one product per order is allowed. Please continue to checkout');

            }

 

            // Add cart if no cart found

            if (!$this->errors)

            {

                if (!$this->context->cart->id)

                {

                    if (Context::getContext()->cookie->id_guest)

                    {

                        $guest = new Guest(Context::getContext()->cookie->id_guest);

                        $this->context->cart->mobile_theme = $guest->mobile_theme;

                    }

                    $this->context->cart->add();

                    if ($this->context->cart->id)

                        $this->context->cookie->id_cart = (int)$this->context->cart->id;

                }

 

                // Check customizable fields

                if (!$product->hasAllRequiredCustomizableFields() && !$this->customization_id)

                    $this->errors[] = Tools::displayError('Please fill in all of the required fields, and then save your customizations.');

            }   // <- close if statement as well!

 

            if (!$this->errors)

            {

                $cart_rules = $this->context->cart->getCartRules();

                ...

 

 

 

That should do it, I think.

 

pascal.

This isn't what I want; I want to limit the qty ;You have right to add to cart only 3 item per product

Link to comment
Share on other sites

This is the answer to the question asked...1 item for only 1 product... 8-[

 

Please open a new topic if you want to ask a DIFFERENT question.. Don't hijack this topic...

 

Then please PM me the link to the new topic and I will have another look at it. (Will be begin next week, as I will be away for three days)

Link to comment
Share on other sites

  • 2 years later...
  • 8 months later...

Pascal  this limits every product to quantity of 1.  I would like to limit some products to 9 and some to 13 quantity.  How can I do this per product.  The modules there do not address this specifically either.  Is there a way to specify it in the product when adding to cart as well.  I would rather the person see it at the product page and not wait until he gets to the cart to see the message as well.  

Link to comment
Share on other sites

×
×
  • Create New...