Nopcommerce 4.40 Payment Plugin - Plugin Configure Error - "Page not found"

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 ano atrás
Hi, I have the same issue described in this topic https://www.nopcommerce.com/en/boards/topic/71539/nopcommerce-420-payment-plugin-plugin-configure-error-page-not-found
I applied the solution from the topic but the issue remains unsolved.
1. Plugin name (Payment plugin): Nop.Plugin.Payments.VanillaPay
2. csproj file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  <OutputPath>..\..\Presentation\Nop.Web\Plugins\Payments.VanillaPay</OutputPath>
  <OutDir>$(OutputPath)</OutDir>
  </PropertyGroup>

  <ItemGroup>
    <None Remove="plugin.json" />
  <None Remove="logo.png" />
  <None Remove="Views\Configure.cshtml" />
  <None Remove="Views\PaymentInfo.cshtml" />
  <None Remove="Views\_ViewImports.cshtml" />
  </ItemGroup>

  <ItemGroup>
    <Content Include="plugin.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  <Content Include="logo.png">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </Content>
  <Content Include="Views\Configure.cshtml">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </Content>
  <Content Include="Views\PaymentInfo.cshtml">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </Content>
  <Content Include="Views\_ViewImports.cshtml">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </Content>
  </ItemGroup>

  <ItemGroup>
  <ProjectReference Include="..\..\Presentation\Nop.Web.Framework\Nop.Web.Framework.csproj" />
  <ClearPluginAssemblies Include="$(MSBuildProjectDirectory)\..\..\Build\ClearPluginAssemblies.proj" />
  </ItemGroup>

  <!-- This target execute after "Build" target -->
  <Target Name="NopTarget" AfterTargets="Build">
  <!-- Delete unnecessary libraries from plugins path -->
  <MSBuild Projects="@(ClearPluginAssemblies)" Properties="PluginPath=$(MSBuildProjectDirectory)\$(OutDir)" Targets="NopClear" />
  </Target>

</Project>



3. File located of the Views folder:
_ViewImports.cshtml
Configure.cshtml
PaymentInfo.cshtml

4. Configure Method in my plugin Controller named PaymentVanillaPayController

public async Task<IActionResult> Configure(ConfigurationModel model)
{
     ...
     if (storeScope <= 0)
                return View("~/Plugins/Payments.VanillaPay/Views/Configure.cshtml", model);
    ...
    return View("~/Plugins/Payments.VanillaPay/Views/Configure.cshtml", model);
}


5.  GetConfigurationPageUrl:

public override string GetConfigurationPageUrl()
{
        return $"{_webHelper.GetStoreLocation()}Admin/PaymentVanillaPay/Configure";
}


6. GetPublicViewComponentName:

public string GetPublicViewComponentName()
{
        return "PaymentVanillaPay";
}


Any helps would be very appreciated.
Thanks in advance.
Regards.
1 ano atrás
niainaraz69 wrote:
4. Configure Method in my plugin Controller named PaymentVanillaPayController

public async Task<IActionResult> Configure(ConfigurationModel model)
{
     ...
     if (storeScope <= 0)
                return View("~/Plugins/Payments.VanillaPay/Views/Configure.cshtml", model);
    ...
    return View("~/Plugins/Payments.VanillaPay/Views/Configure.cshtml", model);
}



Do you have the controller methods correct and with the tags
This one you showed does not normally return a view

        [AuthorizeAdmin]
        [Area(AreaNames.Admin)]
        public async Task<IActionResult> Configure()
        {
        ....
                return View(...)
        }

        [HttpPost]
        [AuthorizeAdmin]
        [Area(AreaNames.Admin)]
        [AutoValidateAntiforgeryToken]
        /// <returns>A task that represents the asynchronous operation</returns>
        public async Task<IActionResult> Configure(ConfigurationModel model)
        {
        ...
                return await Configure();
        }

Check your methods with the ones in
nopCommerce_4.40.4_Source\Plugins\Nop.Plugin.Payments.Manual\Controllers\PaymentManualController.cs
1 ano atrás
Sorry, i copied the wrong code (4), the correct one is

[AuthorizeAdmin]
[Area(AreaNames.Admin)]
/// <returns>A task that represents the asynchronous operation</returns>
public async Task<IActionResult> Configure()
{
    ....
    if (storeScope <= 0)
                return View("~/Plugins/Payments.VanillaPay/Views/Configure.cshtml", model);
    ....
    return View("~/Plugins/Payments.VanillaPay/Views/Configure.cshtml", model);
}


I checked all my plugin's codes - everything seems ok, cleaned and rebuild the plugin but it still not working.
1 ano atrás
The plugin is installed I assume ?
Otherwise you would not see the Configure Button

So if you enter the url you get the error ?
https://yourwebsite.com/Admin/PaymentVanillaPay/Configure
1 ano atrás
Yes it is Sir. I think I'm gonna create it again from scratch and we will see the result. May be I missed something
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.