Product_Importer

Summary

No summary available.

Source

File: src/BigCommerce/Import/Importers/Products/Product_Importer.php

class Product_Importer {
	/**
	 * @var Product The Product from the BigCommerce catalog API
	 */
	private $product;

	/**
	 * @var Listing the Listing from the BigCommerce channel API
	 */
	private $listing;

	/**
	 * @var CatalogApi
	 */
	private $catalog_api;

	/**
	 * @var \WP_Term
	 */
	private $channel_term;

	/**
	 * Product_Importer constructor.
	 *
	 * @param Product    $product
	 * @param Listing    $listing
	 * @param CatalogApi $catalog_api
	 * @param \WP_Term   $channel_term
	 */
	public function __construct( Product $product, Listing $listing, CatalogApi $catalog_api, \WP_Term $channel_term ) {
		$this->product      = $product;
		$this->listing      = $listing;
		$this->catalog_api  = $catalog_api;
		$this->channel_term = $channel_term;
	}

	/**
	 * @return int The ID of the imported post
	 */
	public function import() {
		$strategy_factory = new Product_Strategy_Factory( $this->product, $this->listing, $this->channel_term, $this->catalog_api, Import_Strategy::VERSION );

		$strategy = $strategy_factory->get_strategy();

		return $strategy->do_import();
	}
}

Methods


User Contributed Notes

You must log in before being able to contribute a note or feedback.