fix cookie -- not working

This commit is contained in:
2026-05-12 11:25:32 +02:00
parent 669d24c6a3
commit 8c4e664ca8
23 changed files with 836 additions and 166 deletions
+20
View File
@@ -1,10 +1,12 @@
package templates
import (
"sort"
"strconv"
"strings"
pscatalog "git.ma-al.com/goc_marek/ps_shop/internal/prestashop/catalog"
pscookie "git.ma-al.com/goc_marek/ps_shop/internal/prestashop/cookie"
)
func menuListClass(depth int) string {
@@ -76,3 +78,21 @@ func menuPanelID(id int64) string {
}
return "mega-menu-panel-" + strconv.FormatInt(id, 10)
}
func sessionCookieLines(session *pscookie.SessionContext) []string {
if session == nil || len(session.Values) == 0 {
return nil
}
keys := make([]string, 0, len(session.Values))
for key := range session.Values {
keys = append(keys, key)
}
sort.Strings(keys)
lines := make([]string, 0, len(keys))
for _, key := range keys {
lines = append(lines, key+"="+session.Values[key])
}
return lines
}