/**
  * Constructor
  *
  * Base constructor
  *
  * @access public
  */
 public function __construct()
 {
     parent::__construct();
     $this->tableName = 'addon_products';
     $this->primaryKeyName = 'id';
     $this->searchFields = array('id', 'price', 'description');
 }
 public function __construct()
 {
     parent::__construct();
     $this->tableName = 'customer_groups';
     $this->primaryKeyName = 'customergroupid';
     $this->customKeyName = '';
     $this->searchFields = array('customergroupid', 'groupname');
 }
Example #3
0
 public function __construct()
 {
     parent::__construct();
     $this->tableName = 'products';
     $this->primaryKeyName = 'productid';
     $this->customKeyName = '';
     $this->searchFields = array('productid', 'prodname', 'prodcode');
 }
Example #4
0
 /**
  * Constructor
  *
  * Base constructor
  *
  * @access public
  */
 public function __construct()
 {
     parent::__construct();
     $this->customer = new ISC_ENTITY_CUSTOMER();
     $this->tableName = 'pic';
     $this->primaryKeyName = 'picid';
     $this->searchFields = array('picid', 'filename', 'description');
 }
 /**
  * Constructor
  *
  * Base constructor
  *
  * @access public
  */
 public function __construct()
 {
     parent::__construct();
     $this->shipping = new ISC_ENTITY_SHIPPING();
     $this->tableName = 'orders';
     $this->primaryKeyName = 'orderid';
     $this->customKeyName = 'ordformsessionid';
     $this->searchFields = array('orderid', 'ordtoken', 'ordcustid', 'ordbillfirstname', 'ordbilllastname', 'ordbillemail', 'ordshipfirstname', 'ordshiplastname', 'ordshipemail');
 }
Example #6
0
 /**
  * Constructor
  *
  * Base constructor
  *
  * @access public
  */
 public function __construct()
 {
     parent::__construct();
     $this->shipping = new ISC_ENTITY_SHIPPING();
     $this->group = new ISC_ENTITY_CUSTOMERGROUP();
     $this->tableName = 'customers';
     $this->primaryKeyName = 'customerid';
     $this->customKeyName = 'custformsessionid';
     $this->searchFields = array('customerid', 'custgroupid', 'custconfirstname', 'custconlastname', 'custconemail', 'custconphone');
 }
Example #7
0
	public function __construct()
	{
		$schema = array(
				"customergroupid" => "int",
				"groupname" => "text",
				"discount" => "price",
				"discountmethod" => "text",
				"isdefault" => "bool",
				"categoryaccesstype" => "text",
		);

		$tableName = "customer_groups";
		$primaryKeyName = "customergroupid";
		$searchFields = array(
				'customergroupid',
				'groupname'
		);

		$customKeyName = "";

		parent::__construct($schema, $tableName, $primaryKeyName, $searchFields, $customKeyName);
	}
	/**
	 * 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;
	}
Example #9
0
	/**
	 * Edit a customer
	 *
	 * Method will edit a customer's details
	 *
	 * @access public
	 * @param array $input The customer's details
	 * @param int $customerId The optional customer ID. Default will be $input[$this->primaryKeyName]
	 * @param bool $isFullAddressBook TRUE to delete any addresses first before adding them in. Default is FALSE
	 * @param bool $filterUniqueAddress TRUE to only insert unique addresses, FALSE not to check. Default is FALSE
	 * @return bool TRUE if the customer exists and the details were updated successfully, FALSE oterwise
	 */
	public function edit($input, $customerId='', $isFullAddressBook=false, $filterUniqueAddress=false)
	{
		if (!parent::edit($input, $customerId)) {
			return false;
		}

		if (!isId($customerId)) {
			$customerId = $input[$this->primaryKeyName];
		}

		if (array_key_exists("addresses", $input) && is_array($input["addresses"]) && !empty($input["addresses"])) {

			/**
			 * Do we need to clear out our address book first?
			 */
			if ($isFullAddressBook) {
				$this->shipping->deleteByCustomer($customerId);
			}

			/**
			 * Sanatise the addresses, just in case
			 */
			if (is_associative_array($input["addresses"])) {
				$input["addresses"] = array($input["addresses"]);
			}

			foreach ($input["addresses"] as $address) {
				$address['shipcustomerid'] = $customerId;

				if (!$isFullAddressBook && array_key_exists("shipid", $address) && isId($address["shipid"])) {
					$this->shipping->edit($address);
				} else if (!$filterUniqueAddress || !$this->shipping->basicSearch($address)) {
					$this->shipping->add($address);
				}
			}
		}

		if (isset($input['custpassword']) && !empty($input['custpassword'])) {
			// change password from edit screen
			$this->updatePassword($customerId, $input['custpassword']);
		}

		return true;
	}
Example #10
0
	/**
	 * Search for a matching address
	 *
	 * Method will do a predefined search for a matching address
	 *
	 * @access public
	 * @param array $address The address details array
	 * @return int The matching address ID if found, FALSE if no match
	 */
	public function basicSearch($address)
	{
		if (!is_array($address)) {
			return false;
		}

		/**
		 * Clean our address array
		 */
		$address = Interspire_Array::clean($address);

		if (!is_array($address) || !isset($address["shipcustomerid"]) || !isset($address["shipfirstname"]) || !isset($address["shiplastname"]) || !isset($address["shipaddress1"])) {
			return false;
		}

		$searchFields = array();
		$searchFields["shipcustomerid"] = $address["shipcustomerid"];
		$searchFields["shipfirstname"] = array(
												"value" => $address["shipfirstname"],
												"func" => "LOWER"
										);

		$searchFields["shiplastname"] = array(
												"value" => $address["shiplastname"],
												"func" => "LOWER"
										);

		$searchFields["shipaddress1"] = array(
												"value" => $address["shipaddress1"],
												"func" => "LOWER"
										);

		$formSessionId = 0;
		if (isset($address["shipformsessionid"])) {
			$formSessionId = $address["shipformsessionid"];
		}

		return parent::search($searchFields, array(), array(), $formSessionId);
	}
Example #11
0
 /**
  * Search for a matching address
  *
  * Method will do a predefined search for a matching address
  *
  * @access public
  * @param array $address The address details array
  * @return int The matching address ID if found, FALSE if no match
  */
 public function basicSearch($address)
 {
     /**
      * Clean our address array
      */
     $address = array_map('trim', $address);
     $address = array_filter($address);
     if (!is_array($address) || !isset($address['shipcustomerid']) || !isset($address['shipfirstname']) || !isset($address['shiplastname']) || !isset($address['shipaddress1'])) {
         return false;
     }
     $searchFields = array();
     $searchFields['shipcustomerid'] = $address['shipcustomerid'];
     $searchFields['shipfirstname'] = array('value' => $address['shipfirstname'], 'func' => 'LOWER');
     $searchFields['shiplastname'] = array('value' => $address['shiplastname'], 'func' => 'LOWER');
     $searchFields['shipaddress1'] = array('value' => $address['shipaddress1'], 'func' => 'LOWER');
     $formSessionId = 0;
     if (isset($address['shipformsessionid'])) {
         $formSessionId = $address['shipformsessionid'];
     }
     return parent::search($searchFields, array(), array(), $formSessionId);
 }
Example #12
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;
	}
Example #13
0
	public function __construct()
	{
		$schema = array(
				"productid" => "int",
				"prodname" => "text",
				"prodtype" => "int",
				"prodcode" => "text",
				"prodfile" => "text",
				"proddesc" => "text",
				"prodsearchkeywords" => "text",
				"prodavailability" => "text",
				"prodprice" => "price",
				"prodcostprice" => "price",
				"prodretailprice" => "price",
				"prodsaleprice" => "price",
				"prodcalculatedprice" => "price",
				"prodsortorder" => "int",
				"prodvisible" => "bool",
				"prodfeatured" => "bool",
				"prodvendorfeatured" => "bool",
				"prodrelatedproducts" => "text",
				"prodcurrentinv" => "int",
				"prodlowinv" => "int",
				"prodoptionsrequired" => "bool",
				"prodwarranty" => "text",
				"prodweight" => "measurement",
				"prodwidth" => "measurement",
				"prodheight" => "measurement",
				"proddepth" => "measurement",
				"prodfixedshippingcost" => "price",
				"prodfreeshipping" => "bool",
				"prodinvtrack" => "int",
				"prodratingtotal" => "int",
				"prodnumratings" => "int",
				"prodnumsold" => "int",
				"proddateadded" => "date",
				"prodbrandid" => "int",
				"prodnumviews" => "int",
				"prodpagetitle" => "text",
				"prodmetakeywords" => "text",
				"prodmetadesc" => "text",
				"prodlayoutfile" => "text",
				"prodvariationid" => "int",
				"prodallowpurchases" => "bool",
				"prodhideprice" => "bool",
				"prodcallforpricinglabel" => "text",
				"prodcatids" => "text",
				"prodlastmodified" => "date",
				"prodvendorid" => "int",
				"prodhastags" => "bool",
				"prodwrapoptions" => "text",
				"prodconfigfields" => "text",
				"prodeventdaterequired" => "bool",
				"prodeventdatefieldname" => "text",
				"prodeventdatelimited" => "bool",
				"prodeventdatelimitedtype" => "int",
				"prodeventdatelimitedstartdate" => "date",
				"prodeventdatelimitedenddate" => "date",
				"prodmyobasset" => "text",
				"prodmyobincome" => "text",
				"prodmyobexpense" => "text",
				"prodpeachtreegl" => "text",
				"prodcondition" => "text",
				"prodshowcondition" => "bool",
				"product_enable_optimizer" => "bool",
				"prodpreorder" => "bool",
				"prodreleasedate" => "int",
				"prodreleasedateremove" => "bool",
				"prodpreordermessage" => "text",
				"prodminqty" => "int",
				"prodmaxqty" => "int",
				'tax_class_id' => 'int',
				"opengraph_type" => "text",
				"opengraph_use_product_name" => "bool",
				"opengraph_title" => "text",
				"opengraph_use_meta_description" => "bool",
				"opengraph_description" => "text",
				"opengraph_use_image" => "bool",
				"upc" => "text",
				"disable_google_checkout" => "int",
				"last_import" => "int",
		);

		$tableName = "products";
		$primaryKeyName = "productid";
		$searchFields = array(
				"productid",
				"prodname",
				"prodcode"
		);

		$customKeyName = "";

		parent::__construct($schema, $tableName, $primaryKeyName, $searchFields, $customKeyName);
	}