BANNERS Extension - Installing instructions

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 anni tempo fa
Hello all


Here is how to install the BANNERS Extension
https://www.nopcommerce.com/p/150/banners.aspx

Note: This tutorial is for version nopCommerce 1.80

{1} Coping Files
Copy the files to the following folders
A: Copy the folder Advertise to Libraris
http://mazad4q8.com/up/viewimages/5360dbde64.jpg

(1): Copy the content of Administration to NopCommerceStore\Administration

(2): Copy the content of Administration\Modules to NopCommerceStore\Administration\Modules

(3): Copy Banner.ascx, Banner.ascx.cs and Banner.ascx.designer.cs to NopCommerceStore\Modules

(4): Copy the file magicimage.js to NopCommerceStore\Scripts





{B} Adding the "Bsnners" to the admin menu

Edit the file Admin.sitemap and add the following code in <!-- Customers -->


<siteMapNode title="Manage Banners" url="~/administration/Banners.aspx" description="Manage Banners" nopResourceTitle="Admin.Sitemap.BannersTitle" nopResourceDescription="Admin.Sitemap.BannersDescription" />


Your code should look like this
http://mazad4q8.com/up/viewimages/bae81c3834.jpg


{C} Adding table to Database

(1): Run SQL Server Management Studio and run the following sql command
http://mazad4q8.com/up/viewimages/bbc1cfc405.jpg



CREATE TABLE [dbo].[Nop_Banner](
  [BannerID] [int] IDENTITY(1,1) NOT NULL,
  [Title] [nvarchar](50) NOT NULL,
  [URLLink] [nvarchar](250) NULL,
  [TargetLink] [nvarchar](20) NULL,
  [BannerBinary] [varbinary](max) NOT NULL,
  [Extension] [nvarchar](20) NOT NULL,
  [PositionName] [nvarchar](30) NULL,
  [Active] [bit] NOT NULL,
  [DisplayOrder] [int] NOT NULL,
  [CreatedOn] [datetime] NOT NULL,
  [UpdatedOn] [datetime] NULL,
CONSTRAINT [PK_Nop_Banner] PRIMARY KEY CLUSTERED
(
  [BannerID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO


INSERT INTO [dbo].[Nop_CustomerAction]
           ([Name]
           ,[SystemKeyword]
           ,[Comment]
           ,[DisplayOrder])
     VALUES
           ('Manage Banners'
           ,'ManageBanners'
           ,''
           ,400)

GO

INSERT INTO [dbo].[Nop_Setting]
           ([Name]
           ,[Value]
           ,[Description])
     VALUES
           ('Cache.BannerManager.BannersCacheEnabled'
           ,'false'
           ,'')
GO



GO




_________________________________


Then run this one :

_________________________________





INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.Banners.Title','Manage Banners')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.Banners.AddNewButton.Text','New')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.Banners.AddNewButton.Tooltip','New Banner')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.Banners.TitleName','Title')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.Banners.Type','Type')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.Banners.PositionName','Position')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.Banners.Active','Actived')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.Banners.DisplayOrder','Display Order')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.Banners.Edit','Edit')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.Banners.Edit.Tooltip','Edit this banner')

INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.Sitemap.BannersTitle','Banners')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.Sitemap.BannersDescription','Manager your Banners')

INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.Title','Details Banner')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.BackToBanners','back to list of banners')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.SaveButton.Text','Save')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.SaveButton.Tooltip','Save this banner')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.DeleteButton.Text','Delete')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.DeleteButton.Tooltip','Delete this banner')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.Title','Title:')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.Title.Tooltip','Title banner.')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.Title.ErrorMessage','Title banner is necessary.')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.UrlLink','Url Link:')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.UrlLink.Tooltip','This destination URL link for image banner.')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.TargetLink','Target Link:')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.TargetLink.Tooltip','Target destination for image banner.')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.FileUpload','Image:')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.FileUpload.Tooltip','Image banner.')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.FileUpload.ErrorMessage','File of image is necessary.')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.PositionName','Position Name:')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.PositionName.Tooltip','Use this field to group banners.')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.DisplayOrder','Display Order:')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.DisplayOrder.Tooltip','Use this for order for banner, Use same number for random.')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.DisplayOrder.RequiredErrorMessage','Number Display Order is necessary.')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.DisplayOrder.RangeErrorMessage','Valid range for this number is 0 to 99999')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.Active','Actived')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.Active.Tooltip','Status of banner for show in your store.')
INSERT INTO [dbo].[Nop_LocaleStringResource] ([LanguageID],[ResourceName],[ResourceValue]) VALUES (7,'Admin.BannerDetails.ShowFile','Show file')


Problem Note # 1 I have experenced some error here, i'll explain how i solve it in the end of this topic


{D} Edit NopModel.edmx
Double Click on NopModel.edmx
Right Click on Model Browser and select Update Model from Database...
http://mazad4q8.com/up/viewimages/52d9892332.jpg

You'll get the following window
http://mazad4q8.com/up/viewimages/2c393e56d2.jpg
Select Nop_Banner

You will get the following window
http://mazad4q8.com/up/viewimages/0846dfb298.jpg
Click on Next


Right click and Select Add and select Entity...
http://mazad4q8.com/up/viewimages/7c41b6fe66.jpg


Then in Entity name: enter Banner and in Entity Set enter Banners

Save and close

Problem Note # 2 I have faced some problems here i'll explain how i solve it in the end of this post





{D} Edit NopObjectContext.cs
Edit the file NopObjectContext.cs and add the following code
You will find it under nopCommerce_1.80_Source\Libraries\Nop.BusinessLogic\Data




/// <summary>
          /// Gets an Banner instance that is used to query, add, modify, and delete objects of the specified entity type.
          /// </summary>
          public ObjectSet<Banner> Banners
          {
              get
              {
                  if ((_banners == null))
                  {
                      _banners = CreateObjectSet<Banner>();
                  }
                  return _banners;
              }
          }
          private ObjectSet<Banner> _banners;

http://mazad4q8.com/up/viewimages/64c18b9101.jpg







Here I'll explane how i solved some of the problems that I have fased during the installation

Problem Note # 1
When I copied the hole sql command and ran it, i got an error, so I ran them sapretly as I separated them above



Problem Note # 2

For some reason I did not found the table (Nop_Banner) listed, I opened the file app.config under Nop.BusinessLogic and found that the connection string there was pointing to my sql express database, I coped the one which is inside connictionstring.config and pasted in the connection string starting from Data Source

The old one:

<connectionStrings>
    <add name="NopEntities" connectionString="metadata=res://*/Data.NopModel.csdl|res://*/Data.NopModel.ssdl|res://*/Data.NopModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ISAFA-PCONIMAC\SQLEXPRESS;Initial Catalog=AllAboutDB;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>


The new one:

<connectionStrings>
    <add name="NopEntities" connectionString="metadata=res://*/Data.NopModel.csdl|res://*/Data.NopModel.ssdl|res://*/Data.NopModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ISAFA-PCONIMAC;Initial Catalog=AllAboutDB;Integrated Security=True;Persist Security Info=False;MultipleActiveResultSets=True;Connect Timeout=120&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>





I hope this tutorial would help someone :)
13 anni tempo fa
I'm using 1.90

I have completed all the steps except D because the files are different in 1.90

If anyone know how to do it i'd much appreciate it :)
13 anni tempo fa
Thank you very much!!!
13 anni tempo fa
you are welcome :)
13 anni tempo fa
I am using 1.8

I am not able to perform task D, as i am not able to find Edit NopModel.edmx
My site is live and hosted on arvixe, so is the steps different for already hosted site?

Thanks
Kakoli
13 anni tempo fa
Yes I think

Because this file you'll find it under nopCommerce_1.80_Source\Libraries\Nop.BusinessLogic\Data

You must mack the changes on not compiled version then compile it
13 anni tempo fa
Thanks for a quick reply you are awesome :-) , so after compling, what should i do to update my live site? sorry may be a stupid question, i am not that good a techie :-)
13 anni tempo fa
no problem i'm happy to help u :)

I think after you complete and test your website on your local machine, BackUP your live site, then Delete all the website except the connectionstring.config file then upload the new one after compiling it and then insert the SQL command to your live database if you did not done it already

BUT dont forget to Back Up Before you do anything

Backup your website and your database before make any changes

and if it works fine i will very happy to see some screen shots if possible :)
13 anni tempo fa
wooow! seems litte scary to me :-), anyway i will try that on sunday, and thanks so much for all your help, will surely updte you, and Wish you a very Happy New Year.
13 anni tempo fa
please liquidq8 check ur inbox i sent u one message which is very important


with regards
kutub
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.