ChDUP Posted May 6, 2014 Share Posted May 6, 2014 Bonjour à tous. Pour une modification du calcul du franco de port, j'ai besoin de récuperer l'id du groupe du client dans la function getPackageShippingCost de la class Cart. (Prestashop 1.5.6) Actuellement j'utilise ceci : global $customer; $group=$customer->id_default_group; qui fonctionne, mais l'appel à une variable globale ne me semble pas optimum. Comment améliorer ceci ? Merci d'avance Link to comment Share on other sites More sharing options...
J. Danse Posted May 6, 2014 Share Posted May 6, 2014 L'utilisation du contexte, éventuellement: $this->context->customr->id_default_group; Et si le contexte n'est pas définit: $context = Context::getContext(); 1 Link to comment Share on other sites More sharing options...
ChDUP Posted May 6, 2014 Author Share Posted May 6, 2014 effectivement, c'est déjà bien meilleur que mon global $customer Merci Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now