Jump to content

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

If In Each Page Rate Topic   - - - - -

 
  • masoud_tesna
  • Advanced Member
  • Trial users
  • Join Date: 27-Jun 19
  • 57 posts

Posted 30 September 2019 - 08:37 AM #1

in my add-on file:

controlers/frontend/init.post.php

if (Registry::get('runtime.controller') == 'index' && Registry::get('runtime.mode') == 'index') {

//my code

}
But this Conditional code, only works in Index Page. I want it to work in All pages Not only in the Main page.
Thanks.


 
  • sw1
  • Newbie
  • Trial users
  • Join Date: 16-Jun 16
  • 9 posts

Posted 30 September 2019 - 10:25 AM #2

Hello,

Check this code

    if (Registry::get('runtime.controller') && Registry::get('runtime.mode')) {
     
    //my code
     
    }


 
  • masoud_tesna
  • Advanced Member
  • Trial users
  • Join Date: 27-Jun 19
  • 57 posts

Posted 30 September 2019 - 11:14 AM #3

 

Hello,

Check this code

    if (Registry::get('runtime.controller') && Registry::get('runtime.mode')) {
     
    //my code
     
    }

hi my friend. not worked!

2019_09_30_14_43_07_.png



 
  • masoud_tesna
  • Advanced Member
  • Trial users
  • Join Date: 27-Jun 19
  • 57 posts

Posted 30 September 2019 - 11:30 AM #4

 

Hello,

Check this code

    if (Registry::get('runtime.controller') && Registry::get('runtime.mode')) {
     
    //my code
     
    }

i want if empty $geo['country_code'] redirect to an another page, i want to apply this condition for all pages.



 
  • masoud_tesna
  • Advanced Member
  • Trial users
  • Join Date: 27-Jun 19
  • 57 posts

Posted 30 September 2019 - 11:32 AM #5

i want if empty $geo['country_code'] redirect to an another page, i want to apply this condition for all pages.

i use this code but not work:

if (Registry::get('runtime.controller') !== 'unavailable_country ' && Registry::get('runtime.mode') !== 'unavailable_country ') {
    
    if(empty($geo_select)) {

        return array(CONTROLLER_STATUS_REDIRECT,'unavailable_country.select_country');

    }
    
}


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

Posted 30 September 2019 - 01:28 PM #6

Do you receive error page or continuous 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    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 1203 posts

Posted 30 September 2019 - 03:29 PM #7

 

i use this code but not work:

if (Registry::get('runtime.controller') !== 'unavailable_country ' && Registry::get('runtime.mode') !== 'unavailable_country ') {
    
    if(empty($geo_select)) {

        return array(CONTROLLER_STATUS_REDIRECT,'unavailable_country.select_country');

    }
    
}

 

Hello

 

You have useless 1 space after unavailable_country

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl, marketplace

We specialize in creating the highest quality addons, safe, useful and flexible