Giter VIP home page Giter VIP logo

medusa-custom-attributes's Introduction

👷 Speciality: Full-stack developer 🎓 Student: Wyższa Szkoła Bankowa we Wrocławiu / Cloud Engineer 💡 Skills
🧻 Projects 🧑‍💻 Languages: Javascript, Typescript 📦 Tech stack: React, Typescript, NestJs 💬 telegram: @imzape 📫 [email protected]

medusa-custom-attributes's People

Contributors

vholik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

medusa-custom-attributes's Issues

Simple Text or LongText attributes as custom attributes?

Hi, I've seen your extension and it looks like it adds some Parts that are definitely missing to the default medusajs.

One thing I am missing in your solution is the possibility to add a plain text attribute, to be able to add things like a simple EAN or such.
Is there a reason why this is not included in your plugin? If not, I would be interested to add it or would really be happy if you could add it.

Widget in Rigby's MercurJS VendorUI

Hello,

I find that this works on a typical Medusa project, but for MercurJS, the visual customizations only apply to the AdminUI, which should be the case but just for the page 'Custom Attributes' this plugin introduces.

The Widget that gets injected in the Product detail page also appears on the AdminUI (which in the context of Mercur marketplace is irrelevant), but not on the Vendor panel, which is the one that actually should use the Widget, to link products to specific attributes defined at the system level by the Admin.

Is there any way to maybe pass this as an option to MercurJS VendorUI plugin, should I copy/paste the Widget code, from medusa-custom-attributes to my MercurJS project or what is the reccommended way @vholik ?

Getting 'property attribute_values should not exist, property int_attribute_values should not exist' after adding custom attributing and trying to use it inside product

Hello!

this plugin was working just fine for me the other day, and today when i tried to check a new boolean attribute i added to my product, the console logs print:

error:   property attribute_values should not exist, property int_attribute_values should not exist
Error: property attribute_values should not exist, property int_attribute_values should not exist
    at /Users/moh/Projects/project/node_modules/@medusajs/medusa/dist/utils/validator.js:153:31
    at step (/Users/moh/Projects/project/node_modules/@medusajs/medusa/dist/utils/validator.js:44:23)
    at Object.next (/Users/moh/Projects/project/node_modules/@medusajs/medusa/dist/utils/validator.js:25:53)
    at fulfilled (/Users/moh/Projects/project/node_modules/@medusajs/medusa/dist/utils/validator.js:16:58) {
  type: 'invalid_data',
  code: undefined,
  date: 2024-04-23T11:31:04.208Z
}

any ideas?

HELP!

Hello guys, please help with any suggestions.

I have standalone project of medusa admin ui.
So if I want to use this plugin how can I extend it's ui on my seperate admin ui project ?

error An unexpected error occurred: "could not find a copy of @medusajs/medusa to link

After installation backend not work, admin not work, not possible login etc. Storefront not fetch products from backend API etc.

[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "medusa-custom-attributes > @medusajs/[email protected]" has unmet peer dependency "react@^16.x || ^17.x || ^18.x".
warning " > @tanstack/[email protected]" has unmet peer dependency "react@^16.8.0 || ^17.0.0 || ^18.0.0".
warning "medusa-custom-attributes > [email protected]" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
warning "medusa-custom-attributes > [email protected]" has unmet peer dependency "react-dom@^16.8 || ^17.0 || ^18.0".
warning " > [email protected]" has unmet peer dependency "react@>=16.0.0".
warning "@medusajs/admin > @medusajs/admin-ui > [email protected]" has unmet peer dependency "@types/react@^16.3.0 || ^17.0.0 || ^18.0.0".
warning "@medusajs/admin > @medusajs/admin-ui > react-hot-toast > [email protected]" has unmet peer dependency "csstype@^3.0.10".
warning "@medusajs/cache-inmemory > @medusajs/modules-sdk > @graphql-tools/[email protected]" has unmet peer dependency "graphql@^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0".
warning "@medusajs/cache-inmemory > @medusajs/modules-sdk > @graphql-tools/[email protected]" has unmet peer dependency "graphql@^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0".
warning "@medusajs/cache-inmemory > @medusajs/modules-sdk > @graphql-tools/merge > @graphql-tools/[email protected]" has unmet peer dependency "graphql@^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0".
warning "@medusajs/cache-inmemory > @medusajs/modules-sdk > @graphql-tools/merge > @graphql-tools/utils > @graphql-typed-document-node/[email protected]" has unmet peer dependency "graphql@^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0".
warning "@medusajs/medusa > [email protected]" has unmet peer dependency "@types/ioredis-mock@^8".
warning " > [email protected]" has unmet peer dependency "@medusajs/icons@^1.0.0".
warning " > [email protected]" has unmet peer dependency "@medusajs/ui@^2.2.0".
warning " > [email protected]" has unmet peer dependency "medusa-react@^9.0.9".
warning " > [email protected]" has unmet peer dependency "react@^18.2.0".
warning " > [email protected]" has unmet peer dependency "react-dom@^18.2.0".
warning " > [email protected]" has unmet peer dependency "webpack@^5.0.0".
error An unexpected error occurred: "could not find a copy of @medusajs/medusa to link in C:\\Users\\\\\medusa-project\\commerce\\node_modules\\medusa-custom-attributes\\node_modules".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\\medusa-project\\commerce\\yarn-error.log".

@update
After delete node_modules and install again, I try run server and get (migrations done):

 Initializing database
error:   Error starting server
TypeORMError: Entity metadata for ProductCategory#products was not found. Check if you specified a correct entity object and if it's connected in the connection options.
    at C:\Users\...\...\medusa-project\commerce\node_modules\typeorm\metadata-builder\EntityMetadataBuilder.js:720:23
    at Array.forEach (<anonymous>)
    at EntityMetadataBuilder.computeInverseProperties (C:\Users\...\...\medusa-project\commerce\node_modules\typeorm\metadata-builder\EntityMetadataBuilder.js:713:34)
    at C:\Users\...\...\medusa-project\commerce\node_modules\typeorm\metadata-builder\EntityMetadataBuilder.js:84:58
    at Array.forEach (<anonymous>)
    at EntityMetadataBuilder.build (C:\Users\...\...\medusa-project\commerce\node_modules\typeorm\metadata-builder\EntityMetadataBuilder.js:84:25)
    at ConnectionMetadataBuilder.buildEntityMetadatas (C:\Users\...\...\medusa-project\commerce\node_modules\typeorm\connection\ConnectionMetadataBuilder.js:66:150)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async DataSource.buildMetadatas (C:\Users\...\...\medusa-project\commerce\node_modules\typeorm\data-source\DataSource.js:460:33)
    at async DataSource.initialize (C:\Users\...\...\medusa-project\commerce\node_modules\typeorm\data-source\DataSource.js:141:13)

Page and Widget not showing in Admin Panel using Mercur JS

Hello,

I am using Mercur JS and i am not using it's lates version, since i want to have full control over the UIs and the latest update removes the ability to do this, since it ports the UIs as plugins. After installing the plugin and running the migrations succesfully i am not seeing the tab in my Admin Panel, nor the widget inside the product page.

Is this because:

  • This plugin does not work with Mercur?
  • This plugin works with Mercur but only the latest version, taht ports the UIs as plugins?

Also, if this works with Mercur, how would i add the Widget to Vendor Panel (only widget sice i would like only Admins to define the attributes) but of course, Vendors to use the defined attributes for the products.

Thanks!

CSV Export / Import support?

Do the additional fields created by this plugin support CSV import/export?
And if not, would it be best to create my own custom import/exporter?

Filter by category

Hello,

Is there a way to filter by category as well or is it something already supported by medusa ?

An error occurred while processing product.updated: TypeError: Cannot read properties of undefined (reading 'relations')

I've implemented the src/subscribers/product-update-handler.ts from
https://docs.medusajs.com/development/events/create-subscriber

This works fine without this plugin, but when i activate this plugin i get the following error:

error: An error occurred while processing product.updated: TypeError: Cannot read properties of undefined (reading 'relations')

Medusa: 1.20.2
medusa-custom-attributes: 1.0.15

custom_attributes dropped from response when passing expand options

Passing any relation to expand for the storefront products/ API endpoint appears to drop custom_attributes from the response data. Should the inclusion of attribute relations in defaultStoreProductsRelations mean they're always returned?

I've worked around this by handling custom_attributes passed in as a relation to expand:

  async listAndCount(
    selector: ProductSelector & {
      attributes: string[];
      int_attributes: IntAttributeParam;
    },
    config: FindProductConfig = {
      relations: [],
      skip: 0,
      take: 20,
      include_discount_prices: false,
    }
  ): Promise<[Product[], number]> {
    const manager = this.activeManager_;
    const productRepo = manager.withRepository(this.productRepository_);

    if (config.relations?.includes("custom_attributes")) {
      config.relations.push(
        "attribute_values",
        "attribute_values.attribute",
        "int_attribute_values",
        "int_attribute_values.attribute",
      )
      config.relations = config.relations.filter(rel => rel !== "custom_attributes");
    }

Invalid data error

error: property attribute_values should not exist, property int_attribute_values should not exist
Error: property attribute_values should not exist, property int_attribute_values should not exist
at C:\Users\PCL\Documents\Projects\BHS-Experiments\bhs-medusa\node_modules@medusajs\medusa\dist\utils\validator.js:153:31
at step (C:\Users\PCL\Documents\Projects\BHS-Experiments\bhs-medusa\node_modules@medusajs\medusa\dist\utils\validator.js:44:23)
at Object.next (C:\Users\PCL\Documents\Projects\BHS-Experiments\bhs-medusa\node_modules@medusajs\medusa\dist\utils\validator.js:25:53)
at fulfilled (C:\Users\PCL\Documents\Projects\BHS-Experiments\bhs-medusa\node_modules@medusajs\medusa\dist\utils\validator.js:16:58) {
type: 'invalid_data',
code: undefined,
date: 2024-01-29T04:36:13.553Z
}

Getting this error when attaching a custom attribute to a product
image

Issue: Inconsistent Entity Relationship Handling for Custom Entities

Description:
I'm encountering issues when trying to extend the Product entity from @medusajs/medusa and establish a one-to-one relationship with a custom entity, ProductSpecification. The problem appears to be due to conflicts or missing configurations in the base Product entity when using TypeORM decorators. This issue arose after installing the custom-attributes node module; the relationship was working correctly before this installation. The error occurs specifically when I click on the product details in the admin UI.

Steps to Reproduce:

Create a custom entity ProductSpecification with a one-to-one relationship to the Product entity.
Extend the Product entity from @medusajs/medusa.
Define the relationship in the extended Product entity.
Install the custom-attributes node module.
Click on the product details in the admin UI.
Code Examples:

Product Entity (models/product.ts):

import { Entity, OneToOne } from "typeorm";
import { Product as MedusaProduct } from "@medusajs/medusa";
import { ProductSpecification } from "./product-specification";

@entity()
export class Product extends MedusaProduct {
@OnetoOne(() => ProductSpecification, (specification) => specification.product)
specification?: ProductSpecification | null;
}

ProductSpecification Entity (models/product-specification.ts):

import {
BeforeInsert,
Column,
Entity,
OneToOne,
JoinColumn
} from "typeorm";
import { SoftDeletableEntity } from "@medusajs/medusa";
import { generateEntityId } from "@medusajs/medusa/dist/utils";
import { Product } from "./product";

@entity()
export class ProductSpecification extends SoftDeletableEntity {
@column({ type: "varchar" })
model: string | null;

@column({ type: "varchar" })
product_id: string;

@OnetoOne(() => Product, (product) => product.specification)
@joincolumn({ name: "product_id", referencedColumnName: "id" })
product?: Product | null;

@BeforeInsert()
private beforeInsert(): void {
this.id = generateEntityId(this.id, "prod_spec");
}
}

Configuration for Extending Product Fields (extend-product-fields.ts):

export default async function () {
const imports = (await import(
"@medusajs/medusa/dist/api/routes/store/products/index"
)) as any;
imports.defaultStoreProductsRelations = [
...imports.defaultStoreProductsRelations,
"specification",
];
imports.allowedStoreProductsRelations = [
...imports.allowedStoreProductsRelations,
"specification",
];

const admin_imports = (await import(
"@medusajs/medusa/dist/api/routes/admin/products/index"
)) as any;
admin_imports.defaultAdminProductRelations = [
...admin_imports.defaultAdminProductRelations,
"specification",
];
admin_imports.defaultAdminGetProductsVariantsRelations = [
...admin_imports.defaultAdminGetProductsVariantsRelations,
"specification",
];
admin_imports.defaultAdminProductRemoteQueryObject = [
...admin_imports.defaultAdminProductRemoteQueryObject,
"specification",
];
}

Expected Behavior:
The Product entity should be able to define a relationship with the ProductSpecification entity without issues. Additionally, the relationship should be recognized and managed by TypeORM.

Actual Behavior:
Adding a @OnetoOne decorator to the extended Product entity results in the following error when clicking on the product details in the admin UI:

error: Relation with property path specification in entity was not found.
TypeORMError: Relation with property path specification in entity was not found.
at JoinAttribute.getValue (/path/to/project/node_modules/typeorm/query-builder/JoinAttribute.js:109:23)
at get relation [as relation] (/path/to/project/node_modules/typeorm/query-builder/JoinAttribute.js:111:53)
at get metadata [as metadata] (/path/to/project/node_modules/typeorm/query-builder/JoinAttribute.js:122:18)
at SelectQueryBuilder.join (/path/to/project/node_modules/typeorm/query-builder/SelectQueryBuilder.js:963:53)
at SelectQueryBuilder.leftJoin (/path/to/project/node_modules/typeorm/query-builder/SelectQueryBuilder.js:195:14)
at SelectQueryBuilder.leftJoinAndSelect (/path/to/project/node_modules/typeorm/query-builder/SelectQueryBuilder.js:215:14)
at /path/to/project/node_modules/@medusajs/medusa/dist/utils/repository.js:148:80
at step (/path/to/project/node_modules/@medusajs/medusa/dist/utils/repository.js:33:23)
at Object.next (/path/to/project/node_modules/@medusajs/medusa/dist/utils/repository.js:14:53)
at /path/to/project/node_modules/@medusajs/medusa/dist/utils/repository.js:8:71

Problem visiting product page on admin

error:   Relation with property path attribute_values in entity was not found.
TypeORMError: Relation with property path attribute_values in entity was not found.

Making a new product also gives me this

Relation with property path attribute_values in entity was not found. TypeORMError: Relation with property path attribute_values in entity was not found. at JoinAttribute.getValue (/Users/xxx/sites/medusa-store/node_modules/typeorm/query-builder/JoinAttribute.js:109:23) at get relation [as relation]

Issue with integration with default storefront || ReferenceError: useAttributes is not defined

Follows the integration documentation with the Medusa core storefront. For refference: https://rigby.pl/en/blog/custom-attributes-in-medusa.js-part-2-ui

I created:
@modules/attributes/components/product-filters-context

import React from "react";

interface ProductFiltersContextProps {
  attributes?: Record<string, string[]> | null;
  intAttributes?: Record<string, number[]> | null;
  setAttributes?: React.Dispatch<React.SetStateAction<Record<string, string[]> | null>>
  setIntAttributes?: React.Dispatch<
    React.SetStateAction<Record<string, number[]> | null | undefined>
  >;
}

const ProductFiltersContext = React.createContext<ProductFiltersContextProps>(
  {}
);


interface ProductFiltersProviderProps {
  initialValues: ProductFiltersContextProps;
  children: React.ReactNode;
}

export const ProductFiltersProvider = ({
  children,
  initialValues,
}: ProductFiltersProviderProps) => {
  const {
    attributes: initialAttributes,
    intAttributes: initialIntAttributes, // Range attributes
  } = initialValues;

  const [intAttributes, setIntAttributes] =
    React.useState<Record<string, number[]>>(initialIntAttributes ?? {});

  const [attributes, setAttributes] = React.useState<Record<
    string,
    string[]
  > | null>(initialAttributes ?? {});

  return (
    <ProductFiltersContext.Provider
      value={{
        attributes,
        setAttributes,
        intAttributes,
        setIntAttributes,
      }}
    >
      {children}
    </ProductFiltersContext.Provider>
  );
};

export const useProductFilters = () => {
  const context = React.useContext(ProductFiltersContext);

  return context;
};

@modules/attributes/components/attribute-filters

import React from "react";
import { useProductFilters, ProductFiltersProvider } from "@modules/attributes/components/product-filters-context";

export const AttributeFilters = React.memo((props: ProductFiltersProps) => {
    const { className } = props;
    const {
      setAttributes,
      attributes,
      intAttributes,
      setIntAttributes,
    } = useProductFilters(); 
  
    // Custom hook to fetch "/store/attributes" route
    const { attributes: customAttributes } = useAttributes();
  
    return (
      <VStack
        className={classnames(cls.AttributeFilters, {}, [className])}
        gap="32"
      >
        {customAttributes?.map((attribute) => {
          if (attribute.type === "boolean") {
            const checked = attributes?.[attribute.handle] ?? false;
  
            return (
              <Checkbox
                key={attribute.id}
                name={attribute.name}
                checked={!!checked}
                onChange={() => {
                  if (checked) {
                    const newAttributes = { ...attributes };
                    delete newAttributes[attribute.handle];
                    setAttributes?.(newAttributes);
                  } else {
                    setAttributes?.((prev) => ({
                      ...prev,
                      [attribute.handle]: [attribute.values[0].id],
                    }));
                  }
                }}
              >
                {attribute.name}
              </Checkbox>
            );
          }
  
          if (attribute.type === "range") {
            return (
              <Range
                name={attribute.name}
                maxValue={100}
                minValue={0}
                key={attribute.id}
                setValues={(value) => {
                  setIntAttributes?.((prev) => ({
                    ...prev,
                    [attribute.id]: value,
                  }));
                }}
                values={[
                  intAttributes?.[attribute.id]?.[0] ?? 0,
                  intAttributes?.[attribute.id]?.[1] ?? 100,
                ]}
              />
            );
          }
  
          return (
            <CheckboxList
              key={attribute.id}
              checked={attributes?.[attribute.handle] ?? []}
              label={attribute.name}
              options={attribute.values.map((value) => ({
                value: value.id,
                label: value.value,
              }))}
              onChange={(values) =>
                setAttributes?.((prev) => ({
                  ...prev,
                  [attribute.handle]: values,
                }))
              }
            />
          );
        })}
      </VStack>
    );
  });

Now I try implement this filter directly in base category template:
https://github.com/medusajs/nextjs-starter-medusa/blob/main/src/modules/categories/templates/index.tsx

add line:
import { AttributeFilters } from "@modules/attributes/components/attribute-filters";

But everytime I get:

Unhandled Runtime Error
ReferenceError: useAttributes is not defined

Source
src\modules\attributes\components\attribute-filters\index.tsx (16:45) @ useAttributes

  14 | 
  15 |   // Custom hook to fetch "/store/attributes" route
> 16 |   const { attributes: customAttributes } = useAttributes();

Can you help/give advice on how we can implement this filter directly into the category template?

I can't find information with the definition of useAttributes() anywhere.

Yarn and NPM repositories no longer working?

Cant install from yarn

error Received malformed response from registry for "medusa-plugin-custom-attributes". The registry may be down.

Is this still alive? Awesome project keep it up!

All products + variants disappeared after enabling plugin

Heya team
Thanks for your work on this.

In a bit of a pickle...

I have Medusa running on a Railway setup. I added a couple products, and a couple variations on each and all was swell. I realized custom fields would be useful, and I found this plugin.

I followed the steps on the guide:

  • npm installed the plugin
  • updated config
  • added the env variable to my railway deployment
  • pushed & waited for deploy to finish
  • ran the migration which returned:
$ railway run npx medusa migrations run
query: SELECT * FROM current_schema()
query: SELECT version();
query: SELECT * FROM "information_schema"."tables" WHERE "table_schema" = 'public' AND "table_name" = 'migrations'
query: SELECT * FROM "public"."migrations" "migrations" ORDER BY "id" DESC
No migrations are pending
Connection to Redis in module 'event-bus-redis' established
Connection to Redis in module 'cache-redis' established

Not sure if that's good or bad, but either way when I logged back into my site, all my products & variations are gone 😢 I don't know if its related as I never checked the network tab before the issue, but I see this on my products tab:

pic-004285

Weirdly, my collection still shows that there are 2 products in it, but the products themselves have gone AWOL.

pic-004284

Any tips?

PS: This instance is live so I can pop logins if it'll help..

Products doesnt load due MedusaV2Flag.key undefined

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/medusa-custom-attributes/dist/services/product.js b/node_modules/medusa-custom-attributes/dist/services/product.js
index 36bd11d..b6a6854 100644
--- a/node_modules/medusa-custom-attributes/dist/services/product.js
+++ b/node_modules/medusa-custom-attributes/dist/services/product.js
@@ -80,7 +80,7 @@ class ProductService extends medusa_1.ProductService {
         delete selector.attributes;
         delete selector.int_attributes;
         const hasSalesChannelsRelation = (_a = config.relations) === null || _a === void 0 ? void 0 : _a.includes("sales_channels");
-        if (this.featureFlagRouter_.isFeatureEnabled(utils_1.MedusaV2Flag.key) &&
+        if (utils_1?.MedusaV2Flag?.key && this.featureFlagRouter_.isFeatureEnabled(utils_1.MedusaV2Flag.key) &&
             hasSalesChannelsRelation) {
             config.relations = (_b = config.relations) === null || _b === void 0 ? void 0 : _b.filter((r) => r !== "sales_channels");
         }
@@ -93,7 +93,7 @@ class ProductService extends medusa_1.ProductService {
         else {
             [products, count] = await productRepo.findWithRelationsAndCount(relations, query);
         }
-        if (this.featureFlagRouter_.isFeatureEnabled(utils_1.MedusaV2Flag.key) &&
+        if (utils_1?.MedusaV2Flag?.key && this.featureFlagRouter_.isFeatureEnabled(utils_1.MedusaV2Flag.key) &&
             hasSalesChannelsRelation) {
             // @ts-expect-error
             await this.decorateProductsWithSalesChannels(products);

This issue body was partially generated by patch-package.

Enhancement Suggestion: Optimize Product Information Retrieval by Revising Data Relations

Hello,

First, I'd like to express my appreciation for the plugin—it's been fantastic to work with. However, I'd like to discuss a potential enhancement concerning the data model, particularly regarding the retrieval of product information through custom attributes.

In the current implementation, the relation is defined as attribute_values.attribute. This setup requires additional computations on the frontend to access an attribute's specific values for a product. Such an approach, while functional, seems to introduce unnecessary complexity when fetching product details.

I propose a modification to the data model that could streamline data retrieval: introducing a direct relation from attribute to attribute_values within the product entity. This change would allow for more straightforward and efficient access to product information, as it aligns more naturally with how product attributes are typically displayed and utilized in e-commerce platforms.

For example, in our specific use case, we require custom attributes to enrich product information. Implementing a attribute.attribute_values relation would directly serve this need, reducing the frontend logic required to map attributes to their respective values.

I believe this adjustment could enhance the plugin's efficiency and usability, especially for use cases similar to ours that demand extensive use of custom product attributes. I'm eager to hear your thoughts on this suggestion and discuss potential impacts or implementation strategies.

Thank you for considering this enhancement.

I have admin API error on product list page

request
"GET /admin/products?fields=id%2Ctitle%2Cthumbnail%2Cstatus%2Chandle%2Ccollection_id&expand=variants%2Coptions%2Cvariants.prices%2Cvariants.options%2Ccollection%2Ctags%2Ctype%2Cimages%2Csales_channels&is_giftcard=false HTTP/1.1"

error:
error: productRepo.findWithRelationsAndCount is not a function
TypeError: productRepo.findWithRelationsAndCount is not a function
at ProductService.listAndCount (/Applications/MAMP/htdocs/japan-new/japan-store/node_modules/medusa-custom-attributes/dist/services/product.js:60:51)
at /Applications/MAMP/htdocs/japan-new/japan-store/node_modules/@medusajs/medusa/dist/api/routes/admin/products/list-products.js:344:57

I am using "@medusajs/medusa": "1.20.1", "medusa-custom-attributes": "^1.0.14",

Meilisearch

Hi,

I've created a custom attribute and expected it to be added to the Meilisearch index, but it wasn't.

Is this a bug or expected behavior? If it's expected, are there plans to change it?

Error: attributes must be an object

I keep getting the following error when trying to filter the products based on the attribute value.

{ "type": "invalid_data", "message": "attributes must be an object" }

What could be the issue here ?

[2024-01-21 17:21:02] 172.68.51.63 - - [21/Jan/2024:17:21:02 +0000] "GET /store/products?attributes[]=attr_val_01HM47KF3RJ9D46RBNSMSYVAMJ HTTP/1.1" 400 64 "-" "PostmanRuntime/7.36.1"

API Documentation

Hello! First thanks for the work done with this plugin!
I have questions regarding the API usage.
I want to give this plugin a try, but I have a 100% headless usecase for the admin API; I don't use the admin dashboard.

Is it possible to use this plugin in a headless manner?

Is I understand correctly, the workflow is:

  1. A new product is added, a painting by Picasso ( "Painter" -> "Picasso")
  2. The "Painter" attribute is updated, and the "Picasso" value is added
  3. The product is updated, and the "Picasso" attribute of type "Painter" is added to the product.

Is is possible to update a product to edit it's attributes via the API? Does your plugin extends the Update Product endpoint?

Thanks, and please tell me if I'm not clear!

Error: "an unknown value was passed to the validate function" for single, multi & boolean types

I've cloned the plugin to add some custom functionality however, with a fresh install with no modifications it yields the error "an unknown value was passed to the validate function" when attempting to add a single, multi or boolean type attribute.

For some reason the range type works fine.

Is there possibly a simple explanation? The class-validator code is a labryinth to debug.

Error: productCategoryRepo.getFreeTextSearchResultsAndCount is not a function

i keep getting this error when try to list categories in admin page

error: productCategoryRepo.getFreeTextSearchResultsAndCount is not a function
TypeError: productCategoryRepo.getFreeTextSearchResultsAndCount is not a function
at ProductCategoryService.

but if i disable this plugin, then i can list them properly

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.