Fancybox not fired when used in own productdetailstemplate

Posted by Community Admin on 05-Aug-2018 10:01

Fancybox not fired when used in own productdetailstemplate

All Replies

Posted by Community Admin on 05-Sep-2011 00:00

I have created my own detailstemplate. Basically copied the default and rearranged the fields. In my template the fancybox is not executed on productimages. Any help appreciated. Below is the template

<%@ Control Language="C#" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Modules.Ecommerce.Orders.Web.UI" TagPrefix="sfOrders" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Modules.Ecommerce.Catalog.Web.UI.Fields" TagPrefix="sfCatalog" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.ContentUI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Modules.Ecommerce.Catalog.Web.UI" Assembly="Telerik.Sitefinity" %>

<sf:ResourceLinks id="resourcesLinks" runat="server">
  <sf:ResourceFile JavaScriptLibrary="JQueryFancyBox"/>
<sf:ResourceLinks id="resourcesLinks2" runat="server" UseEmbeddedThemes="true" Theme="Default">
  <sf:ResourceFile Name="Telerik.Sitefinity.Resources.Themes.Basic.Styles.fancybox.css" Static="true" />

<sf:ConditionalTemplateContainer ID="conditionalTemplate"  runat="server">
        <sf:ConditionalTemplate Left="IsActive" Operator="Equal" Right="false" runat="server">
            <asp:Literal runat="server" Text="<%$Resources:OrdersResources, ProductNotAvailable %>" />

        <sf:ConditionalTemplate Left="IsActive" Operator="Equal" Right="true" runat="server">
            <div class="sfproductDetails sfClearfix">
                              <div class="sfproductInfoWrp">
                    <h1 class="sfproductTitle"><asp:Literal ID="productTitle" runat="server" /></h1>

                        <div class="sfproductDescription"><asp:Literal ID="productDescription" runat="server" /></div>

                    <div class="sfproductPrice">
                        <sfCatalog:DisplayPriceField ObjectType="Product" id="displayPriceField" runat="server" />

                                   <sfOrders:AddToCartWidget id="addToCartWidget" runat="server" />

                 <div class="sfproductImgsWrp">
                    <div class="sfproductImgsListWrp">
                     <div class="sfproductMainImgWrp">
                                           <asp:HyperLink runat="server" ID="mainProductImage" class="sfproductImgLnk" /> </div>

                    <ul class="sfproductImgsList">
                    <asp:Repeater runat="server" ID="otherProductImages">
                            <li class="sfproductImgWrp">
                                <a href='<%# DataBinder.Eval(Container.DataItem, "Url") %>' rel="fancybox" class="sfproductImgLnk">
                                    <asp:Image CssClass="sfproductImg" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "ThumbnailUrl") %>'  />


Posted by Community Admin on 05-Sep-2011 00:00
Hi Richard,

I think you forgot to hook up Fancybox to the a href. Just before you close your <sf:conditionalTemplate> you should have something like this:

<script type="text/javascript">
    $(function ()
        $("a[rel=fancybox]").fancybox( titleShow: false );

Success ermee

Posted by Community Admin on 06-Sep-2011 00:00
Hi Jochem,

thanks for your reply. Still not workable, somehow after changing/customizing the template it seems the fancybox recources are not triggered. I did a restore on the original template of the productdetails and that's not working anymore either.

Note the image gallery still works and it uses the same embedded resource files so any help from telerik in this is highly appreciated.

best regards,


Dank je wel Jochem
Posted by Community Admin on 06-Sep-2011 00:00
Hi Richard,

I'm reasonably sure that your problem has to do with the template editor, which now strips out inline script tags from templates. One way to confirm whether this is the problem is to add an inline script tag to your template, save the changes, and then view the template again. If the tags are missing after that, then its the template editor doing it. The default template for the products detail view for the 4.2 release uses inline scripts to setup up Fancybox, so the default template might not work anymore because the script tags were stripped.

Posted by Community Admin on 06-Sep-2011 00:00
Hi Tom,

thanks for your reply. This seems to be the case, any ideas on how to solve this or create a workaround.

Best regards,

Posted by Community Admin on 06-Sep-2011 00:00
Hi Richard,

Unfortunately I don't. The only way I've been able to fix the default template for the products detail view is by re-installing Sitefinity. As for creating a template with inline scripts, I'm not sure you'll be able to using the built-in template editor.

This isn't an ecommerce only problem (everything that uses the template editor is affected by this) so I would recommend re-posting this in the more general, "Developing for Sitefinity" area, as it might draw the attention of someone who knows more about this than I. Sorry I couldn't be of more help.

Posted by Community Admin on 07-Sep-2011 00:00
Hey Richard,

I totally agree with Tom on reposting this in the general bug & issues forum or the Developing with Sitefinity forum, I've taken much of the support fun out of the ecommerce section last month with all my posts :) and he's right, it's not limited to product templates.

Hadn't thought of the inline scripts being stripped out of the editor but totally re-installing Sitefinity is a bad to drastic. There's a dirty workaround to fix it by going into SQL Management Studio and edit the template inside the db.

Just create your new template, fire up SSMS and browse the [sf_presentation_data] table. Somewhere in the middle you'll find your template with the html stored in the [dta] column. Copy it out to Notepad, add the inline statements and paste it back.

Normally I wouldn't suggest messing around with the db directly, but in cases like this where the only alternative is to start completely over, I think it's fair game.

Posted by Community Admin on 08-Sep-2011 00:00
Thank you both for the answer. Copied the thread to bugs as suggested. Doing the trick in ssme worked so far.

Jochem by any chance did you already create a new paymentprocessor for IDeal? Or does anybody know how to create a new paymentprocessor  besides the ones installed/


Posted by Community Admin on 08-Sep-2011 00:00
Hey Richard,

To be honest I'm holding out on customization/dev for ecommerce till the next SP at least...

We are planning to add multiple language support for catalogs in Sitefinity 4.3 and tax implementation is changing in SP release which will address some of your concerns. "

Is a recent support quote and I'm still having issues with prices not being calculated correctly (

So I'm waiting till things turn a bit more stable, but perhaps in the future you, Daniel & me could stick our heads together and see what we come up with.

This thread is closed