Ejemplo n.º 1
0
	/**
	 * Get the product variation combination record
	 *
	 * Method will return the product variation combination record
	 *
	 * @access public
	 * @param int $variationId The product variation combination ID
	 * @param int $productId The optional product ID for the combination
	 * @param bool $mergeProductDetails TRUE to also get the product details, FALSE not to. Default is TRUE
	 * @return array The product variation combination array on success, NULL if no record could be found, FALSE on error
	 */
	public function get($variationId, $productId='', $mergeProductDetails=true)
	{
		$variation = parent::get($variationId);

		if (!is_array($variation)) {
			return false;
		}

		if (isId($productId) && (!isset($variation["vcproductid"]) || $variation["vcproductid"] !== $productId)) {
			return false;
		}

		/**
		 * Merge in the product details if we can
		 */
		if ($mergeProductDetails && isset($variation["vcproductid"]) && isId($variation["vcproductid"])) {
			$product = $this->productEntity->get($variation["vcproductid"]);

			if (is_array($product)) {
				$variation += $product;
			}
		}

		return $variation;
	}
Ejemplo n.º 2
0
	public function get($orderId)
	{
		$order = parent::get($orderId);

		if (!$order) {
			return false;
		}

		$order["customer"] = false;
		if (isId($order["ordcustid"])) {

			$customer = $this->customer->get($order["ordcustid"]);
			$order["customer"] = $customer;
		}

		$order["products"] = array();

		$query = "SELECT *
					FROM [|PREFIX|]order_products
					WHERE orderorderid = " . (int)$orderId;

		$result = $GLOBALS["ISC_CLASS_DB"]->Query($query);
		while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) {
			$prod = $this->product->get($row["ordprodid"]);
			if ($prod) {
				$prod["prodorderquantity"] = $row["ordprodqty"];
				if(GetConfig('taxDefaultTaxDisplayOrders') == TAX_PRICES_DISPLAY_INCLUSIVE) {
					$prod['prodorderamount'] = $row['price_inc_tax'];
				}
				else {
					$prod['prodorderamount'] = $row['price_ex_tax'];
				}
				$prod["prodordvariationid"] = $row["ordprodvariationid"];
				$prod["prodorderid"] = $row["orderprodid"];
				$order["products"][] = $prod;
			}
		}

		return $order;
	}