Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1581 | Revision 1583 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 1581 Revision 1582
Zeile 41... Zeile 41...
41
            if ( isset( $GLOBALS["INI"]["Navigation"]["showArtikelstamm"] ) )
41
            if ( isset( $GLOBALS["INI"]["Navigation"]["showArtikelstamm"] ) )
42
            {
42
            {
43
                $showArtikelstamm = true;
43
                $showArtikelstamm = true;
44
            }
44
            }
Zeile 45... Zeile 45...
45
 
45
 
Zeile 46... Zeile 46...
46
            $treebuffer = $this->with( 'directory' )->orderBy( "kennung" )->orderBy( "name" )->whereIn( "status", [ 0, 99 ] )->where( "directory_id", "=", $root )->where( 'articlemaster', '=' , 0 )->get();
46
            $treebuffer = $this->with( 'directory' )->orderBy( "kennung" )->orderBy( "name" )->whereIn( "status", [ 0, 99 ] )->where( "directory_id", "=", $root )->where( 'articlemaster', '=', 0 )->get();
47
 
47
 
48
 
48
 
Zeile 235... Zeile 235...
235
 
235
 
236
        function medium(): HasMany
236
        function medium(): HasMany
237
        {
237
        {
238
            return $this->hasMany( DirectoryMedium::class )->orderBy( "rank" );
238
            return $this->hasMany( DirectoryMedium::class )->orderBy( "rank" );
-
 
239
        }
239
        }
240
 
240
        function template(): HasMany
241
        function template(): HasMany
241
        {
242
        {
242
            return $this->hasMany( DirectoryTemplate::class );
243
            return $this->hasMany( DirectoryTemplate::class );
-
 
244
        }
243
        }
245
 
244
        public function manufacturer(): BelongsTo
246
        public function manufacturer(): BelongsTo
245
        {
247
        {
246
            return $this->belongsTo( Manufacturer::class );
248
            return $this->belongsTo( Manufacturer::class );
Zeile -... Zeile 249...
-
 
249
        }
-
 
250
 
-
 
251
        public function shopPosition( Item|null $item)
-
 
252
        {
-
 
253
            $buffer = array(); //$pos = "Sie sind hier: <a href=\"/\">Startseite</a> <span class='breadcrumb-trenner'> &raquo; </span>";
-
 
254
            $path = $this->getPath_New( $_SESSION['navigation']['position'] );
-
 
255
            foreach ( $path as $dir )
-
 
256
            {
-
 
257
                //Wenn man auf der Artikeldetailseite ist und der Artikel in einem Artikelstamm liegt dann darf nicht zusätzlich der Artikelstamm angezeigt werden
-
 
258
                if ( is_array( $item ) && $dir["Artikelstamm"] == 1 )
-
 
259
                {
-
 
260
 
-
 
261
                    $isItemImArtikelstamm = true;
-
 
262
                }
-
 
263
                else
-
 
264
                {
-
 
265
                    $buffer[] = $dir['ID'] . "-" . str2url( $dir['Name'] );
-
 
266
                    $isItemImArtikelstamm = false;
-
 
267
                }
-
 
268
 
-
 
269
                if ( !$isItemImArtikelstamm )
-
 
270
                {
-
 
271
                    if ( $GLOBALS["INI"]['alias'] == 0 )
-
 
272
                    {
-
 
273
                        $link = "?navigation=" . $dir['ID'];
-
 
274
                    }
-
 
275
                    else
-
 
276
                    {
-
 
277
                        $link = "/" . implode( "/", $buffer ) . "/";
-
 
278
                    }
-
 
279
 
-
 
280
                    /*if ( $dir['Artikelstamm'] == 0 )
-
 
281
                    * {
-
 
282
                    * $pos .= "<a href=\"$link\">" . $dir['Name'] . "</a>";
-
 
283
                    * }
-
 
284
                    * else
-
 
285
                    * {*/ //$pos .= "<a href=\"$link\">" . $dir['Name'] . "</a>";
-
 
286
                    //}
-
 
287
 
-
 
288
                    $pos[] = array(
-
 
289
                        "link"  => $link,
-
 
290
                        "name"  => $dir["Name"],
-
 
291
                        "dirID" => ( $dir["ID"] ),
-
 
292
                    );
-
 
293
                }
-
 
294
 
-
 
295
            }
-
 
296
 
-
 
297
            if ( is_array( $item ) )
-
 
298
            {
-
 
299
                $pos[] = array(
-
 
300
                    "link" => $item['itemLink'],
-
 
301
                    "name" => $item['kurzbezeichnung'],
-
 
302
                );
-
 
303
            }
-
 
304
            return $pos;
-
 
305
        }
-
 
306
 
-
 
307
        private function getPath_new( $root, $return_locked_folders = false ): array
-
 
308
        {
-
 
309
            $conn = $GLOBALS["shopDB"];
-
 
310
            if ( isset( $GLOBALS["remoteDB"] ) && is_object( $GLOBALS["remoteDB"] ) )
-
 
311
            {
-
 
312
                $conn = $GLOBALS["remoteDB"];
-
 
313
            }
-
 
314
            $ini = array();
-
 
315
            if ( !isset( $_SESSION["INI"] ) || !is_array( $_SESSION["INI"] ) )
-
 
316
            {
-
 
317
                if ( isset( $GLOBALS["INI"] ) )
-
 
318
                {
-
 
319
                    $ini = $GLOBALS["INI"];
-
 
320
                }
-
 
321
            }
-
 
322
            else
-
 
323
            {
-
 
324
                $ini = $_SESSION["INI"];
-
 
325
            }
-
 
326
            $treeRoot = -1;
-
 
327
            if ( $ini["treeRoot"] )
-
 
328
            {
-
 
329
                $treeRoot = $ini["treeRoot"];
-
 
330
            }
-
 
331
 
-
 
332
            $path = array();
-
 
333
            $father = $root;
-
 
334
            while ( $father != -1 && !is_null( $father ) )
-
 
335
            {
-
 
336
                $sql = "
-
 
337
                SELECT
-
 
338
                    *
-
 
339
                FROM
-
 
340
                    directory
-
 
341
                WHERE
-
 
342
                    ID=" . $father . "
-
 
343
                AND
-
 
344
                    language='" . $ini["language"] . "'
-
 
345
            ";
-
 
346
                $status_sql = "
-
 
347
                AND
-
 
348
                    status IN (0,2)
-
 
349
            ";
-
 
350
                if ( $return_locked_folders === false )
-
 
351
                {
-
 
352
                    $sql .= $status_sql;
-
 
353
                }
-
 
354
                $res = $conn->query( $sql );
-
 
355
                if ( !$res )
-
 
356
                {
-
 
357
                    return array();
-
 
358
                }
-
 
359
                $row = $res->fetch_assoc();
-
 
360
                if ( !is_array( $row ) )
-
 
361
                {
-
 
362
                    return array();
-
 
363
                }
-
 
364
                $father = $row["Father"];
-
 
365
                foreach ( array(
-
 
366
                    "",
-
 
367
                    "2",
-
 
368
                    "3",
-
 
369
                ) as $i )
-
 
370
                {
-
 
371
                    if ( $row["bild_url" . $i] )
-
 
372
                    {
-
 
373
                        $row["bild_url" . $i . "_beurer"] = $ini['itemContainerKorrektur']["imagePath" . $i] . $row["bild_url" . $i];
-
 
374
                        $row["bild_url" . $i] = "<img src=" . $ini['itemContainerKorrektur']["imagePath" . $i] . $row["bild_url" . $i] . " >";
-
 
375
                    }
-
 
376
                    else
-
 
377
                    {
-
 
378
                        $row["bild_url" . $i] = "";
-
 
379
                    }
-
 
380
                }
-
 
381
                $path[] = $row;
-
 
382
            }
-
 
383
            $path = array_reverse( $path );
-
 
384
            if ( $path[0]["Father"] != $treeRoot )
-
 
385
            {
-
 
386
                unset( $path[0] );
-
 
387
            }
-
 
388
            if ( !is_array( $path ) )
-
 
389
            {
-
 
390
                $path = array();
-
 
391
            }
-
 
392
            return $path;
247
        }
393
        }