Hello, Tyson
Great it work perfectly with universal module and Hidden type.
For this topic to be a reference for Blesta users
Let me assure you that this is not enough
To get those custom filed visible for clients on client area also it require to update the universal_module.php file code
File location: blesta_root_folder/components/modules/universal_module/universal_module.php
first
we need to find the following code
private function isUrl($str)
{
return preg_match("#^\S+://\S+\.\S+.+$#", $str);
}
then we need to add the following code (bellow the above code)
/**
* Returns all tabs to display to a client when managing a service whose
* package uses this module
*
* @param stdClass $package A stdClass object representing the selected package
* @return array An array of tabs in the format of method => title. Example: array('methodName' => "Title", 'methodName2' => "Title2")
*/
public function getClientTabs($package) {
return array(
'moreinfo' => array('name' => "More Info", 'icon' => "fa fa-gears")
);
}
/**
* The More Info tab
*
* @param stdClass $package A stdClass object representing the current package
* @param stdClass $service A stdClass object representing the current service
* @param array $get Any GET parameters
* @param array $post Any POST parameters
* @param array $files Any FILES parameters
* @return string The string representing the contents of this tab
*/
public function moreinfo($package, $service, array $get=null, array $post=null, array $files=null) {
$row = $this->getModuleRow($package->module_row);
$out = '';
$servicefields = array();
foreach ($row->meta as $key=>$value ) {
if (strpos($key, "service_field_name") !== false) {
// Here we match the service field label with their key and value
foreach($service->fields as $field) {
if($field->key == $value) {
$name = 'service_field_label_' . str_replace('service_field_name_', '', $key);
$servicefields[] = array("label" => $row->meta->$name,
"key" => $value,
"value" => $field->value);
}
}
}
}
foreach($servicefields as $field) {
// Filter out for showing only public fields
if(strpos($field['key'], "public_") === 0 ) {
$out .= "<p><b>". $field['label'] . ":</b> " . $field['value'] . "</p>";
}
}
return "<h4>Service Details</h4><br />" . $out ;
}
Thank you very much
if possible can you share the code to hide the cost of configurable option of package when we set the cost (of configurable option) equal to 0.
Greeting