lunar icon indicating copy to clipboard operation
lunar copied to clipboard

Bugfix issue 254: Make identifier nullable on product variant and order line

Open fmeccanici opened this issue 1 year ago • 2 comments

This PR solves the issue reported in https://github.com/lunarphp/lunar/issues/254. It is not an ideal fix, but this way it will not throw an exception anymore. Ideally the config from the admin package and the core package would share the product identifiers, the ones shown below:

    'sku' => [
        'required' => true,
        'unique' => true,
    ],
    'gtin' => [
        'required' => false,
        'unique' => false,
    ],
    'mpn' => [
        'required' => false,
        'unique' => false,
    ],
    'ean' => [
        'required' => false,
        'unique' => false,
    ],

This way we could return the corresponding identifier in the getIdentifier() method on ProductVariant instead of doing the following (which is not fool proof):

    public function getIdentifier()
    {
        return $this->sku ?? $this->gtin ?? $this->mpn ?? $this->ean ?? null;
    }

fmeccanici avatar Sep 20 '23 19:09 fmeccanici

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 20, 2023 7:28pm

vercel[bot] avatar Sep 20 '23 19:09 vercel[bot]

Thanks @fmeccanici I agree it needs addressing but this isn't like they correct approach. I will convert to draft for the moment and then we can revisit with @glennjacobs

alecritson avatar Sep 22 '23 12:09 alecritson

Closing as this PR has had a status of "Draft" for a long time and our focus is now moving to 1.x with Filament admin panel.

glennjacobs avatar May 06 '24 21:05 glennjacobs