Giter VIP home page Giter VIP logo

Comments (3)

 avatar commented on July 21, 2024

Simply, how would I write to the cart products if I added a field called 'items'? I'm trying to do this from the ProductPage.js. I can't simply use the updateProduct from AdminProductEdit I don't think.

from nicistore.

 avatar commented on July 21, 2024

Okay, I'm working on the API now, adding tables to DB based on Variants per User. Is there a method to retrieve the current userID / Guest user token on the frontend (securely) or is this all dealt with on API level?

from nicistore.

andrecrt avatar andrecrt commented on July 21, 2024

Hi,

In regards to you last question about the current userID, you can use the AccountStore for that.

The question about Variants, I'm sorry but I don't think I follow your issue... and since I haven't implemented them it's hard for me to grasp what you are trying to achieve. From my point of view, variants are, first and foremost, just another product like any other with their own SKU, pricing, etc. But since they are almost exactly like each other, differing only on a specific attribute usually (color, size, etc), they may end up having their own product page.

Is this it?

From the top of my head I would use the attribute "metadata" from Products (as you mentioned) to kind of link one product to another. Now.. you could define one of these products as the "parent" and all other are variants of it or you could, in each of the variants, have the whole details about the other products

Product A
Product B (Variant of A)
Product C (Variant of B)

Option 1 (Product A is parent):

productB.metadata.variantOf = {
id: ProductA_ID,
attribute: 'color' // this product differs from A in its color,
value: 'red'
}

productC.metadata.variantOf = {
id: ProductA_ID,
attribute: 'size' // this product differs from A in its color,
value: 'xl'
}

Option 2 (All Products have variant information):

productA.metadata.variants = [
{id: ProductB_ID, attribute: 'color', value: 'red'},
{id: ProductC_ID, attribute: 'size', value 'xl'}
]

productB.metadata.variants = [
{id: ProductA_ID, attribute: 'color', value: 'blue'},
{id: ProductC_ID, attribute: 'size', value 'xl'}
]

productC.metadata.variants = [
{id: ProductA_ID, attribute: 'color', value: 'blue'},
{id: ProductB_ID, attribute: 'size', value 's'}
]

from nicistore.

Related Issues (20)

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.