Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProductType value 15, 25 are not present in the enum ProductType. Is it a defect or intentionally kept? #411

Open
Nikhil13x opened this issue Jun 14, 2023 · 1 comment

Comments

@Nikhil13x
Copy link
Contributor

@TheFlo
Copy link

TheFlo commented Dec 3, 2024

Hi @Nikhil13x

This is most probably an error since the beginning of GrandNode2.

I had the same question so I looked into the source code of previous GrandNode version.
According to GrandNode source code, ProductType 15 and 25 were Reservation and Auction respectively:

https://github.com/grandnode/grandnode/blob/c209758031e88d0279a023a7237b1f68ebd9f4dc/Grand.Domain/Catalog/ProductType.cs

namespace Grand.Domain.Catalog
{
    /// <summary>
    /// Represents a product type
    /// </summary>
    public enum ProductType
    {
        /// <summary>
        /// Simple
        /// </summary>
        SimpleProduct = 5,
        /// <summary>
        /// Grouped (product with variants)
        /// </summary>
        GroupedProduct = 10,

        /// <summary>
        /// Reservation product
        /// </summary>
        Reservation = 15,

        /// <summary>
	/// Bundled product
	/// </summary>
	BundledProduct = 20,

        /// <summary>
        /// Auction
        /// </summary>
        Auction = 25
    }
}

This could be fixed with a simple replacement but there might be other places where the old values still remains, like:

<div class="prices" v-bind:class="{ 'reservation-price': Model.ProductType == 15 }">
<template v-if="Model.ProductType != 25">

<div class="prices" v-bind:class="{ 'reservation-price': Model.ProductType == 15 }">
<template v-if="Model.ProductType != 25">

An improvement could be to replace those "magic numbers" with an int cast of the corresponding ProductType enum value or a well named constant in the .js files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants