An error occurred while processing the template.
The following has evaluated to null or missing: ==> cpInstance [in template "20096#20121#1132724" at line 199, 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#1132724" at line 199, 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 cpDefBookSetting = cpDefBookSettingService.getCPDefinitionBookSetting("com.liferay.commerce.product.model.CPDefinition", cpCatalogEntry.getCPDefinitionId())
12 cpInstanceLocalService = serviceLocator.findService("com.liferay.commerce.product.service.CPInstanceLocalService")
13 cpInstance = cpInstanceLocalService.fetchDefaultCPInstance(cpCatalogEntry.getCPDefinitionId())
14 cpMedias = cpContentHelper.getImages(cpCatalogEntry.getCPDefinitionId(), themeDisplay)
15 <#-- cpDefinitionVirtualSetting = virtualCPTypeHelper.getCPDefinitionVirtualSetting(cpCatalogEntry.getCPDefinitionId(), cpContentHelper.getDefaultCPInstance(request).getCPInstanceId()) -->
16 cpOptionCategories = cpContentHelper.getCPOptionCategories(themeDisplay.getCompanyId())
17 sampleViewURL = ""
18 commerceCartPortletURL = commerceOrderHttpHelper.getCommerceCartPortletURL(request)
19/>
20<input id="cartURLField" name="cartURLField" type="hidden" value="${commerceCartPortletURL}" />
21<!-- START sampleViewURL -->
22<#if virtualCPTypeHelper?has_content>
23 <#if virtualCPTypeHelper.getCPDefinitionVirtualSetting(cpCatalogEntry.getCPDefinitionId(), cpContentHelper.getDefaultCPInstance(request).getCPInstanceId())?has_content>
24 <#assign
25 cpDefinitionVirtualSetting = virtualCPTypeHelper.getCPDefinitionVirtualSetting(cpCatalogEntry.getCPDefinitionId(), cpContentHelper.getDefaultCPInstance(request).getCPInstanceId())
26 />
27 <#if cpDefinitionVirtualSetting.sampleURL?has_content>
28 <#assign
29 sampleViewURL = cpDefinitionVirtualSetting.getSampleUrl()
30 />
31 <#else>
32 <#if cpDefinitionVirtualSetting.sampleFileEntryId?has_content>
33 <#if cpDefinitionVirtualSetting.sampleFileEntryId != 0>
34 <#assign
35 sampleViewURL = cpContentHelper.getDownloadFileEntryURL(cpDefinitionVirtualSetting.getSampleFileEntry(), themeDisplay)
36 sampleViewURL = stringUtil.replace(sampleViewURL, "&download=true", "")
37 />
38 </#if>
39 </#if>
40 </#if>
41 </#if>
42</#if>
43<!-- END sampleViewURL -->
44
45<!--[Start] BRE Bookstore -->
46<section class="c-product-header c-product-header--dark c-product-header--image-43">
47 <div class="container">
48 <div class="row no-gutters">
49 <div class="col-md-3">
50 <div class="c-product-header__frame">
51 <#if cpMedias?has_content>
52 <#list cpMedias as cpMedia>
53 <div class="c-product-header__image">
54 <img src="${cpMedia.getDownloadURL()}" alt="" class="img-fluid" />
55 </div>
56 </#list>
57 </#if>
58 <#if sampleViewURL?has_content>
59 <a href="${sampleViewURL}" class="c-button c-button--secondary c-button--secondary--dark w-100" target="_blank">View sample</a>
60 </#if>
61
62 </div>
63 </div>
64 <div class="col-md-9">
65 <div class="c-product-header__body">
66 <div class="c-product-header__category">${languageUtil.get(request, cpCatalogEntry.getProductTypeName())}</div>
67 <h2 class="c-product-header__title">${cpCatalogEntry.getName()}</h2>
68 <p class="c-product-header__text">${cpCatalogEntry.getShortDescription()}</p>
69 </div>
70 <#-- Specifications Start -->
71 <#if cpOptionCategories?has_content>
72 <div class="c-attributes">
73 <div class="row">
74 <#list cpOptionCategories as cpOptionCategory>
75 <#if cpOptionCategory.getKey() == "book">
76 <#assign categorizedCPDefinitionSpecificationOptionValues = cpContentHelper.getCategorizedCPDefinitionSpecificationOptionValues(cpCatalogEntry.getCPDefinitionId(), cpOptionCategory.getCPOptionCategoryId()) />
77 <#if categorizedCPDefinitionSpecificationOptionValues?has_content>
78 <#list categorizedCPDefinitionSpecificationOptionValues as cpDefinitionSpecificationOptionValue>
79 <div class="col-4 col-lg-auto">
80 <#assign cpSpecificationOption = cpDefinitionSpecificationOptionValue.getCPSpecificationOption() />
81 <div class="c-attribute">
82 <div class="c-attribute__label">${htmlUtil.escape(cpSpecificationOption.getTitle(languageUtil.getLanguageId(locale)))}</div>
83 <div class="c-attribute__value">${htmlUtil.escape(cpDefinitionSpecificationOptionValue.getValue(languageUtil.getLanguageId(locale)))}</div>
84 </div>
85 </div>
86 </#list>
87 </#if>
88 </#if>
89 </#list>
90 <div class="col-4 col-lg-auto">
91 <div class="c-attribute">
92 <div class="c-attribute__label">Published Date</div>
93 <div class="c-attribute__value">
94 <#if cpDefBookSetting.getPublishDate() ??>
95 ${dateUtil.getDate(cpDefBookSetting.getPublishDate(), "dd-MMM-yyyy", locale)}
96 </#if>
97 </div>
98 </div>
99 </div>
100 <div class="col-4 col-lg-auto">
101 <div class="c-attribute">
102 <div class="c-attribute__label">ISBN</div>
103 <div class="c-attribute__value">${htmlUtil.escape(cpDefBookSetting.ISBN)}</div>
104 </div>
105 </div>
106 </div>
107 </div>
108 </#if>
109 <#-- Specifications End -->
110 </div>
111 </div>
112 </div>
113</section>
114<!--[End] BRE Bookstore -->
115
116<!--[Start] Main container -->
117<section class="c-section c-section--gray-f5">
118 <div class="container">
119 <div class="row">
120
121 <div class="col-md-8">
122
123 <div class="c-accordian c-accordian--bookshop c-accordian--list c-accordian--default" >
124 <div class="accordion" id="productDetail">
125 <div class="card">
126 <div class="card-header">
127 <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#productDescription">
128 ${languageUtil.get(request, "book-description")}
129 </button>
130 </div>
131
132 <div id="productDescription" class="collapse show" data-parent="#productDetail">
133 <div class="card-body">
134 ${cpCatalogEntry.getDescription()}
135 </div>
136 </div>
137 </div>
138
139 <#if cpDefBookSetting?has_content>
140 <div class="card">
141 <div class="card-header">
142 <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#productContents">
143 ${languageUtil.get(request, "content")}
144 </button>
145 </div>
146
147 <div id="productContents" class="collapse show" data-parent="#productDetail">
148 <div class="card-body">
149 ${cpDefBookSetting.getBookContent(locale)}
150 </div>
151 </div>
152 </div>
153 </#if>
154
155 </div>
156 </div>
157 </div>
158
159 <div class="col-md-4">
160
161 <!--[Start] Booking card -->
162 <div class="c-booking-card">
163 <div class="c-booking-card__category">${languageUtil.get(request, cpCatalogEntry.getProductTypeName())}</div>
164 <h3 class="c-booking-card__title">${cpCatalogEntry.getName()}</h3>
165 <div class="c-booking-card__price">
166 <#if cpInstance.price == 0>
167 <span class="price compact"><span class="price-value"> Free </span> </span>
168 <#else />
169 <@liferay_commerce_ui["price"] compact=true CPCatalogEntry=cpCatalogEntry />
170 ${languageUtil.get(request, "plus-vat")}
171 </#if>
172 </div>
173 <!-- <a href="" class="c-button c-button--primary w-100">Add to cart</a> -->
174 <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')}'});">
175 <@liferay_commerce_ui["add-to-cart"] CPCatalogEntry=cpCatalogEntry />
176 </div>
177 </div>
178 <!--[End] Booking card -->
179
180 </div>
181 </div>
182 </div>
183</section>
184<!--[End] Main container -->
185</#if>
186
187<script>
188 Liferay.after('current-order-updated', () => {
189 var commerceCartPortletURL = document.getElementById("cartURLField").value;
190 window.location.href = commerceCartPortletURL;
191 });
192
193 if(window.dataLayer){
194 dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.
195 dataLayer.push({
196 event: 'view_item',
197 ecommerce: {
198 currency: 'GBP',
199 value: ${cpInstance.price},
200 item_list_id: 'bookshop_view_item',
201 item_list_name: 'Bookshop view item',
202 items: [{
203 item_name: '${cpCatalogEntry.getName()}',
204 item_category: 'Bookshop',
205 item_id: '${cpCatalogEntry.getCPDefinitionId()}',
206 price: ${cpInstance.price}
207 }]
208 },
209 bre_user_id: '${themeDisplay.isSignedIn()?then(themeDisplay.getUserId(),'Guest')}'
210 });
211 }
212</script>