Skip to content

Commit

Permalink
edit readme
Browse files Browse the repository at this point in the history
  • Loading branch information
edouardproust committed Apr 10, 2022
1 parent 33615bf commit 0418f17
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ Storee is a simple e-commerce website featuring a cart and a complete payment sy
composer install -n
```

3. Update **src/Config.php**
3. Update **src/Config.php**

## Usefull commands

- Clear cache on prod: `cache:clear --env=prod --no-debug`

15 changes: 7 additions & 8 deletions src/Controller/StaticPage/HomeController.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?php namespace App\Controller\StaticPage;
<?php

namespace App\Controller\StaticPage;

use App\App\Service\AdminSettingService;
use App\Repository\ProductRepository;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class HomeController extends AbstractController {
class HomeController extends AbstractController
{

/** @var ProductRepository */
private $productRepository;
Expand All @@ -23,20 +26,16 @@ public function __construct(ProductRepository $productRepository, AdminSettingSe
/**
* @Route("/", name="home")
*/
public function show(): Response
public function show(): Response
{
$popularProductsSetting = $this->adminSettingService->getValue('homePopularProductsCriteria');
$itemsNumber = $this->adminSettingService->getValue('homeCollectionItemsNumber');
$test = $this->productRepository->findForCollection(null, $itemsNumber, 'purchases');
foreach($test as $t) {
dump($t);
}

return $this->render('staticPage/home.html.twig', [
'lastProducts' => $this->productRepository->findForCollection(null, $itemsNumber, 'createdAt'),
'popularProducts' => $this->productRepository->findForCollection(null, $itemsNumber, $popularProductsSetting),
'itemColWidth' => $this->adminSettingService->getBoostrapColWidth()
]);
}

}
}

0 comments on commit 0418f17

Please sign in to comment.