Jump to content

A Customer can buy only 1 quantity of a product, how to?


Recommended Posts

Hi,

This is my solution. You have to edit cart.php

//update the cart...
if ($add OR Tools::getIsset('update') OR $delete)
{
//get the values
$idProduct = intval(Tools::getValue('id_product', NULL));
$idProductAttribute = intval(Tools::getValue('id_product_attribute', Tools::getValue('ipa')));
$customizationId = intval(Tools::getValue('id_customization', 0));
$qty = intval(abs(Tools::getValue('qty', 1)));
..........
..........
}

Change it to:

//update the cart...
if ($add OR Tools::getIsset('update') OR $delete)
{
//get the values
$idProduct = intval(Tools::getValue('id_product', NULL));
$idProductAttribute = intval(Tools::getValue('id_product_attribute', Tools::getValue('ipa')));
$customizationId = intval(Tools::getValue('id_customization', 0));
$qty = intval(abs(Tools::getValue('qty', 1)));

if($idProduct == 1234567890) $qty = 1;
..........
..........
}

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...