Jump to content

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

Identifier "ajax" Is Not Defined Rate Topic   - - - - -

 
  • ooaykac
  • Senior Member
  • Members
  • Join Date: 22-Nov 12
  • 297 posts

Posted 28 May 2019 - 02:09 PM #1

I am developing a new addon. I want to use ajax. When I try to use ajax in $mode in PHP I get the error below:

PHP Fatal error:  Uncaught InvalidArgumentException: Identifier "ajax" is not defined. in C:\wamp64\www\app\lib\vendor\pimple\pimple\src\Pimple\Container.php:95

How can I identify "AJAX"?



 
  • soft-solid
  • Junior Member
  • Members
  • Join Date: 19-Apr 10
  • 897 posts

Posted 28 May 2019 - 02:21 PM #2

Hello

 

Show a part of your addon code

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl

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

Posted 29 May 2019 - 05:57 AM #3

If you run URL in your browser without using ajax, you will see such error. 


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    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • crazyshark20
  • Junior Member
  • Members
  • Join Date: 19-Aug 09
  • 304 posts

Posted 17 October 2019 - 09:20 PM #4

Hi i have this error in checkout page i use addon and use version 4.10.4.sp1 . Can anyone help for this. When click "place order" button wants to goes order recieved page. But gives error. thanks for all
 
PHP Fatal Error
 
Uncaught Pimple\Exception\UnknownIdentifierException: Identifier "ajax" is not defined. in /var/www/vhosts/xxxxx.com/httpdocs/app/lib/vendor/pimple/pimple/src/Pimple/Container.php:101
Stack trace:
#0 /var/www/vhosts/xxxxx.com/httpdocs/app/addons/banks/payments/banks.php(51): Pimple\Container->offsetGet('ajax')
#1 /var/www/vhosts/xxxxx.com/httpdocs/app/functions/fn.cart.php(1549): include('/var/www/vhosts...')
#2 /var/www/vhosts/xxxxx.com/httpdocs/app/functions/fn.cart.php(9282): fn_start_payment(96, Array, Array)
#3 /var/www/vhosts/xxxxx.com/httpdocs/app/controllers/frontend/checkout.php(338): fn_checkout_place_order(Array, Array, Array)
#4 /var/www/vhosts/xxxxx.com/httpdocs/app/functions/fn.control.php(665): include('/var/www/vhosts...')
#5 /var/www/vhosts/xxxxx.com/httpdocs/app/functions/fn.control.php(423): fn_run_controller('/var/www/vhosts...', 'checkout', 'place_order', '', '')
#6 /var/www/vhosts/xxxxx.com/httpdocs/index.php(25): fn_dispatch()
#7 {main}
  
 
Error at
app/lib/vendor/pimple/pimple/src/Pimple/Container.php, line: 101
 
 
And banks.php in it
 
47    exit;
48  }else{
49
50   $redirect = fn_url("payment_notification.response?payment=banks&order_id={$order_info['order_id']}", AREA);
51   Tygh::$app['ajax']->assign('force_redirection', $redirect);
52   exit;


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

Posted 18 October 2019 - 01:23 PM #5

It is better to contact developers of the Banks addon with this issue.

 

As alternative try to replace

Tygh::$app['ajax']->assign('force_redirection', $redirect);

with

if (defined('AJAX_REQUEST')) {
    Tygh::$app['ajax']->assign('force_redirection', $redirect);
} else {
     fn_redirect($redirect);
}

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    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • crazyshark20
  • Junior Member
  • Members
  • Join Date: 19-Aug 09
  • 304 posts

Posted 18 October 2019 - 01:45 PM #6

Hi ecom thanks for all it works well 



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

Posted 21 October 2019 - 05:57 AM #7

You are welcome!


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    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.