External Domain Search has Stopped Working

srsakib

Member
Hello,
Clientexec has been installed on the subdomain. The search box is on the main domain. The search box was working fine after getting help from Mr. Matt. But, from 6.3, it was stopped working for my site.

Recently I wanted to reconfigure it. So, I discovered that the step changed from 0 to 1. I changed the value to 1. But, it's still not working. I tried the below code.

.htaccess for subdomain:

Code:
<IfModule mod_headers.c>
      Header add Access-Control-Allow-Origin "https://domain.com"
      Header add Access-Control-Allow-Methods "POST"
  </IfModule>

The search box code is,


JavaScript:
<input id="domainname" type="text" name="domainname" value='yournewsite.com' />
<input id="submit-button" type="submit" value="Search Domain">

<script type="text/javascript">
    var ceURL = 'https://sub.domain.com/';
    var groupId = 2;
    $('#submit-button').click(function(e) {
        e.preventDefault();
        var fullname = $('#domainname').val();
        if ( fullname.indexOf(".") == -1 ) {
            $('#domainname').addClass('domain_fail');
            $('#domainname').val(fullname+' - not a valid domain name');
        } else {
            name = fullname.substr(0, fullname.indexOf('.'));
            tld = fullname.substr(fullname.indexOf('.')+1);
            window.location = ceURL + 'order.php?step=1&productGroup=' + groupId + '&domainName=' + name + '&tld=' + tld;          
        }
        return false;
    });

Did I miss anything?

I also tried the code from How do I add external domain search to my site.
 

jdigital

New Member
Your code does work. Make sure you have an ending </script> tag at the end and that you're including jquery before to define $
You might also check that your product group really is 2 and that you're not just following the example. Mine is 8, so i would search for a domain within your clientexec site and make sure your 2 urls match.
 
Last edited:

jdigital

New Member
I would also change value='yournewsite.com' to placeholder='yournewsite.com' so your visitor does not have to erase the current value.
 

srsakib

Member
Your code does work. Make sure you have an ending </script> tag at the end and that you're including jquery before to define $
You might also check that your product group really is 2 and that you're not just following the example. Mine is 8, so i would search for a domain within your clientexec site and make sure your 2 urls match.
Hello,
Thank you for your response. I have used the script tag. The productGroup is 2 for my client portal.

Everything was working perfectly before the major update. I have hidden the search box from the main site because of not working. My website has been redesigned. So, now I want to add the search box again. But, I'm badly facing the issue again.
 

jdigital

New Member
Hmmm...I put your code on an external page under a different domain and pointed it to my CE install and it worked fine. I'm running the latest install. Can you put the search box back where you want it and provide a url, maybe the community can help you without bothering CE support.
 

jdigital

New Member
If you view errors on developer tools is it giving you an error? If it says $ is not defined, then like I said, your redesigned site may not be including jquery. If that's not the issue, those are really just _GET variables not _POST, so really just pasting the url into an address bar should work. The only other thing I can think is you may have some rewrite condition in your htaccess that may be altering the url. If you can provide a url, it may be obvious what is going on.
 

srsakib

Member
If you view errors on developer tools is it giving you an error? If it says $ is not defined, then like I said, your redesigned site may not be including jquery. If that's not the issue, those are really just _GET variables not _POST, so really just pasting the url into an address bar should work. The only other thing I can think is you may have some rewrite condition in your htaccess that may be altering the url. If you can provide a url, it may be obvious what is going on.
Hi,
Thank you so much for your assistance. The issue was with the page optimization. Due to combined JS or minifying, the code was not working. After disabling those features, it starts working again.
 
Top