Basket Image Should Be Of Version, When Available

Posted By shulemj Thu 30 Jun 2016
Add to Favorites1
Author Message
shulemj
 Posted Thu 30 Jun 2016
Supreme Being

Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)

Group: Forum Members
Last Active: Thu 11 Jul 2019
Posts: 115, Visits: 565
Showing a little image near each item is a very nice feature (enabled via config:frontend.basket.showimages).

However, it would be a lot more attractive if the image would be pulled from the version (if product has more than one version and the version has an image; If not, it should fall back to the product.)

So I realize that Front/BasketView.ascx is using Templates/ProductTemplateImageOnly.ascx. ProductTemplateImageOnly is also used by "recent products", so I wouldn't dare manipulate it.


I was thinking that I should replicate it (along with the code-behind), and create the custom conditions, but don't know the how-to specifics.


Can anyone steer me in the right direction from here? (Or, maybe tell me that I'm playing with the wrong tools...)
shulemj
 Posted Tue 13 Sep 2016
Supreme Being

Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)

Group: Forum Members
Last Active: Thu 11 Jul 2019
Posts: 115, Visits: 565
Anyone else who wants to see this feature implemented?
Tiggywiggler
 Posted Tue 13 Sep 2016
Supreme Being

Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)

Group: Forum Members
Last Active: Mon 6 Dec 2021
Posts: 235, Visits: 750
Yes, this would be good. You could reproduce the control and then customise it as required. The way to copy the control would be to grab the files and copy them over to the new location (inside ~/UserControls/Custom/) and then change the name of the file to whatever you want (e.g. MyCustomImageControl).

The you need to change the two references to the Module name and code behind name in the control, and then the reference to the code module in the code behind. For example, using the control you talked about (not sure which control would be best, some investigation would be required):

In the design:
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ProductTemplateImageOnly.ascx.vb"
Inherits="ProductTemplateImageOnly" %>


Becomes

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="MyCustomImageControl.ascx.vb"
Inherits="MyCustomImageControl" %>


and in the code behind:
Inherits System.Web.UI.UserControlPartial Class ProductTemplateImageOnly

Becomes

Inherits System.Web.UI.UserControlPartial Class MyCustomImageControl


That should compile okay, after that you simply replace the reference to ProductTemplateImageOnly with a reference to MyCustomImageControl wherever you want to use it(e.g. BasketView) and then modify MyCustomImageControl to do what you want.


We are always willing to help out the community or pitch in to help you fix a problem. However, if you want a complete solution made such as a code module or new feature added you have two options. Either
1) Reach out to the Kartris internal development team at http://www.kartris.com/Contact.aspx.
2) Contact one of the Kartris approved partners at http://www.kartris.com/t-Worldwide-Developers.aspx.

Have fun and good luck coding.
Tue 13 Sep 2016 by Tiggywiggler
shulemj
 Posted Tue 13 Sep 2016
Supreme Being

Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)

Group: Forum Members
Last Active: Thu 11 Jul 2019
Posts: 115, Visits: 565
You are overestimating me. I really don't know half the terms you mentioned.

I was rather hoping that Kartris would implement it in the next update.
shulemj
 Posted Wed 14 Sep 2016
Supreme Being

Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)

Group: Forum Members
Last Active: Thu 11 Jul 2019
Posts: 115, Visits: 565
Okay, I played around and tried to follow your instructions. This is the error:

Please note that the name of my new UC is ProductTemplateImageSpecific.


-----------------------------------------------------------------------------
>> Unhandled Error occurred in Page:http://www.malchutjudaica.com/Basket.aspx
-----------------------------------------------------------------------------
>> 9/13/2016 4:31:45 PM
>> Version:2.9005
>> URL:http://www.malchutjudaica.com/Basket.aspx
>> 47.16.211.251
>> DESCRIPTION:
System.Web.HttpParseException (0x80004005): Unknown server tag 'userTongueroductTemplateImageSpecific'. ---> System.Web.HttpParseException (0x80004005): Unknown server tag 'userTongueroductTemplateImageSpecific'. ---> System.Web.HttpParseException (0x80004005): Unknown server tag 'userTongueroductTemplateImageSpecific'. ---> System.Web.HttpException (0x80004005): Unknown server tag 'userTongueroductTemplateImageSpecific'.
at System.Web.UI.TemplateParser.ProcessError(String message)
at System.Web.UI.TemplateParser.ProcessBeginTag(Match match, String inputText)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ProcessException(Exception ex)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
at System.Web.UI.TemplateParser.ParseInternal()
at System.Web.UI.TemplateParser.Parse()
at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate)
at System.Web.UI.BaseTemplateParser.GetReferencedType(VirtualPath virtualPath, Boolean allowNoCompile)
at System.Web.UI.BaseTemplateParser.GetUserControlType(VirtualPath virtualPath)
at System.Web.UI.MainTagNameToTypeMapper.ProcessUserControlRegistration(UserControlRegisterEntry ucRegisterEntry)
at System.Web.UI.MainTagNameToTypeMapper.TryUserControlRegisterDirectives(String tagName)
at System.Web.UI.TemplateParser.ProcessException(Exception ex)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
at System.Web.UI.TemplateParser.ParseInternal()
at System.Web.UI.TemplateParser.Parse()
at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
at System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path)
at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

==================================================




shulemj
 Posted Wed 14 Sep 2016
Supreme Being

Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)

Group: Forum Members
Last Active: Thu 11 Jul 2019
Posts: 115, Visits: 565
Okay, I played around and tried to follow your instructions. This is the error:

Please note that the name of my new UC is ProductTemplateImageSpecific.


-----------------------------------------------------------------------------
>> Unhandled Error occurred in Page:http://www.malchutjudaica.com/Basket.aspx
-----------------------------------------------------------------------------
>> 9/13/2016 4:31:45 PM
>> Version:2.9005
>> URL:http://www.malchutjudaica.com/Basket.aspx
>> 47.16.211.251
>> DESCRIPTION:
System.Web.HttpParseException (0x80004005): Unknown server tag 'userTongueroductTemplateImageSpecific'. ---> System.Web.HttpParseException (0x80004005): Unknown server tag 'userTongueroductTemplateImageSpecific'. ---> System.Web.HttpParseException (0x80004005): Unknown server tag 'userTongueroductTemplateImageSpecific'. ---> System.Web.HttpException (0x80004005): Unknown server tag 'userTongueroductTemplateImageSpecific'.
at System.Web.UI.TemplateParser.ProcessError(String message)
at System.Web.UI.TemplateParser.ProcessBeginTag(Match match, String inputText)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ProcessException(Exception ex)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
at System.Web.UI.TemplateParser.ParseInternal()
at System.Web.UI.TemplateParser.Parse()
at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate)
at System.Web.UI.BaseTemplateParser.GetReferencedType(VirtualPath virtualPath, Boolean allowNoCompile)
at System.Web.UI.BaseTemplateParser.GetUserControlType(VirtualPath virtualPath)
at System.Web.UI.MainTagNameToTypeMapper.ProcessUserControlRegistration(UserControlRegisterEntry ucRegisterEntry)
at System.Web.UI.MainTagNameToTypeMapper.TryUserControlRegisterDirectives(String tagName)
at System.Web.UI.TemplateParser.ProcessException(Exception ex)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
at System.Web.UI.TemplateParser.ParseInternal()
at System.Web.UI.TemplateParser.Parse()
at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
at System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path)
at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

==================================================




Tiggywiggler
 Posted Thu 15 Sep 2016
Supreme Being

Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)

Group: Forum Members
Last Active: Mon 6 Dec 2021
Posts: 235, Visits: 750
You are missing the final step, which is to add a reference to the new control. You should already see an existing Register command towards the top of the page so you should know where to put the new one. Under the existing one should be fine.

At the top of the page where you wish to use this new control (e.g. BasketView.ascx) add a reference like this:

<%@ Register TagPrefix="user" TagName="ProductTemplateImageSpecific" Src="~/UserControls/Custom/ProductTemplateImageSpecific.ascx" %>

so that when you use the term <userTongueroductTemplateImageSpecific ID="UC_ProductTemplateImageOnly" runat="server" />

It knows what to look for.


We are always willing to help out the community or pitch in to help you fix a problem. However, if you want a complete solution made such as a code module or new feature added you have two options. Either
1) Reach out to the Kartris internal development team at http://www.kartris.com/Contact.aspx.
2) Contact one of the Kartris approved partners at http://www.kartris.com/t-Worldwide-Developers.aspx.

Have fun and good luck coding.
Thu 15 Sep 2016 by Tiggywiggler
shulemj
 Posted Fri 16 Sep 2016
Supreme Being

Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)

Group: Forum Members
Last Active: Thu 11 Jul 2019
Posts: 115, Visits: 565
Your last message helped, but it seems that I cannot reach the Version ID, as Eval("V_ID"), Eval("Version_ID"), Eval("BV_VersionID") all throw error "DataBinding: 'Kartris.BasketItem' does not contain a property with the name"
Tiggywiggler
 Posted Sat 17 Sep 2016
Supreme Being

Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)Supreme Being - (120,478 reputation)

Group: Forum Members
Last Active: Mon 6 Dec 2021
Posts: 235, Visits: 750
Well the important, and positive, thing to see here is that you now have a working custom control which will allow you to start building the control that you desire. This is a great first step and you should take great joy in such progress Smile

Have you tried Eval("VersionID")?


We are always willing to help out the community or pitch in to help you fix a problem. However, if you want a complete solution made such as a code module or new feature added you have two options. Either
1) Reach out to the Kartris internal development team at http://www.kartris.com/Contact.aspx.
2) Contact one of the Kartris approved partners at http://www.kartris.com/t-Worldwide-Developers.aspx.

Have fun and good luck coding.
shulemj
 Posted Sun 18 Sep 2016
Supreme Being

Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)Supreme Being - (58,825 reputation)

Group: Forum Members
Last Active: Thu 11 Jul 2019
Posts: 115, Visits: 565
Yes!!! You did it! It worked! Thank you so much.

You created a monster...

I have a issue though. I added two versions to the cart: one with a image set for the version and another with only an image on the product. The version with set image shows nicely, while the version with an image only on product doesn't show at all.

My code should've pulled the product's image when version doesn't have an image:
          If dirFolderVers.GetFiles().Length < 1 Then
For Each objFile In dirFolder.GetFiles()
strImageLinkPath = CkartrisBLL.WebShopURL & "Image.aspx?strFileName=" & objFile.Name & "&amp;strItemType=" & strItemType & "&amp;numMaxHeight=" & KartSettingsManager.GetKartConfig("frontend.display.images.minithumb.height") & "&amp;numMaxWidth=" & KartSettingsManager.GetKartConfig("frontend.display.images.minithumb.width") & "&amp;numItem=" & litProductID.Text & "&amp;strParent=0"
strImageTag = "<a href=""" & strNavigateURL & """><img alt=""" & litP_Name.Text & """ src=""" & strImageLinkPath & """ /></a>"
Exit For
Next
Else
For Each objFile In dirFolderVers.GetFiles()
strImageLinkPath = CkartrisBLL.WebShopURL & "Image.aspx?strFileName=" & objFile.Name & "&amp;strItemType=" & strItemTypeVers & "&amp;numMaxHeight=" & KartSettingsManager.GetKartConfig("frontend.display.images.minithumb.height") & "&amp;numMaxWidth=" & KartSettingsManager.GetKartConfig("frontend.display.images.minithumb.width") & "&amp;numItem=" & litVersionID.Text & "&amp;strParent=" & litProductID.Text
strImageTag = "<a href=""" & strNavigateURL & """><img alt=""" & litP_Name.Text & """ src=""" & strImageLinkPath & """ /></a>"
Exit For
Next
End If


Instead, it shoes the 'no image available' dummy from the "Catch ex As Exception" labeled "NO IMAGES FOUND But folder found"


Why is it running into the catch?
Sun 18 Sep 2016 by shulemj

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top