Merge branch 'master' of https://github.com/thelia/thelia
This commit is contained in:
@@ -227,7 +227,7 @@ class BaseAdminController extends BaseController
|
||||
*
|
||||
* @see \Thelia\Controller\BaseController::getRouteFromRouter()
|
||||
*/
|
||||
protected function getRoute($routeId, $parameters = array(), $referenceType = Router::RELATIVE_PATH)
|
||||
protected function getRoute($routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_URL)
|
||||
{
|
||||
return $this->getRouteFromRouter(
|
||||
'router.admin',
|
||||
|
||||
@@ -235,7 +235,7 @@ class BaseController extends ContainerAware
|
||||
* @throws \InvalidArgumentException When the router doesn't exist
|
||||
* @return string The generated URL
|
||||
*/
|
||||
protected function getRouteFromRouter($routerName, $routeId, $parameters = array(), $referenceType = Router::RELATIVE_PATH)
|
||||
protected function getRouteFromRouter($routerName, $routeId, $parameters = array(), $referenceType = Router::ABSOLUTE_URL)
|
||||
{
|
||||
/** @var Router $router */
|
||||
$router = $this->container->get($routerName);
|
||||
|
||||
@@ -34,6 +34,7 @@ use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Model\Base\ProductSaleElementsQuery;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Thelia\Model\Map\ProductSaleElementsTableMap;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
|
||||
@@ -41,7 +42,7 @@ use Thelia\Type;
|
||||
*
|
||||
* Product Sale Elements loop
|
||||
*
|
||||
* @todo : manage currency and attribute_availability
|
||||
* @todo : manage attribute_availability ?
|
||||
*
|
||||
* Class ProductSaleElements
|
||||
* @package Thelia\Core\Template\Loop
|
||||
@@ -68,9 +69,9 @@ class ProductSaleElements extends BaseLoop
|
||||
new Argument(
|
||||
'order',
|
||||
new TypeCollection(
|
||||
new Type\EnumListType(array('alpha', 'alpha_reverse', 'attribute', 'attribute_reverse'))
|
||||
new Type\EnumListType(array('min_price', 'max_price', 'promo', 'new', 'random'))
|
||||
),
|
||||
'attribute'
|
||||
'random'
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -94,16 +95,16 @@ class ProductSaleElements extends BaseLoop
|
||||
foreach ($orders as $order) {
|
||||
switch ($order) {
|
||||
case "min_price":
|
||||
$search->addAscendingOrderByColumn('real_lowest_price', Criteria::ASC);
|
||||
$search->addAscendingOrderByColumn('price_FINAL_PRICE', Criteria::ASC);
|
||||
break;
|
||||
case "max_price":
|
||||
$search->addDescendingOrderByColumn('real_lowest_price');
|
||||
$search->addDescendingOrderByColumn('price_FINAL_PRICE');
|
||||
break;
|
||||
case "promo":
|
||||
$search->addDescendingOrderByColumn('main_product_is_promo');
|
||||
$search->orderByPromo(Criteria::DESC);
|
||||
break;
|
||||
case "new":
|
||||
$search->addDescendingOrderByColumn('main_product_is_new');
|
||||
$search->orderByNewness(Criteria::DESC);
|
||||
break;
|
||||
case "random":
|
||||
$search->clearOrderByColumns();
|
||||
@@ -125,12 +126,22 @@ class ProductSaleElements extends BaseLoop
|
||||
$defaultCurrency = CurrencyQuery::create()->findOneByByDefault(1);
|
||||
$defaultCurrencySuffix = '_default_currency';
|
||||
|
||||
$search->joinProductPrice('price', Criteria::INNER_JOIN);
|
||||
//->addJoinCondition('price', '');
|
||||
$search->joinProductPrice('price', Criteria::LEFT_JOIN)
|
||||
->addJoinCondition('price', '`price`.`currency_id` = ?', $currency->getId(), null, \PDO::PARAM_INT);
|
||||
|
||||
$search->withColumn('`price`.CURRENCY_ID', 'price_CURRENCY_ID')
|
||||
->withColumn('`price`.PRICE', 'price_PRICE')
|
||||
->withColumn('`price`.PROMO_PRICE', 'price_PROMO_PRICE');
|
||||
$search->joinProductPrice('price' . $defaultCurrencySuffix, Criteria::LEFT_JOIN)
|
||||
->addJoinCondition('price_default_currency', '`price' . $defaultCurrencySuffix . '`.`currency_id` = ?', $defaultCurrency->getId(), null, \PDO::PARAM_INT);
|
||||
|
||||
/**
|
||||
* rate value is checked as a float in overloaded getRate method.
|
||||
*/
|
||||
$priceSelectorAsSQL = 'ROUND(CASE WHEN ISNULL(`price`.PRICE) THEN `price_default_currency`.PRICE * ' . $currency->getRate() . ' ELSE `price`.PRICE END, 2)';
|
||||
$promoPriceSelectorAsSQL = 'ROUND(CASE WHEN ISNULL(`price`.PRICE) THEN `price_default_currency`.PROMO_PRICE * ' . $currency->getRate() . ' ELSE `price`.PROMO_PRICE END, 2)';
|
||||
$search->withColumn($priceSelectorAsSQL, 'price_PRICE')
|
||||
->withColumn($promoPriceSelectorAsSQL, 'price_PROMO_PRICE')
|
||||
->withColumn('CASE WHEN ' . ProductSaleElementsTableMap::PROMO . ' = 1 THEN ' . $promoPriceSelectorAsSQL . ' ELSE ' . $priceSelectorAsSQL . ' END', 'price_FINAL_PRICE');
|
||||
|
||||
$search->groupById();
|
||||
|
||||
$PSEValues = $this->search($search, $pagination);
|
||||
|
||||
@@ -153,8 +164,6 @@ class ProductSaleElements extends BaseLoop
|
||||
->set("IS_PROMO", $PSEValue->getPromo() === 1 ? 1 : 0)
|
||||
->set("IS_NEW", $PSEValue->getNewness() === 1 ? 1 : 0)
|
||||
->set("WEIGHT", $PSEValue->getWeight())
|
||||
|
||||
->set("CURRENCY", $PSEValue->getVirtualColumn('price_CURRENCY_ID'))
|
||||
->set("PRICE", $price)
|
||||
->set("PRICE_TAX", $taxedPrice - $price)
|
||||
->set("TAXED_PRICE", $taxedPrice)
|
||||
|
||||
@@ -83,7 +83,7 @@ class Thelia extends Kernel
|
||||
$con = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
|
||||
$con->setAttribute(ConnectionWrapper::PROPEL_ATTR_CACHE_PREPARES, true);
|
||||
if ($this->isDebug()) {
|
||||
|
||||
//$serviceContainer->setLogger('defaultLogger', \Thelia\Log\Tlog::getInstance());
|
||||
$con->useDebug(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,6 @@ class URL
|
||||
|
||||
$schemeAuthority = "$scheme://$host"."$port";
|
||||
}
|
||||
|
||||
return $schemeAuthority.$this->requestContext->getBaseUrl();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
{*include file="includes/header.html"*}
|
||||
|
||||
Here you are : {navigate to="current"}<br />
|
||||
From : {navigate to="return_to"}<br />
|
||||
Index : {navigate to="index"}<br />
|
||||
@@ -60,7 +62,7 @@ Index : {navigate to="index"}<br />
|
||||
<h4>Product sale elements</h4>
|
||||
|
||||
{assign var=current_product value=$ID}
|
||||
{loop name="pse" type="product_sale_elements" product="$ID"}
|
||||
{loop name="pse" type="product_sale_elements" product="$ID" order="promo,min_price"}
|
||||
<div style="border: solid 2px darkorange; padding: 5px; margin: 5px;">
|
||||
{loop name="combi" type="attribute_combination" product_sale_elements="$ID"}
|
||||
{$ATTRIBUTE_TITLE} = {$ATTRIBUTE_AVAILABILITY_TITLE}<br />
|
||||
@@ -87,4 +89,6 @@ Index : {navigate to="index"}<br />
|
||||
|
||||
{elseloop rel="product"}
|
||||
<h2>Produit introuvable !</h2>
|
||||
{/elseloop}
|
||||
{/elseloop}
|
||||
|
||||
{*include file="includes/footer.html"*}
|
||||
Reference in New Issue
Block a user