Hi,
On this page of docs
www.hikashop.com/support/documentation/1...erial-developer.html
we have
/**
* @param object $pack : the hikashop pack object, with the options.
* [ pack_id, product_id, quantity, pack_name, pack_data, pack_generator, pack_params ]
* @param object $order : the hikashop order object, with all data.
* @param int $quantity : the quantity of serials that you generator has to create.
* @param array $serials : output array for the generated serials.
*/
public function generate(&$pack, &$order, $quantity, &$serials) {
if(!isset($pack->mypluginname)) // replace "mypluginname" by your plugin name
return;
// load $this->plugin_params;
parent::pluginParams($pack->mypluginname); // replace "mypluginname" by your plugin name
for($q = 0; $q < $quantity; $q++) {
$serial = '';
/*
* Generate your serial here
*/
$serials[] = $serial;
}
}
I think it is not clear how this function will be called, and what exactly $quantity is?
Let we have in CART few products with quantity
product1 1
product2 3
product3 1
How many times will be called function generate() ?
a) once? And we need self iterate each product in the array products ?
b) 3 times? once per each product?
c) 5 times?