Opencart - how to automaticlly add product to cart when certain conditions are met -


is possible add product(s) cart when conditions met?

for expample: condition - if in cart product category c add product x , can`t delete form cart if condition still active.

customer adds product p category c , system automaticlly adds product x in cart 2 product now.

my goal have 2 product in invoice 2 separate items then. manually adding second product not option.

there method named add under cart.php here

catalog->controller->checkout->cart.php 

in product id on user clicked out add product in cart, here can check condition product belongs category. if condition true can add option product cart using method

$this->cart->add($optional-product_id, $quantity, $option, $recurring_id);  -> default $quantity 1. -> default $recurring_id 0. -> , $option array ($option = array()). 

i hope lot.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -