Skip to main content

Custom Field validation?

More
6 years 7 months ago #315709 by mikekiy
-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.15
-- PHP version -- : 7.2
-- Browser(s) name and version -- : Chrome

Hey,

So we have a custom database table with some data and we want to add a field to a product say 'Purchase Code' and when they try and add the product to the cart we want to validate that the code entered exists and has not been used. Is this possible? I can do it with custom ajax routine / script. But wondered what you think is the best way?

Also, same once order is complete I want to run a quick database routine? Suggestions?

Many thanks
Tony

Please Log in or Create an account to join the conversation.

More
6 years 7 months ago #315710 by nicolas
Replied by nicolas on topic Custom Field validation?
Hi,

The best is to implement the onAfterProductQuantityCheck(&$product, &$wantedQuantity, &$quantity, &$cart_products, &$cart_product_id, &$displayErrors) trigger in a plugin of the group "hikashop".
This trigger will be called just before a product is added to the cart.
You can set $quantity to 0 to cancel the add to cart.

And for the order, I would recommend to do the same with the trigger onBeforeOrderCreate(&$order, &$do)
You can set $do to false to cancel the creation of the order.

Please Log in or Create an account to join the conversation.

Time to create page: 0.183 seconds
Powered by Kunena Forum