Recent Topics

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



  • $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



  • 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.



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



  • 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 }}
    

Log in to reply