An error occurred while processing the template.
The following has evaluated to null or missing: ==> cpInstance [in template "20096#20121#1132728" at line 218, column 34] ---- Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${cpInstance.price} [in template "20096#20121#1132728" at line 218, column 32] ----
1<#--
2Widget templates can be used to modify the look of a
3specific application.
4
5Please use the right panel to quickly add commonly used variables.
6Autocomplete is also available and can be invoked by typing "${".
7-->
8<#if cpCatalogEntry??>
9<#assign
10 cpDefBookSettingService = serviceLocator.findService("com.bregroup.store.service.CPDefinitionBookSettingLocalService")
11 cpInstanceLocalService = serviceLocator.findService("com.liferay.commerce.product.service.CPInstanceLocalService")
12 assetCategoryService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService")
13 cpInstance = cpInstanceLocalService.fetchDefaultCPInstance(cpCatalogEntry.getCPDefinitionId())
14 categoryNames = assetCategoryService.getCategoryNames("com.liferay.commerce.product.model.CPDefinition", cpCatalogEntry.getCPDefinitionId())
15 cpMedias = cpContentHelper.getImages(cpCatalogEntry.getCPDefinitionId(), themeDisplay)
16 <#-- cpDefinitionVirtualSetting = virtualCPTypeHelper.getCPDefinitionVirtualSetting(cpCatalogEntry.getCPDefinitionId(), cpContentHelper.getDefaultCPInstance(request).getCPInstanceId()) -->
17 cpOptionCategories = cpContentHelper.getCPOptionCategories(themeDisplay.getCompanyId())
18 publishDate = ""
19 sampleViewURL = ""
20 commerceCartPortletURL = commerceOrderHttpHelper.getCommerceCartPortletURL(request)
21 isbn = ""
22 isArchived = false
23/>
24<#if categoryNames??>
25 <#if categoryNames?seq_contains("Archived") || categoryNames?seq_contains("Badged Archived")>
26 <#assign isArchived = true />
27 </#if>
28
29 </#if>
30<input id="cartURLField" name="cartURLField" type="hidden" value="${commerceCartPortletURL}" />
31<!-- START sampleViewURL -->
32<#if virtualCPTypeHelper?has_content>
33 <#if virtualCPTypeHelper.getCPDefinitionVirtualSetting(cpCatalogEntry.getCPDefinitionId(), cpContentHelper.getDefaultCPInstance(request).getCPInstanceId())?has_content>
34 <#assign
35 cpDefinitionVirtualSetting = virtualCPTypeHelper.getCPDefinitionVirtualSetting(cpCatalogEntry.getCPDefinitionId(), cpContentHelper.getDefaultCPInstance(request).getCPInstanceId())
36 />
37 <#if cpDefinitionVirtualSetting.sampleURL?has_content>
38 <#assign
39 sampleViewURL = cpDefinitionVirtualSetting.getSampleUrl()
40 />
41 <#else>
42 <#if cpDefinitionVirtualSetting.sampleFileEntryId?has_content>
43 <#if cpDefinitionVirtualSetting.sampleFileEntryId != 0>
44 <#assign
45 sampleViewURL = cpContentHelper.getDownloadFileEntryURL(cpDefinitionVirtualSetting.getSampleFileEntry(), themeDisplay)
46 sampleViewURL = stringUtil.replace(sampleViewURL, "&download=true", "")
47 />
48 </#if>
49 </#if>
50 </#if>
51 </#if>
52</#if>
53<!-- END sampleViewURL -->
54<#if cpDefBookSettingService.getCPDefinitionBookSetting("com.liferay.commerce.product.model.CPDefinition", cpCatalogEntry.getCPDefinitionId()) ?? >
55 <#assign
56 cpDefBookSetting = cpDefBookSettingService.getCPDefinitionBookSetting("com.liferay.commerce.product.model.CPDefinition", cpCatalogEntry.getCPDefinitionId())
57 isbn = cpDefBookSetting.ISBN
58 />
59 <#if cpDefBookSetting.getPublishDate() ?? >
60 <#assign publishDate = dateUtil.getDate(cpDefBookSetting.getPublishDate(), "dd-MMM-yyyy", locale) />
61 </#if>
62</#if>
63
64<!--[Start] BRE Bookstore -->
65<section class="c-product-header c-product-header--dark c-product-header--image-43">
66 <div class="container">
67 <div class="row no-gutters">
68 <div class="col-md-3">
69 <div class="c-product-header__frame">
70 <#if cpMedias?has_content>
71 <#list cpMedias as cpMedia>
72 <div class="c-product-header__image">
73 <img src="${cpMedia.getDownloadURL()}" alt="" class="img-fluid" />
74 </div>
75 </#list>
76 </#if>
77 <#--
78 <#if cpDefinitionVirtualSetting.getSampleUrl()?has_content>
79 <#assign
80 sampleViewURL = cpDefinitionVirtualSetting.getSampleUrl()
81 />
82 <#else>
83 <#assign
84 sampleViewURL = cpContentHelper.getDownloadFileEntryURL(cpDefinitionVirtualSetting.getSampleFileEntry(), themeDisplay)
85 sampleViewURL = stringUtil.replace(sampleViewURL, "&download=true", "")
86 />
87 </#if>
88 -->
89 <#if sampleViewURL?has_content>
90 <a href="${sampleViewURL}" class="c-button c-button--secondary c-button--secondary--dark w-100" target="_blank">View sample</a>
91 </#if>
92
93 </div>
94 </div>
95 <div class="col-md-9">
96 <div class="c-product-header__body">
97 <div class="c-product-header__category"><#list categoryNames as curCategory> ${curCategory}</#list></div>
98 <h2 class="c-product-header__title">${cpCatalogEntry.getName()}</h2>
99 <p class="c-product-header__text">${cpCatalogEntry.getShortDescription()}</p>
100 </div>
101 <#-- Specifications Start -->
102 <#if cpOptionCategories?has_content>
103 <div class="c-attributes">
104 <div class="row">
105 <#list cpOptionCategories as cpOptionCategory>
106 <#if cpOptionCategory.getKey() == "book">
107 <#assign categorizedCPDefinitionSpecificationOptionValues = cpContentHelper.getCategorizedCPDefinitionSpecificationOptionValues(cpCatalogEntry.getCPDefinitionId(), cpOptionCategory.getCPOptionCategoryId()) />
108 <#if categorizedCPDefinitionSpecificationOptionValues?has_content>
109 <#list categorizedCPDefinitionSpecificationOptionValues as cpDefinitionSpecificationOptionValue>
110 <div class="col-4 col-lg-auto">
111 <#assign cpSpecificationOption = cpDefinitionSpecificationOptionValue.getCPSpecificationOption() />
112 <div class="c-attribute">
113 <div class="c-attribute__label">${htmlUtil.escape(cpSpecificationOption.getTitle(languageUtil.getLanguageId(locale)))}</div>
114 <div class="c-attribute__value">${htmlUtil.escape(cpDefinitionSpecificationOptionValue.getValue(languageUtil.getLanguageId(locale)))}</div>
115 </div>
116 </div>
117 </#list>
118 </#if>
119 </#if>
120 </#list>
121 <div class="col-4 col-lg-auto">
122 <div class="c-attribute">
123 <div class="c-attribute__label">Published Date</div>
124 <div class="c-attribute__value">${publishDate}</div>
125 </div>
126 </div>
127 <div class="col-4 col-lg-auto">
128 <div class="c-attribute">
129 <div class="c-attribute__label">ISBN</div>
130 <div class="c-attribute__value">${htmlUtil.escape(isbn)}</div>
131 </div>
132 </div>
133 </div>
134 </div>
135 </#if>
136 <#-- Specifications End -->
137 </div>
138 </div>
139 </div>
140</section>
141<!--[End] BRE Bookstore -->
142
143<!--[Start] Main container -->
144<section class="c-section c-section--gray-f5 c-section--ptb-32">
145 <div class="container">
146 <div class="row">
147 <div class="col-md-8">
148 <div class="c-accordian c-accordian--bookshop c-accordian--list c-accordian--default">
149 <div class="accordion" id="productDetail">
150 <div class="card">
151 <div class="card-header">
152 <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#productDescription">
153 ${languageUtil.get(request, "book-description")}
154 </button>
155 </div>
156
157 <div id="productDescription" class="collapse show" data-parent="#productDetail">
158 <div class="card-body">
159 <#if isArchived>
160 <div>
161 <p>
162 <strong>THIS PUBLICATION HAS BEEN ARCHIVED.</strong>
163 </p>
164 <p style="font-style: italic;">
165 Whilst this publication can still be purchased some of the information in it has been superseded by more recent research and standards. The BRE Group does not accept any responsibility whatsoever for any loss or damage, including - without limitation - indirect or consequential loss or damage arising from use, or loss of use, of data or profits arising out of, or in connection with, the use of this document.
166 </p>
167 </div>
168 </#if>
169 ${cpCatalogEntry.getDescription()}
170 <#if cpInstance.purchasable?string('yes', 'no') == "no">
171 <br/>
172 <i>If you are interested in this publication - please contact the BRE Bookshop and provide your registered email address.</i>
173 </#if>
174
175 </div>
176 </div>
177 </div>
178 </div>
179 </div>
180 </div>
181 <div class="col-md-4">
182 <!--[Start] Booking card -->
183 <div class="c-booking-card">
184 <div class="c-booking-card__category"><#list categoryNames as curCategory> ${curCategory}</#list></div>
185 <h3 class="c-booking-card__title">${cpCatalogEntry.getName()}</h3>
186 <div class="c-booking-card__price">
187 <#if cpInstance.price == 0>
188 <span class="price compact"><span class="price-value"> Free </span> </span>
189 <#else />
190 <@liferay_commerce_ui["price"] compact=true CPCatalogEntry=cpCatalogEntry />
191 ${languageUtil.get(request, "plus-vat")}
192 </#if>
193 </div>
194 <!-- <a href="" class="c-button c-button--primary w-100">Add to cart</a> -->
195 <div class="c-booking-card__button" onclick="dataLayer.push({event: 'add_to_cart', ecommerce: {currency: 'GBP',value: ${cpInstance.price},item_list_id: 'bookshop_add_to_cart',item_list_name: 'Bookshop add to cart',items: [{item_name: '${cpCatalogEntry.getName()}',item_category: 'Bookshop',item_id: '${cpCatalogEntry.getCPDefinitionId()}', price:${cpInstance.price}}]},bre_user_id : '${themeDisplay.isSignedIn()?then(themeDisplay.getUserId(),'Guest')}'});">
196 <@liferay_commerce_ui["add-to-cart"] CPCatalogEntry=cpCatalogEntry />
197 </div>
198 </div>
199 </div>
200 <!--[End] Booking card -->
201 </div>
202 </div>
203 </div>
204</section>
205<!--[End] Main container -->
206</#if>
207<script>
208 Liferay.after('current-order-updated', () => {
209 var commerceCartPortletURL = document.getElementById("cartURLField").value;
210 window.location.href = commerceCartPortletURL;
211 });
212
213 dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.
214 dataLayer.push({
215 event: 'view_item',
216 ecommerce: {
217 currency: 'GBP',
218 value: ${cpInstance.price},
219 item_list_id: 'bookshop_view_item',
220 item_list_name: 'Bookshop view item',
221 items: [{
222 item_name: '${cpCatalogEntry.getName()}',
223 item_category: 'Bookshop',
224 item_id: '${cpCatalogEntry.getCPDefinitionId()}',
225 price: '${cpInstance.price}'
226 }]
227 },
228 bre_user_id: '${themeDisplay.isSignedIn()?then(themeDisplay.getUserId(),'Guest')}'
229 });
230</script>