Overview
Review our customization policy for the CIMcloud platform before making changes.
With Custom Code, you can add it to any pages besides the following:
- Portal Login
- Worker Portal Login
- Settings / Configuration pages in the Worker Portal
- Checkout Pages
- Showcart
- Account
- Payment
For catalog pages, you can override our Core Knockout JS templates:
- Search Results / Category Pages (pc_combined_results.asp)
- Product Detail Page (pc_product_detail.asp)
Examples with Code
Modifying SKU Label on Product Detail
Display additional fields on the Product Detail page
Redesign the Product Detail Page
Finding Knockout Templates on Catalog Pages
Catalog Pages are comprised of core Knockout JS templates, which are essentially sections of markup with variables. Templates can contain other templates within them as well.
Important Notes:
- Any overrides to Core Templates will no longer receive CIMcloud Core product updates
- Your override replaces the template used in our core product
- Our Product Release articles will identify any changes to templates going forward, please review this for any conflicts to your Custom Code when updating site’s version
- It is imperative that you override the most-specific Core Template due to the above.
- For example, if you wanted to add a message below the Product Name on the Search Results page:
- There is a template ID for catalog.product_card
- If you want to add a message below the name, you could do this by overriding catalog.product_card with your new message
- However, it would be better to override the catalog.name_link here since it has less chance of missing important updates since it is more specific compared to its parent’s template
- For example, if you wanted to add a message below the Product Name on the Search Results page:
Overriding Knockout Templates for Catalog Pages
Once you have identified the template you would like to override, here are the steps to override it:
- Login to the Worker Portal
- Impersonate a Contact to view the sitefront with the “Customize” badge
- Head to the catalog page you would like to override a template for (Product Detail or Search Results)
- Inspect the element you would like to override in Developer Tools
- Note: On Search Results, you may want to add additional information to all products in the results. You only need to copy the template of one product, since it is reused for each product displayed
- Find the name of the template ID with the format: <!– ko template: ‘template_category.template_section’ –>
- For example: <!– ko template: ‘catalog.name_link’ –>
- Use the finder to get the <script> of that template ID, or “View Page Source” to find it more easily
- For example:
-
<script type=”text/html” id=”catalog.name_link”><a class=”detail_link” data-bind=”attr: { href: link, title: utils.decodeHTML(name()), ‘data-key’: key }, html: name”></a></script>
-
- For example:
- Copy the entire template, including it’s script tags
- Click the “Customize” badge in the Lower Left
- Paste your template into Custom Code (Header or Footer will work), adding “_custom” to the template ID to override the Core Template
- Example:
-
<script type=”text/html” id=”catalog.name_link_custom”><a class=”detail_link” data-bind=”attr: { href: link, title: utils.decodeHTML(name()), ‘data-key’: key }, html: name”></a></script>
-
- Example:
CIMcloud Helpers
There are a variety of helpers that you can use within Custom Code. Please visit our CIMcloud Helpers article for more information around this implementation.