Skip to content

Data Types

Bright Antwi Boasiako edited this page Mar 30, 2021 · 8 revisions

Table of contents

Model Operations

Model::OPERATION_ADD
Model::OPERATION_REPLACE
Model::OPERATION_DELETE

Product

  • Fields: id, parent_id, sku, barcode, brand_name, type, weight, weight_unit, length, width, height, dimension_unit, fba_prep_instructions, case_quantity, case_length, case_width, case_height, case_dimension_unit, name
  • Constants:
    • Product Types:
      • TYPE_STANDARD
      • TYPE_VIRTUAL
    • Weight Units:
      • WEIGHT_UNIT_LB
      • WEIGHT_UNIT_KG
      • WEIGHT_UNIT_OZ
    • Dimenstion Units:
      • DIMENSION_UNIT_INCH
      • DIMENSION_UNIT_CM
  • Functions:
    • setBrand( string $name ): Set brand name
    • setProductType( string $type ): must be standard or virtual.
    • setWeightUnit( string $weightUnit ): must be lb, kg or oz.
    • setDimensionUnit( string $dimensionUnit ): must be in or cm.
    • Images
      • setPrimaryImage( string $imageUrl, bool $downloadToServer = false ): set primary product image
      • setPrimaryProductImage( ProductImage $productImage ): set primary product image, see ProductImage
      • addProductImage( ProductImage $productImage, $operation = self::OPERATION_ADD ): add/replace/delete product images
      • deleteProductImage( int $productImageId ): delete image
    • setDescription( string $description ): add description to product.
    • Tags
      • setTags( $tags ): set tags (replace)
      • addTags( $tags ): add tag or array of tags.
      • deleteTags( $tags ): delete tag or array of tags.

      Do not use this functions together

    • Price
      • addPrice( ProductPricing $pricing, string $operation = self::OPERATION_ADD ): add/replace/delete product pricing tiers, see ProductPricing
      • deletePrice( ProductPricing $pricing ): delete pricing tier from product, see ProductPricing
      • replaceAllPrices( $prices ): replace all product pricing
    • Suppliers
      • addSupplier( SupplierProduct $supplierProduct, string $operation = self::OPERATION_ADD ): add/replace/delete product suppliers, see SupplierProduct
      • deleteSupplier( SupplierProduct $supplierProduct ): delete supplier product, see SupplierProduct
      • replaceAllSuppliers( $supplierProducts ): replace all product suppliers
    • Categories
      • addToCategory( ProductToCategory $category, $operation = self::OPERATION_ADD ): add/replace/delete product categories, see ProductToCategory
      • addCategory( int $categoryId, bool $isPrimary = false, $operation = self::OPERATION_ADD ): add/replace/delete product categories
      • deleteCategory( int $categoryId ): detach the category from product
      • replaceAllCategories( $categories ): replace all product categories
    • Attribute Groups
      • setAttributeGroups( $attributeGroups ): set attribute groups to the product(one or many).
      • addAttributeGroups( int || array $attributeGroups ): add attribute groups by id
      • deleteAttributeGroups( int || array $attributeGroups ): delete attribute groups by id

      Do not use this functions together

    • Attributes
      • addProductAttribute( ProductAttribute $attribute, string $operation = self::OPERATION_ADD ): add/replace/delete product attributes, see ProductAttribute
      • addAttribute( int $attributeId, $value, string $operation = self::OPERATION_ADD ): add/replace/delete product attribute.
      • deleteAttribute( int $attributeId ): delete attribute from product.
      • replaceAllAttributes( $attributes ): replace all product attributes.
      • addVariant( Product $variant ): add a child product
      • setInventoryUnitCost( float $cost ): Sets the unique cost of initial inventory of the product.
      • addWarehouseInventory( int $warehouseId, int $quantity ): Adds initial inventory count for a warehouse for the product.
    • Bundles
      • addBundleComponent( int $componentId, int $quantity ): Adds a bundle component to the product.
      • addBundleComponents( array $components ): Adds multiple bundle components to the product.
      • removeBundleComponent( int $componentId ): Removes a bundle component from the product.
$product = new Product(['sku' => 'abc', 'name' => 'abcd123']);
$product->barcode = '123465';
$product->weight = 12.5;
$product->type = Product::TYPE_STANDARD;
$product->weight_unit = Product::WEIGHT_UNIT_LB;
$product->setTags(['aa', 'bb']);
$product->addTags('cc'); // will be set product tags ['aa', 'bb', 'cc']
$product->deleteTags('cc'); // will detach the 'cc' tag from the product
$product->addPrice(new ProductPricing(['product_pricing_tier_name' => 'Retail', 'price' => 10.5]));

// add supplier product with pricing
$supplierPricing  = new SupplierProductPricing();
$supplierPricing->price = 110;
$supplierPricing->supplier_pricing_tier_name = 'abc';

$supplierProduct  = new SupplierProduct([ 'supplier_name' => 'Test Supplier', 'is_default' => true ]);
$supplierProduct->addPrice( $supplierPricing );

$product->addSupplier( $supplierProduct );

// taxonomy
$product->addToCategory(new ProductToCategory(['category_id' => 20, 'is_primary' => true]));
$product->addCategory( 23, false );// another function to add product to categry

$product->setAttributeGroups([1,2,3]);

$product->addProductAttribute(new ProductAttribute(['id' => 5, 'value' => 'val']));
$product->addAttribute(6, 'val'); // another function to add attribute to product

ProductCategory

  • Fields: parent_id, name
  • Functions:
    • setAttributeGroups( $attributeGroups ): set attribute groups to the product(one or many).

ProductPricing

  • Fields: (product_pricing_tier_id or product_pricing_tier_name), price

ProductToCategory

  • Fields: product_id, category_id, is_primary

ProductAttribute

  • Fields: name, value

ProductImage

  • Fields: url, name, sort_order, is_primary, download

Supplier

  • Fields: id, name, company_name, primary_contact_name, email, purchase_order_email, phone, website, leadtime, minimum_order_quantity, minimum_purchase_order, warehouse

  • Functions:

    • addWarehouse( Warehouse $warehouse): adds a warehouse to the supplier.
    • setOfficeAddress( array $address): adds the office address of the supplier.
    • addOfficeAddressField( string $field, string $value): sets office address field of the supplier.

SupplierProduct

  • Fields: id, product_id, (supplier_id or supplier_name), is_default, supplier_sku, leadtime, minimum_order_quantity
  • Functions:

SupplierProductPricing

  • Fields: (supplier_pricing_tier_id or supplier_pricing_tier_name), price

Warehouse

  • Fields: name, type, email, phone
  • Constants:
    • Warehouse Types:
      • TYPE_DIRECT
      • TYPE_3PL
      • TYPE_SUPPLIER - TYPE_VENDOR
  • Functions:
    • setDefaultLocation( WarehouseLocation $location ): set the default location for the warehouse, see WarehouseLocation

WarehouseLocation

  • Fields: warehouse_id, aisle, bay, shelf, bin

PricingTier

  • Fields: id, name, currency_code

Attribute

  • Fields: id, name, type, display_options, validation, has_options, sort_order
  • Constants:
    • Attribute Types:
      • TYPE_STRING
      • TYPE_LONGTEXT
      • TYPE_DATE
      • TYPE_DATETIME
      • TYPE_NUMERIC
      • TYPE_INTEGER
      • TYPE_CHECKBOX
  • Functions:
    • addValue( string $value, int $sortOrder = null ): add value to attribute if has_options
    • addAttributeValue( AttributeValue $attributeValue ): add value to attribute if has_options

AttributeGroup

  • Fields: parent_id, name
  • Functions:
    • setAttributes( $attributes): set attributes to the attribute group(one or many).

AttributeValue

  • Fields: value, sort_order

SalesOrder

  • Fields: customer_reference, sales_channel_brand_id, sales_channel_brand_name, status, customer_id, shipping_address_id, billing_address_id,shipping_method_id, currency_code,payment_status, order_date, receive_by_date, payment_date, ship_by_date
  • Functions:
    • setShippingAddress( string $name ): Set shipping address.
    • setBillingAddress( Address $billingAddress ): Set billing address.
    • setCustomerAddress( Address $customerAddress ): Set customer address.
    • addSalesOrderLine( SalesOrderLine $salesOrderLine ): Add sales order line.
  • Constants:
    • SalesOrder Status:
      • STATUS_DRAFT
      • STATUS_OPEN
      • STATUS_CLOSED
    • SalesOrder FulfillmentStatues:
      • FULFILLMENT_STATUS_UNFULFILLED
      • FULFILLMENT_STATUS_PARTIALLY_FULFILLED
      • FULFILLMENT_STATUS_FULFILLED

SalesOrderLine

  • Fields: product_id, sku, description, amount, quantity, tax, nominal_code_id,nominal_code_name, nominal_code, sales_channel_line_id, discount, warehouse_id

SalesOrderFulfillment

  • Fields: sales_order_id, warehouse_id, shipping_method_id, fulfilled_at, cost, tracking_number

  • Functions

    • addFulfillmentLine( int $salesOrderId, int $quantity ): add sales order line to fulfill
  • Example

    $fulfillment                    = new SalesOrderFulfillment();
    $fulfillment->sales_order_id     = $salesOrder->id;
    $fulfillment->fulfilled_at       = '2019-09-20T06:46:27+00:00';
    $fulfillment->shipping_method_id = 1;
    
    $fulfillResponse = $salesOrders->fulfill( $fulfillment );

    If more than one warehouses among the sales order lines, warehouse_id would be a required field. Otherwise, it is optional and would just assume the warehouse id.

    Items (and quantities) can be specified but don’t have to be. If they are not specified, it assumes the entire item selection for that warehouse was fulfilled

SalesChannel

  • Fields: sales_channel_type_id, name, country, sales_channel_brand_id, connection_settings, integration_settings, credentials, sales_channel_type

SalesChannelBrand

  • Fields: name, company_name, email, address_id, logo_url, archived_at

PurchaseOrder

  • Fields: purchase_order_date, purchase_order_number, submission_format, approval_status, payment_term_id, incoterm_id, supplier_id,shipping_method_id, supplier_warehouse_id,destination_warehouse_id, currency_id, currency_code, estimated_delivery_date, supplier_notes, purchase_order_lines

  • Functions:

    • addPurchaseOrderLine( PurchaseOrderLine $purchaseOrderLine ): Add purchase order line.
  • Constants:

    • PurchaseOrder Status:

      • STATUS_DRAFT
      • STATUS_OPEN
      • STATUS_CLOSED
    • PurchaseOrder Approval Statuses:

      • APPROVAL_STATUS_PENDING
      • APPROVAL_STATUS_APPROVED
    • PurchaseOrder Submission Statuses:

      • SUBMISSION_STATUS_UNSUBMITTED
      • SUBMISSION_STATUS_SUBMITTED
      • SUBMISSION_STATUS_CHANGE_REQUEST_VENDOR
      • SUBMISSION_STATUS_CHANGE_REQUEST_BUYER
      • SUBMISSION_STATUS_FINALIZED
      • SUBMISSION_STATUS_CANCELED
      • SUBMISSION_STATUS_VOIDED
    • PurchaseOrder Receipt Statuses:

      • RECEIPT_STATUS_UNRECEIVED
      • RECEIPT_STATUS_RECEIVED
      • RECEIPT_STATUS_PARTIALLY_RECEIVED
      • RECEIPT_STATUS_DROPSHIP
  • Functions:

    • addPurchaseOrderLine( PurchaseOrderLine $purchaseOrderLine ): adds a purchase order line to the purchase order, see PurchaseOrderLine

PurchaseOrderLine

  • Fields: product_id, sku, description, amount, quantity, tax, discount,estimated_delivery_date, nominal_code_id, line_reference

PurchaseOrderShipment

  • Fields: purchase_order_id, shipment_date, shipping_method_id, tracking, shipment_lines
  • Functions:
    • addShipmentLine( int $purchaseOrderLineId, int $quantity ): adds a purchase order shipment line by purchase order line id.
    • addShipmentLineByReference( int $reference, int $quantity ): adds a purchase order shipment line by purchase order line reference.

PurchaseOrderReceipt

  • Fields: purchase_order_id, purchase_order_shipment_id, received_at, warehouse_id, receipt_lines
  • Functions:
    • addShipmentReceiptLine( int $shipmentLineId, int $quantity ): adds a purchase order shipment receipt line by purchase order shipment line id.
    • addShipmentReceiptLineByReference( int $reference, int $quantity ): adds a purchase order shipment receipt line by purchase order line reference.

Address

  • Fields: name, company, email, phone, address1, address2, address3, city, province, province_code, zip, country, country_code

NominalCode

  • Fields: code, name, type
  • Constants:
    • NominalCode Types:
      • TYPE_REVENUE
      • TYPE_EXPENSE
      • TYPE_ASSET
      • TYPE_LIABILITY
      • TYPE_EQUITY

Incoterm

  • Fields: code, description

Import

  • Fields:
    • csv_file: the CSV file path
    • csv_delimiter: The column delimiter, Default ,
    • csv_enclosure: The row enclosure, Default \n
    • override: Override a product if exists, Default true

Currency

  • Fields: code, name, convetsion, is_default

InventoryAdjustment

  • Fields: adjustment_date, product_id, warehouse_id, warehouse_location_id, quantity, notes

Customer

  • Fields: default_address_id, name, email, zip, address1

Settings

  • Fields: user_id, key, description, type, value, default_value
  • Constants:
    • Setting Types:
      • TYPE_STRING
      • TYPE_DATE
      • TYPE_CHECKBOX
      • TYPE_INTEGER