public function checkProductAvailibiltyOrderItems($arrobjProducts, $arrmixOrderItems)
    {
        $arrstrProductIds = array();
        $arrintItems = array();
        foreach ($arrobjProducts as $objProduct) {
            $arrstrProductIds[] = '\'' . $objProduct->getProductNumber() . '\'';
            $arrintItems[$objProduct->getProductNumber()] = $arrmixOrderItems[$objProduct->getId()];
        }
        $strQueryString = '	SELECT
								Id,
								Quantity_Available__c
							FROM
								CustomProduct__C WHERE Id IN ( ' . implode(',', $arrstrProductIds) . ' )';
        try {
            $arrmixTempProducts = $this->m_objSforcePartnerClient->query($strQueryString);
        } catch (\Exception $e) {
            echo 'Unable to fetch records from Salesforce';
            return;
        }
        $objQueryResult = new QueryResult($arrmixTempProducts);
        $this->arrmixProducts = array();
        $boolIsProductAvailable = true;
        for ($objQueryResult->rewind(); $objQueryResult->pointer < $objQueryResult->size; $objQueryResult->next()) {
            $arrmixRecords = $objQueryResult->current();
            if ($arrmixRecords->fields->Quantity_Available__c < $arrintItems[$arrmixRecords->Id]) {
                $boolIsProductAvailable = false;
                break;
            }
        }
        $this->output[] = 'Checked Product Avalaibility';
        return $boolIsProductAvailable;
    }
 /**
  * Retrieves data from specified objects, whether or not they have been deleted.
  *
  * @param String $query Query String
  * @param QueryOptions $queryOptions  Batch size limit.  OPTIONAL
  * @return QueryResult
  */
 public function queryAll($query, $queryOptions = NULL)
 {
     $this->setHeaders("queryAll");
     $raw = $this->sforce->queryAll(array('queryString' => $query))->result;
     $QueryResult = new QueryResult($raw);
     $QueryResult->setSf($this);
     // Dependency Injection
     return $QueryResult;
 }
    private function getSFProducts()
    {
        $strQueryString = 'SELECT
									Id,
									Name,
									Catagory_Id__c,
									Color_Code__c,
									Discount__c,
									List_Price__c,
									Product_Code__c,
									Product_Description__c,
									Product_Image_Url__c,
									Quantity_Available__c,
									Size__c
								FROM
									CustomProduct__C';
        try {
            $arrmixTempProducts = $this->m_objSforcePartnerClient->query($strQueryString);
        } catch (\Exception $e) {
            echo 'Unable to fetch records from Salesforce';
        }
        $objQueryResult = new QueryResult($arrmixTempProducts);
        $this->arrmixProducts = array();
        for ($objQueryResult->rewind(); $objQueryResult->pointer < $objQueryResult->size; $objQueryResult->next()) {
            $arrmixRecords = $objQueryResult->current();
            $this->arrmixProducts[$arrmixRecords->Id]['product_number'] = $arrmixRecords->Id;
            $this->arrmixProducts[$arrmixRecords->Id]['name'] = $arrmixRecords->fields->Name;
            $this->arrmixProducts[$arrmixRecords->Id]['category'] = $arrmixRecords->fields->Catagory_Id__c;
            $this->arrmixProducts[$arrmixRecords->Id]['link'] = $arrmixRecords->fields->Product_Image_Url__c;
            $this->arrmixProducts[$arrmixRecords->Id]['list_price'] = $arrmixRecords->fields->List_Price__c;
            $this->arrmixProducts[$arrmixRecords->Id]['description'] = $arrmixRecords->fields->Product_Description__c;
            $this->arrmixProducts[$arrmixRecords->Id]['color'] = $arrmixRecords->fields->Color_Code__c;
            $this->arrmixProducts[$arrmixRecords->Id]['size'] = $arrmixRecords->fields->Size__c;
            $this->arrmixProducts[$arrmixRecords->Id]['quantity_available'] = $arrmixRecords->fields->Quantity_Available__c;
            $this->arrmixProducts[$arrmixRecords->Id]['discount'] = $arrmixRecords->fields->Discount__c;
        }
    }