Conflicts:
	core/lib/Thelia/Core/Event/TheliaEvents.php
This commit is contained in:
franck
2013-08-08 10:14:02 +02:00
31 changed files with 999 additions and 433 deletions

View File

@@ -29,30 +29,13 @@ use Thelia\Model\Cart;
class CartEvent extends InternalEvent {
protected $cart;
protected $modified;
public $cart;
public function __construct(Cart $cart)
{
$this->cart = $cart;
$this->modified = false;
}
public function setCart(Cart $cart)
{
$this->cart = $cart;
$this->modified = true;
}
public function getCart()
{
return $this->cart;
}
public function isModified()
{
return $this->modified;
}
}

View File

@@ -21,19 +21,22 @@
/* */
/*************************************************************************************/
namespace Thelia\Core\Template\BaseParam;
namespace Thelia\Core\Event;
use Thelia\Tpex\BaseParam\BaseParam;
use Thelia\Tools\Redirect;
class Secure extends BaseParam
{
public function exec()
use Thelia\Model\CartItem;
class CartItemEvent extends InternalEvent {
protected $cartItem;
public function __construct(CartItem $cartItem)
{
$request = $this->getRequest();
if (!$request->getSession()->get('connected') && $this->baseParamValue) {
Redirect::unauthorize();
}
$this->cartItem = $cartItem;
}
}
public function getCartItem()
{
return $this->cartItem;
}
}

View File

@@ -114,4 +114,19 @@ final class TheliaEvents
*/
const AFTER_CHANGECATEGORY = "action.after_changecategory";
/**
* sent when a new existing cat id duplicated. This append when current customer is different from current cart
*/
const CART_DUPLICATE = "cart.duplicate";
/**
* sent when a new item is added to current cart
*/
const CART_ADDITEM = "cart.addItem";
/**
* sent when a cart item is modify
*/
const CART_MODIFYITEM = "cart.modifyItem";
}

View File

@@ -1,12 +1,25 @@
<?php
/**
* Created by JetBrains PhpStorm.
* User: manu
* Date: 08/07/13
* Time: 11:41
* To change this template use File | Settings | File Templates.
*/
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\HttpFoundation;
use Symfony\Component\HttpFoundation\Request as BaseRequest;
@@ -19,4 +32,20 @@ class Request extends BaseRequest{
return $this->get("product_id");
}
public function getUriAddingParameters(array $parameters = null)
{
$uri = $this->getUri();
$additionalQs = '';
foreach ($parameters as $key => $value) {
$additionalQs .= sprintf("&%s=%s", $key, $value);
}
if ('' == $this->getQueryString()) {
$additionalQs = '?'. ltrim($additionalQs, '&');
}
return $uri . $additionalQs;
}
}

View File

@@ -169,7 +169,8 @@ class Category extends BaseLoop
foreach ($categories as $category) {
if ($notEmpty && $category->countAllProducts() == 0) continue;
if ($this->getNotEmpty() && $category->countAllProducts() == 0) continue;
$loopResultRow = new LoopResultRow();