How To Create And Access Front End Page Of An Addon?

Hello,

We are trying to create the front end page for our addon but not able to do so. So please let us know in detail about files need to created and also let us know how to access it.

Thanks!

1. Create controller filename

app/addons/[ADDON_NAME]/controllers/frontend/[CONTROLLER_NAME].php

2. Create template view + content

design/themes/[THEME_NAME]/templates/addons/[ADDON_NAME]/views/[CONTROLLER_NAME]/[VIEW_NAME].tpl

# add content



#Example:

ADDON_NAME=my_changes
CONTROLLER_NAME=custom_page
THEME_NAME=responsive
VIEW_NAME=view

#Files

app/addons/my_changes/controllers/frontend/custom_page.php
design/themes/responsive/templates/addons/my_changes/views/custom_page/view.tpl

#URL

http://www.example.com/?dispatch=custom_page.view

Hello,

Thank you for your quick reply. We have created both files but we are getting page not found error. So please let us know how to proceed further.

Thanks!

Please attach the urls for the files you created

Hello,

We have created the files as you asked, just changed the addon name. We are developing in localhost. So you will not be able to access it.

Thanks!

Please make sure that the $mode value in controller corresponds the template file name

Hello,

Yes, it is same but still not working. We have also tried with the other addons already present but not able to make it working. So can anyone share some sample code to just display a message and stops need to followed.

Thanks!

For example, the Gift Certificates addon

Controller

app/addons/gift_certificates/controllers/frontend/gift_certificates.php

Template:

design/themes/responsive/templates/addons/gift_certificates/views/gift_certificates/update.tpl

Hello,

We have tried to follow the files but still getting the same result. So can some one suggest some debugging tricks. So that we can check where is the exact issue.

Thanks!

At first try to delete the var/cache directory manually

Hello,

We have tried it but didn't worked for us. Can you please let us know some debugging tricks.

Thanks!

Use the following code in the controller to check if the system uses it

fn_print_die('test');

Hello,

We have added this code but still getting the same result.

Thanks!

How are you trying to reach new page?

Hello,

We are accessing via http://localhost/cscart/?dispatch=custom_page.view.

We have also tried with update, http://localhost/cscart1/?dispatch=custom_page.update, as in the gift_certificate addon.

Thanks!

Please attach a screenshot of the addons and design folder tree and also make sure the add-on is active ;)

Hello,

Module is active and working in back end with no issue. Please see the attached images.

Thanks!

Selection_001.png

Selection_002.png

Hello,

The controller issue is now resolve. Now when we are trying to use Registry::set('addons.demo.test', 'some value'); then the value is not reflected in our addon setting page. So please let us know if there is any issue.

Thanks!

Use Registry::get instead of Registry::set