Post by blackgoat » Fri Oct 19, 2018 10:27 am

I have been playing around with 3.0.2 before I upgrade my live site. After adding a test product, the front end gives me the following error when clicking on that product. I do have some modules installed and a custom template.

Parse error: syntax error, unexpected 'ControllerProductProduct' (T_STRING) in /home/xxxxx/ocartdata/storage/modification/catalog/controller/product/product.php on line 160

I typically can find the answer in the forums and don't have to ask, but this one is stumping me.

I have gone over line 160 a dozen times, to the point my eyes are crossing. I cannot find where the error is. I'm hoping that someone, with a fresh set of eyes can pick it out. This is the entire line 160 from the file.

Code: Select all

<?phpclass ControllerProductProduct extends Controller {	private $error = array();	public function index() {		$this->load->language('product/product');		$data['breadcrumbs'] = array();		$data['breadcrumbs'][] = array(			'text' => $this->language->get('text_home'),			'href' => $this->url->link('common/home')		);		$this->load->model('catalog/category');		if (isset($this->request->get['path'])) {			$path = '';			$parts = explode('_', (string)$this->request->get['path']);			$category_id = (int)array_pop($parts);			foreach ($parts as $path_id) {				if (!$path) {					$path = $path_id;				} else {					$path .= '_' . $path_id;				}				$category_info = $this->model_catalog_category->getCategory($path_id);				if ($category_info) {					$data['breadcrumbs'][] = array(						'text' => $category_info['name'],						'href' => $this->url->link('product/category', 'path=' . $path)					);				}			}			// Set the last category breadcrumb			$category_info = $this->model_catalog_category->getCategory($category_id);			if ($category_info) {				$url = '';				if (isset($this->request->get['sort'])) {					$url .= '&sort=' . $this->request->get['sort'];				}				if (isset($this->request->get['order'])) {					$url .= '&order=' . $this->request->get['order'];				}				if (isset($this->request->get['page'])) {					$url .= '&page=' . $this->request->get['page'];				}				if (isset($this->request->get['limit'])) {					$url .= '&limit=' . $this->request->get['limit'];				}				$data['text_empty'] = $this->language->get('text_empty');				$data['breadcrumbs'][] = array(					'text' => $category_info['name'],					'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url)				);			}		}		$this->load->model('catalog/manufacturer');		if (isset($this->request->get['manufacturer_id'])) {			$data['breadcrumbs'][] = array(				'text' => $this->language->get('text_brand'),				'href' => $this->url->link('product/manufacturer')			);			$url = '';			if (isset($this->request->get['sort'])) {				$url .= '&sort=' . $this->request->get['sort'];			}			if (isset($this->request->get['order'])) {				$url .= '&order=' . $this->request->get['order'];			}			if (isset($this->request->get['page'])) {				$url .= '&page=' . $this->request->get['page'];			}			if (isset($this->request->get['limit'])) {				$url .= '&limit=' . $this->request->get['limit'];			}			$manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($this->request->get['manufacturer_id']);			if ($manufacturer_info) {				$data['breadcrumbs'][] = array(					'text' => $manufacturer_info['name'],					'href' => $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . $url)				);			}		}		if (isset($this->request->get['search']) || isset($this->request->get['tag'])) {			$url = '';			if (isset($this->request->get['search'])) {				$url .= '&search=' . $this->request->get['search'];			}			if (isset($this->request->get['tag'])) {				$url .= '&tag=' . $this->request->get['tag'];			}			if (isset($this->request->get['description'])) {				$url .= '&description=' . $this->request->get['description'];			}			if (isset($this->request->get['category_id'])) {				$url .= '&category_id=' . $this->request->get['category_id'];			}			if (isset($this->request->get['sub_category'])) {				$url .= '&sub_category=' . $this->request->get['sub_category'];			}			if (isset($this->request->get['sort'])) {				$url .= '&sort=' . $this->request->get['sort'];			}			if (isset($this->request->get['order'])) {				$url .= '&order=' . $this->request->get['order'];			}			if (isset($this->request->get['page'])) {				$url .= '&page=' . $this->request->get['page'];			}			if (isset($this->request->get['limit'])) {				$url .= '&limit=' . $this->request->get['limit'];			}			$data['breadcrumbs'][] = array(				'text' => $this->language->get('text_search'),				'href' => $this->url->link('product/search', $url)			);		}		if (isset($this->request->get['product_id'])) {			$product_id = (int)$this->request->get['product_id'];		} else {			$product_id = 0;		}		$this->load->model('catalog/product');		$product_info = $this->model_catalog_product->getProduct($product_id);		if ($product_info) {			$url = '';			if (isset($this->request->get['path'])) {				$url .= '&path=' . $this->request->get['path'];			}			if (isset($this->request->get['filter'])) {				$url .= '&filter=' . $this->request->get['filter'];			}			if (isset($this->request->get['manufacturer_id'])) {				$url .= '&manufacturer_id=' . $this->request->get['manufacturer_id'];			}			if (isset($this->request->get['search'])) {				$url .= '&search=' . $this->request->get['search'];			}			if (isset($this->request->get['tag'])) {				$url .= '&tag=' . $this->request->get['tag'];			}			if (isset($this->request->get['description'])) {				$url .= '&description=' . $this->request->get['description'];			}			if (isset($this->request->get['category_id'])) {				$url .= '&category_id=' . $this->request->get['category_id'];			}			if (isset($this->request->get['sub_category'])) {				$url .= '&sub_category=' . $this->request->get['sub_category'];			}			if (isset($this->request->get['sort'])) {				$url .= '&sort=' . $this->request->get['sort'];			}			if (isset($this->request->get['order'])) {				$url .= '&order=' . $this->request->get['order'];			}			if (isset($this->request->get['page'])) {				$url .= '&page=' . $this->request->get['page'];			}			if (isset($this->request->get['limit'])) {				$url .= '&limit=' . $this->request->get['limit'];			}			$data['breadcrumbs'][] = array(				'text' => $product_info['name'],				'href' => $this->url->link('product/product', $url . '&product_id=' . $this->request->get['product_id'])			);			$this->document->setTitle($product_info['meta_title']);	



Thanks in advance for any help!

Newbie

Posts

Joined
Thu May 10, 2018 9:28 am

Post by cyclops12 » Fri Oct 19, 2018 5:03 pm

This looks like an error in an ocmod/vqmod that you have installed.
If you have a mod that is changing the product controller then disable it, refresh cache and see if problem persists, if not then you have found the culprit and you should ask the author of the mod

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by paulfeakins » Fri Oct 19, 2018 6:26 pm

Try running it through here first:
http://www.phpformatter.com/

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by blackgoat » Fri Oct 19, 2018 9:52 pm

Thank you to both of you, both of your suggestions led me in the right direction and I believe it is now fixed. Disabling modules (and ultimately uninstalling one) and uploading fresh file copies after comparing seems to have fixed the parse error(s). A good night sleep also helped!

Newbie

Posts

Joined
Thu May 10, 2018 9:28 am
Who is online

Users browsing this forum: No registered users and 288 guests