This commit is contained in:
franck
2013-09-16 12:52:59 +02:00
34 changed files with 784 additions and 350 deletions

View File

@@ -65,7 +65,7 @@ class Cart extends BaseAction implements EventSubscriberInterface
->filterByProductSaleElementsId($productSaleElementsId) ->filterByProductSaleElementsId($productSaleElementsId)
->findOne(); ->findOne();
$this->doAddItem($cart, $productId, $productSaleElementsId, $quantity, $productPrice); $this->doAddItem($cart, $productId, $productPrice->getProductSaleElements(), $quantity, $productPrice);
} }
if ($append && $cartItem !== null) { if ($append && $cartItem !== null) {
@@ -166,17 +166,18 @@ class Cart extends BaseAction implements EventSubscriberInterface
* @param float $quantity * @param float $quantity
* @param ProductPrice $productPrice * @param ProductPrice $productPrice
*/ */
protected function doAddItem(\Thelia\Model\Cart $cart, $productId, $productSaleElementsId, $quantity, ProductPrice $productPrice) protected function doAddItem(\Thelia\Model\Cart $cart, $productId, \Thelia\Model\ProductSaleElements $productSaleElements, $quantity, ProductPrice $productPrice)
{ {
$cartItem = new CartItem(); $cartItem = new CartItem();
$cartItem->setDisptacher($this->getDispatcher()); $cartItem->setDisptacher($this->getDispatcher());
$cartItem $cartItem
->setCart($cart) ->setCart($cart)
->setProductId($productId) ->setProductId($productId)
->setProductSaleElementsId($productSaleElementsId) ->setProductSaleElementsId($productSaleElements->getId())
->setQuantity($quantity) ->setQuantity($quantity)
->setPrice($productPrice->getPrice()) ->setPrice($productPrice->getPrice())
->setPromoPrice($productPrice->getPromoPrice()) ->setPromoPrice($productPrice->getPromoPrice())
->setPromo($productSaleElements->getPromo())
->setPriceEndOfLife(time() + ConfigQuery::read("cart.priceEOF", 60*60*24*30)) ->setPriceEndOfLife(time() + ConfigQuery::read("cart.priceEOF", 60*60*24*30))
->save(); ->save();
} }

View File

@@ -26,6 +26,7 @@ namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\KernelEvents;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
@@ -43,6 +44,10 @@ class HttpException extends BaseAction implements EventSubscriberInterface
if ($event->getException() instanceof NotFoundHttpException) { if ($event->getException() instanceof NotFoundHttpException) {
$this->display404($event); $this->display404($event);
} }
if($event->getException() instanceof AccessDeniedHttpException) {
$this->display403($event);
}
} }
protected function display404(GetResponseForExceptionEvent $event) protected function display404(GetResponseForExceptionEvent $event)

View File

@@ -99,7 +99,6 @@
</route> </route>
<route id="cart.add.process" path="/cart/add"> <route id="cart.add.process" path="/cart/add">
<default key="_controller">Thelia\Controller\Front\CartController::addItem</default> <default key="_controller">Thelia\Controller\Front\CartController::addItem</default>
<default key="_view">cart</default>
</route> </route>
<route id="cart.delete.process" path="/cart/delete/{cart_item}"> <route id="cart.delete.process" path="/cart/delete/{cart_item}">

View File

@@ -69,10 +69,10 @@ class ConstraintValidator
/** /**
* Do variable comparison * Do variable comparison
* *
* @param mixed $v1 Variable 1 * @param mixed $v1 Variable 1
* @param string $o Operator * @param string $o Operator
* @param mixed $v2 Variable 2
* *
* @param mixed $v2 Variable 2
* @throws \Exception * @throws \Exception
* @return bool * @return bool
*/ */

View File

@@ -24,6 +24,7 @@
namespace Thelia\Constraint\Rule; namespace Thelia\Constraint\Rule;
use Symfony\Component\Intl\Exception\NotImplementedException; use Symfony\Component\Intl\Exception\NotImplementedException;
use Thelia\Constraint\ConstraintValidator;
use Thelia\Core\Translation\Translator; use Thelia\Core\Translation\Translator;
use Thelia\Coupon\CouponAdapterInterface; use Thelia\Coupon\CouponAdapterInterface;
use Thelia\Constraint\Validator\ComparableInterface; use Thelia\Constraint\Validator\ComparableInterface;
@@ -73,6 +74,9 @@ abstract class CouponRuleAbstract implements CouponRuleInterface
/** @var array Values set by Admin in BackOffice */ /** @var array Values set by Admin in BackOffice */
protected $values = array(); protected $values = array();
/** @var ConstraintValidator Constaints validator */
protected $constraintValidator = null;
/** /**
* Constructor * Constructor
* *

View File

@@ -47,6 +47,7 @@ class AddressController extends BaseFrontController
*/ */
public function generateModalAction($address_id) public function generateModalAction($address_id)
{ {
$this->checkAuth(); $this->checkAuth();
$this->checkXmlHttpRequest(); $this->checkXmlHttpRequest();
@@ -62,6 +63,7 @@ class AddressController extends BaseFrontController
*/ */
public function createAction() public function createAction()
{ {
$this->checkAuth(); $this->checkAuth();
$addressCreate = new AddressCreateForm($this->getRequest()); $addressCreate = new AddressCreateForm($this->getRequest());

View File

@@ -337,6 +337,7 @@ final class TheliaEvents
const BEFORE_DELETECURRENCY = "action.before_deleteCurrency"; const BEFORE_DELETECURRENCY = "action.before_deleteCurrency";
const AFTER_DELETECURRENCY = "action.after_deleteCurrency"; const AFTER_DELETECURRENCY = "action.after_deleteCurrency";
const CHANGE_DEFAULT_CURRENCY = 'action.changeDefaultCurrency';
// -- Product templates management ----------------------------------------- // -- Product templates management -----------------------------------------
const TEMPLATE_CREATE = "action.createTemplate"; const TEMPLATE_CREATE = "action.createTemplate";

View File

@@ -94,7 +94,7 @@ class ViewListener implements EventSubscriberInterface
{ {
$request = $this->container->get('request'); $request = $this->container->get('request');
if (!$view = $request->attributes->get('_view')) { if (null === $view = $request->attributes->get('_view')) {
$request->attributes->set('_view', $this->findView($request)); $request->attributes->set('_view', $this->findView($request));
} }

View File

@@ -164,10 +164,12 @@ class Session extends BaseSession
$cart = null; $cart = null;
if ($cart_id) { if ($cart_id) {
$cart = CartQuery::create()->findPk($cart_id); $cart = CartQuery::create()->findPk($cart_id);
try { if($cart) {
$this->verifyValidCart($cart); try {
} catch (InvalidCartException $e) { $this->verifyValidCart($cart);
$cart = null; } catch (InvalidCartException $e) {
$cart = null;
}
} }
} }

View File

@@ -73,7 +73,7 @@ abstract class BaseI18nLoop extends BaseLoop
$columns, $columns,
$foreignTable, $foreignTable,
$foreignKey, $foreignKey,
$forceReturn $this->getForce_return()
); );
} }
} }

View File

@@ -89,6 +89,7 @@ abstract class BaseLoop
Argument::createIntTypeArgument('page'), Argument::createIntTypeArgument('page'),
Argument::createIntTypeArgument('limit', PHP_INT_MAX), Argument::createIntTypeArgument('limit', PHP_INT_MAX),
Argument::createBooleanTypeArgument('backend_context', false), Argument::createBooleanTypeArgument('backend_context', false),
Argument::createBooleanTypeArgument('force_return', false),
); );
} }

View File

@@ -37,6 +37,7 @@ use Thelia\Model\Product;
use Thelia\Model\ProductQuery; use Thelia\Model\ProductQuery;
use Thelia\Model\Tools\ModelCriteriaTools; use Thelia\Model\Tools\ModelCriteriaTools;
use Thelia\Tools\DateTimeFormat; use Thelia\Tools\DateTimeFormat;
use Thelia\Cart\CartTrait;
/** /**
* Implementation of data access to main Thelia objects (users, cart, etc.) * Implementation of data access to main Thelia objects (users, cart, etc.)
@@ -46,6 +47,8 @@ use Thelia\Tools\DateTimeFormat;
*/ */
class DataAccessFunctions extends AbstractSmartyPlugin class DataAccessFunctions extends AbstractSmartyPlugin
{ {
use CartTrait;
private $securityContext; private $securityContext;
protected $parserContext; protected $parserContext;
protected $request; protected $request;
@@ -151,6 +154,20 @@ class DataAccessFunctions extends AbstractSmartyPlugin
} }
} }
public function cartDataAccess($params, $smarty)
{
$cart = $this->getCart($this->request);
$result = "";
switch($params["attr"]) {
case "count_item":
$result = $cart->getCartItems()->count();
break;
}
return $result;
}
/** /**
* Lang global data * Lang global data
* *
@@ -263,6 +280,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
new SmartyPluginDescriptor('function', 'folder', $this, 'folderDataAccess'), new SmartyPluginDescriptor('function', 'folder', $this, 'folderDataAccess'),
new SmartyPluginDescriptor('function', 'currency', $this, 'currencyDataAccess'), new SmartyPluginDescriptor('function', 'currency', $this, 'currencyDataAccess'),
new SmartyPluginDescriptor('function', 'lang', $this, 'langDataAccess'), new SmartyPluginDescriptor('function', 'lang', $this, 'langDataAccess'),
new SmartyPluginDescriptor('function', 'cart', $this, 'cartDataAccess'),
); );
} }
} }

View File

@@ -32,6 +32,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Session; use Symfony\Component\HttpFoundation\Session;
use Thelia\Core\Event\CurrencyEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Model; use Thelia\Model;
/** /**
@@ -146,6 +148,9 @@ class TheliaHttpKernel extends HttpKernel
$currency = null; $currency = null;
if ($request->query->has("currency")) { if ($request->query->has("currency")) {
$currency = Model\CurrencyQuery::create()->findOneByCode($request->query->get("currency")); $currency = Model\CurrencyQuery::create()->findOneByCode($request->query->get("currency"));
if($currency) {
$this->container->get("event_dispatcher")->dispatch(TheliaEvents::CHANGE_DEFAULT_CURRENCY, new CurrencyEvent($currency));
}
} else { } else {
$currency = $request->getSession()->getCurrency(false); $currency = $request->getSession()->getCurrency(false);
} }

View File

@@ -29,6 +29,7 @@ use Thelia\Form\Exception\ProductNotFoundException;
use Thelia\Model\ProductSaleElementsQuery; use Thelia\Model\ProductSaleElementsQuery;
use Thelia\Model\ConfigQuery; use Thelia\Model\ConfigQuery;
use Thelia\Model\ProductQuery; use Thelia\Model\ProductQuery;
use Thelia\Core\Translation\Translator;
/** /**
* Class CartAdd * Class CartAdd
@@ -75,13 +76,15 @@ class CartAdd extends BaseForm
)) ))
->add("product_sale_elements_id", "text", array( ->add("product_sale_elements_id", "text", array(
"constraints" => array( "constraints" => array(
new Constraints\NotBlank(),
new Constraints\Callback(array("methods" => array( new Constraints\Callback(array("methods" => array(
array($this, "checkStockAvailability") array($this, "checkStockAvailability")
))) )))
) ),
"required" => true
)) ))
->add("quantity", "text", array( ->add("quantity", "number", array(
"constraints" => array( "constraints" => array(
new Constraints\NotBlank(), new Constraints\NotBlank(),
new Constraints\Callback(array("methods" => array( new Constraints\Callback(array("methods" => array(
@@ -90,6 +93,10 @@ class CartAdd extends BaseForm
new Constraints\GreaterThanOrEqual(array( new Constraints\GreaterThanOrEqual(array(
"value" => 0 "value" => 0
)) ))
),
"label" => Translator::getInstance()->trans("Quantity"),
"label_attr" => array(
"for" => "quantity"
) )
)) ))
->add("append", "hidden") ->add("append", "hidden")
@@ -126,13 +133,17 @@ class CartAdd extends BaseForm
{ {
$data = $context->getRoot()->getData(); $data = $context->getRoot()->getData();
$productSaleElements = ProductSaleElementsQuery::create() if (null === $data["product_sale_elements_id"]) {
->filterById($data["product_sale_elements_id"]) $context->addViolationAt("quantity", Translator::getInstance()->trans("Invalid product_sale_elements"));
->filterByProductId($data["product"]) } else {
->findOne(); $productSaleElements = ProductSaleElementsQuery::create()
->filterById($data["product_sale_elements_id"])
->filterByProductId($data["product"])
->findOne();
if ($productSaleElements->getQuantity() < $value && ConfigQuery::read("verifyStock", 1) == 1) { if ($productSaleElements->getQuantity() < $value && ConfigQuery::read("verifyStock", 1) == 1) {
$context->addViolation("quantity value is not valid"); $context->addViolation("quantity value is not valid");
}
} }
} }

View File

@@ -44,16 +44,18 @@ class Cart extends BaseCart
$item->setQuantity($cartItem->getQuantity()); $item->setQuantity($cartItem->getQuantity());
$item->setProductSaleElements($productSaleElements); $item->setProductSaleElements($productSaleElements);
if ($currentDateTime <= $cartItem->getPriceEndOfLife()) { if ($currentDateTime <= $cartItem->getPriceEndOfLife()) {
$item->setPrice($cartItem->getPrice()); $item->setPrice($cartItem->getPrice())
$item->setPromoPrice($cartItem->getPromoPrice()); ->setPromoPrice($cartItem->getPromoPrice())
->setPromo($productSaleElements->getPromo())
// TODO : new price EOF or duplicate current priceEOF from $cartItem ? // TODO : new price EOF or duplicate current priceEOF from $cartItem ?
$item->setPriceEndOfLife($cartItem->getPriceEndOfLife()); ->setPriceEndOfLife($cartItem->getPriceEndOfLife());
} else { } else {
$productPrices = ProductPriceQuery::create()->filterByProductSaleElements($productSaleElements)->findOne(); $productPrices = ProductPriceQuery::create()->filterByProductSaleElements($productSaleElements)->findOne();
$item->setPrice($productPrices->getPrice()); $item->setPrice($productPrices->getPrice())
$item->setPromoPrice($productPrices->getPromoPrice()); ->setPromoPrice($productPrices->getPromoPrice())
$item->setPriceEndOfLife(time() + ConfigQuery::read("cart.priceEOF", 60*60*24*30)); ->setPromo($productSaleElements->getPromo())
->setPriceEndOfLife(time() + ConfigQuery::read("cart.priceEOF", 60*60*24*30));
} }
$item->save(); $item->save();
} }
@@ -76,4 +78,17 @@ class Cart extends BaseCart
{ {
} }
public function getTotalAmount()
{
$total = 0;
foreach($this->getCartItems() as $cartItem) {
$total += $cartItem->getPrice()-$cartItem->getDiscount();
}
$total -= $this->getDiscount();
return $total;
}
} }

View File

@@ -65,6 +65,7 @@ class Config extends BaseConfig {
*/ */
public function postUpdate(ConnectionInterface $con = null) public function postUpdate(ConnectionInterface $con = null)
{ {
$this->resetQueryCache();
$this->dispatchEvent(TheliaEvents::AFTER_UPDATECONFIG, new ConfigEvent($this)); $this->dispatchEvent(TheliaEvents::AFTER_UPDATECONFIG, new ConfigEvent($this));
} }
@@ -83,6 +84,12 @@ class Config extends BaseConfig {
*/ */
public function postDelete(ConnectionInterface $con = null) public function postDelete(ConnectionInterface $con = null)
{ {
$this->resetQueryCache();
$this->dispatchEvent(TheliaEvents::AFTER_DELETECONFIG, new ConfigEvent($this)); $this->dispatchEvent(TheliaEvents::AFTER_DELETECONFIG, new ConfigEvent($this));
} }
public function resetQueryCache()
{
ConfigQuery::resetCache($this->getName());
}
} }

View File

@@ -16,11 +16,32 @@ use Thelia\Model\Base\ConfigQuery as BaseConfigQuery;
* *
*/ */
class ConfigQuery extends BaseConfigQuery { class ConfigQuery extends BaseConfigQuery {
protected static $cache = array();
public static function read($search, $default = null) public static function read($search, $default = null)
{ {
if (array_key_exists($search, self::$cache)) {
return self::$cache[$search];
}
$value = self::create()->findOneByName($search); $value = self::create()->findOneByName($search);
return $value ? $value->getValue() : $default; self::$cache[$search] = $value ? $value->getValue() : $default;
return self::$cache[$search];
}
public static function resetCache($key = null)
{
if($key) {
if(array_key_exists($key, self::$cache)) {
unset(self::$cache[$key]);
return true;
}
}
self::$cache = array();
return true;
} }
public static function getDefaultLangWhenNoTranslationAvailable() public static function getDefaultLangWhenNoTranslationAvailable()

View File

@@ -65,6 +65,9 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue($ConstraintValidator));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -99,6 +102,9 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue($ConstraintValidator));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -136,6 +142,9 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(5)); ->will($this->returnValue(5));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue($ConstraintValidator));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -183,6 +192,9 @@ class ConstraintValidatorTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(5)); ->will($this->returnValue(5));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue($ConstraintValidator));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(

View File

@@ -23,6 +23,7 @@
namespace Thelia\Coupon; namespace Thelia\Coupon;
use Thelia\Constraint\ConstraintValidator;
use Thelia\Constraint\Rule\AvailableForTotalAmountManager; use Thelia\Constraint\Rule\AvailableForTotalAmountManager;
use Thelia\Constraint\Rule\Operators; use Thelia\Constraint\Rule\Operators;
@@ -169,6 +170,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -205,6 +209,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -241,6 +248,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -277,6 +287,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -313,6 +326,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -349,6 +365,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -385,6 +404,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -421,6 +443,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -457,6 +482,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -493,6 +521,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -529,6 +560,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -565,6 +599,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -601,6 +638,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(
@@ -637,6 +677,9 @@ class AvailableForTotalAmountTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getCheckoutCurrency') ->method('getCheckoutCurrency')
->will($this->returnValue('EUR')); ->will($this->returnValue('EUR'));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForTotalAmountManager($stubAdapter); $rule1 = new AvailableForTotalAmountManager($stubAdapter);
$operators = array( $operators = array(

View File

@@ -23,6 +23,7 @@
namespace Thelia\Coupon; namespace Thelia\Coupon;
use Thelia\Constraint\ConstraintValidator;
use Thelia\Constraint\Rule\AvailableForXArticlesManager; use Thelia\Constraint\Rule\AvailableForXArticlesManager;
use Thelia\Constraint\Rule\Operators; use Thelia\Constraint\Rule\Operators;
use Thelia\Constraint\Rule\SerializableRule; use Thelia\Constraint\Rule\SerializableRule;
@@ -192,6 +193,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter); $rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array( $operators = array(
@@ -224,6 +228,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter); $rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array( $operators = array(
@@ -256,6 +263,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter); $rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array( $operators = array(
@@ -288,6 +298,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter); $rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array( $operators = array(
@@ -320,6 +333,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter); $rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array( $operators = array(
@@ -352,6 +368,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter); $rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array( $operators = array(
@@ -384,6 +403,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter); $rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array( $operators = array(
@@ -416,6 +438,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter); $rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array( $operators = array(
@@ -448,6 +473,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter); $rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array( $operators = array(
@@ -480,6 +508,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter); $rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array( $operators = array(
@@ -512,6 +543,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter); $rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array( $operators = array(
@@ -544,6 +578,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter); $rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array( $operators = array(
@@ -570,6 +607,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter); $rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array( $operators = array(
@@ -602,6 +642,9 @@ class AvailableForXArticlesTest extends \PHPUnit_Framework_TestCase
$stubAdapter->expects($this->any()) $stubAdapter->expects($this->any())
->method('getNbArticlesInCart') ->method('getNbArticlesInCart')
->will($this->returnValue(4)); ->will($this->returnValue(4));
$stubAdapter->expects($this->any())
->method('getConstraintValidator')
->will($this->returnValue(new ConstraintValidator()));
$rule1 = new AvailableForXArticlesManager($stubAdapter); $rule1 = new AvailableForXArticlesManager($stubAdapter);
$operators = array( $operators = array(

View File

@@ -1,7 +1,5 @@
<?php <?php
use Thelia\Constraint\ConstraintFactory; use Thelia\Constraint\ConstraintFactory;
use Thelia\Constraint\ConstraintManager;
use Thelia\Constraint\Rule\AvailableForTotalAmount;
use Thelia\Constraint\Rule\AvailableForTotalAmountManager; use Thelia\Constraint\Rule\AvailableForTotalAmountManager;
use Thelia\Constraint\Rule\AvailableForXArticlesManager; use Thelia\Constraint\Rule\AvailableForXArticlesManager;
use Thelia\Constraint\Rule\Operators; use Thelia\Constraint\Rule\Operators;
@@ -39,14 +37,6 @@ try {
->find(); ->find();
$categoryAssociatedContent->delete(); $categoryAssociatedContent->delete();
$attributeCategory = Thelia\Model\AttributeCategoryQuery::create()
->find();
$attributeCategory->delete();
$featureCategory = Thelia\Model\FeatureCategoryQuery::create()
->find();
$featureCategory->delete();
$featureProduct = Thelia\Model\FeatureProductQuery::create() $featureProduct = Thelia\Model\FeatureProductQuery::create()
->find(); ->find();
$featureProduct->delete(); $featureProduct->delete();
@@ -327,22 +317,6 @@ try {
} }
} }
//attribute_category and feature_category (all categories got all features/attributes)
foreach($categoryIdList as $categoryId) {
foreach($attributeList as $attributeId => $attributeAvId) {
$attributeCategory = new Thelia\Model\AttributeCategory();
$attributeCategory->setCategoryId($categoryId)
->setAttributeId($attributeId)
->save();
}
foreach($featureList as $featureId => $featureAvId) {
$featureCategory = new Thelia\Model\FeatureCategory();
$featureCategory->setCategoryId($categoryId)
->setFeatureId($featureId)
->save();
}
}
foreach($productIdList as $productId) { foreach($productIdList as $productId) {
//add random accessories - or not //add random accessories - or not
$alreadyPicked = array(); $alreadyPicked = array();
@@ -366,6 +340,7 @@ try {
$productAssociatedContent = new Thelia\Model\ProductAssociatedContent(); $productAssociatedContent = new Thelia\Model\ProductAssociatedContent();
do { do {
$pick = array_rand($contentIdList, 1); $pick = array_rand($contentIdList, 1);
\Thelia\Log\Tlog::getInstance()->debug("pick : $pick");
} while(in_array($pick, $alreadyPicked)); } while(in_array($pick, $alreadyPicked));
$alreadyPicked[] = $pick; $alreadyPicked[] = $pick;
@@ -623,6 +598,8 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$coupon1->setMaxUsage(40); $coupon1->setMaxUsage(40);
$coupon1->setIsCumulative(1); $coupon1->setIsCumulative(1);
$coupon1->setIsRemovingPostage(0); $coupon1->setIsRemovingPostage(0);
$coupon1->setIsAvailableOnSpecialOffers(1);
$coupon1->save(); $coupon1->save();
@@ -671,8 +648,10 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$serializedRules = $constraintFactory->serializeCouponRuleCollection($rules); $serializedRules = $constraintFactory->serializeCouponRuleCollection($rules);
$coupon2->setSerializedRules($serializedRules); $coupon2->setSerializedRules($serializedRules);
$coupon1->setMaxUsage(-1); $coupon2->setMaxUsage(-1);
$coupon2->setIsCumulative(0); $coupon2->setIsCumulative(0);
$coupon2->setIsRemovingPostage(1); $coupon2->setIsRemovingPostage(1);
$coupon2->setIsAvailableOnSpecialOffers(1);
$coupon2->save(); $coupon2->save();
} }

View File

@@ -21,7 +21,7 @@ CREATE TABLE `category`
`version_created_at` DATETIME, `version_created_at` DATETIME,
`version_created_by` VARCHAR(100), `version_created_by` VARCHAR(100),
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- product -- product
@@ -54,7 +54,7 @@ CREATE TABLE `product`
CONSTRAINT `fk_product_template1` CONSTRAINT `fk_product_template1`
FOREIGN KEY (`template_id`) FOREIGN KEY (`template_id`)
REFERENCES `template` (`id`) REFERENCES `template` (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- product_category -- product_category
@@ -81,7 +81,7 @@ CREATE TABLE `product_category`
REFERENCES `category` (`id`) REFERENCES `category` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- country -- country
@@ -105,7 +105,7 @@ CREATE TABLE `country`
REFERENCES `area` (`id`) REFERENCES `area` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE SET NULL ON DELETE SET NULL
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- tax -- tax
@@ -121,7 +121,7 @@ CREATE TABLE `tax`
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- tax_rule -- tax_rule
@@ -135,7 +135,7 @@ CREATE TABLE `tax_rule`
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- tax_rule_country -- tax_rule_country
@@ -170,7 +170,7 @@ CREATE TABLE `tax_rule_country`
REFERENCES `country` (`id`) REFERENCES `country` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- feature -- feature
@@ -186,7 +186,7 @@ CREATE TABLE `feature`
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- feature_av -- feature_av
@@ -208,7 +208,7 @@ CREATE TABLE `feature_av`
REFERENCES `feature` (`id`) REFERENCES `feature` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- feature_product -- feature_product
@@ -245,7 +245,7 @@ CREATE TABLE `feature_product`
REFERENCES `feature_av` (`id`) REFERENCES `feature_av` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- feature_template -- feature_template
@@ -271,7 +271,7 @@ CREATE TABLE `feature_template`
CONSTRAINT `fk_feature_template` CONSTRAINT `fk_feature_template`
FOREIGN KEY (`template_id`) FOREIGN KEY (`template_id`)
REFERENCES `template` (`id`) REFERENCES `template` (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- attribute -- attribute
@@ -286,7 +286,7 @@ CREATE TABLE `attribute`
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- attribute_av -- attribute_av
@@ -308,7 +308,7 @@ CREATE TABLE `attribute_av`
REFERENCES `attribute` (`id`) REFERENCES `attribute` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- attribute_combination -- attribute_combination
@@ -340,7 +340,7 @@ CREATE TABLE `attribute_combination`
CONSTRAINT `fk_attribute_combination_product_sale_elements_id` CONSTRAINT `fk_attribute_combination_product_sale_elements_id`
FOREIGN KEY (`product_sale_elements_id`) FOREIGN KEY (`product_sale_elements_id`)
REFERENCES `product_sale_elements` (`id`) REFERENCES `product_sale_elements` (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- product_sale_elements -- product_sale_elements
@@ -367,7 +367,7 @@ CREATE TABLE `product_sale_elements`
REFERENCES `product` (`id`) REFERENCES `product` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- attribute_template -- attribute_template
@@ -393,7 +393,7 @@ CREATE TABLE `attribute_template`
CONSTRAINT `fk_attribute_template` CONSTRAINT `fk_attribute_template`
FOREIGN KEY (`template_id`) FOREIGN KEY (`template_id`)
REFERENCES `template` (`id`) REFERENCES `template` (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- config -- config
@@ -412,7 +412,7 @@ CREATE TABLE `config`
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE INDEX `name_UNIQUE` (`name`) UNIQUE INDEX `name_UNIQUE` (`name`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- customer -- customer
@@ -446,7 +446,7 @@ CREATE TABLE `customer`
REFERENCES `customer_title` (`id`) REFERENCES `customer_title` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE RESTRICT ON DELETE RESTRICT
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- address -- address
@@ -493,7 +493,7 @@ CREATE TABLE `address`
REFERENCES `country` (`id`) REFERENCES `country` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE RESTRICT ON DELETE RESTRICT
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- customer_title -- customer_title
@@ -509,7 +509,7 @@ CREATE TABLE `customer_title`
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- lang -- lang
@@ -535,7 +535,7 @@ CREATE TABLE `lang`
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- folder -- folder
@@ -555,7 +555,7 @@ CREATE TABLE `folder`
`version_created_at` DATETIME, `version_created_at` DATETIME,
`version_created_by` VARCHAR(100), `version_created_by` VARCHAR(100),
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- content -- content
@@ -574,7 +574,7 @@ CREATE TABLE `content`
`version_created_at` DATETIME, `version_created_at` DATETIME,
`version_created_by` VARCHAR(100), `version_created_by` VARCHAR(100),
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- product_image -- product_image
@@ -597,7 +597,7 @@ CREATE TABLE `product_image`
REFERENCES `product` (`id`) REFERENCES `product` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- product_document -- product_document
@@ -620,7 +620,7 @@ CREATE TABLE `product_document`
REFERENCES `product` (`id`) REFERENCES `product` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- order -- order
@@ -679,7 +679,7 @@ CREATE TABLE `order`
REFERENCES `order_status` (`id`) REFERENCES `order_status` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE SET NULL ON DELETE SET NULL
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- currency -- currency
@@ -698,7 +698,7 @@ CREATE TABLE `currency`
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- order_address -- order_address
@@ -723,7 +723,7 @@ CREATE TABLE `order_address`
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- order_product -- order_product
@@ -752,7 +752,7 @@ CREATE TABLE `order_product`
REFERENCES `order` (`id`) REFERENCES `order` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- order_status -- order_status
@@ -767,7 +767,7 @@ CREATE TABLE `order_status`
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- order_feature -- order_feature
@@ -790,7 +790,7 @@ CREATE TABLE `order_feature`
REFERENCES `order_product` (`id`) REFERENCES `order_product` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- module -- module
@@ -810,7 +810,7 @@ CREATE TABLE `module`
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE INDEX `code_UNIQUE` (`code`) UNIQUE INDEX `code_UNIQUE` (`code`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- accessory -- accessory
@@ -839,7 +839,7 @@ CREATE TABLE `accessory`
REFERENCES `product` (`id`) REFERENCES `product` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- area -- area
@@ -855,7 +855,7 @@ CREATE TABLE `area`
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- delivzone -- delivzone
@@ -877,7 +877,7 @@ CREATE TABLE `delivzone`
REFERENCES `area` (`id`) REFERENCES `area` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE SET NULL ON DELETE SET NULL
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- group -- group
@@ -893,7 +893,7 @@ CREATE TABLE `group`
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE INDEX `code_UNIQUE` (`code`) UNIQUE INDEX `code_UNIQUE` (`code`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- resource -- resource
@@ -909,7 +909,7 @@ CREATE TABLE `resource`
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE INDEX `code_UNIQUE` (`code`) UNIQUE INDEX `code_UNIQUE` (`code`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- admin -- admin
@@ -931,7 +931,7 @@ CREATE TABLE `admin`
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- admin_group -- admin_group
@@ -959,7 +959,7 @@ CREATE TABLE `admin_group`
REFERENCES `admin` (`id`) REFERENCES `admin` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- group_resource -- group_resource
@@ -989,7 +989,7 @@ CREATE TABLE `group_resource`
REFERENCES `resource` (`id`) REFERENCES `resource` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- group_module -- group_module
@@ -1018,7 +1018,7 @@ CREATE TABLE `group_module`
REFERENCES `module` (`id`) REFERENCES `module` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- message -- message
@@ -1038,7 +1038,7 @@ CREATE TABLE `message`
`version_created_by` VARCHAR(100), `version_created_by` VARCHAR(100),
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE INDEX `name_UNIQUE` (`name`) UNIQUE INDEX `name_UNIQUE` (`name`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- coupon -- coupon
@@ -1074,7 +1074,7 @@ CREATE TABLE `coupon`
INDEX `idx_is_removing_postage` (`is_removing_postage`), INDEX `idx_is_removing_postage` (`is_removing_postage`),
INDEX `idx_max_usage` (`max_usage`), INDEX `idx_max_usage` (`max_usage`),
INDEX `idx_is_available_on_special_offers` (`is_available_on_special_offers`) INDEX `idx_is_available_on_special_offers` (`is_available_on_special_offers`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- coupon_order -- coupon_order
@@ -1096,7 +1096,7 @@ CREATE TABLE `coupon_order`
REFERENCES `order` (`id`) REFERENCES `order` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- admin_log -- admin_log
@@ -1115,7 +1115,7 @@ CREATE TABLE `admin_log`
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- content_folder -- content_folder
@@ -1142,7 +1142,7 @@ CREATE TABLE `content_folder`
REFERENCES `folder` (`id`) REFERENCES `folder` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- cart -- cart
@@ -1179,7 +1179,7 @@ CREATE TABLE `cart`
CONSTRAINT `fk_cart_currency_id` CONSTRAINT `fk_cart_currency_id`
FOREIGN KEY (`currency_id`) FOREIGN KEY (`currency_id`)
REFERENCES `currency` (`id`) REFERENCES `currency` (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- cart_item -- cart_item
@@ -1214,7 +1214,7 @@ CREATE TABLE `cart_item`
CONSTRAINT `fk_cart_item_product_sale_elements_id` CONSTRAINT `fk_cart_item_product_sale_elements_id`
FOREIGN KEY (`product_sale_elements_id`) FOREIGN KEY (`product_sale_elements_id`)
REFERENCES `product_sale_elements` (`id`) REFERENCES `product_sale_elements` (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- product_price -- product_price
@@ -1241,7 +1241,7 @@ CREATE TABLE `product_price`
FOREIGN KEY (`currency_id`) FOREIGN KEY (`currency_id`)
REFERENCES `currency` (`id`) REFERENCES `currency` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- category_image -- category_image
@@ -1264,7 +1264,7 @@ CREATE TABLE `category_image`
REFERENCES `category` (`id`) REFERENCES `category` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- folder_image -- folder_image
@@ -1287,7 +1287,7 @@ CREATE TABLE `folder_image`
REFERENCES `folder` (`id`) REFERENCES `folder` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- content_image -- content_image
@@ -1310,7 +1310,7 @@ CREATE TABLE `content_image`
REFERENCES `content` (`id`) REFERENCES `content` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- category_document -- category_document
@@ -1333,7 +1333,7 @@ CREATE TABLE `category_document`
REFERENCES `category` (`id`) REFERENCES `category` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- content_document -- content_document
@@ -1356,7 +1356,7 @@ CREATE TABLE `content_document`
REFERENCES `content` (`id`) REFERENCES `content` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- folder_document -- folder_document
@@ -1379,7 +1379,7 @@ CREATE TABLE `folder_document`
REFERENCES `folder` (`id`) REFERENCES `folder` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- product_associated_content -- product_associated_content
@@ -1408,7 +1408,7 @@ CREATE TABLE `product_associated_content`
REFERENCES `content` (`id`) REFERENCES `content` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- category_associated_content -- category_associated_content
@@ -1437,7 +1437,7 @@ CREATE TABLE `category_associated_content`
REFERENCES `content` (`id`) REFERENCES `content` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- rewriting_url -- rewriting_url
@@ -1464,7 +1464,7 @@ CREATE TABLE `rewriting_url`
REFERENCES `rewriting_url` (`id`) REFERENCES `rewriting_url` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE RESTRICT ON DELETE RESTRICT
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- rewriting_argument -- rewriting_argument
@@ -1486,7 +1486,7 @@ CREATE TABLE `rewriting_argument`
REFERENCES `rewriting_url` (`id`) REFERENCES `rewriting_url` (`id`)
ON UPDATE RESTRICT ON UPDATE RESTRICT
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- template -- template
@@ -1500,7 +1500,7 @@ CREATE TABLE `template`
`created_at` DATETIME, `created_at` DATETIME,
`updated_at` DATETIME, `updated_at` DATETIME,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- category_i18n -- category_i18n
@@ -1521,7 +1521,7 @@ CREATE TABLE `category_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `category` (`id`) REFERENCES `category` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- product_i18n -- product_i18n
@@ -1542,7 +1542,7 @@ CREATE TABLE `product_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `product` (`id`) REFERENCES `product` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- country_i18n -- country_i18n
@@ -1563,7 +1563,7 @@ CREATE TABLE `country_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `country` (`id`) REFERENCES `country` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- tax_i18n -- tax_i18n
@@ -1582,7 +1582,7 @@ CREATE TABLE `tax_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `tax` (`id`) REFERENCES `tax` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- tax_rule_i18n -- tax_rule_i18n
@@ -1601,7 +1601,7 @@ CREATE TABLE `tax_rule_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `tax_rule` (`id`) REFERENCES `tax_rule` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- feature_i18n -- feature_i18n
@@ -1622,7 +1622,7 @@ CREATE TABLE `feature_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `feature` (`id`) REFERENCES `feature` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- feature_av_i18n -- feature_av_i18n
@@ -1643,7 +1643,7 @@ CREATE TABLE `feature_av_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `feature_av` (`id`) REFERENCES `feature_av` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- attribute_i18n -- attribute_i18n
@@ -1664,7 +1664,7 @@ CREATE TABLE `attribute_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `attribute` (`id`) REFERENCES `attribute` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- attribute_av_i18n -- attribute_av_i18n
@@ -1685,7 +1685,7 @@ CREATE TABLE `attribute_av_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `attribute_av` (`id`) REFERENCES `attribute_av` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- config_i18n -- config_i18n
@@ -1706,7 +1706,7 @@ CREATE TABLE `config_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `config` (`id`) REFERENCES `config` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- customer_title_i18n -- customer_title_i18n
@@ -1725,7 +1725,7 @@ CREATE TABLE `customer_title_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `customer_title` (`id`) REFERENCES `customer_title` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- folder_i18n -- folder_i18n
@@ -1746,7 +1746,7 @@ CREATE TABLE `folder_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `folder` (`id`) REFERENCES `folder` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- content_i18n -- content_i18n
@@ -1767,7 +1767,7 @@ CREATE TABLE `content_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `content` (`id`) REFERENCES `content` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- product_image_i18n -- product_image_i18n
@@ -1788,7 +1788,7 @@ CREATE TABLE `product_image_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `product_image` (`id`) REFERENCES `product_image` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- product_document_i18n -- product_document_i18n
@@ -1809,7 +1809,7 @@ CREATE TABLE `product_document_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `product_document` (`id`) REFERENCES `product_document` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- currency_i18n -- currency_i18n
@@ -1827,7 +1827,7 @@ CREATE TABLE `currency_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `currency` (`id`) REFERENCES `currency` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- order_status_i18n -- order_status_i18n
@@ -1848,7 +1848,7 @@ CREATE TABLE `order_status_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `order_status` (`id`) REFERENCES `order_status` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- module_i18n -- module_i18n
@@ -1869,7 +1869,7 @@ CREATE TABLE `module_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `module` (`id`) REFERENCES `module` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- group_i18n -- group_i18n
@@ -1890,7 +1890,7 @@ CREATE TABLE `group_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `group` (`id`) REFERENCES `group` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- resource_i18n -- resource_i18n
@@ -1911,7 +1911,7 @@ CREATE TABLE `resource_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `resource` (`id`) REFERENCES `resource` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- message_i18n -- message_i18n
@@ -1932,7 +1932,7 @@ CREATE TABLE `message_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `message` (`id`) REFERENCES `message` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- coupon_i18n -- coupon_i18n
@@ -1952,7 +1952,7 @@ CREATE TABLE `coupon_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `coupon` (`id`) REFERENCES `coupon` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- category_image_i18n -- category_image_i18n
@@ -1973,7 +1973,7 @@ CREATE TABLE `category_image_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `category_image` (`id`) REFERENCES `category_image` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- folder_image_i18n -- folder_image_i18n
@@ -1994,7 +1994,7 @@ CREATE TABLE `folder_image_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `folder_image` (`id`) REFERENCES `folder_image` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- content_image_i18n -- content_image_i18n
@@ -2015,7 +2015,7 @@ CREATE TABLE `content_image_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `content_image` (`id`) REFERENCES `content_image` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- category_document_i18n -- category_document_i18n
@@ -2036,7 +2036,7 @@ CREATE TABLE `category_document_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `category_document` (`id`) REFERENCES `category_document` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- content_document_i18n -- content_document_i18n
@@ -2057,7 +2057,7 @@ CREATE TABLE `content_document_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `content_document` (`id`) REFERENCES `content_document` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- folder_document_i18n -- folder_document_i18n
@@ -2078,7 +2078,7 @@ CREATE TABLE `folder_document_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `folder_document` (`id`) REFERENCES `folder_document` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- template_i18n -- template_i18n
@@ -2096,7 +2096,7 @@ CREATE TABLE `template_i18n`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `template` (`id`) REFERENCES `template` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- category_version -- category_version
@@ -2120,7 +2120,7 @@ CREATE TABLE `category_version`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `category` (`id`) REFERENCES `category` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- product_version -- product_version
@@ -2146,7 +2146,7 @@ CREATE TABLE `product_version`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `product` (`id`) REFERENCES `product` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- folder_version -- folder_version
@@ -2170,7 +2170,7 @@ CREATE TABLE `folder_version`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `folder` (`id`) REFERENCES `folder` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- content_version -- content_version
@@ -2193,7 +2193,7 @@ CREATE TABLE `content_version`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `content` (`id`) REFERENCES `content` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- message_version -- message_version
@@ -2216,7 +2216,7 @@ CREATE TABLE `message_version`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `message` (`id`) REFERENCES `message` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- coupon_version -- coupon_version
@@ -2246,7 +2246,7 @@ CREATE TABLE `coupon_version`
FOREIGN KEY (`id`) FOREIGN KEY (`id`)
REFERENCES `coupon` (`id`) REFERENCES `coupon` (`id`)
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB CHARACTER SET='utf8';
# This restores the fkey checks, after having unset them earlier # This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="thelia"> <database defaultIdMethod="native" name="thelia">
<vendor type="mysql">
<parameter name="Engine" value="InnoDB"/>
<parameter name="Charset" value="utf8"/>
</vendor>
<table name="category" namespace="Thelia\Model"> <table name="category" namespace="Thelia\Model">
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" /> <column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
<column name="parent" type="INTEGER" /> <column name="parent" type="INTEGER" />

View File

@@ -40,7 +40,9 @@ class PropelCollector extends DataCollector implements Renderable, LoggerInterfa
protected $peakMemory = 0; protected $peakMemory = 0;
public function __construct() protected $alternativeLogger;
public function __construct(LoggerInterface $alternativeLogger = null)
{ {
$serviceContainer = Propel::getServiceContainer(); $serviceContainer = Propel::getServiceContainer();
$serviceContainer->setLogger('defaultLogger', $this); $serviceContainer->setLogger('defaultLogger', $this);
@@ -54,6 +56,8 @@ class PropelCollector extends DataCollector implements Renderable, LoggerInterfa
'commit', 'commit',
'rollBack', 'rollBack',
)); ));
$this->alternativeLogger = $alternativeLogger;
} }
/** /**
@@ -118,6 +122,10 @@ class PropelCollector extends DataCollector implements Renderable, LoggerInterfa
list($sql, $duration_str) = $this->parseAndLogSqlQuery($message); list($sql, $duration_str) = $this->parseAndLogSqlQuery($message);
$message = "$sql ($duration_str)"; $message = "$sql ($duration_str)";
if ($this->alternativeLogger) {
$this->alternativeLogger->log($level, $message);
}
} }
/** /**
@@ -172,7 +180,7 @@ class PropelCollector extends DataCollector implements Renderable, LoggerInterfa
*/ */
public function emergency($message, array $context = array()) public function emergency($message, array $context = array())
{ {
$this->log(null, $message, $context); $this->log(\Thelia\Log\Tlog::EMERGENCY, $message, $context);
} }
/** /**
@@ -187,7 +195,7 @@ class PropelCollector extends DataCollector implements Renderable, LoggerInterfa
*/ */
public function alert($message, array $context = array()) public function alert($message, array $context = array())
{ {
$this->log(null, $message, $context); $this->log(\Thelia\Log\Tlog::ALERT, $message, $context);
} }
/** /**
@@ -201,7 +209,7 @@ class PropelCollector extends DataCollector implements Renderable, LoggerInterfa
*/ */
public function critical($message, array $context = array()) public function critical($message, array $context = array())
{ {
$this->log(null, $message, $context); $this->log(\Thelia\Log\Tlog::CRITICAL, $message, $context);
} }
/** /**
@@ -214,7 +222,7 @@ class PropelCollector extends DataCollector implements Renderable, LoggerInterfa
*/ */
public function error($message, array $context = array()) public function error($message, array $context = array())
{ {
$this->log(null, $message, $context); $this->log(\Thelia\Log\Tlog::ERROR, $message, $context);
} }
/** /**
@@ -229,7 +237,7 @@ class PropelCollector extends DataCollector implements Renderable, LoggerInterfa
*/ */
public function warning($message, array $context = array()) public function warning($message, array $context = array())
{ {
$this->log(null, $message, $context); $this->log(\Thelia\Log\Tlog::WARNING, $message, $context);
} }
/** /**
@@ -241,7 +249,7 @@ class PropelCollector extends DataCollector implements Renderable, LoggerInterfa
*/ */
public function notice($message, array $context = array()) public function notice($message, array $context = array())
{ {
$this->log(null, $message, $context); $this->log(\Thelia\Log\Tlog::NOTICE, $message, $context);
} }
/** /**
@@ -255,7 +263,7 @@ class PropelCollector extends DataCollector implements Renderable, LoggerInterfa
*/ */
public function info($message, array $context = array()) public function info($message, array $context = array())
{ {
$this->log(null, $message, $context); $this->log(\Thelia\Log\Tlog::INFO, $message, $context);
} }
/** /**
@@ -267,7 +275,7 @@ class PropelCollector extends DataCollector implements Renderable, LoggerInterfa
*/ */
public function debug($message, array $context = array()) public function debug($message, array $context = array())
{ {
$this->log(null, $message, $context); $this->log(\Thelia\Log\Tlog::DEBUG, $message, $context);
} }

View File

@@ -50,7 +50,7 @@ class DebugBarListeners extends BaseAction implements EventSubscriberInterface {
//$debugBar->addCollector(new RequestDataCollector()); //$debugBar->addCollector(new RequestDataCollector());
$debugBar->addCollector(new TimeDataCollector()); $debugBar->addCollector(new TimeDataCollector());
$debugBar->addCollector(new MemoryCollector()); $debugBar->addCollector(new MemoryCollector());
$debugBar->addCollector(new PropelCollector()); $debugBar->addCollector(new PropelCollector(\Thelia\Log\Tlog::getInstance()));
} }
/** /**

View File

@@ -2,150 +2,156 @@
(function($) { (function($) {
/* ------------------------------------------------------------------ /* ------------------------------------------------------------------
onLoad Function -------------------------------------------------- */ onLoad Function -------------------------------------------------- */
$(document).ready(function(){ $(document).ready(function(){
// Main Navigation Hover // Main Navigation Hover
$('.nav-main') $('.nav-main')
.on('click.subnav', '[data-toggle=dropdown]', function(event){ .on('click.subnav', '[data-toggle=dropdown]', function(event){
if($(this).parent().hasClass('open') && $(this).is(event.target)) if($(this).parent().hasClass('open') && $(this).is(event.target))
return false; return false;
}) })
.on('mouseenter.subnav', '.dropdown', function(event){ .on('mouseenter.subnav', '.dropdown', function(event){
if($(this).hasClass('open')) if($(this).hasClass('open'))
return; return;
$(this).addClass('open'); $(this).addClass('open');
}) })
.on('mouseleave.subnav', '.dropdown', function(){ .on('mouseleave.subnav', '.dropdown', function(){
if(!$(this).hasClass('open')) if(!$(this).hasClass('open'))
return; return;
$(this).removeClass('open'); $(this).removeClass('open');
}); });
// Tooltip // Tooltip
$('body').tooltip({ $('body').tooltip({
selector: '[data-toggle=tooltip]' selector: '[data-toggle=tooltip]'
}); });
// Toolbar // Toolbar
var $category_products = $('#category-products'); var $category_products = $('#category-products');
if($category_products.size() > 0){ if($category_products.size() > 0){
var $parent = $category_products.parent(); var $parent = $category_products.parent();
$parent.on('click.view-mode', '[data-toggle=view]', function(){ $parent.on('click.view-mode', '[data-toggle=view]', function(){
if( ($(this).hasClass('btn-grid') && $parent.hasClass('grid')) || ($(this).hasClass('btn-list') && $parent.hasClass('list'))) if( ($(this).hasClass('btn-grid') && $parent.hasClass('grid')) || ($(this).hasClass('btn-list') && $parent.hasClass('list')))
return; return;
$parent.toggleClass('grid').toggleClass('list'); $parent.toggleClass('grid').toggleClass('list');
return false; return false;
}); });
} }
// Login // Login
/* var $form_login = $('#form-login'); var $form_login = $('#form-login');
if($form_login.size() > 0) { if($form_login.size() > 0) {
$form_login.on('change.account', ':radio', function(){ $form_login.on('change.account', ':radio', function(){
if($(this).val() === '0') if($(this).val() === '0')
$('#password', $form_login).val('').prop('disabled', true); // Disabled (new customer) $('#password', $form_login).val('').prop('disabled', true); // Disabled (new customer)
else else
$('#password', $form_login).prop('disabled', false); // Enabled $('#password', $form_login).prop('disabled', false); // Enabled
}).find(':radio:checked').trigger('change.account'); }).find(':radio:checked').trigger('change.account');
}*/ }
// Forgot Password // Forgot Password
/* /*
var $forgot_password = $('.forgot-password', $form_login); var $forgot_password = $('.forgot-password', $form_login);
if($forgot_password.size() > 0) { if($forgot_password.size() > 0) {
$forgot_password.popover({ $forgot_password.popover({
html : true, html : true,
title: 'Forgot Password', title: 'Forgot Password',
content: function() { content: function() {
return $('#form-forgotpassword').html(); return $('#form-forgotpassword').html();
} }
}).on('click.btn-forgot', function(){ }).on('click.btn-forgot', function(){
$('.btn-forgot').click(function(){ $('.btn-forgot').click(function(){
alert('click form'); alert('click form');
return false; return false;
}); });
$('.btn-close').click(function(){ $('.btn-close').click(function(){
$forgot_password.popover('hide'); $forgot_password.popover('hide');
}); });
return false; return false;
}); });
} }
*/ */
//.Form Filters //.Form Filters
$('#form-filters').each(function(){ $('#form-filters').each(function(){
var $form = $(this); var $form = $(this);
$form $form
.on('change.filter', ':checkbox', function(){ .on('change.filter', ':checkbox', function(){
$form.submit(); $form.submit();
}) })
.find('.group-btn > .btn').addClass('sr-only'); .find('.group-btn > .btn').addClass('sr-only');
}); });
// Product details Thumbnails // Product details Thumbnails
$('#product-gallery').each(function(){ $('#product-gallery').each(function(){
var $thumbnails = $('.thumbnail', this), var $item = $('.item', this),
$image = $('.product-image > img', this); $thumbnails = $('.thumbnail', this),
$image = $('.product-image > img', this);
$(this).on('click.thumbnails', '.thumbnail', function(){ // Show Carousel control if needed
if($(this).hasClass('active')) if($item.size() > 1){
return false; $('#product-thumbnails', this).carousel({interval: false}).find('.carousel-control').show();
}
$image.attr('src',$(this).attr('href')); $(this).on('click.thumbnails', '.thumbnail', function(){
$thumbnails.removeClass('active'); if($(this).hasClass('active'))
$(this).addClass('active'); return false;
return false; $image.attr('src',$(this).attr('href'));
}); $thumbnails.removeClass('active');
}); $(this).addClass('active');
// Payment Method return false;
$('#payment-method').each(function(){ });
var $label = $('label', this); });
$label.on('change', ':radio', function(){
$label.removeClass('active'); // Payment Method
$label.filter('[for="' + $(this).attr('id') + '"]').addClass('active'); $('#payment-method').each(function(){
}).filter(':has(:checked)').addClass('active'); var $label = $('label', this);
}); $label.on('change', ':radio', function(){
$label.removeClass('active');
$label.filter('[for="' + $(this).attr('id') + '"]').addClass('active');
}).filter(':has(:checked)').addClass('active');
});
// Styliser le message Confirm par Bootstrap sur un formulaire // Styliser le message Confirm par Bootstrap sur un formulaire
/* /*
$('body').on('click', '[data-confirm]', function(){ $('body').on('click', '[data-confirm]', function(){
var $this = $(this); var $this = $(this);
bootbox.confirm($(this).attr('data-confirm'), bootbox.confirm($(this).attr('data-confirm'),
function(result){ function(result){
if(result) { if(result) {
// Si lien // Si lien
if($this.attr('href')){ if($this.attr('href')){
window.location.href = $this.attr('href'); window.location.href = $this.attr('href');
}else{ }else{
// Si on doit soumettre un formulaire // Si on doit soumettre un formulaire
var $form = $this.closest("form"); var $form = $this.closest("form");
if($form.size() > 0){ if($form.size() > 0){
$form.submit(); $form.submit();
} }
} }
} }
} }
); );
return false; return false;
}); });
*/ */
}); });
})(jQuery); })(jQuery);

View File

@@ -6,6 +6,16 @@
// Collapse // Collapse
.no-js .collapse { display: block!important; } .no-js .collapse { display: block!important; }
// thumbnail
.thumbnail {
&.active,
&:active {
border-style: solid;
border-width: 2px;
}
&.active { border-color: @gray-light; }
}
// Layout // Layout
.main { margin-bottom: @line-height-computed; } .main { margin-bottom: @line-height-computed; }
.layout-col-1, .layout-col-1,

View File

@@ -9,11 +9,16 @@
// Availibility // Availibility
.availability { .availability {
display: block;
// In Stock // In Stock
&.in-stock {} .in-stock {
font-style: italic;
text-transform: uppercase;
}
// Out of Stock // Out of Stock
&.out-of-stock {} .out-of-stock {}
} }
@@ -61,11 +66,33 @@
margin-bottom: @line-height-computed; margin-bottom: @line-height-computed;
} }
.product-thumbnails { #product-thumbnails {
> ul { .carousel-inner {
margin: 0 auto;
width: 90%;
}
.carousel-control {
background-image: none;
display: none; // Need js
width: 4%; margin-top: -4px;
.icon-prev {
&:before {
.icon(@chevron-left);
}
}
.icon-next {
&:before {
.icon(@chevron-right);
}
}
}
ul {
.list-inline; .list-inline;
li { margin: 0;
width: 20%; > li {
margin: 0; padding: 0;
width: 19%;
} }
} }
} }
@@ -80,13 +107,12 @@
} }
.product-price { .product-price {
margin-bottom: @line-height-computed; margin-bottom: @line-height-computed;
.availability { }
.availibity-label { .sr-only; } .product-cart {
font-style: italic; background: @option-bg;
text-transform: uppercase; border: 1px solid @option-border;
position: absolute; border-radius: @option-border-radius;
right: 15px; margin-bottom: @line-height-computed; padding: @option-padding;
}
} }
} }

View File

@@ -5,7 +5,7 @@
@FontAwesomePath: "../font/fontawesome"; @FontAwesomePath: "../font/fontawesome";
//bootstrap font //bootstrap font
@icon-font-path: "../font/bootstrap/"; @icon-font-path: "../font/bootstrap/";
// Grid system // Grid system
@grid-float-breakpoint: @screen-desktop; @grid-float-breakpoint: @screen-desktop;
@@ -14,9 +14,9 @@
@legend-border-color: transparent; @legend-border-color: transparent;
// Buttons // Buttons
@btn-default-color: #333; @btn-default-color: #333;
@btn-default-bg: #f5f5f5; @btn-default-bg: #f5f5f5;
@btn-default-border: #ccc; @btn-default-border: #ccc;
@btn-primary-color: #fff; @btn-primary-color: #fff;
@btn-primary-bg: @brand-primary; @btn-primary-bg: @brand-primary;
@@ -74,14 +74,14 @@
@block-subheading-font-size: ceil(@font-size-base * 1.1); // 15.4px @block-subheading-font-size: ceil(@font-size-base * 1.1); // 15.4px
// Thelia : Block Links // Thelia : Block Links
@block-nav-bg: transparent; @block-nav-bg: transparent;
@block-nav-hover-bg: #f7f7f7; @block-nav-hover-bg: #f7f7f7;
@block-nav-border: #eee; @block-nav-border: #eee;
@block-nav-color: #747474; @block-nav-color: #747474;
// Thelia : Block Links // Thelia : Block Links
@block-links-bg: transparent; @block-links-bg: transparent;
@block-links-hover-bg: #f7f7f7; @block-links-hover-bg: darken(@body-bg, 8%);
@block-links-border: #fff; @block-links-border: #fff;
@block-links-color: #747474; @block-links-color: #747474;
@@ -112,25 +112,3 @@
@option-heading-border: darken(@body-bg, 12.5%); //#dfdfdf @option-heading-border: darken(@body-bg, 12.5%); //#dfdfdf
@option-heading-color: @text-color; @option-heading-color: @text-color;
@option-heading-font-size: @font-size-base; @option-heading-font-size: @font-size-base;
// Callout
@callout-bg: @body-bg;
@callout-border: #ddd;
@callout-text: @text-color;
@callout-success-text: @state-success-text;
@callout-success-border: @state-success-border;
@callout-success-bg: @state-success-bg;
@callout-warning-text: @state-warning-text;
@callout-warning-border: @state-warning-border;
@callout-warning-bg: @state-warning-bg;
@callout-danger-text: @state-danger-text;
@callout-danger-border: @state-danger-border;
@callout-danger-bg: @state-danger-bg;
@callout-info-text: @state-info-text;
@callout-info-border: @state-info-border;
@callout-info-bg: @state-info-bg;

View File

@@ -41,16 +41,6 @@ label { font-weight: 600; }
.box-shadow(none); .box-shadow(none);
} }
// thumbnail
.thumbnail {
&.active,
&:active {
border-style: solid;
border-width: 5px;
}
&.active { border-color: @gray-light; }
}
// Navbar // Navbar
.navbar { .navbar {
@@ -169,9 +159,9 @@ header {
font-weight: 600; font-weight: 600;
text-align: left; text-align: left;
text-shadow: none; text-shadow: none;
@media (min-width: @screen-desktop) { padding: 2px 15px 2px 5px; } @media (min-width: @screen-desktop) { padding: 2px 15px 2px 5px; }
&:hover, &:hover,
&:focus { &:focus {
background-color: @brand-primary; background-color: @brand-primary;
@@ -208,7 +198,7 @@ header {
font-weight: 600; font-weight: 600;
text-align: left; text-align: left;
text-shadow: none; text-shadow: none;
@media (min-width: @screen-desktop) { padding: 2px 15px 2px 5px; } @media (min-width: @screen-desktop) { padding: 2px 15px 2px 5px; }
&:hover, &:hover,
@@ -252,7 +242,7 @@ header {
// Products List // Products List
#category-products .btn-cart { #category-products .btn-cart {
.btn-secondary; .btn-secondary;
&:before { &:before {
content: @shopping-cart; content: @shopping-cart;
font-size: 1.3em; font-size: 1.3em;
@@ -335,6 +325,9 @@ td.product,
} }
} }
// Availibility
.availibity-label { .sr-only; }
.products-grid, .products-grid,
.products-list { .products-list {
@@ -600,6 +593,38 @@ td.product,
margin-bottom: 10px; margin-bottom: 10px;
} }
} }
.product-cart {
background-color: #f5f5f5!important;
margin-bottom: @line-height-computed; padding: 10px!important;
}
}
#product-thumbnails {
.carousel-control {
width: 17px!important;
&.left {
border-right: 7px solid #ccc;
color: #ccc;
text-align: left;
> .icon-prev {
left: 0; margin-left: 0; margin-top: -15px;
&:before {
color: inherit;
content: @caret-left!important;
}
}
}
&.right {
border-left: 7px solid #ccc;
text-align: right;
> .icon-next {
left: auto; right: 0; margin-left: 0; margin-top: -15px;
&:before {
content: @caret-right!important;
}
}
}
}
} }
@media (min-width: @screen-tablet) { @media (min-width: @screen-tablet) {
@@ -613,7 +638,13 @@ td.product,
// Product Details // Product Details
#product-details { #product-details {
.group-qty {
.form-control {
display: inline-block;
margin-right: 1em; margin-left: .4em;
width: 100px;
}
}
} }
} }
} }
@@ -896,7 +927,7 @@ td.product,
} }
// Add address button // Add address button
#account-address, #account-address,
#delivery-address { #delivery-address {
.btn-add-address { .btn-add-address {
.btn-link; .btn-link;
@@ -1021,7 +1052,7 @@ td.product,
margin-right: .3em; margin-right: .3em;
vertical-align: middle; vertical-align: middle;
} }
&:hover, &:hover,
&:focus { color: @link-hover-color; } &:focus { color: @link-hover-color; }
} }
@@ -1075,7 +1106,7 @@ td.product,
} }
.table-cart { .table-cart {
thead, thead,
tbody, tbody,
tfoot { tfoot {
@@ -1139,14 +1170,14 @@ td.product,
padding: 12px; padding: 12px;
text-align: left; text-align: left;
width: 100%; width: 100%;
&:hover, &:hover,
&:focus, &:focus,
&:active, &:active,
&.active { &.active {
background-color: @brand-primary; background-color: @brand-primary;
} }
&.disabled, &.disabled,
&[disabled] { &[disabled] {
&, &,
@@ -1158,7 +1189,7 @@ td.product,
} }
} }
} }
@media (min-width: @screen-tablet) { @media (min-width: @screen-tablet) {
.btn-step { .btn-step {
border-top: 0; border-top: 0;

View File

@@ -50,8 +50,8 @@
// Pager // Pager
@pager-border-radius: 0; @pager-border-radius: 0;
@pager-disabled-color: @gray-light; @pager-disabled-color: @gray-light;
// Navbar // Navbar

View File

@@ -40,7 +40,7 @@
<a href="{$URL}" itemprop="url" tabindex="-1" class="product-image"> <a href="{$URL}" itemprop="url" tabindex="-1" class="product-image">
{ifloop rel="image_product_new" } {ifloop rel="image_product_new" }
<img itemprop="image" <img itemprop="image"
{loop name="image_product_new" type="image" limit="1" product="{$ID}"} {loop name="image_product_new" type="image" limit="1" product="{$ID}" force_return="1" width="280" height="196" resize_mode="crop"}
src="{$IMAGE_URL}" src="{$IMAGE_URL}"
{/loop} {/loop}
alt="Product #{$LOOP_COUNT}" > alt="Product #{$LOOP_COUNT}" >
@@ -99,7 +99,7 @@
<a href="{$URL}" itemprop="url" tabindex="-1" class="product-image"> <a href="{$URL}" itemprop="url" tabindex="-1" class="product-image">
{ifloop rel="image_product_promo" } {ifloop rel="image_product_promo" }
<img itemprop="image" <img itemprop="image"
{loop name="image_product_promo" type="image" limit="1" product="{$ID}"} {loop name="image_product_promo" type="image" limit="1" product="{$ID}" force_return="1" width="218" height="146" resize_mode="crop"}
src="{$IMAGE_URL}" src="{$IMAGE_URL}"
{/loop} {/loop}
alt="Product #{$LOOP_COUNT}" > alt="Product #{$LOOP_COUNT}" >

View File

@@ -95,7 +95,7 @@ URL: http://www.thelia.net
{/elseloop} {/elseloop}
<li class="dropdown"> <li class="dropdown">
<a href="cart.html" class="dropdown-toggle cart" data-toggle="dropdown"> <a href="cart.html" class="dropdown-toggle cart" data-toggle="dropdown">
Cart <span class="badge">2</span> Cart <span class="badge">{cart attr="count_item"}</span>
</a> </a>
</li> </li>
</ul> </ul>

View File

@@ -0,0 +1,202 @@
{extends file="layout.tpl"}
{block name="breadcrumb"}
<nav class="nav-breadcrumb" role="navigation" aria-labelledby="breadcrumb-label">
<strong id="breadcrumb-label">You are here: </strong>
<ul class="breadcrumb" itemprop="breadcrumb">
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="index.php" itemprop="url"><span itemprop="title">Home</span></a></li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="category.php" itemprop="url"><span itemprop="title">Category 1</span></a></li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="category.php" itemprop="url"><span itemprop="title">Category 1.2</span></a></li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="active"><span itemprop="title">Product name</span></li>
</ul>
</nav><!-- /.nav-breadcrumb -->
{/block}
{block name="main-content"}
<div class="main">
{loop name="product.details" type="product" id="{product attr="id"}"}
<article id="product" class="col-main" role="main" itemscope itemtype="http://schema.org/Product">
<!-- Use the meta tag to specify content that is not visible on the page in any way -->
<meta itemprop="brand" content="Diesel">
<meta itemprop="productID" content="isbn:925872">
<section id="product-gallery">
<figure class="product-image">
{loop type="image" name="image.main" product="{$ID}" width="560" height="445" resize_mode="crop" limit="1" force_result="1"}
<img src="{$IMAGE_URL}" alt="{$TITLE}" class="img-responsive" itemprop="image" data-toggle="magnify">
{/loop}
</figure>
<div id="product-thumbnails" class="slide" style="position:relative;">
<div class="carousel-inner">
<div class="item active">
<ul>
{loop name="image.carousel" type="image" product="{$ID}" width="560" height="445" resize_mode="crop" limit="5" force_result="1"}
<li>
<a href="{$IMAGE_URL}" class="thumbnail {if $LOOP_COUNT == 1}active{/if}">
{loop type="image" name="image.thumbs" id="{$ID}" product="$OBJECT_ID" width="118" height="85" resize_mode="crop" force_result="1"}
<img src="{$IMAGE_URL}" alt="{$TITLE}">
{/loop}
</a>
</li>
{/loop}
</ul>
</div>
{ifloop rel="image.carouselsup"}
<div class="item">
<ul>
{loop name="image.carouselsup" type="image" product="{$ID}" width="560" height="445" resize_mode="crop" offset="5" force_result="1"}
<li>
<a href="{$IMAGE_URL}" class="thumbnail">
{loop type="image" name="image.thumbssup" id="{$ID}" product="$OBJECT_ID" width="118" height="85" resize_mode="crop" force_result="1"}
<img src="{$IMAGE_URL}" alt="{$TITLE}">
{/loop}
</a>
</li>
{/loop}
</ul>
</div>
{/ifloop}
</div>
{ifloop rel="image.carouselsup"}
<a class="left carousel-control" href="#product-thumbnails" data-slide="prev"><i class="icon-prev"></i></a>
<a class="right carousel-contol" href="#product-thumbnails" data-slide="next"><i class="icon-next"></i></a>
{/ifloop}
</div>
</section>
<section id="product-details">
<div class="product-info">
<h1 class="name"><span itemprop="name">{$TITLE}</span></h1>
<span itemprop="sku" class="sku">{intl l='Ref.'}: {$REF}</span>
<div class="short-description">
<p>{$POSTSCRIPTUM}</p>
</div>
</div>
<div class="product-price" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<div class="availability"><span class="availibity-label">{intl l="Availability"}: </span><span itemprop="availability" href="http://schema.org/InStock" class="in-stock">In stock</span></div>
<div class="price-container">
<meta itemprop="category" content="Category1">
<meta itemprop="itemCondition" itemscope itemtype="http://schema.org/NewCondition"> <!-- List of condition : NewCondition, DamagedCondition, UsedCondition, RefurbishedCondition -->
<meta itemprop="priceCurrency" content="USD"> <!-- List of currency : The currency used to describe the product price, in three-letter ISO format. -->
<link itemprop="availability" href="http://schema.org/InStock" content="in_stock" />
<!-- List of availibility :
out_of_stock : http://schema.org/OutOfStock
in_stock : http://schema.org/InStock
instore_only : http://schema.org/InStoreOnly
preorder : http://schema.org/PreOrder
online_only : http://schema.org/OnlineOnly
-->
{if $IS_PROMO }
{loop name="productSaleElements_promo" type="product_sale_elements" product="{$ID}" limit="1"}
{assign var="default_product_sale_elements" value="$ID"}
<span class="special-price"><span itemprop="price" class="price-label">{intl l="Special Price:"} </span><span class="price">{format_number number="{$TAXED_PROMO_PRICE}"} {currency attr="symbol"}</span></span>
<span class="old-price"><span class="price-label">{intl l="Regular Price:"} </span><span class="price">{format_number number="{$TAXED_PRICE}"} {currency attr="symbol"}</span></span>
{/loop}
{else}
<span class="special-price"><span itemprop="price" class="price-label">{intl l="Special Price:"} </span><span class="price">{format_number number="{$BEST_TAXED_PRICE}"} {currency attr="symbol"}</span></span>
{/if}
</div>
</div>
{form name="thelia.cart.add" }
<form id="form-product-details" action="{url path="/cart/add" }" method="post" role="form">
{form_hidden_fields form=$form}
<input type="hidden" name="view" value="product">
<input type="hidden" name="product_id" value="{$ID}">
{if $form_error}<div class="alert alert-error">{$form_error_message}</div>{/if}
{form_field form=$form field='product_sale_elements_id'}
{if $default_product_sale_elements }
<input type="hidden" name="{$name}" value="{$default_product_sale_elements}" {$attr}>
{else}
{loop name="productSaleElements_promo" type="product_sale_elements" product="{$ID}" limit="1"}
<input type="hidden" name="{$name}" value="{$ID}" {$attr}>
{/loop}
{/if}
{/form_field}
{form_field form=$form field="product"}
<input id="{$label_attr.for}" type="hidden" name="{$name}" value="{$ID}" {$attr} >
{/form_field}
<fieldset class="product-options">
<div class="option option-color">
<label for="option-color" class="option-heading">Show</label>
<div class="option-content">
<select id="option-color" name="option-color" class="form-control">
<option value="0">Blue</option>
<option value="1">Red</option>
<option value="2">Purple</option>
</select>
</div>
</div>
<div class="option option-size">
<fieldset>
<legend class="option-heading">Size</legend>
<div class="option-content">
<label class="checkbox-inline" for="size1">
<input type="checkbox" name="size1" id="size1" value="1"> Large
</label>
<label class="checkbox-inline" for="size2">
<input type="checkbox" name="size2" id="size2" value="2"> Medium
</label>
<label class="checkbox-inline" for="size3">
<input type="checkbox" name="size3" id="size3" value="3"> Small
</label>
</div>
</fieldset>
</div>
</fieldset>
<fieldset class="product-cart form-inline">
{form_field form=$form field='quantity'}
<div class="form-group group-qty {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label for="{$label_attr.for}">{$label}</label>
<input type="number" name="{$name}" id="{$label_attr.for}" class="form-control" value="{$value|default:1}" min="0" required>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
{/form_field}
<div class="form-group group-btn">
<button type="submit" class="btn btn_add_to_cart">{intl l="Add to cart"}</button>
</div>
</fieldset>
</form>
{/form}
</section>
<section id="product-tabs">
<ul class="nav nav-tabs" role="tablist">
<li class="active" role="presentation"><a id="tab1" href="#description" data-toggle="tab" role="tab">{intl l="Description"}</a></li>
<li role="presentation"><a id="tab2" href="#additional" data-toggle="tab" role="tab">{intl l="Additional Info"}</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active in" id="description" itemprop="description" role="tabpanel" aria-labelledby="tab1">
<p>{$DESCRIPTION}</p>
</div>
<div class="tab-pane" id="additional" role="tabpanel" aria-labelledby="tab2">
<p>Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.</p>
</div>
</div>
</section>
</article><!-- /product -->
{/loop}
<ul class="pager">
<li class="previous"><a href="#">Previous product</a></li>
<li class="next"><a href="#">Next product</a></li>
</ul
></div>
</div><!-- /.container -->
{/block}