Help Creating New Module

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 年 前
Good Day,
              I am trying to create a new module that I can use to change the format and the information of the products displayed on the home page. (similar to the HomePageProducts module)

(I am using version 1.20)

I copied the HomePageProducts module and renamed it to UpcomingEvents and made the following changes to the code

--------------------------------------------------------------------------------------------------
UpcomingEvents.ascx
--------------------------------------------------------------------------------------------------
<%@ Control Language="C#" AutoEventWireup="true"
    Inherits="NopSolutions.NopCommerce.Web.Modules.UpcomingEventsControl" Codebehind="UpcomingEvents.ascx.cs" %>



------------------------------------------------------------------------------------------------
UpcomingEvents.ascx.cs
------------------------------------------------------------------------------------------------
Changed the line

public partial class HomepageProductsControl : BaseNopUserControl
    {

to

public partial class UpcomingEventsControl : BaseNopUserControl
    {



---------------------------------------------------------------------------------------------------
UpcomingEvents.ascx.designer.cs
---------------------------------------------------------------------------------------------------

changed the line

    public partial class HomePageProductsControl {

to

    public partial class UpcomingEventsControl {



and finally on the

-----------------------------------------------------------------------------------------------------
Default.aspx
-----------------------------------------------------------------------------------------------------

Added
<%@ Register TagPrefix="nopCommerce" TagName="UpcomingEvents" Src="~/Modules/UpcomingEvents.ascx" %>

    <nopCommerce:UpcomingEvents ID="ctrlUpcomingEvents" runat="server" />
    <div class="clear">
    </div>


I Rebuild the nopCommerceStore

and copy the files the version I have installed online (used the no_source version to deploy)

When I go to the home page I get the following error

----------------------------------------------------------------------------------------------------------
Could not load type 'NopSolutions.NopCommerce.Web.Modules.UpcomingEventsControl'.

What am I doing wrong?
14 年 前
Anyone Created a new module yet?
I tried following some tutorials creating user controls, but still isn't working, anyone have any idea?
14 年 前
Hi,

I think you are not recompiling the code properly are you using visual studio? what you are doing looks correct.

mike..
14 年 前
Hi Mike,
            Thanks a lot for your response, I just figured out what I was doing wrong.

In case any of you had the same problem the mistake I was making is that I copied across the new User Control (.ascx file) but I did not update the files in /bin folder.

After you recompile and publish some of the files in the /bin folders may also be updated, so you must remember to copy across those files as well.

Again Mike, thanks a lot for your assistance.

I at least hope that this post may help someone else in case they make the same error.

Shawn
14 年 前
I am using 1.40 and having the same issue.

Getting Error:

Parser Error Message: 'NopSolutions.NopCommerce.Web.Modules.ProductGridAdd' is not allowed here because it does not extend class 'System.Web.UI.UserControl'.

Source Error:


Line 1:  <%@ Control Language="C#" AutoEventWireup="true" Inherits="NopSolutions.NopCommerce.Web.Modules.ProductGridAdd" CodeBehind="ProductGridAdd.ascx.cs" %>
Line 2:  <%@ Register TagPrefix="nopCommerce" TagName="SimpleTextBox" Src="~/Modules/SimpleTextBox.ascx" %>
Line 3:  <%@ Register TagPrefix="nopCommerce" TagName="NumericTextBox" Src="~/Modules/NumericTextBox.ascx" %>


Source File: /Modules/ProductGridAdd.ascx    Line: 1


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4016


I followed the same procudures as in this Forum thread except my Control name is ProductGridAdd...

Any ideas were to look for the issue would be welcome.

Thanks, Vince
14 年 前
Forget it - As previous post it was a mistake on my part.  Spelling error in CS page...
14 年 前
Its those case sensitive names again isn't it!
14 年 前
You've got it!  Very Frustrating but sticking with it.

Hours waisted with the case sensitivity...

I think I am going to try creating that custom ProductVariantGrid so far so good once I got past this error!
14 年 前
Visual Studio should "red squiggely" any errors with names so you really shouldn't have this issue.
14 年 前
Some reason it is not showing me until I compile it - then I look and it looks the same until I look REALLY close and see the Lowercase.

Thanks for the tip!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.