Hi,
The generate function have several parameters. In these parameters you have the $order object which contains all information of the order.
You can access to the order custom fields in the same time.
If you have a custom field named "software_type" (the name and not the label), you can access it by: $order->software_type.
If you want to read an item custom field, you have to check the order cart like it is done in the plugin "secure ebook".
if(!empty($order->cart->products)) {
foreach($order->cart->products as $p) {
if($p->product_id == $pack->product_id) {
// Read the product code or any "item custom field".
$product_code = $p->order_product_code;
break;
}
}
}
If you want to read a product custom field, you have to load the product.
$productClass = hikaserial::get('shop.class.product');
$product = $productClass->get($pack->product_id);
$software_type_custom_field = $product->software_type;
If you want to example on the plugin params you can check the "secure ebook" plugin too.
You can create as many params as you want in the plugin, they would be serialized and stored in the database.
In the configuration file, you have to use a specific name for your inputs like:
<input type="text" name="data[generator][generator_params][sdk_key]" value="<?php echo @$this->element->generator_params->sdk_key; ?>"/>
The name should start with "data[generator][generator_params]".
In the plugin afterwards, you can access to this parameters.
First you have to call the plugin system in order to load your parameters for your plugin instance (because you can have several configurations in the same plugin).
parent::pluginParams($pack->randomgen);
(replace "randomgen" with your plugin name).
If you plugin is not a "multiple configuration" plugin, you should load the parameters with another command:
parent::pluginParams(0, 'secureebook');
(replace "secureebook" with your plugin name).
And after you can access to the parameters like
$this->plugin_params->sdk_key;
Regards,