Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How Can I Stop Script Execution From A Hook Rate Topic   - - - - -

 
  • Elsherif
  • Member
  • Trial users
  • Join Date: 10-Jul 15
  • 36 posts

Posted 24 August 2015 - 09:11 AM #1

Hi,
I'm using a hook in my addon that in one case displays a notification using "fn_set_notification" and it is supposed to stop execution after this because in this case there is an error with the entered data.
So right now I'm just using exit; after the notification and it is working fine but it generates the following error:
PHP Fatal error:  Uncaught  --> Smarty: Missing template name <--
  thrown in /path//to/public_html/app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php on line 679

So I guess the controller is returned to the templater which doesn't have a template to show or whatever.
How can I do this the right way?

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11752 posts

Posted 25 August 2015 - 08:15 AM #2

Redirect to the page of your choice.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Elsherif
  • Member
  • Trial users
  • Join Date: 10-Jul 15
  • 36 posts

Posted 25 August 2015 - 08:42 AM #3

Redirect to the page of your choice.

 

It is an AJAX request.



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 20915 posts

Posted 25 August 2015 - 11:38 AM #4

Please provide us with the code which is executed before exit function


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • Elsherif
  • Member
  • Trial users
  • Join Date: 10-Jul 15
  • 36 posts

Posted 25 August 2015 - 12:16 PM #5

Please provide us with the code which is executed before exit function

if (!preg_match('/\S+/', $request_data['new_name']) && defined('AJAX_REQUEST')) {
					$msg = 'Please fill in your new name value.';
					fn_set_notification('E', fn_get_lang_var('error'), $msg, 'I', 'empty_name');
					exit;
				}


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 20915 posts

Posted 25 August 2015 - 03:38 PM #6

Hm.. I do not see any reason for the mentioned error. Try to remove the check of the ajax error and run the URL directly in the browser


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • Elsherif
  • Member
  • Trial users
  • Join Date: 10-Jul 15
  • 36 posts

Posted 26 August 2015 - 06:11 AM #7

Hm.. I do not see any reason for the mentioned error. Try to remove the check of the ajax error and run the URL directly in the browser

 

Didn't help .... I discovered a strange thing now though, it is that I use the same code for 3 conditions in the same hook and none of the other two produce the error it is only this one and more interestingly I tried changing the order of the three conditions and I found that the error is always produced by the last condition no matter which one of them it is.

Thoughts?



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 20915 posts

Posted 26 August 2015 - 08:54 AM #8

Thoughts?

No thoughts from me without detailed code examination. Sorry


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • Elsherif
  • Member
  • Trial users
  • Join Date: 10-Jul 15
  • 36 posts

Posted 26 August 2015 - 10:41 AM #9

No thoughts from me without detailed code examination. Sorry

 

No problem I can provide the code just tell me what you need. :)



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11752 posts

Posted 26 August 2015 - 06:22 PM #10

I have seen that error in the past at different client sites (mostly V 4.2.x).  I'd always just assumed that something was continuing on from a POST when it should have redirected because I don't think the templater is initialized on a POST request.  However, I've never been able to track it down because it seemed inconsistent without adding diagnostic info into the templater to see the call stack.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • yorgos
  • Junior Member
  • Members
  • Join Date: 26-Oct 10
  • 5 posts

Posted 12 January 2016 - 03:29 PM #11

Hi guys i have the same problem. any idea how to fix this? i get the followin error in error logs:

[12-Jan-2016 17:06:53 Europe/Istanbul] PHP Fatal error:  Uncaught  --> Smarty: Missing template name <-- 

  thrown in /home/name/public_html/app/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php on line 679