Page 1 of 1

Parse error: syntax error, unexpected T_IF, expecting T_FUNC

Posted: Wed Feb 26, 2014 6:51 am
by ronnieb
Hi
Can anyone help pinpoint what the problem is

I'm getting this error

Parse error: syntax error, unexpected T_IF, expecting T_FUNCTION in /home/******/public_html/shop/vqmod/vqcache/vq2-admin_model_catalog_product.php on line 31


I have cleared the vqmod cache , I'm using VQMod 2.4.1

this is the file upto line 50

Code: Select all

<?php
class ModelCatalogProduct extends Model {
	public function addProduct($data) {
		$this->db->query("INSERT INTO " . DB_PREFIX . "product SET model = '" . $this->db->escape($data['model']) . "', sku = '" . $this->db->escape($data['sku']) . "', upc = '" . $this->db->escape($data['upc']) . "', ean = '" . $this->db->escape($data['ean']) . "', jan = '" . $this->db->escape($data['jan']) . "', isbn = '" . $this->db->escape($data['isbn']) . "', mpn = '" . $this->db->escape($data['mpn']) . "', location = '" . $this->db->escape($data['location']) . "', quantity = '" . (int)$data['quantity'] . "', minimum = '" . (int)$data['minimum'] . "', subtract = '" . (int)$data['subtract'] . "', stock_status_id = '" . (int)$data['stock_status_id'] . "', date_available = '" . $this->db->escape($data['date_available']) . "', manufacturer_id = '" . (int)$data['manufacturer_id'] . "', shipping = '" . (int)$data['shipping'] . "', price = '" . (float)$data['price'] . "', points = '" . (int)$data['points'] . "', weight = '" . (float)$data['weight'] . "', weight_class_id = '" . (int)$data['weight_class_id'] . "', length = '" . (float)$data['length'] . "', width = '" . (float)$data['width'] . "', height = '" . (float)$data['height'] . "', length_class_id = '" . (int)$data['length_class_id'] . "', status = '" . (int)$data['status'] . "', tax_class_id = '" . $this->db->escape($data['tax_class_id']) . "', sort_order = '" . (int)$data['sort_order'] . "', date_added = NOW()");
		
		$product_id = $this->db->getLastId();
		
		if (isset($data['image'])) {
			$this->db->query("UPDATE " . DB_PREFIX . "product SET image = '" . $this->db->escape(html_entity_decode($data['image'], ENT_QUOTES, 'UTF-8')) . "' WHERE product_id = '" . (int)$product_id . "'");
		}
		
		
			foreach ($data['product_description'] as $language_id => $value) {
				$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "', tag = '" . $this->db->escape($value['tag']) . "', short_desc = '" . $this->db->escape($value['short_desc']) . "'");
			}
			


					if(isset($value['title_tag'])) {
						if (!isset($product_id)) {
							$octitler_product_id = $this->db->getLastId();
						} else {
							$octitler_product_id = $product_id;
						}
						$this->db->query("UPDATE " . DB_PREFIX . "product_description SET title_tag = '" . $this->db->escape($value['title_tag']) . "' WHERE product_id = '" . (int)$octitler_product_id . "'");
						unset($octitler_product_id);
					}
				
		}
		
		if (isset($data['product_store'])) {
			foreach ($data['product_store'] as $store_id) {
				$this->db->query("INSERT INTO " . DB_PREFIX . "product_to_store SET product_id = '" . (int)$product_id . "', store_id = '" . (int)$store_id . "'");
			}
		}

		if (isset($data['product_attribute'])) {
			foreach ($data['product_attribute'] as $product_attribute) {
				if ($product_attribute['attribute_id']) {
					$this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "' AND attribute_id = '" . (int)$product_attribute['attribute_id'] . "'");
					
					foreach ($product_attribute['product_attribute_description'] as $language_id => $product_attribute_description) {				
						$this->db->query("INSERT INTO " . DB_PREFIX . "product_attribute SET product_id = '" . (int)$product_id . "', attribute_id = '" . (int)$product_attribute['attribute_id'] . "', language_id = '" . (int)$language_id . "', text = '" .  $this->db->escape($product_attribute_description['text']) . "'");
					}
				}
			}
		}  
	
		if (isset($data['product_option'])) {


Can anyone help - I cant edit any orders in admin, and I don't know ehere to start looking for the error

Thanks
Ron

Re: Parse error: syntax error, unexpected T_IF, expecting T_

Posted: Wed Feb 26, 2014 7:04 am
by victorj
it has to do with a vqmod extension you installed.

look for a vqmod that is affecting part of admin you have a problem with and disable this mod by renaming it to xxx.xml_
and see if error disapears.

if it is working, your vqmod is not compatible with your version of oc or has a conflict with a other vqmod or is not writen correct

Re: Parse error: syntax error, unexpected T_IF, expecting T_

Posted: Wed Feb 26, 2014 7:07 am
by ronnieb
thanks, I was guessing that there was a conflict just how to find it !

Re: Parse error: syntax error, unexpected T_IF, expecting T_

Posted: Wed Feb 26, 2014 7:12 am
by victorj
assuming you have vqmod manager installed, if not do its very handy, look for mods related to the page the error occurs, in your case the order section.
just disable one by one and between each one check if error disaprears, more or less a trial and error problem solving.

other aproach
disable every vqmod check every thin work normal and enable one by one and see when error aprears

Re: Parse error: syntax error, unexpected T_IF, expecting T_

Posted: Wed Feb 26, 2014 7:23 am
by ronnieb
yes I have vqmod installed.

The error is on admin -> sales -> orders then when I click edit I get the above error. Everything else works fine.

which admin file does the edit link point to - ?

when I look at the link it shows

https://www.************/admin/index.php?route=sale/order/update&token=f33ad35bff08f4ca08bf7dfc44c98814&order_id=16132

Re: Parse error: syntax error, unexpected T_IF, expecting T_

Posted: Wed Feb 26, 2014 7:28 am
by victorj
something with a mod concerning orders by looking at the error it is impossible to say wich vqmod is doing this, check error logs in vqmod they might tell you, otherwise proceed as described above and start disabeling them one by one till problem is found.