I am looking to display the geozone in the registration process as a dropdown menu, similar to the zone (region) selection. However, the options available for the geozone should be dynamically updated based on the zone selected by the customer.
The Visual Representation
To achieve this, I have made certain modifications to the controller and view files. The screenshot below illustrates the current state:
The geozone field is currently displaying Kotamadya/Kabupaten. However, when I choose the region Aceh, the geozone field does not update accordingly.
Error Message Encountered
An error message was displayed as follows:
SyntaxError: Unexpected token <
OK
<br />
<b>Fatal error</b>: Call to a member function
getGeozonesByZoneId() on a non-object in <b>
/home/........../catalog/controller/account/register.php
</b> on line <b>513</b><br />
The Code Snippet
In ../controller/account/register.php, I made the following adjustments:
public function zone() {
$json = array();
// Code block referencing model_localisation_zone
if($geozone_info)
{
// Code block referencing model_localisation_geo_zone
$json = array(
// JSON object properties
);
}
$this->response->setOutput(json_encode($json));
}
The specific line causing the issue is mentioned as:
'geozone' => $this->model_localisation_geozone->getGeozonesByZoneId($this->request->get['zone_id'])
I believe the getGeozonesByZoneId function is implemented correctly in ../model/localisation/geo_zone.php as shown below:
<?php
// PHP code snippet of ModelLocalisationGeozone class
?>
Additionally, JavaScript code has been included in register.tpl for handling the dynamic updates:
// JavaScript code snippet
If anyone has insights or solutions to help me resolve this issue, your assistance would be greatly appreciated. Thank you in advance!