Author Topic: Parse error: syntax error  (Read 421 times)

Martyn Falkous

  • Beginner
  • *
  • Posts: 2
Parse error: syntax error
« on: December 05, 2019, 11:05:06 am »
New Virtuemart installation, in administrator and front end we are getting the following error:

Parse error: syntax error, unexpected 'and' (T_LOGICAL_AND), expecting ')' in /home2/xxxxxxxx/public_html/administrator/components/com_virtuemart/models/user.php on line 934

Line 934 reads:

   (    (empty($data['virtuemart_vendor_id'] and empty($data['user_is_vendor']))) or

Any ideas please?

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9280
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Parse error: syntax error
« Reply #1 on: December 05, 2019, 11:13:51 am »
shouldn't it be

      if(!empty($data['virtuemart_vendor_user_id']) and is_array($data['virtuemart_vendor_user_id']) or ($data['virtuemart_vendor_user_id']>1) and
                     (    (empty($data['virtuemart_vendor_id']) and empty($data['user_is_vendor'])) or
                        (!empty($data['virtuemart_vendor_id']) and $data['virtuemart_vendor_id']!=$data['virtuemart_vendor_user_id']) ) ){

?

closing )  on the first empty and removed from the end of the statement?
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Martyn Falkous

  • Beginner
  • *
  • Posts: 2
Re: Parse error: syntax error
« Reply #2 on: December 05, 2019, 11:23:31 am »
Hi GJC

Thank you so much, no idea how it was not corrupt but working now :)

Thanks Again!

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10008
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Parse error: syntax error
« Reply #3 on: December 05, 2019, 12:06:07 pm »
Really strange, I wonder that I got no error, which php versoin do you use?
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 9280
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Parse error: syntax error
« Reply #4 on: December 05, 2019, 12:12:11 pm »
could u explain what function you were trying when u saw the error?
The syntax was wrong but we are having trouble recreating the error..
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Zilvermeeuw

  • Beginner
  • *
  • Posts: 27
Re: Parse error: syntax error
« Reply #5 on: January 09, 2020, 06:31:00 am »
I got the same error, and GJC gives the solution.
I can reproduce the error with the following steps:
  • New VM with Centos7, minimal install, update, install LAMP
  • Copy (with php kickstart *.jpa) an webshop with joomla 3.4.8 and virtuemart 3.0.12
  • Update joomla to 3.6.5, update virtuemart (version I cannot access at this time, but later I can)
Now virtuemart/administrator gives the error as mentioned by TS. And the solution of GJC solves it.

disday

  • Beginner
  • *
  • Posts: 2
  • A beginner
Re: Parse error: syntax error
« Reply #6 on: January 13, 2020, 18:51:45 pm »
Good day! I just updated VM from 3.4 to 3.6 and got same error on attempt to open http://****/administrator/index.php?option=com_virtuemart
Code: [Select]
PHP Parse error:  syntax error, unexpected 'and' (T_LOGICAL_AND), expecting ')' in ******/administrator/components/com_virtuemart/models/user.php on line 934Corrected parentheses as GJC Web Design advised. VM Control Panel became avaliable but if I tried enter to Orders server returned HTTP 500 again with
Code: [Select]
PHP Parse error:  syntax error, unexpected 'and' (T_LOGICAL_AND), expecting ')' in ***/administrator/components/com_virtuemart/models/orders.php on line 607,I corrected Line 607 same way and it works
Code: [Select]
if(!empty($itemTaxes['VatTax']) and count($itemTaxes['VatTax'])==1){Maybe it helps you.