Browse Source

Merge branch 'feature/productUpdate' of https://gitea.laclic.fr/Laclic/LcShopBundle into feature/productUpdate

feature/export_comptable
Guillaume 4 years ago
parent
commit
f78a71dfe9
2 changed files with 5 additions and 19 deletions
  1. +3
    -17
      ShopBundle/Controller/Backend/ProductFamilyController.php
  2. +2
    -2
      ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js

+ 3
- 17
ShopBundle/Controller/Backend/ProductFamilyController.php View File

$entity->addProduct($newProduct); $entity->addProduct($newProduct);
} }
}else { }else {
dump('blop');
foreach ($entity->getProducts() as $product) {

dump($product);

}
//Récupère le product origin //Récupère le product origin
$originProducts = $this->em->getRepository(ProductInterface::class)->findBy(array( $originProducts = $this->em->getRepository(ProductInterface::class)->findBy(array(
'productFamily' => $entity->getId(), 'productFamily' => $entity->getId(),
if ($entity->getActiveProducts()) { if ($entity->getActiveProducts()) {
$originProduct->setStatus(-1); $originProduct->setStatus(-1);
} else { } else {
foreach ($entity->getProducts() as $product) {
/*foreach ($entity->getProducts() as $product) {
$product->setStatus(0); $product->setStatus(0);
}
}*/
$originProduct->setStatus(1); $originProduct->setStatus(1);
} }


//Enregistrement //Enregistrement
$originProduct->setProductFamily($entity);
$this->em->persist($originProduct);
$entity->addProduct($originProduct); $entity->addProduct($originProduct);


foreach ($entity->getProducts() as $product) { foreach ($entity->getProducts() as $product) {
$product->setProductFamily($entity); $product->setProductFamily($entity);
$this->em->persist($product); $this->em->persist($product);
$entity->addProduct($product); $entity->addProduct($product);
dump($product);

} }
//die();

} }
} }


$id = $this->request->query->get('id'); $id = $this->request->query->get('id');
$easyadmin = $this->request->attributes->get('easyadmin'); $easyadmin = $this->request->attributes->get('easyadmin');
$entity = $easyadmin['item']; $entity = $easyadmin['item'];
foreach ($entity->getProducts() as $product){
dump($product);
}

if ($this->request->isXmlHttpRequest() && $property = $this->request->query->get('property')) { if ($this->request->isXmlHttpRequest() && $property = $this->request->query->get('property')) {
$newValue = 'true' === mb_strtolower($this->request->query->get('newValue')); $newValue = 'true' === mb_strtolower($this->request->query->get('newValue'));
$fieldsMetadata = $this->entity['list']['fields']; $fieldsMetadata = $this->entity['list']['fields'];

+ 2
- 2
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js View File

deleteProductForm: function () { deleteProductForm: function () {
if (confirm('Êtes-vous sur de cette action ?')) { if (confirm('Êtes-vous sur de cette action ?')) {
this.status = -1; this.status = -1;
/*Vue.delete(this.$parent.formProducts, this.keyForm);
//Vue.delete(this.$parent.formProducts, this.keyForm);
this.$nextTick(function () { this.$nextTick(function () {
this.$parent.updateSortableProducts(true); this.$parent.updateSortableProducts(true);
});*/
});
} }


}, },

Loading…
Cancel
Save