Jump to content

Required Order ID/ Number Contact Page


Recommended Posts

Hello guys

 

I was trying to make some changes to my contact page.

 

I want to make the client be obligated to put is Order ID when he choses Returns in the subjet theme. I mean i want to make the field Order ID/Number to be required when the client choose "Retour Product".

 

I would like to know if any good soul here can help me.

 

Cheers

Luis

Link to comment
Share on other sites

Hi,

 

have a look in the controllers/front/ContactController.php file, that's where information are checked before being sent. You ll need to override this file to add the condition you want

Hi

 

Those were my toughts... However i really need help to change the code. The theme i can handle but controllers are a thing i can't really handle.

 

Ty

Link to comment
Share on other sites

controllers/front/contactController.php

 

add this code

                    if (Tools::getValue('id_contact')==2){
                        if (Tools::getValue('id_order')==0){
                            $this->errors[] = Tools::displayError('Enter ID of order');
                            return;
                        }
                    }

right before:

					if (empty($contact->email))
						Mail::Send($this->context->language->id, 'contact_form', ((isset($ct) && Validate::isLoadedObject($ct)) ? sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token) : Mail::l('Your message has been correctly sent')), $var_list, $from, null, null, null, $fileAttachment);

remember to change 2 in: Tools::getValue('id_contact')==2 to id that is equal to "returns"

 

 

effect

Xz0bJ50.png

Link to comment
Share on other sites

controllers/front/contactController.php

 

add this code

                    if (Tools::getValue('id_contact')==2){
                        if (Tools::getValue('id_order')==0){
                            $this->errors[] = Tools::displayError('Enter ID of order');
                            return;
                        }
                    }

right before:

					if (empty($contact->email))
						Mail::Send($this->context->language->id, 'contact_form', ((isset($ct) && Validate::isLoadedObject($ct)) ? sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token) : Mail::l('Your message has been correctly sent')), $var_list, $from, null, null, null, $fileAttachment);

remember to change 2 in: Tools::getValue('id_contact')==2 to id that is equal to "returns"

 

 

effect

Xz0bJ50.png

Vekia... your are the men. Thankssssss

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...