Example #1
0
 public static function getUserShop()
 {
     static $usershop;
     if (!is_object($usershop)) {
         $user = JFactory::getUser(self::$load_user_id);
         $db = JFactory::getDBO();
         require_once JPATH_ROOT . "/components/com_jshopping/tables/usershop.php";
         $usershop = new jshopUserShop($db);
         if ($user->id) {
             if (!$usershop->isUserInShop($user->id)) {
                 $usershop->addUserToTableShop($user);
             }
             $usershop->load($user->id);
             $usershop->percent_discount = $usershop->getDiscount();
         } else {
             $usershop->percent_discount = 0;
         }
         JDispatcher::getInstance()->trigger('onAfterGetUserShopJSFactory', array(&$usershop));
     }
     return $usershop;
 }
Example #2
0
 public static function getUserShop()
 {
     static $usershop;
     if (!is_object($usershop)) {
         $user = JFactory::getUser();
         $db = JFactory::getDBO();
         require_once JPATH_ROOT . "/components/com_jshopping/tables/usershop.php";
         $usershop = new jshopUserShop($db);
         if ($user->id) {
             if (!$usershop->isUserInShop($user->id)) {
                 $usershop->addUserToTableShop($user);
             }
             $usershop->load($user->id);
             $usershop->percent_discount = $usershop->getDiscount();
         } else {
             $usershop->percent_discount = 0;
         }
     }
     return $usershop;
 }