<?php

	CLASS ISC_SIDEACCOUNTMENU_PANEL extends PANEL
	{
		public function SetPanelSettings()
		{
			$GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');
			$customerid = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId();
			$cs1 = "SELECT afiliado FROM [|PREFIX|]customers WHERE customerid = '$customerid'";//PHP7
            $csrow1 = $GLOBALS['ISC_CLASS_DB']->Query($cs1);//PHP7
            $dados = $GLOBALS['ISC_CLASS_DB']->Fetch($csrow1);//PHP7
            $veraf = $dados['afiliado'];
			if(gzte11(ISC_LARGEPRINT)) {
				$query = "SELECT COUNT(*)
					FROM [|PREFIX|]orders o, [|PREFIX|]order_messages om
					WHERE o.ordcustid = " . (int)$customerid . " AND o.deleted = 0 AND om.messageorderid = o.orderid AND om.messagefrom = 'admin' AND messagestatus = 'unread'
				";
				$GLOBALS['NumNewMessages'] = (int)$GLOBALS['ISC_CLASS_DB']->FetchOne($query);
			}
			else {
				$GLOBALS['HideMessagesMenu'] = "none";
			}
			if(gzte11(ISC_LARGEPRINT) && GetConfig('EnableReturns') == 1) {
				$query = sprintf("SELECT returnid FROM [|PREFIX|]returns WHERE retcustomerid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($customerid));
				if(!$GLOBALS['ISC_CLASS_DB']->FetchOne($query)) {
					$GLOBALS['HideReturnRequestsMenu'] = "none";
				}
			    }else{$GLOBALS['HideReturnRequestsMenu'] = 'none';}
					$afilativar = GetModuleVariable("addon_afiliados","ativar");
                if ($veraf == 'sim' AND $afilativar == "1"){ 
                	$GLOBALS['Hideafiliados'] = "";
                }else{  
                	$GLOBALS['Hideafiliados'] = 'none';
                }  
				$query = sprintf("SELECT count(wishlistid) AS num FROM [|PREFIX|]wishlists WHERE customerid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($customerid));
				$GLOBALS['NumWishListItems'] = $GLOBALS['ISC_CLASS_DB']->FetchOne($query);
		}
	}
