products

package
v0.0.0-...-8be382e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	gorm.Model
	l10n.Locale
	sorting.Sorting
	Name string
	Code string

	Categories []Category
	CategoryID uint
}

func (Category) DefaultPath

func (category Category) DefaultPath() string

func (Category) Validate

func (category Category) Validate(db *gorm.DB)

type Collection

type Collection struct {
	gorm.Model
	Name string
	l10n.LocaleCreatable
}

type Color

type Color struct {
	gorm.Model
	l10n.Locale
	sorting.Sorting
	Name string
	Code string `l10n:"sync"`

	publish2.Version
	publish2.Schedule
	publish2.Visible
}

func (Color) Validate

func (color Color) Validate(db *gorm.DB)

type ColorVariation

type ColorVariation struct {
	gorm.Model
	ProductID uint
	Product   Product
	ColorID   uint
	Color     Color
	ColorCode string
	Images    media_library.MediaBox
	// SizeVariations []SizeVariation
	publish2.SharedVersion
}

func (ColorVariation) MainImageURL

func (colorVariation ColorVariation) MainImageURL() string

func (ColorVariation) ViewPath

func (colorVariation ColorVariation) ViewPath() string

ViewPath view path of color variation

type ColorVariationImage

type ColorVariationImage struct {
	gorm.Model
	ColorVariationID uint
	Image            ColorVariationImageStorage `sql:"type:varchar(4096)"`
}

type ColorVariationImageStorage

type ColorVariationImageStorage struct{ oss.OSS }

func (ColorVariationImageStorage) GetSizes

func (ColorVariationImageStorage) GetSizes() map[string]*media.Size

type Material

type Material struct {
	gorm.Model
	l10n.Locale
	Name string
	Code string `l10n:"sync"`
}

type Product

type Product struct {
	gorm.Model
	l10n.Locale
	sorting.SortingDESC

	Name            string
	NameWithSlug    slug.Slug `l10n:"sync"`
	Featured        bool
	Code            string       `l10n:"sync"`
	CategoryID      uint         `l10n:"sync"`
	Category        Category     `l10n:"sync"`
	Collections     []Collection `l10n:"sync" gorm:"many2many:product_collections;"`
	MadeCountry     string       `l10n:"sync"`
	Gender          string       `l10n:"sync"`
	MainImage       media_library.MediaBox
	Price           float32          `l10n:"sync"`
	Description     string           `sql:"size:2000"`
	ColorVariations []ColorVariation `l10n:"sync"`

	ColorVariationsSorter sorting.SortableCollection
	ProductProperties     ProductProperties `sql:"type:text"`
	Seo                   qor_seo.Setting

	SizeVariations []SizeVariation `l10n:"sync"`

	Variations []ProductVariation

	publish2.Version
	publish2.Schedule
	publish2.Visible
}

func (Product) DefaultPath

func (product Product) DefaultPath() string

func (Product) GetSEO

func (product Product) GetSEO() *qor_seo.SEO

func (Product) MainImageURL

func (product Product) MainImageURL(styles ...string) string

func (Product) Validate

func (product Product) Validate(db *gorm.DB)

type ProductImage

type ProductImage struct {
	gorm.Model
	Title        string
	Color        Color
	ColorID      uint
	Category     Category
	CategoryID   uint
	SelectedType string
	File         media_library.MediaLibraryStorage `sql:"size:4294967295;" media_library:"url:/system/{{class}}/{{primary_key}}/{{column}}.{{extension}}"`
}

func (*ProductImage) GetMediaOption

func (productImage *ProductImage) GetMediaOption() (mediaOption media_library.MediaOption)

func (*ProductImage) GetSelectedType

func (productImage *ProductImage) GetSelectedType() string

func (*ProductImage) ScanMediaOptions

func (productImage *ProductImage) ScanMediaOptions(mediaOption media_library.MediaOption) error

func (*ProductImage) SetSelectedType

func (productImage *ProductImage) SetSelectedType(typ string)

func (ProductImage) Validate

func (productImage ProductImage) Validate(db *gorm.DB)

type ProductProperties

type ProductProperties []ProductProperty

func (*ProductProperties) Scan

func (productProperties *ProductProperties) Scan(value interface{}) error

func (ProductProperties) Value

func (productProperties ProductProperties) Value() (driver.Value, error)

type ProductProperty

type ProductProperty struct {
	Name  string
	Value string
}

type ProductVariation

type ProductVariation struct {
	gorm.Model
	ProductID *uint
	Product   Product

	Color      Color `variations:"primary"`
	ColorID    *uint
	Size       Size `variations:"primary"`
	SizeID     *uint
	Material   Material `variations:"primary"`
	MaterialID *uint

	SKU               string
	ReceiptName       string
	Featured          bool
	Price             uint
	SellingPrice      uint
	AvailableQuantity uint
	Images            media_library.MediaBox
}

type Size

func (Size) Validate

func (size Size) Validate(db *gorm.DB)

type SizeVariation

type SizeVariation struct {
	gorm.Model
	ProductID uint
	Product   Product

	// ColorVariationID  uint
	// ColorVariation    ColorVariation
	SizeID uint
	Size   Size
	// AvailableQuantity uint
	publish2.SharedVersion
}

func SizeVariations

func SizeVariations() []SizeVariation

func (SizeVariation) Stringify

func (sizeVariation SizeVariation) Stringify() string

func (SizeVariation) ViewPath

func (sizeVariation SizeVariation) ViewPath() string

ViewPath view path of color variation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL