Jump to content

override par boutique


Recommended Posts

non si tu créés 2 class de même nom il y a tout à parier que ça va bugger, essaye plutôt :

 



class IndexController extends IndexControllerCore
{
public function LaFonctionQueJOverride()
{
 if ((int)Context::getContext()->shop->id == 2)
 {
...  
}

else
{
...
}
}
}

 

sinon Shop::getContextShopID() renvoi aussi l'id du shop (si tu es dans Shop::CONTEXT_SHOP)

Edited by coeos.pro (see edit history)
Link to comment
Share on other sites

le truc c'est que j'ai plein de fonction en override

ce qui devrais dire qu'il faut mettre un if dans chaque fonction


class IndexController extends IndexControllerCore
{
public function Init()
{
 if ((int)Context::getContext()->shop->id == 2)
 {
    ... 
  }
}
public function InitContent()
{
 if ((int)Context::getContext()->shop->id == 2)
 {
    ... 
  }
}
public assignScenes()
{
 if ((int)Context::getContext()->shop->id == 2)
 {
    ... 
  }
}
}

 

et que malheureusment ca fonctionne pas si me met le if avant lest fonctions:

class IndexController extends IndexControllerCore

{
 if ((int)Context::getContext()->shop->id == 2)
 {
public function Init()
{
    ...
}
public function InitContent()
{
    ...
}
public assignScenes()
{
    ...
}
}
}

Link to comment
Share on other sites

Merci c'est effectivement ce que j'ai tester mais

Du coup j'ai autant de fonction que d'ovverride

chaque fonction commence par un condition.

Et si la condition est pas remplit, le systeme va lire, charger le fichier override + toute les fonction pour rien?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...