X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Contact Form - Subject dropdown (https://forum.x-cart.com/showthread.php?t=73595)

slenderfungus 02-17-2016 02:56 PM

Contact Form - Subject dropdown
 
I'd like to modify the basic contact form so users can select a subject title from a dropdown form selector list; the subject would then become the subject of the email sent from the form. Can this be done?

This is with the latest X-Cart 5.

qualiteam 03-09-2016 07:27 AM

Re: Contact Form - Subject dropdown
 
Hello Brian,

You can do this by creating a custom module (or implementing the change via Custom Skin module).

The steps to create the module are:

1. In your module add a new class, make it extended from \XLite\View\FormField\Select\Regular and define your subject options there with their short key names.

2. Copy the skins/default/en/modules/CDev/ContactUs/contact_us/fields/field.subject.tpl template to a directory in your custom module and make it replace the default one. You can do it by adding a new "theme" from your module (http://kb.x-cart.com/display/XDD/Basic+guide+to+theme+creation), or by using the moveTemplatesInLists() method in your Main.php file.

3. The default template uses the \XLite\View\FormField\Input\Text class to render the field. In your template you should change this class to the one that you created on the first step.

4. Decorate the \XLite\Module\CDev\ContactUs\Controller\Customer\C ontactUs class from your module and make it use the real subject instead of the short key name passed by the browser to the server (see the getValue() method).

5. Re-deploy the store to make the custom module appear in the list of installed modules and enable the module.

slenderfungus 03-11-2016 03:32 PM

Re: Contact Form - Subject dropdown
 
Thank you. I will attempt to make this modification in the next week.

slenderfungus 05-19-2016 02:54 PM

Re: Contact Form - Subject dropdown
 
I have attempted to start this process by following the module creation documentation located here:
http://kb.x-cart.com/display/XDD/Step+1+-+creating+simplest+module
http://kb.x-cart.com/display/XDD/Step+2+-+applying+design+changes
http://kb.x-cart.com/display/XDD/Step+3+-+applying+logic+changes

the problem is I cannot enable my module. It simply will not turn on when I click on "enable"

razortw 05-22-2016 03:30 PM

Re: Contact Form - Subject dropdown
 
Quote:

Originally Posted by slenderfungus
I have attempted to start this process by following the module creation documentation located here:
http://kb.x-cart.com/display/XDD/Step+1+-+creating+simplest+module
http://kb.x-cart.com/display/XDD/Step+2+-+applying+design+changes
http://kb.x-cart.com/display/XDD/Step+3+-+applying+logic+changes

the problem is I cannot enable my module. It simply will not turn on when I click on "enable"

Are you sure you are not missing anything in Main.php file?
Could you please send it here?


All times are GMT -8. The time now is 10:22 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.