@@ -62,7 +62,7 @@ final class AddProductToOrderViewModel: ObservableObject {
6262 ///
6363 var ghostRows : [ ProductRowViewModel ] {
6464 return Array ( 0 ..< 6 ) . map { index in
65- ProductRowViewModel ( product : sampleGhostProduct ( id: index) , canChangeQuantity : false )
65+ ghostProductRow ( id: index)
6666 }
6767 }
6868
@@ -199,69 +199,15 @@ extension AddProductToOrderViewModel {
199199
200200 /// Used for ghost list view while syncing
201201 ///
202- private func sampleGhostProduct( id: Int64 ) -> Product {
203- Product ( siteID: 1 ,
204- productID: id,
205- name: " Love Ficus " ,
206- slug: " " ,
207- permalink: " " ,
208- date: Date ( ) ,
209- dateCreated: Date ( ) ,
210- dateModified: nil ,
211- dateOnSaleStart: nil ,
212- dateOnSaleEnd: nil ,
213- productTypeKey: ProductType . simple. rawValue,
214- statusKey: ProductStatus . draft. rawValue,
215- featured: false ,
216- catalogVisibilityKey: ProductCatalogVisibility . hidden. rawValue,
217- fullDescription: nil ,
218- shortDescription: nil ,
219- sku: " 123456 " ,
220- price: " 20 " ,
221- regularPrice: nil ,
222- salePrice: nil ,
223- onSale: false ,
224- purchasable: true ,
225- totalSales: 0 ,
226- virtual: false ,
227- downloadable: false ,
228- downloads: [ ] ,
229- downloadLimit: - 1 ,
230- downloadExpiry: - 1 ,
231- buttonText: " " ,
232- externalURL: nil ,
233- taxStatusKey: ProductTaxStatus . taxable. rawValue,
234- taxClass: nil ,
235- manageStock: false ,
236- stockQuantity: 7 ,
237- stockStatusKey: ProductStockStatus . inStock. rawValue,
238- backordersKey: ProductBackordersSetting . notAllowed. rawValue,
239- backordersAllowed: false ,
240- backordered: false ,
241- soldIndividually: true ,
242- weight: nil ,
243- dimensions: ProductDimensions ( length: " 1 " , width: " 1 " , height: " 1 " ) ,
244- shippingRequired: false ,
245- shippingTaxable: false ,
246- shippingClass: nil ,
247- shippingClassID: 0 ,
248- productShippingClass: nil ,
249- reviewsAllowed: false ,
250- averageRating: " 5 " ,
251- ratingCount: 0 ,
252- relatedIDs: [ ] ,
253- upsellIDs: [ ] ,
254- crossSellIDs: [ ] ,
255- parentID: 0 ,
256- purchaseNote: nil ,
257- categories: [ ] ,
258- tags: [ ] ,
259- images: [ ] ,
260- attributes: [ ] ,
261- defaultAttributes: [ ] ,
262- variations: [ ] ,
263- groupedProducts: [ ] ,
264- menuOrder: 0 ,
265- addOns: [ ] )
202+ private func ghostProductRow( id: Int64 ) -> ProductRowViewModel {
203+ ProductRowViewModel ( productOrVariationID: id,
204+ name: " Ghost Product " ,
205+ sku: nil ,
206+ price: " 20 " ,
207+ stockStatusKey: ProductStockStatus . inStock. rawValue,
208+ stockQuantity: 1 ,
209+ manageStock: false ,
210+ canChangeQuantity: false ,
211+ imageURL: nil )
266212 }
267213}
0 commit comments