Feature Pack 5 or later

Modifying dynamic Recipe URLs to contain desired input fields for constructing SEO-friendly URLs

Introduced in Feature Pack 3 The current Recipe URL page contains some parameters in its dynamic URL that is not compatible with constructing SEO -friendly URLs. In this section you modify the recipe page so that the current recipe implementation is maintained when constructing SEO-friendly URLs.

Procedure

  1. Navigate to Stores > WebContent > WEB-INF > config > com.mycompany.commerce.project
  2. Edit get-data-config.xml to define a new expression builder to retrieve ProjectCollection objects by their unique collectionId.
    1. Add the following code under the wcf:get-data-config object tag:
      <!-- Get Collections by their UniqueID -->
      	<expression-builder>
      		<name>getCollectionsByID</name>
      		<data-type-name>ProjectCollection</data-type-name>
      		<expression-template>{_wcf.ap=$accessProfile$}/ProjectCollection[ProjectCollectionIdentifier[(UniqueID='$collectionID$')]]</expression-template>
      		<param>
      			<name>accessProfile</name>
      			<value>MyCompany_Store_Details</value>
      		</param>
      	</expression-builder>
    2. Save and close the file.
  3. Navigate to Stores > WebContent > storedir > Widgets > RecipeCollection.
  4. Modify the RecipeCollection JSP files to pass a collection parameter into the Recipe URL and to remove the collectionName parameter from the page title and replace it by retrieving the information from a service request.
    1. Open RecipeCollection_Data.jsp and locate the following code:
      <wcf:url var="RecipeDisplayURL" patternName="RecipeDisplay" value="RecipeDisplay" >
      	<wcf:param name="project" value="${project.projectIdentifier.uniqueID}" />
      	<wcf:param name="langId" value="${langId}" />
      	<wcf:param name="storeId" value="${WCParam.storeId}" />
      	<wcf:param name="catalogId" value="${WCParam.catalogId}" />
      	<wcf:param name="collection" value="${param.collection}" />
      </wcf:url>
      replace it with the following code:
      <wcf:url var="RecipeDisplayURL" patternName="RecipeDisplay" value="RecipeDisplay" >
      	<wcf:param name="project" value="${project.projectIdentifier.uniqueID}" />
      	<wcf:param name="langId" value="${langId}" />
      	<wcf:param name="storeId" value="${WCParam.storeId}" />
      	<wcf:param name="catalogId" value="${WCParam.catalogId}" />
      	<wcf:param name="collection" value="${collection.projectCollectionIdentifier.uniqueID}" />
      </wcf:url>
    2. Open RecipeCollection_UI.jsp and locate the following code:
       <div id="RecipeCollectiontitle" class="Recipe_label_2">${param.collectionName}</div>
      replace it with the following code:
      <div id="RecipeCollectiontitle" class="Recipe_label_2">${collection.projectCollectionIdentifier.externalIdentifier.name}</div>