|
@@ -84,7 +84,9 @@ func (db *clickhouse) ProductCollections(ln model.LanguageCode, id string) ([]*g
|
|
var o []relation.Collection
|
|
var o []relation.Collection
|
|
|
|
|
|
rows, err := db.session.SelectBySql("SELECT "+
|
|
rows, err := db.session.SelectBySql("SELECT "+
|
|
- ln.SqlFieldSelection("title")+", "+ln.SqlFieldSelection("description")+
|
|
|
|
|
|
+ ln.SqlFieldSelection("title", "")+
|
|
|
|
+ ", "+
|
|
|
|
+ ln.SqlFieldSelection("description", "")+
|
|
", `id`, `handle`, `thumbnail`, "+
|
|
", `id`, `handle`, `thumbnail`, "+
|
|
"`created_at`, `updated_at`, `deleted_at` "+
|
|
"`created_at`, `updated_at`, `deleted_at` "+
|
|
"FROM `product_collection` "+
|
|
"FROM `product_collection` "+
|
|
@@ -202,18 +204,22 @@ func (db *clickhouse) ProductVariants(ctx *middleware.GShopifyContext, id string
|
|
var o []relation.ProductVariant
|
|
var o []relation.ProductVariant
|
|
rows, err := db.session.
|
|
rows, err := db.session.
|
|
Select(
|
|
Select(
|
|
- "id", "product_id", "options",
|
|
|
|
- fmt.Sprintf("price['%s'] as price", defaultCurrency),
|
|
|
|
- fmt.Sprintf("unit_price['%s'] as unit_price", defaultCurrency),
|
|
|
|
- fmt.Sprintf("compare_at_price['%s'] as compare_at_price", defaultCurrency),
|
|
|
|
- "barcode", "sku", "hs_code", "origin_country",
|
|
|
|
- "allow_backorder", "manage_inventory", "unit_price_measurement",
|
|
|
|
- "weight", "wight_unit", "created_at", "updated_at", "deleted_at",
|
|
|
|
- ctx.Language.SqlFieldSelection("title"),
|
|
|
|
|
|
+ "t.id as id", "t.product_id as product_id", "t.options as options",
|
|
|
|
+ fmt.Sprintf("t.price['%s'] as price", defaultCurrency),
|
|
|
|
+ fmt.Sprintf("t.unit_price['%s'] as unit_price", defaultCurrency),
|
|
|
|
+ fmt.Sprintf("t.compare_at_price['%s'] as compare_at_price", defaultCurrency),
|
|
|
|
+ "t.barcode as barcode", "t.sku as sku", "t.hs_code as hs_code", "t.origin_country as origin_country",
|
|
|
|
+ "t.allow_backorder as allow_backorder", "t.manage_inventory as manage_inventory", "t.unit_price_measurement as unit_price_measurement",
|
|
|
|
+ "t.weight as weight", "t.wight_unit as weight_unit",
|
|
|
|
+ "t.created_at as created_at", "t.updated_at as updated_at", "t.deleted_at as deleted_at",
|
|
|
|
+ "shopping_profile.type as type",
|
|
|
|
+ ctx.Language.SqlFieldSelection("title", "t"),
|
|
).
|
|
).
|
|
- From(key.Table()).
|
|
|
|
|
|
+ From(fmt.Sprintf("%s as t", key.Table())).
|
|
Where(key.Clause(), key.Args()...).
|
|
Where(key.Clause(), key.Args()...).
|
|
- OrderBy("created_at").
|
|
|
|
|
|
+ LeftJoin("product", "product.id = t.product_id").
|
|
|
|
+ LeftJoin("shopping_profile", "product.profile_id = shopping_profile.id").
|
|
|
|
+ OrderBy("t.created_at").
|
|
Load(&o)
|
|
Load(&o)
|
|
if rows < 1 || err != nil {
|
|
if rows < 1 || err != nil {
|
|
return nil
|
|
return nil
|