AbanteCart Community
Shopping Cart Operations => Support => Topic started by: Claudio Garcia on October 17, 2019, 09:00:48 AM
-
Hi
Where i find code information to restrict a customer to make one order per day and to restring customer registration to one domain .example.com mail accounts only.
Thanks
-
You can check exists orders in Cart Controller Hook: storefront/controller/pages/checkout/cart.php:26
for check email registration create hook for Registartion Controller: storefront/controller/pages/account/create.php:24
-
Hello dvagner
Where i can find some help to modify the cart.php to query for orders? Do you know the tablet name, idorder column name and product table?
Please help me a little bit more, i need some adittional help.
-
Yes
I didnt understand very well. Its like when you to a restaurant and they serve a litte bit, you say "I need more carnita" "i want more meat"
-
What i need is to block customer who orders more than 3 quantity for every product, not per order, Per customer.
I was thinking to block customer to make one order. But its better customer makes orders who they want but restrict only 3 products quantity per each product per all orders. I know is not logical rule but its a requeriment.
I checked exists orders in Cart Controller Hook: storefront/controller/pages/checkout/cart.php:260 line
I did the following change but not working:
Where i can check that?
$cart_products = $this->cart->getProducts();
$product_ids = array();
foreach ($cart_products as $result) {
$product_ids[] = (int)$result['product_id'];
$query = $this->db->query("SELECT sum(ac_order_products.quantity)
FROM ".$this->db->table('ac_order_products')" INNER JOIN ".$this->db->table('ac_orders'). ON ac_orders.order_id = ac_order_products.order_id"
WHERE o.customer_id = '".(int)$this->config->get('customer_id')."'
AND od.product_id = '".$result['product_id']."')");
if (!$query) {
$error_msg[] = "Could not run query: " . mysql_error();
exit;
}
$row = mysql_fetch_row($query);
if ($row[0] > 3) {
$error_msg[] = "You can buy only 3 units from a product in all your orders ......" .$result['name'];
}
My problem is iam not good in php.
Please help check if this is ok and where i cant get the customer id in cart.php
-
Someone please explain how to do it? I really dont understad what Claudio explain