April 27, 2020
Estimated Post Reading Time ~

How to resolve AEM pointing to Search and Promote(S&P) Stage environment?

Recently i have faced a issues on AEM publisher pointing to Search and Promote(S&P) stage environment irrespective of the environment configuration in OSGI configuration( Adobe Search&Promote Integration )



How to confirm AEM is pointing to S&P stage environment:
Check the content of searchformxml property from /etc/cloudservices/search-promote/<<S&P Config Name>>/jcr:content and check the <action> URL

Stage - <action>http://stage.xxxxx.guided.ss-omtrdc.net</action>
Live - <action>http://xxxxx.guided.ss-omtrdc.net</action>



The following steps can be followed as a workaround:
Decode the data if it is already encoded(HTML Decoder) - searchformxml property from /etc/cloudservices/search-promote/<<S&P Config Name>>/jcr:content

Remove <input type="hidden" name="sp_staged" value="1" />

Change the following URLs to point to live configuration
//content.atomz.com/xxxxx/stage/autocomplete_data.js to //content.atomz.com/xxxxx/publish/autocomplete_data.js
//content.atomz.com/xxxxx/stage/autocomplete_styles.css to //content.atomz.com/xxxxx/publish/autocomplete_styles.css

Change the action to point to live URL
<action>http://stage.xxxxx.guided.ss-omtrdc.net</action> to <action>http://xxxxx.guided.ss-omtrdc.net</action>

e.g - this will be different based on your S&P configuration

<searchform>
 <autocomplete>
 <enabled>1</enabled>
 <css><![CDATA[<link rel="stylesheet" type="text/css" href="//content.atomz.com/xxxxxx/publish/autocomplete_styles.css?sp_css_param=1" />]]></css>
 <form-content><![CDATA[<div id="autocomplete"></div>]]></form-content>

 <javascript><![CDATA[<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/utilities/utilities.js" ></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/datasource/datasource-min.js" ></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/autocomplete/autocomplete-min.js"></script>
<script type="text/javascript" src="//content.atomz.com/xxxxxx/publish/autocomplete_data.js?sp_js_param=5"></script>]]></javascript>
 </autocomplete> <tnt> <enabled>0</enabled> <form-content><![CDATA[<div id="tntMBox"></div>]]></form-content> <javascript><![CDATA[<script type="text/javascript">
(function(){var searchTextBoxId='q';var mboxContainerId='tntMBox';var mboxName='searchParamMbox';function removeEventSimple(obj,evt,fn)
{if(obj.removeEventListener)
obj.removeEventListener(evt,fn,false);else if(obj.detachEvent)
obj.detachEvent('on'+evt,fn);}
function addEventSimple(obj,evt,fn)
{if(obj.addEventListener)
obj.addEventListener(evt,fn,false);else if(obj.attachEvent)
obj.attachEvent('on'+evt,fn);}
function setSearchFormMbox()
{mboxDefine(mboxContainerId,mboxName);mboxUpdate('searchParamMbox');removeEventSimple(el,'keydown',setSearchFormMbox);}
var el=document.getElementById(searchTextBoxId);if(el)
addEventSimple(el,'keydown',setSearchFormMbox);})();</script>
]]></javascript> </tnt> <form>
 <name>searchform</name>
 <id>searchform</id>
 <action>http://xxxxxx.guided.ss-omtrdc.net</action>
 <inputs>
 <input>
 <type><![CDATA[text]]></type>
 <id><![CDATA[q]]></id>
 <name>q</name>
 <value></value>
 </input>
 <input>
 <type><![CDATA[submit]]></type>
 <value><![CDATA[Search]]></value>
 </input>
 </inputs>
 </form>
</searchform>

If the same S&P configuration with live option is enabled in any other server then copy and replace the value of searchformxml in /etc/cloudservices/search-promote/<<S&P Config Name>>/jcr:content

I have faced this issue in Adobe Experience Manager(AEM) 6.2 version


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.