<?php
namespace App\Controller;
use Google\Service\Games\CategoryListResponse;
use Google\Service\ManufacturerCenter\ProductDetail;
use Pimcore\Controller\FrontendController;
use Pimcore\Model\DataObject;
use Pimcore\Model\DataObject\Customers;
use Pimcore\Model\DataObject\Manufacturers;
use Pimcore\Model\DataObject\Orders;
use Pimcore\Model\DataObject\Product;
use Pimcore\Model\DataObject\Product\Listing as Productlist;
use Pimcore\Model\DataObject\Orders\Listing as OrdersList;
use Pimcore\Model\DataObject\Manufacturers\Listing as ManufacturersList;
use Pimcore\Model\DataObject\Customers\Listing as CustomersList;
use Pimcore\Model\DataObject\Category\Listing as CategoryList;
use Knp\component\Pager\PaginatorInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\OutputTimestampResolver;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
class ContentController extends FrontendController
{
/**
* @Template
*/
public function defaultAction(Request $request)
{
return [];
}
public function productAction(Request $request, \Knp\Component\Pager\PaginatorInterface $paginator)
{
$proList = Product::getList([
]);
$list = new Productlist();
$list->setOrderKey("name");
$list->setOrder("asc");
$paginator = $paginator->paginate(
$proList,
$request->get('page', 1),
20
);
// dd($paginator);
return $this->render('content/product.html.twig', ["proList" => $proList, 'paginator' => $paginator, 'predator' => $paginator->getPaginationData()]);
}
public function productdetailAction(Request $request)
{
$id = $request->query->get('id');
$product = Product::getByProduct_id($id)->getFieldCollections();
// dd($product);
// dd($product);
// dd($detail);
// $detail[] = $detail;
// $products_name = $request->get('product_name');
// $products_status = $request->get('products_status');
// $product_viewed = $request->get('products_viewed');
// $products_ordered = $request->get('products_ordered');
// $products_size = $request->get('products_size');
// return $this->redirectToRoute('product');
return $this->render('content/productdetail.html.twig', ['product' => $product]);
//
}
public function ordersAction(Request $request, \Knp\Component\Pager\PaginatorInterface $paginator)
{
$ordersList = Orders::getList();
$list = new OrdersList();
$list->setOrderKey("orders_id");
$list->setOrder("asc");
$paginator = $paginator->paginate(
$ordersList,
$request->get('page', 1),
20
);
// dd($paginator);
return $this->render('content/orders.html.twig', ["ordersList" => $ordersList, 'paginator' => $paginator, 'predator' => $paginator->getPaginationData()]);
}
public function ordersdetailAction(Request $request)
{
return $this->render('content/ordersdetail.html.twig');
}
public function manufacturersAction(Request $request, \Knp\Component\Pager\PaginatorInterface $paginator)
{
$manufacturersList = Manufacturers::getList();
$list = new ManufacturersList();
$list->setOrderKey("orders_id");
$list->setOrder("asc");
$paginator = $paginator->paginate(
$manufacturersList,
$request->get('page', 1),
20
);
return $this->render('content/manufacturers.html.twig', ["manufacturersList" => $manufacturersList, 'paginator' => $paginator, 'predator' => $paginator->getPaginationData()]);
}
public function manufacturersdetailAction(Request $request)
{
return $this->render('content/manufacturersdetail.html.twig');
}
public function customersAction(Request $request, \Knp\Component\Pager\PaginatorInterface $paginator)
{
$customersList = Customers::getList();
$list = new CustomersList();
$list->setOrderKey("orders_id");
$list->setOrder("asc");
$paginator = $paginator->paginate(
$customersList,
$request->get('page', 1),
20
);
return $this->render('content/customers.html.twig', ["customersList" => $customersList, 'paginator' => $paginator, 'predator' => $paginator->getPaginationData()]);
}
public function customersdetailAction(Request $request)
{
return $this->render('content/customersdetail.html.twig');
}
public function categoryAction(Request $request, \Knp\Component\Pager\PaginatorInterface $paginator)
{
$categoryList = DataObject\Category::getList();
$list = new CategoryList();
$list->setOrderKey("orders_id");
$list->setOrder("asc");
$paginator = $paginator->paginate(
$categoryList,
$request->get('page', 1),
20
);
return $this->render('content/category.html.twig', ["categoryList" => $categoryList, 'paginator' => $paginator, 'predator' => $paginator->getPaginationData()]);
}
public function categorydetailAction(Request $request)
{
return $this->render('content/categorydetail.html.twig');
}
}