How to remove the ShortDescription From OneVarient.ascx in NopCommerce 1.6

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
Does anybody have a description of how to disable the short description literal from a template page such as Products/OneVariant.ascx, or Categories/ProductsInGrid.ascx?

I've been trying to disable the ShortDescription literal in Templates\Products\OneVariant.ascx, and when I do so by commenting the line for either the short description div, or the asp:literal,  the page throws an error stating object references not set to an instance instance of the object; and the stack trace refers back to the .cs page with line numbers for the short description literal.

I want to keep the short description available for other view options, but for the one varient, I'd like to take it out of the view.

I've also tried setting the visible property for the control to false, or the visibility property of the div style to hidden, but that simply hides the view, and the control is still present in the background as it continues to extend the container lengths for the content.

Thanks in advance for any help!
13 years ago
Hi,

find and comment out (bold)
        protected void BindProductInfo(Product product)
        {
            lProductName.Text = Server.HtmlEncode(product.LocalizedName);
//            lShortDescription.Text = product.LocalizedShortDescription;
            lFullDescription.Text = product.LocalizedFullDescription;
            //manufacturers



you will need to recompile the solution after this change
tested :)



if you don't want to change the codebehind, you can always cheat and move the hidden div  to the bottom of the page
eg move

            <div class="shortdescription" style="visibility:hidden;" >
                <asp:Literal ID="lShortDescription" runat="server" />
</div>

past everything else
13 years ago
Thank you for your reply!

Unfortunately, commenting the CS code produces the same "object reference not set to an instance.." error as I previously mentioned.

The location for the lines of code:

[code]        protected void BindProductInfo(Product product)
        {
            lProductName.Text = Server.HtmlEncode(product.LocalizedName);
//            lShortDescription.Text = product.LocalizedShortDescription;
            lFullDescription.Text = product.LocalizedFullDescription;
            //manufacturers [code]

is found in :  Templates/Products/OnVarient.ascx.cs;

and the lShortDescription.text is found in five locations:
Modules\ProductEmailAFriend.ascx.cs; Modules\ProductBox2.ascx.cs; Modules\ProductBox1.ascx.cs; Modules\ProductInfo.ascx.cs;Templates\Products\OneVariant.ascx.cs; based on search and find within VS 2008.

Commenting the line lShortDescription.text will compile without any errors; and the project can be run until an attempt to view a page with the onevarient short description, which then bombs with the object not set to an instance error, and always refers back to the templates\products\OneVarient.ascx.cs file.

Interestingly, the stack trace shows a path that does not exist on my machine: F:\Temp\Test\nopCommerce 1.60\NopCommerceStore\Templates\Products\OneVariant.ascx.cs:46,  as the offending file.

It may be important to note that from the source code I've only adopted the store solution (NopCommerceStore), and not included any of the other source files. I've created a folder with a unique name - not NopCommerceStore -- and have placed all of the content from the NopCommerceStore folder into the new folder. Yet it seems the solution is compiling to a temporary folder outside of the directory I've established.

This issues seem odd, but if you have any idea what may be happening please let me know!

The Website actually runs great, I haven't had any issues outside of my attempts to remove the short description from  a couple of locations.

Hiding and moving the div with the short description does not resolve this issue, as simply hiding it does not remove the content of the short description - which has size -- and therefore interferes with the layout of the page it is on.

Thank you again for any help you may be able to lend!
13 years ago
my apologies, I wasn't clear

if you comment out the cs code, you must also remove the reference to it in the ascx file

            <div class="shortdescription" style="visibility:hidden;" >
                <asp:Literal ID="lShortDescription" runat="server" />
</div>
13 years ago
[quote=haydie]my apologies, I wasn't clear

if you comment out the cs code, you must also remove the reference to it in the ascx file

            <div class="shortdescription" style="visibility:hidden;" >
                <asp:Literal ID="lShortDescription" runat="server" />
</div>[/quote

Hi and thank you for your comment.

No need for appologies! I have been doing so all along. As a matter of fact, commenting the literal is what causes the exception. Changing the cs code behind has no effect, even after a build.
13 years ago
Instead of removing stuff and causing issues, why not just set the text to nothing and just have an empty literal there?

Change:
 lShortDescription.Text = product.LocalizedShortDescription;

to:
 lShortDescription.Text = string.Empty;
13 years ago
Hi and thank you for the suggestion!

So, the idea is to have the short description available for use in locations deemed necessary, but removed where not required.

In one of our projects, the short description actually contains a significant amount of information that's useful on the single product varient page, but not needed on the categories.productsInGrid view.

It's also part of the "email to a friend" control as well.

So the idea is to provide the short description in the product page setup, but manage exactly where it appears on the website.

For the time being, we have removed the text of the short description completely, which seems to be the only way to prevent it from appearing otherwise.

Thank you again!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.