Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Setting some of the new product attributes to 1 instead of null when creating the product

    Knowledge Base
    3
    6
    2728
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      squirrel last edited by

      What is the best way to set ["new", "visible_individually", "featured", "status"] attributes to 1 on the creation of the product? I mean to be activated once the user creat the product and move to the edit product interface.
      I noted that the data on the product edit is fetching the values from the product_attribute_values not product_flat. product_attribute_values only gets created on the calling the product update. Therefore changing the database default setting won't do the trick.
      Thanks.

      1 Reply Last reply Reply Quote 0
      • devansh-webkul
        devansh-webkul last edited by

        Hi @squirrel,

        May I know what are you trying to do because in Bagisto, all values are saved in product_attribute_values tables and for fetching or displaying records we are using product_flats table to avoid multiple join queries.

        1 Reply Last reply Reply Quote 0
        • S
          squirrel last edited by squirrel

          When you create a product, by default "new", "visible_individually", "featured", "status" values in the
          /catalog/products/edit/{id} page are set to NULL. How can I make them set to 1 for all newly-created products?

          1 Reply Last reply Reply Quote 0
          • devansh-webkul
            devansh-webkul last edited by

            @squirrel,
            You need to set the value in both tables at the time of creation.

            1 Reply Last reply Reply Quote 0
            • harukovn
              harukovn last edited by

              You need to set the value in both tables at the time of creation.

              1 Reply Last reply Reply Quote 0
              • S
                squirrel last edited by

                Hi @devansh-webkul @harukovn, do you mean I update the migration file or change the code for that? If it's about changing the code, could you point me to the methods that I have to change, please?

                Thank you

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post