diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-02-20 09:28:41 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-02-20 09:28:41 +0800 |
commit | 0d474d9483b797e2ff6996f752d057bc144f2311 (patch) | |
tree | 45b86fc4a63fa7fd80da4894b366e0161243e683 | |
parent | f1503bf1a34cdb7b66171a2772108e7475ea792a (diff) |
Add product category
and reorder title & description.
-rw-r--r-- | catalog.cxx | 9 | ||||
-rw-r--r-- | interchange/product.hxx | 12 |
2 files changed, 14 insertions, 7 deletions
diff --git a/catalog.cxx b/catalog.cxx index 395412c..164811f 100644 --- a/catalog.cxx +++ b/catalog.cxx @@ -29,10 +29,10 @@ namespace QInterchange { switch (role) { case Product::SkuRole: return product.sku; - case Product::TitleRole: - return product.title; case Product::DescriptionRole: return product.description; + case Product::TitleRole: + return product.title; case Product::CommentRole: return product.comment; case Product::ThumbRole: @@ -43,6 +43,8 @@ namespace QInterchange { return product.price; case Product::ProdGroupRole: return product.prodGroup; + case Product::CategoryRole: + return product.category; case Product::WeightRole: return product.weight; case Product::AuthorRole: @@ -58,13 +60,14 @@ namespace QInterchange { { return QHash<int, QByteArray>{ { Product::SkuRole, "sku" }, - { Product::TitleRole, "title" }, { Product::DescriptionRole, "description" }, + { Product::TitleRole, "title" }, { Product::CommentRole, "comment" }, { Product::ThumbRole, "thumb" }, { Product::ImageRole, "image" }, { Product::PriceRole, "price" }, { Product::ProdGroupRole, "prodGroup" }, + { Product::CategoryRole, "category" }, { Product::WeightRole, "weight" }, { Product::AuthorRole, "author" }, { Product::CrossSellRole, "crossSell" } diff --git a/interchange/product.hxx b/interchange/product.hxx index 63ac63e..eda700a 100644 --- a/interchange/product.hxx +++ b/interchange/product.hxx @@ -9,13 +9,14 @@ namespace QInterchange { { enum ProductRoles { SkuRole = Qt::UserRole + 1, - TitleRole, DescriptionRole, + TitleRole, CommentRole, ThumbRole, ImageRole, PriceRole, ProdGroupRole, + CategoryRole, WeightRole, AuthorRole, CrossSellRole @@ -28,10 +29,10 @@ namespace QInterchange { { if (product->sku) sku = QString{product->sku}; - if (product->title) - title = QString{product->title}; if (product->description) description = QString{product->description}; + if (product->title) + title = QString{product->title}; if (product->comment) comment = QString{product->comment}; if (product->thumb) @@ -40,6 +41,8 @@ namespace QInterchange { image = QString{product->image}; if (product->prod_group) prodGroup = QString{product->prod_group}; + if (product->category) + category = QString{product->category}; if (product->author) author = QString{product->author}; if (product->crosssell) { @@ -50,13 +53,14 @@ namespace QInterchange { } QString sku; - QString title; QString description; + QString title; QString comment; QString thumb; QString image; double price; QString prodGroup; + QString category; double weight; QString author; QStringList crossSell; |