- Posts: 64
- Thank you received: 0
How to limit max order quantity to 1 for backend?
- irfanhanfi
-
Topic Author
- Offline
Less
More
13 years 2 weeks ago #123752
by irfanhanfi
How to limit max order quantity to 1 for backend? was created by irfanhanfi
-- HikaShop version -- : 2.2.1
-- Joomla version -- : 3.0.4 Stable
-- PHP version -- : 5.4.7
I have the same scenario for backend as I have here www.hikashop.com/forum/2-general-talk-ab...eforecartupdate.html for front end.
If I use onAfterProductQuantityCheck ,it does not fire for backend.Also onBeforeOrderProductsUpdate did not work for me.
The code is-
The problem is, even if we set $do=false it updates order product.
I do not want to add/update product if quantity is more than one.
Regards,
-- Joomla version -- : 3.0.4 Stable
-- PHP version -- : 5.4.7
I have the same scenario for backend as I have here www.hikashop.com/forum/2-general-talk-ab...eforecartupdate.html for front end.
If I use onAfterProductQuantityCheck ,it does not fire for backend.Also onBeforeOrderProductsUpdate did not work for me.
The code is-
Code:
function onBeforeOrderProductsUpdate(&$order, &$do){
$maxQtyMsg = 'Max quantity for product is 1.';
$canOrder = $this->canOrder($order->product[0]->product_id,$order->product[0]->order_product_quantity);
if(!$canOrder){
$do = false;
JFactory::getApplication()->enqueueMessage($maxQtyMsg, 'error');
}
}
I do not want to add/update product if quantity is more than one.
Regards,
Please Log in or Create an account to join the conversation.
13 years 2 weeks ago #123818
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic How to limit max order quantity to 1 for backend?
Hi,
I am sure that if you set "$do = false" the process will stopped.
But please check the trigger "onBeforeOrderUpdate" too, the order product one is called on specific cases that the backend can may not use because it's a more "raw" usage.
Regards,
Code:
$do = true;
$dispatcher->trigger('onBeforeOrderProductsUpdate', array(&$order, &$do) );
if(!$do)
return false;
But please check the trigger "onBeforeOrderUpdate" too, the order product one is called on specific cases that the backend can may not use because it's a more "raw" usage.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
- irfanhanfi
-
Topic Author
- Offline
Less
More
- Posts: 64
- Thank you received: 0
13 years 2 weeks ago - 13 years 2 weeks ago #123874
by irfanhanfi
Replied by irfanhanfi on topic How to limit max order quantity to 1 for backend?
Thanks,but solution does not work for me.
I found that problem is something else.
The problem is $do value only affects total order price not the order product.For example if for Product A $do value is false ,system adds Product A to order but not it's price to total price.
Could you please help me how to solve it?
Please let me know if not clear.
Regards,
I found that problem is something else.
The problem is $do value only affects total order price not the order product.For example if for Product A $do value is false ,system adds Product A to order but not it's price to total price.
Could you please help me how to solve it?
Please let me know if not clear.
Regards,
Last edit: 13 years 2 weeks ago by irfanhanfi.
Please Log in or Create an account to join the conversation.
13 years 2 weeks ago #124013
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic How to limit max order quantity to 1 for backend?
Hi,
It's exactly what is written in my previous message. The "return false" stop the process and get out of the function.
Regards,
Sorry but no. If in the trigger you set the variable "$do" to false, it will stop the all process.The problem is $do value only affects total order price not the order product.For example if for Product A $do value is false ,system adds Product A to order but not it's price to total price.
It's exactly what is written in my previous message. The "return false" stop the process and get out of the function.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Time to create page: 0.174 seconds