Merge branch 'master' of github.com:thelia/thelia

This commit is contained in:
Manuel Raynaud
2013-10-24 19:20:18 +02:00
5 changed files with 47 additions and 44 deletions

View File

@@ -101,7 +101,7 @@ class AddressController extends BaseFrontController
$address = AddressQuery::create()->findPk($address_id);
if (!$address || $customer->getId() != $address->getCustomerId()) {
$this->redirectToRoute("home");
$this->redirectToRoute('default');
}
$this->getParserContext()->set("address_id", $address_id);
@@ -122,11 +122,11 @@ class AddressController extends BaseFrontController
$address = AddressQuery::create()->findPk($address_id);
if (null === $address) {
$this->redirectToRoute("home");
$this->redirectToRoute('default');
}
if ($address->getCustomer()->getId() != $customer->getId()) {
$this->redirectToRoute("home");
$this->redirectToRoute('default');
}
$event = $this->createAddressEvent($form);
@@ -161,12 +161,12 @@ class AddressController extends BaseFrontController
$address = AddressQuery::create()->findPk($address_id);
if (!$address || $customer->getId() != $address->getCustomerId()) {
$this->redirectToRoute("home");
$this->redirectToRoute('default');
}
$this->dispatch(TheliaEvents::ADDRESS_DELETE, new AddressEvent($address));
$this->redirectToRoute("customer.account.view");
$this->redirectToRoute('default', array('view'=>'account'));
}
protected function createAddressEvent($form)

View File

@@ -56,7 +56,7 @@ class BaseFrontController extends BaseController
public function checkAuth()
{
if ($this->getSecurityContext()->hasCustomerUser() === false) {
$this->redirectToRoute("customer.login.view");
$this->redirectToRoute('default', array('view'=>'login'));
}
}
@@ -64,7 +64,7 @@ class BaseFrontController extends BaseController
{
$cart = $this->getSession()->getCart();
if ($cart===null || $cart->countCartItems() == 0) {
$this->redirectToRoute("cart.view");
$this->redirectToRoute('default', array('view'=>'cart'));
}
}

View File

@@ -109,7 +109,7 @@ class CustomerController extends BaseFrontController
$cart = $this->getCart($this->getRequest());
if ($cart->getCartItems()->count() > 0) {
$this->redirectToRoute("cart.view");
$this->redirectToRoute('default', array('view'=>'cart'));
} else {
$this->redirectSuccess($customerCreation);
}
@@ -278,7 +278,7 @@ class CustomerController extends BaseFrontController
// If User is a new customer
if ($form->get('account')->getData() == 0 && !$form->get("email")->getErrors()) {
$this->redirectToRoute("customer.create.view", array("email" => $form->get("email")->getData()));
$this->redirectToRoute("default", array("view" => "register","email" => $form->get("email")->getData()));
} else {
try {

View File

@@ -197,7 +197,7 @@ class OrderController extends BaseFrontController
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute('order.placed', array('order_id' => $orderEvent->getPlacedOrder()->getId()))));
} else {
/* order has not been placed */
$this->redirectToRoute("cart.view");
$this->redirectToRoute('default', array('view'=>'cart'));
}
}

View File

@@ -355,15 +355,17 @@ class Product extends BaseI18nLoop
$search->groupBy(ProductTableMap::ID);
$search->withColumn('ROUND(' . $priceToCompareAsSQL . ', 2)', 'real_price');
$search->withColumn('`price`.PRICE', 'price');
$search->withColumn('`price`.PROMO_PRICE', 'promo_price');
$search->withColumn('`pse`.ID', 'pse_id');
$search->withColumn('`pse`.NEWNESS', 'is_new');
$search->withColumn('`pse`.PROMO', 'is_promo');
$search->withColumn('`pse`.QUANTITY', 'quantity');
$search->withColumn('`pse`.WEIGHT', 'weight');
$search->withColumn('`pse`.EAN_CODE', 'ean_code');
$search->withColumn('ROUND(' . $priceToCompareAsSQL . ', 2)', 'real_price');
$search->withColumn('`price`.PRICE', 'price');
$search->withColumn('`price`.PROMO_PRICE', 'promo_price');
$orders = $this->getOrder();
foreach ($orders as $order) {
@@ -471,37 +473,38 @@ class Product extends BaseI18nLoop
;
$loopResultRow
->set("ID" , $product->getId())
->set("REF" , $product->getRef())
->set("IS_TRANSLATED" , $product->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE" , $locale)
->set("TITLE" , $product->getVirtualColumn('i18n_TITLE'))
->set("CHAPO" , $product->getVirtualColumn('i18n_CHAPO'))
->set("DESCRIPTION" , $product->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM" , $product->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("URL" , $product->getUrl($locale))
->set("BEST_PRICE" , $product->getVirtualColumn('is_promo') ? $promoPrice : $price)
->set("BEST_PRICE_TAX" , $taxedPrice - $product->getVirtualColumn('is_promo') ? $taxedPromoPrice - $promoPrice : $taxedPrice - $price)
->set("BEST_TAXED_PRICE" , $product->getVirtualColumn('is_promo') ? $taxedPromoPrice : $taxedPrice)
->set("PRICE" , $price)
->set("PRICE_TAX" , $taxedPrice - $price)
->set("TAXED_PRICE" , $taxedPrice)
->set("PROMO_PRICE" , $promoPrice)
->set("PROMO_PRICE_TAX" , $taxedPromoPrice - $promoPrice)
->set("TAXED_PROMO_PRICE", $taxedPromoPrice)
->set("WEIGHT" , $product->getVirtualColumn('weight'))
->set("QUANTITY" , $product->getVirtualColumn('quantity'))
->set("EAN_CODE" , $product->getVirtualColumn('ean_code'))
->set("IS_PROMO" , $product->getVirtualColumn('is_promo'))
->set("IS_NEW" , $product->getVirtualColumn('is_new'))
->set("POSITION" , $product->getPosition())
->set("VISIBLE" , $product->getVisible() ? "1" : "0")
->set("TEMPLATE" , $product->getTemplateId())
->set("HAS_PREVIOUS" , $previous != null ? 1 : 0)
->set("HAS_NEXT" , $next != null ? 1 : 0)
->set("PREVIOUS" , $previous != null ? $previous->getId() : -1)
->set("NEXT" , $next != null ? $next->getId() : -1)
->set("DEFAULT_CATEGORY" , $default_category_id)
->set("ID" , $product->getId())
->set("REF" , $product->getRef())
->set("IS_TRANSLATED" , $product->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE" , $locale)
->set("TITLE" , $product->getVirtualColumn('i18n_TITLE'))
->set("CHAPO" , $product->getVirtualColumn('i18n_CHAPO'))
->set("DESCRIPTION" , $product->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM" , $product->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("URL" , $product->getUrl($locale))
->set("BEST_PRICE" , $product->getVirtualColumn('is_promo') ? $promoPrice : $price)
->set("BEST_PRICE_TAX" , $taxedPrice - $product->getVirtualColumn('is_promo') ? $taxedPromoPrice - $promoPrice : $taxedPrice - $price)
->set("BEST_TAXED_PRICE" , $product->getVirtualColumn('is_promo') ? $taxedPromoPrice : $taxedPrice)
->set("PRICE" , $price)
->set("PRICE_TAX" , $taxedPrice - $price)
->set("TAXED_PRICE" , $taxedPrice)
->set("PROMO_PRICE" , $promoPrice)
->set("PROMO_PRICE_TAX" , $taxedPromoPrice - $promoPrice)
->set("TAXED_PROMO_PRICE" , $taxedPromoPrice)
->set("PRODUCT_SALE_ELEMENT" , $product->getVirtualColumn('pse_id'))
->set("WEIGHT" , $product->getVirtualColumn('weight'))
->set("QUANTITY" , $product->getVirtualColumn('quantity'))
->set("EAN_CODE" , $product->getVirtualColumn('ean_code'))
->set("IS_PROMO" , $product->getVirtualColumn('is_promo'))
->set("IS_NEW" , $product->getVirtualColumn('is_new'))
->set("POSITION" , $product->getPosition())
->set("VISIBLE" , $product->getVisible() ? "1" : "0")
->set("TEMPLATE" , $product->getTemplateId())
->set("HAS_PREVIOUS" , $previous != null ? 1 : 0)
->set("HAS_NEXT" , $next != null ? 1 : 0)
->set("PREVIOUS" , $previous != null ? $previous->getId() : -1)
->set("NEXT" , $next != null ? $next->getId() : -1)
->set("DEFAULT_CATEGORY" , $default_category_id)
;
$loopResult->addRow($loopResultRow);