HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Error when using ecommerce catalogues

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#87945 (In Topic #17878)
Avatar

Community saint

When using the Catalogue module as an ecomerece catalogue I am getting this error

PHP WARNING [2] preg_match() expects parameter 2 to be string, object given in sources/urls.php on line 631 (version: 8.1.1, PHP version: 5.2.17, URL: /site/index.php?page=shopping&type=misc&redirected=1)

Here is the stack trace:

Below is a stack trace revealing the state the software was in when the error occurred. If this represents a bug in the unmodified software, you may want to check ocPortal website for a fix, and if there isn't one, report this as a bug. Please note that merely posting a stack trace is not sufficient for us to solve your problem; the stack trace is just an aid that presents us with additional information. We still need to know the error message, what you tried to do, how you tried to do it, version numbers, and any other appropriate information.
We apologise for this problem and if it's a bug we hope you will work with us so that we can fix it for you promptly.

File '/home/davidlfr/public_html/sources/failure.php'
Line '684'
Function 'get_html_trace'
Args  

File '/home/davidlfr/public_html/sources/global2.php'
Line '983'
Function '_fatal_exit'
Args

'PHP WARNING [2] preg_match() expects parameter 2 to be string, object given in sources/urls.php on line 631'


File '/home/davidlfr/public_html/sources/failure.php'
Line '217'
Function 'fatal_exit'
Args

'PHP WARNING [2] preg_match() expects parameter 2 to be string, object given in sources/urls.php on line 631'


File '/home/davidlfr/public_html/sources/global2.php'
Line '857'
Function '_ocportal_error_handler'
Args

'warning'

2

'preg_match() expects parameter 2 to be string, object given'

'sources/urls.php'

631


Function 'ocportal_error_handler'
Args ...

File '/home/davidlfr/public_html/sources/urls.php'
Line '631'
Function 'preg_match'
Args

'#^[^:\{%]*$#'

object


File '/home/davidlfr/public_html/sources/hooks/systems/ecommerce/catalogue_items.php'
Line '426'
Function 'url_is_local'
Args

object


File '/home/davidlfr/public_html/site/pages/modules/shopping.php'
Line '313'
Function 'show_cart_entry'
Class 'Hook_catalogue_items'
Type '->'
Object Hook_catalogue_items::__set_state(array( ))
Args ...

File '/home/davidlfr/public_html/site/pages/modules/shopping.php'
Line '224'
Function 'view_shopping_cart'
Class 'Module_shopping'
Type '->'
Object Module_shopping::__set_state(array( ))
Args  

File '/home/davidlfr/public_html/sources/zones.php'
Line '424'
Function 'run'
Class 'Module_shopping'
Type '->'
Object Module_shopping::__set_state(array( ))
Args  

File '/home/davidlfr/public_html/sources/site.php'
Line '1,037'
Function 'load_module_page'
Args

'site/pages/modules/shopping.php'

'shopping'


File '/home/davidlfr/public_html/sources/site.php'
Line '799'
Function 'request_page'
Args

'shopping'

true


File '/home/davidlfr/public_html/site/index.php'
Line '51'
Function 'do_site'
Args  


Art and Imagination
of David L Friend

http://davidlfriend.com

  My Art Gallery
powered by ocPortal
Back to the top
 
Posted
Rating:
#88037
Avatar

It sounds like you've set another catalogue to be an eCommerce catalogue, but the fields don't quite match the specification needed. I'd advise just using the bundled 'products' catalogue which is provided for this.

This is a bug, it shouldn't be stack-tracing, but you'd still need to match up the fields. which is a bit of a pain to do.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#88045
Avatar

Community saint

Yes I created a separate catalogue more suited to my need, so OK your answer is helping me in my decision making process about ocPortal ecommerce. Thanks again Chris!


Art and Imagination
of David L Friend

http://davidlfriend.com

  My Art Gallery
powered by ocPortal
Back to the top
 
Posted
Rating:
#88754
Avatar

Community saint

OK so I used the ecommerce 'product' catalogue as it is but I still get an error message as shown below:

Error Code

PHP WARNING [2] preg_match() expects parameter 2 to be string, object given in sources/urls.php on line 631 (version: 8.1.1, PHP version: 5.2.17, URL: /site/index.php?page=shopping&type=misc&redirected=1)

Here is the stack trace:

Below is a stack trace revealing the state the software was in when the error occurred. If this represents a bug in the unmodified software, you may want to check ocPortal website for a fix, and if there isn't one, report this as a bug. Please note that merely posting a stack trace is not sufficient for us to solve your problem; the stack trace is just an aid that presents us with additional information. We still need to know the error message, what you tried to do, how you tried to do it, version numbers, and any other appropriate information.
We apologise for this problem and if it's a bug we hope you will work with us so that we can fix it for you promptly.

File '/home/davidlfr/public_html/sources/failure.php'
Line '684'
Function 'get_html_trace'
Args  

File '/home/davidlfr/public_html/sources/global2.php'
Line '983'
Function '_fatal_exit'
Args

'PHP WARNING [2] preg_match() expects parameter 2 to be string, object given in sources/urls.php on line 631'


File '/home/davidlfr/public_html/sources/failure.php'
Line '217'
Function 'fatal_exit'
Args

'PHP WARNING [2] preg_match() expects parameter 2 to be string, object given in sources/urls.php on line 631'


File '/home/davidlfr/public_html/sources/global2.php'
Line '857'
Function '_ocportal_error_handler'
Args

'warning'

2

'preg_match() expects parameter 2 to be string, object given'

'sources/urls.php'

631


Function 'ocportal_error_handler'
Args

File '/home/davidlfr/public_html/sources/urls.php'
Line '631'
Function 'preg_match'
Args

'#^[^:\{%]*$#'

object


File '/home/davidlfr/public_html/sources/hooks/systems/ecommerce/catalogue_items.php'
Line '426'
Function 'url_is_local'
Args

object


File '/home/davidlfr/public_html/site/pages/modules/shopping.php'
Line '313'
Function 'show_cart_entry'
Class 'Hook_catalogue_items'
Type '->'
Object Hook_catalogue_items::__set_state(array( ))
Args

File '/home/davidlfr/public_html/site/pages/modules/shopping.php'
Line '224'
Function 'view_shopping_cart'
Class 'Module_shopping'
Type '->'
Object Module_shopping::__set_state(array( ))
Args  

File '/home/davidlfr/public_html/sources/zones.php'
Line '424'
Function 'run'
Class 'Module_shopping'
Type '->'
Object Module_shopping::__set_state(array( ))
Args  

File '/home/davidlfr/public_html/sources/site.php'
Line '1,037'
Function 'load_module_page'
Args

'site/pages/modules/shopping.php'

'shopping'


File '/home/davidlfr/public_html/sources/site.php'
Line '799'
Function 'request_page'
Args

'shopping'

true


File '/home/davidlfr/public_html/site/index.php'
Line '51'
Function 'do_site'
Args  


Art and Imagination
of David L Friend

http://davidlfriend.com

  My Art Gallery
powered by ocPortal
Back to the top
 
Posted
Rating:
#88755
Avatar

I worked around this error in 8.1.2, using the following file:

Attachment
sources/hooks/systems/ecommerce/catalogue_items.php
» Download: catalogue_items.php (20 Kb, 136 downloads so far)


However I suspect its only needed if the default picture field's field type has been changed, or the field order changed, which would cause other problems.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#88760
Avatar

Community saint

This fixed it enough to allow me to get to the next step but I get an error when I try to update or empty the cart. I see I am running 8.1.1. I am upgrading now to 8.1.2 now - I will check it out and see it it is 'all better' after the upgrade.

Thanks Chris.


Art and Imagination
of David L Friend

http://davidlfriend.com

  My Art Gallery
powered by ocPortal
Back to the top
 
Posted
Rating:
#88761
Avatar

Community saint

I upgraded from 8.1.1 to 8.1.2 and am still getting the error when I try to empty or update the shopping cart. Here is the stack trace:


Stack Trace

PHP NOTICE [8] Object of class ocp_tempcode could not be converted to int in sources/hooks/systems/ecommerce/catalogue_items.php on line 167 (version: 8.1.2, PHP version: 5.2.17, URL: /site/index.php?page=shopping&type=update_cart)

Here is the stack trace:

Below is a stack trace revealing the state the software was in when the error occurred. If this represents a bug in the unmodified software, you may want to check ocPortal website for a fix, and if there isn't one, report this as a bug. Please note that merely posting a stack trace is not sufficient for us to solve your problem; the stack trace is just an aid that presents us with additional information. We still need to know the error message, what you tried to do, how you tried to do it, version numbers, and any other appropriate information.
We apologise for this problem and if it's a bug we hope you will work with us so that we can fix it for you promptly.

File '/home/davidlfr/public_html/sources/failure.php'
Line '698'
Function 'get_html_trace'
Args  

File '/home/davidlfr/public_html/sources/global2.php'
Line '985'
Function '_fatal_exit'
Args

'PHP NOTICE [8] Object of class ocp_tempcode could not be converted to int in sources/hooks/systems/ecommerce/catalogue_items.php on line 167'


File '/home/davidlfr/public_html/sources/failure.php'
Line '218'
Function 'fatal_exit'
Args

'PHP NOTICE [8] Object of class ocp_tempcode could not be converted to int in sources/hooks/systems/ecommerce/catalogue_items.php on line 167'


File '/home/davidlfr/public_html/sources/global2.php'
Line '859'
Function '_ocportal_error_handler'
Args

'notice'

8

'Object of class ocp_tempcode could not be converted to int'

'sources/hooks/systems/ecommerce/catalogue_items.php'

167


Function 'ocportal_error_handler'
Args

File '/home/davidlfr/public_html/sources/hooks/systems/ecommerce/catalogue_items.php'
Line '167'
Function 'intval'
Args

object


File '/home/davidlfr/public_html/site/pages/modules/shopping.php'
Line '427'
Function 'get_available_quantity'
Class 'Hook_catalogue_items'
Type '->'
Object Hook_catalogue_items::__set_state(array( ))
Args

'5'


File '/home/davidlfr/public_html/site/pages/modules/shopping.php'
Line '226'
Function 'update_cart'
Class 'Module_shopping'
Type '->'
Object Module_shopping::__set_state(array( ))
Args  

File '/home/davidlfr/public_html/sources/zones.php'
Line '425'
Function 'run'
Class 'Module_shopping'
Type '->'
Object Module_shopping::__set_state(array( ))
Args  

File '/home/davidlfr/public_html/sources/site.php'
Line '1,045'
Function 'load_module_page'
Args

'site/pages/modules/shopping.php'

'shopping'


File '/home/davidlfr/public_html/sources/site.php'
Line '804'
Function 'request_page'
Args

'shopping'

true


File '/home/davidlfr/public_html/site/index.php'
Line '51'
Function 'do_site'
Args  

Parameters

quantity_5
4
quantity_6
3
x
48
y
15
product_ids
5,6


Art and Imagination
of David L Friend

http://davidlfriend.com

  My Art Gallery
powered by ocPortal
Back to the top
 
Posted
Rating:
#88762
Avatar

Again it looks like the main product fields have been altered or reordered.

I've attached a screenshot of the defaults.


The 4th field must be an integer field, and represents the stock level. If deleted/reordered/type-changed, then ocPortal will have errors trying to read it.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#88764
Avatar

This should suppress the errors, and provide some level of tolerance, but the wrong fields will still end up getting used for things, so its still important to get the order right.

Attachment
» Download: catalogue_items.php (21 Kb, 114 downloads so far)


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#88771
Avatar

Community saint

All Areas you are showing in the .png image are identical to what I have except as I noted here:

All the sorts had been set to no - so I changed it back to default position - STILL GET ERROR
PRODUCT CODE was changed to: A Codename (Short sequence of numbers and letters, no spaces) I changed it back to DEFAULT - STILL GET ERROR
PRODUCT TAX RATE Modified Default values (I believe this is an acceptable modification)

All other settings are the same as the .png image you provided.

Here is a view of the input info for the only product in the catalogue

Here is the Stack Trace I now get:

Error message

A query that had to return something returned nothing: SELECT c_name FROM ocp5_catalogue_entries WHERE (id=5) (version: 8.1.2, PHP version: 5.2.17, URL: /site/index.php?page=shopping&type=misc)

Here is the stack trace:

Below is a stack trace revealing the state the software was in when the error occurred. If this represents a bug in the unmodified software, you may want to check ocPortal website for a fix, and if there isn't one, report this as a bug. Please note that merely posting a stack trace is not sufficient for us to solve your problem; the stack trace is just an aid that presents us with additional information. We still need to know the error message, what you tried to do, how you tried to do it, version numbers, and any other appropriate information.
We apologise for this problem and if it's a bug we hope you will work with us so that we can fix it for you promptly.

File '/home/davidlfr/public_html/sources/failure.php'
Line '698'
Function 'get_html_trace'
Args  

File '/home/davidlfr/public_html/sources/global2.php'
Line '985'
Function '_fatal_exit'
Args

object


File '/home/davidlfr/public_html/sources/database.php'
Line '584'
Function 'fatal_exit'
Args

object


File '/home/davidlfr/public_html/sources/hooks/systems/ecommerce/catalogue_items.php'
Line '419'
Function 'query_value'
Class 'database_driver'
Type '->'
Object database_driver::__set_state(array( 'table_prefix' => 'ocp5_', 'connection_read' => array ( 0 => NULL, 1 => 'davidlfr_ocp', ), 'connection_write' => array ( 0 => NULL, 1 => 'davidlfr_ocp', ), 'text_lookup_original_cache' => array ( 9 => 'Home', 4 => 'The Art and Imaginagtion of David L. Friend', 702 => '', 703 => '', 32 => 'Administrators', 33 => 'Site Director', ), 'text_lookup_cache' => array ( 9 => '', 4 => '', 702 => '', 703 => '', 32 => '', 33 => '', ), 'table_exists_cache' => array ( ), 'static_ob' => Database_Static_mysql::__set_state(array( )), ))
Args

'catalogue_entries'

'c_name'

array ( 'id' => 5, )


File '/home/davidlfr/public_html/site/pages/modules/shopping.php'
Line '311'
Function 'show_cart_entry'
Class 'Hook_catalogue_items'
Type '->'
Object Hook_catalogue_items::__set_state(array( ))
Args

File '/home/davidlfr/public_html/site/pages/modules/shopping.php'
Line '224'
Function 'view_shopping_cart'
Class 'Module_shopping'
Type '->'
Object Module_shopping::__set_state(array( ))
Args  

File '/home/davidlfr/public_html/sources/zones.php'
Line '425'
Function 'run'
Class 'Module_shopping'
Type '->'
Object Module_shopping::__set_state(array( ))
Args  

File '/home/davidlfr/public_html/sources/site.php'
Line '1,045'
Function 'load_module_page'
Args

'site/pages/modules/shopping.php'

'shopping'


File '/home/davidlfr/public_html/sources/site.php'
Line '804'
Function 'request_page'
Args

'shopping'

true


File '/home/davidlfr/public_html/site/index.php'
Line '51'
Function 'do_site'
Args  


Art and Imagination
of David L Friend

http://davidlfriend.com

  My Art Gallery
powered by ocPortal
Back to the top
 
Posted
Rating:
#88776
Avatar

Based on your reply above, it looks like you did nothing wrong. Maybe v8 changed the catalogue API enough to through off the cart system. The eCommerce isn't widely used, so probably nobody was using it on v8 yet. So, sorry for the messing about there.

The above stack trace looks to be a different issue. I suspect you added something to your cart, then delete that entry - but it's still in the cart. I've just fixed that (it shouldn't let you delete something already in a cart), but you'll need to empty the contents of your shopping_cart table manually.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#88778
Avatar

Community saint

Chris Graham said

Based on your reply above, it looks like you did nothing wrong. Maybe v8 changed the catalogue API enough to through off the cart system. The eCommerce isn't widely used, so probably nobody was using it on v8 yet. So, sorry for the messing about there.

The above stack trace looks to be a different issue. I suspect you added something to your cart, then delete that entry - but it's still in the cart. I've just fixed that (it shouldn't let you delete something already in a cart), but you'll need to empty the contents of your shopping_cart table manually.


Chris, how would I empty the contents of your shopping_cart table manually?

Image of the EDIT CATALOG (Products) page

I just cancelled all the orders pending on that cart but I still am getting an error when I try to view the cart


Last edit: by friendly


Art and Imagination
of David L Friend

http://davidlfriend.com

  My Art Gallery
powered by ocPortal
Back to the top
 
Posted
Rating:
#88781
Avatar

In something like phpMyAdmin.

Or quicker, OcCLE…

Code

:$GLOBALS['SITE_DB']->query_delete('shopping_cart');


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#88782
Avatar

Community saint

OK that cleared the cart and it is empty now. I will continue to explore ecommerce here and hopefully that it is all good. Thanks Chris!!

I just tried the check out and it took me to PayPal! I'll have to get a sandbox to play in and check it out further!!


Art and Imagination
of David L Friend

http://davidlfriend.com

  My Art Gallery
powered by ocPortal
Back to the top
 
Posted
Rating:
#88783
Avatar

check it out further

Literally  :lol:


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: