|
|
@@ -0,0 +1,64 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
namespace Lc\ShopBundle\Controller\Frontend ; |
|
|
|
|
|
|
|
use App\Form\Frontend\OrderProductsType; |
|
|
|
use CKSource\CKFinder\Response\JsonResponse; |
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
|
|
use Lc\ShopBundle\Context\GlobalParamInterface; |
|
|
|
use Lc\ShopBundle\Context\ProductFamilyInterface; |
|
|
|
use Symfony\Component\HttpFoundation\Request; |
|
|
|
|
|
|
|
class CartController extends BaseController |
|
|
|
{ |
|
|
|
protected $productFamilyRepository ; |
|
|
|
|
|
|
|
public function __construct(EntityManagerInterface $em, GlobalParamInterface $globalParam) |
|
|
|
{ |
|
|
|
parent::__construct($em, $globalParam); |
|
|
|
$this->productFamilyRepository = $this->em->getRepository($this->em->getClassMetaData(ProductFamilyInterface::class)->getName()) ; |
|
|
|
} |
|
|
|
|
|
|
|
public function addProductFamily(Request $request) |
|
|
|
{ |
|
|
|
$return = [] ; |
|
|
|
$data = $request->request->all() ; |
|
|
|
$return = $data ; |
|
|
|
if(isset($data['order_products']['id_product_family'])) { |
|
|
|
$idProductFamily = $data['order_products']['id_product_family'] ; |
|
|
|
$productFamily = $this->productFamilyRepository->find($idProductFamily) ; |
|
|
|
|
|
|
|
if($productFamily) { |
|
|
|
|
|
|
|
$form = $this->createForm(OrderProductsType::class, ['id_product_family' => $productFamily->getId()]); |
|
|
|
$form->handleRequest($request); |
|
|
|
|
|
|
|
if ($form->isSubmitted() && $form->isValid()) { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return new JsonResponse($return) ; |
|
|
|
} |
|
|
|
|
|
|
|
public function addProduct() |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public function editProduct() |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public function deleteProduct() |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public function summary() |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
} |