| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Add Field to Contact Us form | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Add Field to Contact Us form
I would like to add an optional "Phone Number" field to the Contact Us module in XC5. What is the simplest way to do this?
Thank you.
__________________
Ant XC v5.3.1.8 Horizontal Flyout Categories Menu Module CloudSearch / CloudFilters XC v4.7.6 CloudSearch |
|||||||
#2
|
|||||||
|
|||||||
Re: Add Field to Contact Us form
ant99, I too would like to add fields to the Contact Us page. Lets see what ideas people have.
__________________
Free 5.2.6 Modules: Sales tax, Converge, UPS |
|||||||
#3
|
|||||||||
|
|||||||||
Re: Add Field to Contact Us form
There is no setting to show the phone number field on the contact page. You can add the field by creating a custom module if this is something that you are OK with.
For a better Contact Us page you may try this module (however, I think it does no have the phone field too): https://www.x-cart.com/extensions/addons/contact-us-page-by-mightycall.html
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
#4
|
|||||||
|
|||||||
Re: Add Field to Contact Us form
Hi Alex, Yes I was wanting to modify the form via a custom module. i am just looking for guidance on the code I would be modifying. I already have a custom theme & module in place I just want to modify the form.
Thanks for your suggestion, but I don't think that module will achieve what we're looking for.
__________________
Ant XC v5.3.1.8 Horizontal Flyout Categories Menu Module CloudSearch / CloudFilters XC v4.7.6 CloudSearch |
|||||||
#5
|
|||||||||
|
|||||||||
Re: Add Field to Contact Us form
The template that renders the form is this one:
skins/default/en/modules/CDev/ContactUs/contact_us/body.tpl Instead of editing the template you should inject your new field into the template by adding it into the "contact-us.send.fields" view list. Please check the skins/default/en/modules/CDev/ContactUs/contact_us/fields/ directory to see how other fields are added to the list. The form data is collected in this method: \XLite\Module\CDev\ContactUs\Controller\Customer\C ontactUs::doActionSend() So, you should decorated this class from your module and add the logic that handles the new field. Also, you are to decorate the \XLite\Core\Mailer::sendContactUsMessage() method (and associated templates) to get the new field included into e-mails. I hope this helps.
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
#6
|
|||||||
|
|||||||
Re: Add Field to Contact Us form
Hi Alex,
Thanks for your insight. I was able to locate and find everything to modify. Looks like all is in the proper place, but I had trouble decorating the class XLite\Core\Mailer Specifically, the last step I need in place is to over-ride XLite\Module\CDev\ContactUs\Core:sendContactUsMess age() I need to change the line in bold to point to 'modules/MyModule/ContactUs/message': XLite\Module\CDev\ContactUs\Core\Mailer.php PHP Code:
I have my own body.tpl in the folder (skins/mail/modules/MyModule/ContactUs/message) that would include the extra fields into the email. However, I must be doing something wrong with how I'm decorating the Mailer class. I'm assuming the file would be here: (/classes/XLite/Module/MyModule/Core/Mailer.php) But what do I need to include in this file to decorate the class properly? I tried this: XLite\Module\MyModule\Core\Mailer.php PHP Code:
I also tried this: XLite\Module\MyModule\Core\Mailer.php PHP Code:
__________________
Ant XC v5.3.1.8 Horizontal Flyout Categories Menu Module CloudSearch / CloudFilters XC v4.7.6 CloudSearch |
|||||||
#7
|
|||||||
|
|||||||
Re: Add Field to Contact Us form
(sorry, the [b] tags didn't work inside the code lines. Please note that those [b] tags are showing the parts I'm focusing on to modify...
__________________
Ant XC v5.3.1.8 Horizontal Flyout Categories Menu Module CloudSearch / CloudFilters XC v4.7.6 CloudSearch |
|||||||
#8
|
|||||||||
|
|||||||||
Re: Add Field to Contact Us form
ContactUs module does not create a new class, but modifies the existing one (due to the "implements \XLite\Base\IDecorator" part):
PHP Code:
Well, technically it does create a new class, but it won't be used anywhere except the inheritance tree for the \XLite\Code\Mailer class. So, you should decorate \XLite\Code\Mailer class, not \XLite\Module\CDev\ContactUs\Core\Mailer (and thus your first try sounds good to me). One thing you should to change is the PHPDoc for your class. Since your module can't work without the ContactUs module, you should add the "@LC_Dependencies" tag: PHP Code:
Why did you change the body.tpl template? I believe you don't need to modify it, just add a new template with your field and make it injected into the "contact-us.send.fields" view list by using the @ListChild tag.
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
#9
|
|||||||
|
|||||||
Re: Add Field to Contact Us form
Thank you Alex, the dependency is what I was missing. Looks like it's all wrapped into my module perfectly now.
The body.tpl file that I'm modifying looks like this. (it's in the mail templates) /skins/mail/en/modules/CDev/ContactUs/message/body.tpl PHP Code:
I don't think I can just inject the new field that I added. Correct? This is why I created a new body.tpl to over-ride the one in the ContactUs module. Thanks again.
__________________
Ant XC v5.3.1.8 Horizontal Flyout Categories Menu Module CloudSearch / CloudFilters XC v4.7.6 CloudSearch |
|||||||
#10
|
|||||||||
|
|||||||||
Re: Add Field to Contact Us form
You're right. I though your phrase was about the contact form, not the e-mail itself.
I think replacing the body.tpl for the e-mail is the only possible solution at the moment.
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
|||
X-Cart forums © 2001-2020
|