Merge branch 'catalog' of https://github.com/thelia/thelia into upload_management

# By franck
# Via franck
* 'catalog' of https://github.com/thelia/thelia:
  Finished product combination basic function
  Formatted combination table
This commit is contained in:
gmorel
2013-09-24 18:41:57 +02:00
9 changed files with 392 additions and 260 deletions

View File

@@ -42,6 +42,7 @@ use Thelia\Log\Tlog;
use Symfony\Component\Routing\Router;
use Thelia\Model\Admin;
use Thelia\Core\Security\Token\CookieTokenProvider;
use Thelia\Model\CurrencyQuery;
class BaseAdminController extends BaseController
{
@@ -258,7 +259,7 @@ class BaseAdminController extends BaseController
// Return the new language if a change is required.
if (null !== $edit_currency_id = $this->getRequest()->get('edit_currency_id', null)) {
if (null !== $edit_currency = LangQuery::create()->findOneById($edit_currency_id)) {
if (null !== $edit_currency = CurrencyQuery::create()->findOneById($edit_currency_id)) {
return $edit_currency;
}
}

View File

@@ -56,6 +56,7 @@ use Thelia\Model\ProductSaleElementsQuery;
use Thelia\Model\AttributeCombination;
use Thelia\Model\AttributeAv;
use Thelia\Core\Event\ProductCreateCombinationEvent;
use Thelia\Core\Event\ProductDeleteCombinationEvent;
/**
* Manages products
@@ -753,8 +754,8 @@ class ProductController extends AbstractCrudController
$event = new ProductCreateCombinationEvent(
$this->getExistingObject(),
$this->getRequest()->get('use_default_princing', 0),
$this->getRequest()->get('combination_attributes', array())
$this->getRequest()->get('combination_attributes', array()),
$this->getCurrentEditionCurrency()->getId()
);
try {
@@ -764,8 +765,33 @@ class ProductController extends AbstractCrudController
// Any error
return $this->errorPage($ex);
}
echo "done!";
exit;
$this->redirectToEditionTemplate();
}
/**
* A a new combination to a product
*/
public function deleteCombinationAction() {
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
$event = new ProductDeleteCombinationEvent(
$this->getExistingObject(),
$this->getRequest()->get('product_sale_element_id',0)
);
try {
$this->dispatch(TheliaEvents::PRODUCT_DELETE_COMBINATION, $event);
}
catch (\Exception $ex) {
// Any error
return $this->errorPage($ex);
}
$this->redirectToEditionTemplate();
}
}