Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

How call external stored procedure before page /?target=checkout loaded?

 
Closed Thread
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 05-23-2017, 04:46 AM
  dagdag's Avatar 
dagdag dagdag is offline
 

Advanced Member
  
Join Date: Sep 2014
Location: Volgograd
Posts: 81
 

Question How call external stored procedure before page /?target=checkout loaded?

Good day!

I really need to call my external stored procedure before the checkout page ( shop.com/?target=checkout as example) start loading.
Stored procedure located in x-cart database and does not use or return parameters.

How can this be realize most correctly? Thank you very much!

This is necessary to monitor the connection of the store with the external fiscal registrar.
__________________
my wife's shop
  #2  
Old 05-29-2017, 05:45 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: How call external stored procedure before page /?target=checkout loaded?

Do you mean stored procedures?

If so, working with them will be tricky a bit. X-Cart 5 works with the database via Doctrine that is an abstraction over different database types. But stored procedures are not consistent across different types of databases, so is not something that can be implemented as an abstract thing.

However, you can use "Native Queries" to run raw SQL queries against the database:
PHP Code:
\XLite\Core\Database::getEM()->getConnection()->executeQuery('YOUR RAW SQL QUERY GOES THERE'); 

Does this work?

---

I've been told by our support staff that using the same "database handle" for regular queries and stored procedures may result into "Commands out of sync" error. If this happens to you too, you may try to use the MySQL PDO or MySQLi directly (not via Doctrine).
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions

The following user thanks qualiteam for this useful post:
dagdag (05-29-2017)
  #3  
Old 05-29-2017, 08:19 PM
  dagdag's Avatar 
dagdag dagdag is offline
 

Advanced Member
  
Join Date: Sep 2014
Location: Volgograd
Posts: 81
 

Default Re: How call external stored procedure before page /?target=checkout loaded?

Quote:
However, you can use "Native Queries" to run raw SQL queries against the database:

\XLite\Core\Database::getEM()->getConnection()->executeQuery('YOUR RAW SQL QUERY GOES THERE');

Does this work?
Yes! It works fine! MySQL store procedures (and functions too!) called from x-cart and run without errors.
You are my god! Thank!
__________________
my wife's shop

The following user thanks dagdag for this useful post:
qualiteam (05-29-2017)
Closed Thread
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:16 AM.

   

 
X-Cart forums © 2001-2020