Quantcast
Viewing all articles
Browse latest Browse all 118

Kundengruppe mittels Plugin auslesen

Hallo,

kann mir bitte jemand bei diesem Unterfangen helfen?

Ich möchte auf Shopseiten die Möglichkeit haben, die Kundengruppe mittels der Variable {$sCustomerUserGroup} abzugfragen. Hier mein Versuch, es tut sich leider gar nichts:
class Shopware_Plugins_Frontend_SwagGetUserGroup_Bootstrap extends Shopware_Components_Plugin_Bootstrap {

  public function install() {
    $this->subscribeEvent('Enlight_Controller_Action_PostDispatch','onPostDispatch');
    return true;
  }
  
  public function onPostDispatchFrontend(Enlight_Event_EventArgs $args) {
  
    $request = $args->getSubject()->Request();
    $response = $args->getSubject()->Response();
  
    $customerId = Shopware()->Session()->sUserId;    
    $CustomerUserGroup = $this->getCustomerUserGroup($customerId);
    
    $args->getSubject()->View()->assign("sCustomerUserGroup",self::$CustomerUserGroup);
  }
  
  function getCustomerUserGroup($customerId) {
    $sql = "SELECT customergroup from s_user WHERE id = $customerId";
 
    $customerGroup = Shopware()->Db()->fetchRow();

    $customerGroup = $customerGroup['customergroup'];

    return $customerGroup;
  }
  
}

Viewing all articles
Browse latest Browse all 118

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>