Merge pull request #49 from thelia/frontend

Frontend
This commit is contained in:
Manuel Raynaud
2013-10-24 08:07:18 -07:00
56 changed files with 1396 additions and 1036 deletions

View File

@@ -32,6 +32,11 @@ use Thelia\Core\Event\ActionEvent;
*/
class NewsletterEvent extends ActionEvent
{
/**
* @var string email to save
*/
protected $id;
/**
* @var string email to save
*/
@@ -138,6 +143,22 @@ class NewsletterEvent extends ActionEvent
return $this->locale;
}
/**
* @param string $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getId()
{
return $this->id;
}

View File

@@ -71,6 +71,11 @@ final class TheliaEvents
*/
const CUSTOMER_UPDATEACCOUNT = "action.updateCustomer";
/**
* sent on customer account update profil
*/
const CUSTOMER_UPDATEPROFIL = "action.updateProfilCustomer";
/**
* sent on customer removal
*/
@@ -695,6 +700,8 @@ final class TheliaEvents
* sent for subscribing to the newsletter
*/
const NEWSLETTER_SUBSCRIBE = 'thelia.newsletter.subscribe';
const NEWSLETTER_UPDATE = 'thelia.newsletter.update';
const NEWSLETTER_UNSUBSCRIBE = 'thelia.newsletter.unsubscribe';
/************ LANG MANAGEMENT ****************************/

View File

@@ -12,8 +12,11 @@ namespace Thelia\Core\Template\Loop;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\CountryQuery;
use Thelia\Type;
use Thelia\Type\TypeCollection;
class Cart extends BaseLoop
{
@@ -40,7 +43,8 @@ class Cart extends BaseLoop
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntTypeArgument('limit'),
Argument::createAnyTypeArgument('position')
);
}
@@ -74,6 +78,7 @@ class Cart extends BaseLoop
{
$cart = $this->getCart($this->request);
$cartItems = $cart->getCartItems();
$result = new LoopResult($cartItems);
@@ -81,9 +86,32 @@ class Cart extends BaseLoop
return $result;
}
$limit = $this->getLimit();
$countCartItems = count($cartItems);
if($limit <= 0 || $limit >= $countCartItems){
$limit = $countCartItems;
}
$position = $this->getPosition();
if(isset($position)){
if($position == "first"){
$limit = 1;
$cartItems = array($cartItems[0]);
}else if($position == "last"){
$limit = 1;
$cartItems = array(end($cartItems));
}
// @TODO : if the position is a number
}
$taxCountry = CountryQuery::create()->findPk(64); // @TODO : make it magic;
foreach ($cartItems as $cartItem) {
for ($i=0; $i<$limit; $i ++) {
$cartItem = $cartItems[$i];
$product = $cartItem->getProduct();
$productSaleElement = $cartItem->getProductSaleElements();

View File

@@ -8,6 +8,7 @@ use \Symfony\Component\EventDispatcher\EventDispatcherInterface;
use \Smarty;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Thelia\Core\Template\ParserInterface;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
@@ -139,7 +140,7 @@ class SmartyParser extends Smarty implements ParserInterface
try {
$templateFile = $this->getTemplateFilePath();
} catch (\RuntimeException $e) {
return new Response($e->getMessage(), "404");
return new Response($this->render(\Thelia\Model\ConfigQuery::getPageNotFoundView()), "404");
}
return $this->render($templateFile);