Bagisto Forum

    Bagisto

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

    Where did you construct $product array [$product array is available in product detail page]

    Knowledge Base
    2
    4
    270
    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.
    • A
      AkashWeybee last edited by

      $product array in product detail page

      c9ca9f01-608c-42b5-b358-b231d792d207-image.png

      Basically, I want to add extra fields to this $product array

      product detail page
      cb4aba27-15b8-4db3-9d2e-767d5f594a31-image.png

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

        Hi @AkashWeybee,

        There is an abstract class in file i.e.,

        packages/Webkul/Product/src/Type/AbstractType.php
        

        In that class please check, 'setProduct()' method.

        Please check them. If not then let me know.

        1 Reply Last reply Reply Quote 0
        • A
          AkashWeybee last edited by

          @devansh419
          I want to append a few fields to this array.
          So Where do I need to make changes?

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

            Hi @AkashWeybee,

            As I have seen the screenshot, you are trying to access the object.

            There is a 'index()' method in file name i.e. 'packages/Webkul/Shop/src/Http/Controllers/ProductsCategoriesProxyController.php'.

            There is a variable '$product' present in the 'if' case, if you want to add custom field than asign property like this,

            $product->extra_field_1 = 'Test 1';
            $product->extra_field_2 = 'Test 2';
            

            And then in the main view access the object like this.

            {{ $product->extra_field_1 }}
            {{ $product->extra_field_2 }}
            
            1 Reply Last reply Reply Quote 1
            • First post
              Last post