Link to home
Start Free TrialLog in
Avatar of Robert Granlund
Robert GranlundFlag for United States of America

asked on

PHP error

I am getting a PHP error:Parse error: syntax error, unexpected T_VARIABLE
It says it's at line number: 45
I can't figure it out.
<?php
	$this->EE->db->select('*')
 					->where('order_id', $entry_id)
					->where('entry_id', '29')
					->limit('1');

		$order_query = $this->EE->db->get('cartthrob_order_items');
		$this->_policy  = $entry_id; 

		$order_items = $order_query->result_array();

		$order_query->free_result();

		$keep_extra = FALSE;

		$this->_uuid_cancel = $this->generate_uuid();
		
 		foreach ($order_items as $row)
		{
			$extra = _unserialize($row['extra'], TRUE);

			if ($keep_extra)
			{
				$row['extra'] = $extra;
			}
			else
			{
				foreach ($extra as $key => $value)
			{
					if ( ! isset($row[$key]))
					{
						$row[$key] = $value;
 					}
				}
 				unset($row['extra']);
			}
			break; // only need this one time. 
		}		
		if (isset($row))
		{
		$policy_number = $row['policy_number'];
		$sd = date('Y-m-d', $row['entry_date']);
		
		$cancel_xml = "<PolicyPartialImageCancelRq>";
  			$cancel_xml.= "<RqUID>".$this->_uuid_cancel."</RqUID>";
  			$cancel_xml.= "<TransactionRequestDt>".date('Y-m-d')."</TransactionRequestDt>";
  			$cancel_xml.= "<TransactionEffectiveDt>2015-04-08</TransactionEffectiveDt>";
  			$cancel_xml.= "<TransactionIdentifier>2</TransactionIdentifier>";
 			 $cancel_xml.= "<PolicyCancelNonRenew>";
    			$cancel_xml.= "<PartialPolicy>";
      			$cancel_xml.= "<PolicyNumber>".$policy_number."</PolicyNumber>";
      			$cancel_xml.= "<LOBCd />";
      			$cancel_xml.= "<ContractTerm>";
        			$cancel_xml.= "<EffectiveDt>".$sd."</EffectiveDt>";
      			$cancel_xml.= "</ContractTerm>";
    			$cancel_xml.= "</PartialPolicy>";
    			$cancel_xml.= "<CancelNonRenewInfo>";
      			$cancel_xml.= "<BusinessPurposeTypeCd>XLN</BusinessPurposeTypeCd>";
      			$cancel_xml.= "<RequestorCd>".$cancel_request."</RequestorCd>";
      			$cancel_xml.= "<CancelReasonCd>".ee()->session->userdata('refund_reason')."</CancelReasonCd>";
      			$cancel_xml.= "<CancellationTypeCd>".$cancel_type."</CancellationTypeCd>";
    			$cancel_xml.= "</CancelNonRenewInfo>";
  			$cancel_xml.= "</PolicyCancelNonRenew>";
		$cancel_xml.= "</PolicyPartialImageCancelRq>";
		
		}  //  END Row	

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What's the full error message? Are you sure it's in this particular file and not an included file?
Avatar of Robert Granlund

ASKER

It's not an include file.  The error specifically mentions that line.

Parse error: syntax error, unexpected T_VARIABLE
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here is the entire thing.  It errors at line number: 75
"Parse error: syntax error, unexpected T_VARIABLE"
	public function cancel($transaction_id, $entry_id) {
		
	$this->EE->load->model('order_model');

		$order = $this->EE->order_model->get_order_from_entry($entry_id);

		$this->_user = $this->plugin_settings('username'); 
		$this->_pass = $this->plugin_settings('password');

 		$this->_uuid = $this->generate_uuid();
		
		$refund_reason = ee()->session->userdata('refund_reason');
		
		if(isset($refund_reason) && $refund_reason == "C2") {
			$cancel_type = "FL";
			$cancel_request = "C";
		} elseif (isset($refund_reason) && $refund_reason == "C3") {
			$cancel_type = "FL";
			$cancel_request = "C";
		} elseif (isset($refund_reason) && $refund_reason == "C4") {
			$cancel_type = "PR";
			$cancel_request = "I";
		} elseif (isset($refund_reason) && $refund_reason == "C7") {
			$cancel_type = "SR";
			$cancel_request = "I";
		}  else {
			$cancel_type = "PR";
			$cancel_request = "C";
		}
		

		$this->EE->db->select('*')
 					->where('order_id', $entry_id)
					->where('entry_id', '29')
					->limit('1');

		$order_query = $this->EE->db->get('cartthrob_order_items');
		$this->_policy  = $entry_id; 

		$order_items = $order_query->result_array();

		$order_query->free_result();

		$keep_extra = FALSE;

		$this->_uuid_cancel = $this->generate_uuid();
		
 		foreach ($order_items as $row)
		{
			$extra = _unserialize($row['extra'], TRUE);

			if ($keep_extra)
			{
				$row['extra'] = $extra;
			}
			else
			{
				foreach ($extra as $key => $value)
			{
					if ( ! isset($row[$key]))
					{
						$row[$key] = $value;
 					}
				}
 				unset($row['extra']);
			}
			break; // only need this one time. 
		}		
		if (isset($row))
		{
		$policy_number = $row['policy_number'];
		$sd = date('Y-m-d', $row['entry_date']);
		
		$cancel_xml = "<PolicyPartialImageCancelRq>";
  			$cancel_xml .= "<RqUID>".$this->_uuid_cancel."</RqUID>";
  			$cancel_xml .= "<TransactionRequestDt>".date('Y-m-d')."</TransactionRequestDt>";
  			$cancel_xml .= "<TransactionEffectiveDt>2015-04-08</TransactionEffectiveDt>";
  			$cancel_xml .= "<TransactionIdentifier>2</TransactionIdentifier>";
 			 $cancel_xml .= "<PolicyCancelNonRenew>";
    			$cancel_xml .= "<PartialPolicy>";
      			$cancel_xml .= "<PolicyNumber>".$policy_number."</PolicyNumber>";
      			$cancel_xml .= "<LOBCd />";
      			$cancel_xml .= "<ContractTerm>";
        			$cancel_xml .= "<EffectiveDt>".$sd."</EffectiveDt>";
      			$cancel_xml .= "</ContractTerm>";
    			$cancel_xml .= "</PartialPolicy>";
    			$cancel_xml .= "<CancelNonRenewInfo>";
      			$cancel_xml .= "<BusinessPurposeTypeCd>XLN</BusinessPurposeTypeCd>";
      			$cancel_xml .= "<RequestorCd>".$cancel_request."</RequestorCd>";
      			$cancel_xml .= "<CancelReasonCd>".ee()->session->userdata('refund_reason')."</CancelReasonCd>";
      			$cancel_xml .= "<CancellationTypeCd>".$cancel_type."</CancellationTypeCd>";
    			$cancel_xml .= "</CancelNonRenewInfo>";
  			$cancel_xml .= "</PolicyCancelNonRenew>";
		$cancel_xml .= "</PolicyPartialImageCancelRq>";
		
		}  //  END Row	
		

Open in new window

There was a weird tab issue.  I fixed it.  Thanks for your help and suggestions.