Bagisto Forum

    Bagisto

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

    Issue with configurable product custom attribute.

    Modules
    2
    2
    445
    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.
    • F
      Flow4all last edited by

      Hi, I added an "EAN" attribute, similar to SKU, unique and numeric. And I want that to appear for every configurable product.

      I created the attribute, assigned to a family group and then added this in the Admin / Src / Resources / Views / Products / Accordians / variations..blade.php

      past line 79

      <th class="sku">{{ __('admin::app.catalog.products.sku') }}</th>
                              <th class="ean">EAN</th>
                              <th>{{ __('admin::app.catalog.products.name') }}</th>
      

      Then on 117

      <td>
                      <div class="control-group" :class="[errors.has(variantInputName + '[ean]') ? 'has-error' : '']">
                          <input type="text" v-validate="'required'" v-model="variant.ean" :name="[variantInputName + '[ean]']" class="control" data-vv-as="&quot;ean&quot;" v-slugify/>
                          <span class="control-error" v-if="errors.has(variantInputName + '[ean]')">@{{ errors.first(variantInputName + '[ean]') }}</span>
                      </div>
                  </td>
      

      Then on 245

      
                                      variants.push(Object.assign({
                                              sku: '{{ $product->sku }}' + '-variant-' + optionIds.join('-'),
                                              ean: '{{ $product->ean }}',
                                              name: '',
                                              price: 0,
                                              weight: 0,
                                              status: 1
                                          }, this.variant));
      

      As result I have this:

      alt image text

      The EAN variation on my table that can READ the product EAN but not write or overwrite it. For example: I create a configurable product with 5 sizes (Variations). Then I try to set qty, sku, price, etc... All the values will save but the ean remains blank. If I go the every simple product page and update the Ean attribute there and then come back to the configurable product, I'm able to see the value in the table but not update it.

      What am I missing?

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

        Hi @Flow4all,

        Please check this file packages/Webkul/Product/src/Models/Product.php. You need to add you EAN in fillables.

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