Merge branch 'master' of https://github.com/thelia/thelia
This commit is contained in:
@@ -32,6 +32,8 @@ use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Exception\TheliaProcessException;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\MessageQuery;
|
||||
use Thelia\Model\OrderProductAttributeCombination;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Thelia\Model\OrderProduct;
|
||||
@@ -291,7 +293,48 @@ class Order extends BaseAction implements EventSubscriberInterface
|
||||
*/
|
||||
public function sendOrderEmail(OrderEvent $event)
|
||||
{
|
||||
/* @todo */
|
||||
$order = $event->getOrder();
|
||||
$customer = $order->getCustomer();
|
||||
|
||||
$parser = $this->container->get("thelia.parser");
|
||||
|
||||
$parser->assign('order_id', $order->getId());
|
||||
$parser->assign('order_ref', $order->getRef());
|
||||
|
||||
$message = MessageQuery::create()
|
||||
->filterByName('order_confirmation')
|
||||
->findOne();
|
||||
|
||||
$message
|
||||
->setLocale($order->getLang()->getLocale());
|
||||
|
||||
$subject = $parser->fetch(sprintf("string:%s", $message->getSubject()));
|
||||
$htmlMessage = $parser->fetch(sprintf("string:%s", $message->getHtmlMessage()));
|
||||
$textMessage = $parser->fetch(sprintf("string:%s", $message->getTextMessage()));
|
||||
|
||||
$instance = \Swift_Message::newInstance($subject)
|
||||
->addTo($customer->getEmail(), $customer->getFirstname()." ".$customer->getLastname())
|
||||
->addFrom(ConfigQuery::read('contact_email'), ConfigQuery::read('company_name'))
|
||||
;
|
||||
$instance
|
||||
->setBody($htmlMessage, 'text/html')
|
||||
->addPart($textMessage, 'text/plain');
|
||||
|
||||
$mail = $this->getMailer()->send($instance);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* return an instance of \Swift_Mailer with good Transporter configured.
|
||||
*
|
||||
* @return \Swift_Mailer
|
||||
*/
|
||||
public function getMailer()
|
||||
{
|
||||
$mailer = $this->container->get('mailer');
|
||||
|
||||
return $mailer->getSwiftMailer();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
<requirement key="order_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="admin.order.pdf.invoice" path="/admin/order/pdf/delivery/{order_id}">
|
||||
<route id="admin.order.pdf.delivery" path="/admin/order/pdf/delivery/{order_id}">
|
||||
<default key="_controller">Thelia\Controller\Admin\OrderController::generateDeliveryPdf</default>
|
||||
<requirement key="order_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
@@ -95,6 +95,11 @@
|
||||
<!-- end customer address routes -->
|
||||
|
||||
<!-- cart routes -->
|
||||
<route id="cart.view" path="/cart">
|
||||
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
|
||||
<default key="_view">cart</default>
|
||||
</route>
|
||||
|
||||
<route id="cart.add.process" path="/cart/add">
|
||||
<default key="_controller">Thelia\Controller\Front\CartController::addItem</default>
|
||||
</route>
|
||||
|
||||
@@ -30,7 +30,7 @@ use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Customer\CustomerEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\CustomerModification;
|
||||
use Thelia\Form\CustomerUpdateForm;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
@@ -68,7 +68,7 @@ class CustomerController extends BaseAdminController
|
||||
|
||||
$message = false;
|
||||
|
||||
$customerModification = new CustomerModification($this->getRequest());
|
||||
$customerUpdateForm = new CustomerUpdateForm($this->getRequest());
|
||||
|
||||
try {
|
||||
$customer = CustomerQuery::create()->findPk($customer_id);
|
||||
@@ -77,7 +77,7 @@ class CustomerController extends BaseAdminController
|
||||
throw new \InvalidArgumentException(sprintf("%d customer id does not exist", $customer_id));
|
||||
}
|
||||
|
||||
$form = $this->validateForm($customerModification);
|
||||
$form = $this->validateForm($customerUpdateForm);
|
||||
|
||||
$event = $this->createEventInstance($form->getData());
|
||||
$event->setCustomer($customer);
|
||||
@@ -91,7 +91,7 @@ class CustomerController extends BaseAdminController
|
||||
if ($this->getRequest()->get("save_mode") == "close") {
|
||||
$this->redirectToRoute("admin.customers");
|
||||
} else {
|
||||
$this->redirectSuccess($customerModification);
|
||||
$this->redirectSuccess($customerUpdateForm);
|
||||
}
|
||||
|
||||
} catch (FormValidationException $e) {
|
||||
@@ -105,10 +105,10 @@ class CustomerController extends BaseAdminController
|
||||
if ($message !== false) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error during customer login process : %s.", $message));
|
||||
|
||||
$customerModification->setErrorMessage($message);
|
||||
$customerUpdateForm->setErrorMessage($message);
|
||||
|
||||
$this->getParserContext()
|
||||
->addForm($customerModification)
|
||||
->addForm($customerUpdateForm)
|
||||
->setGeneralError($message)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -45,10 +45,8 @@ class MessageController extends AbstractCrudController
|
||||
null, // no sort order change
|
||||
null, // no sort order change
|
||||
|
||||
AdminResources::MESSAGE_VIEW,
|
||||
AdminResources::MESSAGE_CREATE,
|
||||
AdminResources::MESSAGE_UPDATE,
|
||||
AdminResources::MESSAGE_DELETE,
|
||||
AdminResources::MESSAGE,
|
||||
|
||||
|
||||
TheliaEvents::MESSAGE_CREATE,
|
||||
TheliaEvents::MESSAGE_UPDATE,
|
||||
|
||||
@@ -101,7 +101,7 @@ class AddressController extends BaseFrontController
|
||||
$address = AddressQuery::create()->findPk($address_id);
|
||||
|
||||
if (!$address || $customer->getId() != $address->getCustomerId()) {
|
||||
$this->redirectToRoute("home");
|
||||
$this->redirectToRoute('default');
|
||||
}
|
||||
|
||||
$this->getParserContext()->set("address_id", $address_id);
|
||||
@@ -122,11 +122,11 @@ class AddressController extends BaseFrontController
|
||||
$address = AddressQuery::create()->findPk($address_id);
|
||||
|
||||
if (null === $address) {
|
||||
$this->redirectToRoute("home");
|
||||
$this->redirectToRoute('default');
|
||||
}
|
||||
|
||||
if ($address->getCustomer()->getId() != $customer->getId()) {
|
||||
$this->redirectToRoute("home");
|
||||
$this->redirectToRoute('default');
|
||||
}
|
||||
|
||||
$event = $this->createAddressEvent($form);
|
||||
@@ -161,12 +161,12 @@ class AddressController extends BaseFrontController
|
||||
$address = AddressQuery::create()->findPk($address_id);
|
||||
|
||||
if (!$address || $customer->getId() != $address->getCustomerId()) {
|
||||
$this->redirectToRoute("home");
|
||||
$this->redirectToRoute('default');
|
||||
}
|
||||
|
||||
$this->dispatch(TheliaEvents::ADDRESS_DELETE, new AddressEvent($address));
|
||||
|
||||
$this->redirectToRoute("customer.account.view");
|
||||
$this->redirectToRoute('default', array('view'=>'account'));
|
||||
}
|
||||
|
||||
protected function createAddressEvent($form)
|
||||
|
||||
@@ -56,7 +56,7 @@ class BaseFrontController extends BaseController
|
||||
public function checkAuth()
|
||||
{
|
||||
if ($this->getSecurityContext()->hasCustomerUser() === false) {
|
||||
$this->redirectToRoute("customer.login.view");
|
||||
$this->redirectToRoute('default', array('view'=>'login'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class BaseFrontController extends BaseController
|
||||
{
|
||||
$cart = $this->getSession()->getCart();
|
||||
if ($cart===null || $cart->countCartItems() == 0) {
|
||||
$this->redirectToRoute("cart.view");
|
||||
$this->redirectToRoute('cart.view');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ class CustomerController extends BaseFrontController
|
||||
|
||||
$cart = $this->getCart($this->getRequest());
|
||||
if ($cart->getCartItems()->count() > 0) {
|
||||
$this->redirectToRoute("cart.view");
|
||||
$this->redirectToRoute('cart.view');
|
||||
} else {
|
||||
$this->redirectSuccess($customerCreation);
|
||||
}
|
||||
@@ -278,7 +278,7 @@ class CustomerController extends BaseFrontController
|
||||
|
||||
// If User is a new customer
|
||||
if ($form->get('account')->getData() == 0 && !$form->get("email")->getErrors()) {
|
||||
$this->redirectToRoute("customer.create.view", array("email" => $form->get("email")->getData()));
|
||||
$this->redirectToRoute("default", array("view" => "register","email" => $form->get("email")->getData()));
|
||||
} else {
|
||||
|
||||
try {
|
||||
|
||||
@@ -197,7 +197,7 @@ class OrderController extends BaseFrontController
|
||||
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute('order.placed', array('order_id' => $orderEvent->getPlacedOrder()->getId()))));
|
||||
} else {
|
||||
/* order has not been placed */
|
||||
$this->redirectToRoute("cart.view");
|
||||
$this->redirectToRoute('cart.view');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,13 +84,13 @@ class ViewListener implements EventSubscriberInterface
|
||||
$response = new Response($content, $parser->getStatus() ?: 200);
|
||||
}
|
||||
|
||||
$response->setCache(array(
|
||||
/* $response->setCache(array(
|
||||
'last_modified' => new \DateTime(),
|
||||
'max_age' => 600,
|
||||
's_maxage' => 600,
|
||||
'private' => false,
|
||||
'public' => true,
|
||||
));
|
||||
));*/
|
||||
|
||||
$event->setResponse($response);
|
||||
} catch (ResourceNotFoundException $e) {
|
||||
|
||||
@@ -23,12 +23,18 @@
|
||||
|
||||
namespace Thelia\Core\Template\Element;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Thelia\Core\Template\Element\Exception\SearchLoopException;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
use Thelia\Type\AlphaNumStringListType;
|
||||
use Thelia\Type\EnumListType;
|
||||
use Thelia\Type\EnumType;
|
||||
use Thelia\Type\TypeCollection;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -84,13 +90,43 @@ abstract class BaseLoop
|
||||
*/
|
||||
protected function getDefaultArgs()
|
||||
{
|
||||
return array(
|
||||
Argument::createIntTypeArgument('offset', 0),
|
||||
Argument::createIntTypeArgument('page'),
|
||||
Argument::createIntTypeArgument('limit', PHP_INT_MAX),
|
||||
$defaultArgs = array(
|
||||
Argument::createBooleanTypeArgument('backend_context', false),
|
||||
Argument::createBooleanTypeArgument('force_return', false),
|
||||
);
|
||||
|
||||
if(true === $this->countable) {
|
||||
$defaultArgs = array_merge($defaultArgs, array(
|
||||
Argument::createIntTypeArgument('offset', 0),
|
||||
Argument::createIntTypeArgument('page'),
|
||||
Argument::createIntTypeArgument('limit', PHP_INT_MAX),
|
||||
));
|
||||
}
|
||||
|
||||
if($this instanceof SearchLoopInterface) {
|
||||
$defaultArgs = array_merge($defaultArgs, array(
|
||||
Argument::createAnyTypeArgument('search_term'),
|
||||
new Argument(
|
||||
'search_in',
|
||||
new TypeCollection(
|
||||
new EnumListType($this->getSearchIn())
|
||||
)
|
||||
),
|
||||
new Argument(
|
||||
'search_mode',
|
||||
new TypeCollection(
|
||||
new EnumType(array(
|
||||
SearchLoopInterface::MODE_ANY_WORD,
|
||||
SearchLoopInterface::MODE_SENTENCE,
|
||||
SearchLoopInterface::MODE_STRICT_SENTENCE,
|
||||
))
|
||||
),
|
||||
SearchLoopInterface::MODE_STRICT_SENTENCE
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
return $defaultArgs;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,6 +241,30 @@ abstract class BaseLoop
|
||||
*/
|
||||
protected function search(ModelCriteria $search, &$pagination = null)
|
||||
{
|
||||
if($this instanceof SearchLoopInterface) {
|
||||
$searchTerm = $this->getSearch_term();
|
||||
$searchIn = $this->getSearch_in();
|
||||
$searchMode = $this->getSearch_mode();
|
||||
if(null !== $searchTerm && null !== $searchIn) {
|
||||
|
||||
switch($searchMode) {
|
||||
case SearchLoopInterface::MODE_ANY_WORD:
|
||||
$searchCriteria = Criteria::IN;
|
||||
$searchTerm = explode(' ', $searchTerm);
|
||||
break;
|
||||
case SearchLoopInterface::MODE_SENTENCE:
|
||||
$searchCriteria = Criteria::LIKE;
|
||||
$searchTerm = '%' . $searchTerm . '%';
|
||||
break;
|
||||
case SearchLoopInterface::MODE_STRICT_SENTENCE:
|
||||
$searchCriteria = Criteria::EQUAL;
|
||||
break;
|
||||
}
|
||||
|
||||
$this->doSearch($search, $searchTerm, $searchIn, $searchCriteria);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->getArgValue('page') !== null) {
|
||||
return $this->searchWithPagination($search, $pagination);
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Template\Element\Exception;
|
||||
|
||||
class SearchLoopException extends \RuntimeException
|
||||
{
|
||||
const UNKNOWN_EXCEPTION = 0;
|
||||
|
||||
public function __construct($message, $code = null, $arguments = array(), $previous = null)
|
||||
{
|
||||
if (is_array($arguments)) {
|
||||
$this->arguments = $arguments;
|
||||
}
|
||||
if ($code === null) {
|
||||
$code = self::UNKNOWN_EXCEPTION;
|
||||
}
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Core\Template\Element;
|
||||
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
interface SearchLoopInterface
|
||||
{
|
||||
const MODE_ANY_WORD = 'any_word';
|
||||
const MODE_SENTENCE = 'sentence';
|
||||
const MODE_STRICT_SENTENCE = 'strict_sentence';
|
||||
|
||||
/**
|
||||
* @return array of available field to search in
|
||||
*/
|
||||
public function getSearchIn();
|
||||
|
||||
public function doSearch(&$search, $searchTerm, $searchIn, $searchCriteria);
|
||||
}
|
||||
@@ -28,6 +28,7 @@ use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
use Thelia\Core\Template\Element\SearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
@@ -44,7 +45,7 @@ use Thelia\Type;
|
||||
* @package Thelia\Core\Template\Loop
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class Customer extends BaseLoop
|
||||
class Customer extends BaseLoop implements SearchLoopInterface
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
@@ -67,6 +68,47 @@ class Customer extends BaseLoop
|
||||
);
|
||||
}
|
||||
|
||||
public function getSearchIn()
|
||||
{
|
||||
return array(
|
||||
"ref",
|
||||
"firstname",
|
||||
"lastname",
|
||||
"email",
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CustomerQuery $search
|
||||
* @param $searchTerm
|
||||
* @param $searchIn
|
||||
* @param $searchCriteria
|
||||
*/
|
||||
public function doSearch(&$search, $searchTerm, $searchIn, $searchCriteria)
|
||||
{
|
||||
|
||||
$search->_and();
|
||||
foreach($searchIn as $index => $searchInElement) {
|
||||
if($index > 0) {
|
||||
$search->_or();
|
||||
}
|
||||
switch($searchInElement) {
|
||||
case "ref":
|
||||
$search->filterByRef($searchTerm, $searchCriteria);
|
||||
break;
|
||||
case "firstname":
|
||||
$search->filterByFirstname($searchTerm, $searchCriteria);
|
||||
break;
|
||||
case "lastname":
|
||||
$search->filterByLastname($searchTerm, $searchCriteria);
|
||||
break;
|
||||
case "email":
|
||||
$search->filterByEmail($searchTerm, $searchCriteria);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $pagination
|
||||
*
|
||||
|
||||
@@ -28,8 +28,12 @@ use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Element\SearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
use Thelia\Model\OrderAddress;
|
||||
use Thelia\Model\OrderAddressQuery;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
@@ -38,8 +42,9 @@ use Thelia\Type;
|
||||
* @package Thelia\Core\Template\Loop
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class Order extends BaseLoop
|
||||
class Order extends BaseLoop implements SearchLoopInterface
|
||||
{
|
||||
public $countable = true;
|
||||
public $timestampable = true;
|
||||
@@ -74,6 +79,59 @@ class Order extends BaseLoop
|
||||
);
|
||||
}
|
||||
|
||||
public function getSearchIn()
|
||||
{
|
||||
return array(
|
||||
"ref",
|
||||
"customer_ref",
|
||||
"customer_firstname",
|
||||
"customer_lastname",
|
||||
"customer_email",
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OrderQuery $search
|
||||
* @param $searchTerm
|
||||
* @param $searchIn
|
||||
* @param $searchCriteria
|
||||
*/
|
||||
public function doSearch(&$search, $searchTerm, $searchIn, $searchCriteria)
|
||||
{
|
||||
|
||||
$search->_and();
|
||||
foreach($searchIn as $index => $searchInElement) {
|
||||
if($index > 0) {
|
||||
$search->_or();
|
||||
}
|
||||
switch($searchInElement) {
|
||||
case "ref":
|
||||
$search->filterByRef($searchTerm, $searchCriteria);
|
||||
break;
|
||||
case "customer_ref":
|
||||
$search->filterByCustomer(
|
||||
CustomerQuery::create()->filterByRef($searchTerm, $searchCriteria)->find()
|
||||
);
|
||||
break;
|
||||
case "customer_firstname":
|
||||
$search->filterByOrderAddressRelatedByInvoiceOrderAddressId(
|
||||
OrderAddressQuery::create()->filterByFirstname($searchTerm, $searchCriteria)->find()
|
||||
);
|
||||
break;
|
||||
case "customer_lastname":
|
||||
$search->filterByOrderAddressRelatedByInvoiceOrderAddressId(
|
||||
OrderAddressQuery::create()->filterByLastname($searchTerm, $searchCriteria)->find()
|
||||
);
|
||||
break;
|
||||
case "customer_email":
|
||||
$search->filterByCustomer(
|
||||
CustomerQuery::create()->filterByEmail($searchTerm, $searchCriteria)->find()
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $pagination
|
||||
*
|
||||
|
||||
@@ -26,36 +26,35 @@ namespace Thelia\Core\Template\Loop;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\Join;
|
||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
use Thelia\Core\Template\Element\SearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Exception\TaxEngineException;
|
||||
use Thelia\Model\Base\ProductSaleElementsQuery;
|
||||
use Thelia\Model\CategoryQuery;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Thelia\Model\Map\ProductPriceTableMap;
|
||||
use Thelia\Model\Map\ProductSaleElementsTableMap;
|
||||
use Thelia\Model\Map\ProductTableMap;
|
||||
use Thelia\Model\ProductCategoryQuery;
|
||||
use Thelia\Model\ProductQuery;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Type\TypeCollection;
|
||||
use Thelia\Type;
|
||||
use Thelia\Type\BooleanOrBothType;
|
||||
|
||||
/**
|
||||
*
|
||||
* Product loop
|
||||
*
|
||||
*
|
||||
* Class Product
|
||||
* @package Thelia\Core\Template\Loop
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class Product extends BaseI18nLoop
|
||||
class Product extends BaseI18nLoop implements SearchLoopInterface
|
||||
{
|
||||
public $timestampable = true;
|
||||
public $versionable = true;
|
||||
@@ -66,6 +65,7 @@ class Product extends BaseI18nLoop
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createBooleanTypeArgument('complex', false),
|
||||
Argument::createIntListTypeArgument('id'),
|
||||
new Argument(
|
||||
'ref',
|
||||
@@ -130,6 +130,39 @@ class Product extends BaseI18nLoop
|
||||
);
|
||||
}
|
||||
|
||||
public function getSearchIn()
|
||||
{
|
||||
return array(
|
||||
"ref",
|
||||
"title",
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ProductQuery $search
|
||||
* @param $searchTerm
|
||||
* @param $searchIn
|
||||
* @param $searchCriteria
|
||||
*/
|
||||
public function doSearch(&$search, $searchTerm, $searchIn, $searchCriteria)
|
||||
{
|
||||
|
||||
$search->_and();
|
||||
foreach($searchIn as $index => $searchInElement) {
|
||||
if($index > 0) {
|
||||
$search->_or();
|
||||
}
|
||||
switch($searchInElement) {
|
||||
case "ref":
|
||||
$search->filterByRef($searchTerm, $searchCriteria);
|
||||
break;
|
||||
case "title":
|
||||
$search->where("CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".$searchCriteria." ?", $searchTerm, \PDO::PARAM_STR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $pagination
|
||||
*
|
||||
@@ -137,6 +170,390 @@ class Product extends BaseI18nLoop
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function exec(&$pagination)
|
||||
{
|
||||
$complex = $this->getComplex();
|
||||
if(true === $complex) {
|
||||
return $this->execComplex($pagination);
|
||||
}
|
||||
|
||||
$currencyId = $this->getCurrency();
|
||||
if (null !== $currencyId) {
|
||||
$currency = CurrencyQuery::create()->findOneById($currencyId);
|
||||
if (null === $currency) {
|
||||
throw new \InvalidArgumentException('Cannot found currency id: `' . $currency . '` in product_sale_elements loop');
|
||||
}
|
||||
} else {
|
||||
$currency = $this->request->getSession()->getCurrency();
|
||||
}
|
||||
|
||||
$defaultCurrency = CurrencyQuery::create()->findOneByByDefault(1);
|
||||
$defaultCurrencySuffix = '_default_currency';
|
||||
|
||||
$search = ProductQuery::create();
|
||||
$search->innerJoinProductSaleElements('pse');
|
||||
$search->addJoinCondition('pse', '`pse`.IS_DEFAULT=1');
|
||||
|
||||
$priceJoin = new Join();
|
||||
$priceJoin->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', 'pse', ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'price');
|
||||
$priceJoin->setJoinType(Criteria::LEFT_JOIN);
|
||||
|
||||
$search->addJoinObject($priceJoin, 'price_join')
|
||||
->addJoinCondition('price_join', '`price`.`currency_id` = ?', $currency->getId(), null, \PDO::PARAM_INT);
|
||||
|
||||
if ($defaultCurrency->getId() != $currency->getId()) {
|
||||
$priceJoinDefaultCurrency = new Join();
|
||||
$priceJoinDefaultCurrency->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', 'pse', ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'price' . $defaultCurrencySuffix);
|
||||
$priceJoinDefaultCurrency->setJoinType(Criteria::LEFT_JOIN);
|
||||
|
||||
$search->addJoinObject($priceJoinDefaultCurrency, 'price_join' . $defaultCurrencySuffix)
|
||||
->addJoinCondition('price_join' . $defaultCurrencySuffix, '`price' . $defaultCurrencySuffix . '`.`currency_id` = ?', $defaultCurrency->getId(), null, \PDO::PARAM_INT);
|
||||
|
||||
/**
|
||||
* rate value is checked as a float in overloaded getRate method.
|
||||
*/
|
||||
$priceToCompareAsSQL = 'CASE WHEN ISNULL(`price`.PRICE) OR `price`.FROM_DEFAULT_CURRENCY = 1 THEN
|
||||
CASE WHEN `price`.PROMO=1 THEN `price' . $defaultCurrencySuffix . '`.PROMO_PRICE ELSE `price' . $defaultCurrencySuffix . '`.PRICE END * ' . $currency->getRate() . '
|
||||
ELSE
|
||||
CASE WHEN `price`.PROMO=1 THEN `price`.PROMO_PRICE ELSE `price`.PRICE END
|
||||
END';
|
||||
} else {
|
||||
$priceToCompareAsSQL = 'CASE WHEN `pse`.PROMO=1 THEN `price`.PROMO_PRICE ELSE `price`.PRICE END';
|
||||
}
|
||||
|
||||
/* manage translations */
|
||||
$locale = $this->configureI18nProcessing($search);
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
if (!is_null($id)) {
|
||||
$search->filterById($id, Criteria::IN);
|
||||
}
|
||||
|
||||
$ref = $this->getRef();
|
||||
|
||||
if (!is_null($ref)) {
|
||||
$search->filterByRef($ref, Criteria::IN);
|
||||
}
|
||||
|
||||
$title = $this->getTitle();
|
||||
|
||||
if(!is_null($title)) {
|
||||
$search->where("CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR);
|
||||
}
|
||||
|
||||
$category = $this->getCategory();
|
||||
$categoryDefault = $this->getCategoryDefault();
|
||||
|
||||
if (!is_null($category) ||!is_null($categoryDefault)) {
|
||||
|
||||
$categoryIds = array();
|
||||
if (!is_array($category)) {
|
||||
$category = array();
|
||||
}
|
||||
if (!is_array($categoryDefault)) {
|
||||
$categoryDefault = array();
|
||||
}
|
||||
|
||||
$categoryIds = array_merge($categoryIds, $category, $categoryDefault);
|
||||
$categories =CategoryQuery::create()->filterById($categoryIds, Criteria::IN)->find();
|
||||
|
||||
$depth = $this->getDepth();
|
||||
|
||||
if (null !== $depth) {
|
||||
foreach (CategoryQuery::findAllChild($category, $depth) as $subCategory) {
|
||||
$categories->prepend($subCategory);
|
||||
}
|
||||
}
|
||||
|
||||
$search->filterByCategory(
|
||||
$categories,
|
||||
Criteria::IN
|
||||
);
|
||||
}
|
||||
|
||||
$new = $this->getNew();
|
||||
|
||||
if ($new === true) {
|
||||
$search->where('`pse`.NEWNESS' . Criteria::EQUAL . '1');
|
||||
} elseif ($new === false) {
|
||||
$search->where('`pse`.NEWNESS' . Criteria::EQUAL . '0');
|
||||
}
|
||||
|
||||
$promo = $this->getPromo();
|
||||
|
||||
if ($promo === true) {
|
||||
$search->where('`pse`.PROMO' . Criteria::EQUAL . '1');
|
||||
} elseif ($promo === false) {
|
||||
$search->where('`pse`.PROMO' . Criteria::EQUAL . '0');
|
||||
}
|
||||
|
||||
$min_stock = $this->getMin_stock();
|
||||
|
||||
if (null != $min_stock) {
|
||||
$search->where('`pse`.QUANTITY' . Criteria::GREATER_THAN . '?', $min_stock, \PDO::PARAM_INT);
|
||||
}
|
||||
|
||||
$min_weight = $this->getMin_weight();
|
||||
|
||||
if (null != $min_weight) {
|
||||
$search->where('`pse`.WEIGHT' . Criteria::GREATER_THAN . '?', $min_weight, \PDO::PARAM_STR);
|
||||
}
|
||||
|
||||
$max_weight = $this->getMax_weight();
|
||||
|
||||
if (null != $max_weight) {
|
||||
$search->where('`is_max_weight`.WEIGHT' . Criteria::LESS_THAN . '?', $max_weight, \PDO::PARAM_STR);
|
||||
}
|
||||
|
||||
$min_price = $this->getMin_price();
|
||||
|
||||
if (null !== $min_price) {
|
||||
|
||||
if (false === ConfigQuery::useTaxFreeAmounts()) {
|
||||
// @todo
|
||||
}
|
||||
|
||||
$search->where('ROUND(' . $priceToCompareAsSQL . ', 2)>=?', $min_price, \PDO::PARAM_STR);
|
||||
}
|
||||
|
||||
$max_price = $this->getMax_price();
|
||||
|
||||
if (null !== $max_price) {
|
||||
if (false === ConfigQuery::useTaxFreeAmounts()) {
|
||||
// @todo
|
||||
}
|
||||
|
||||
$search->where('ROUND(' . $priceToCompareAsSQL . ', 2)<=?', $max_price, \PDO::PARAM_STR);
|
||||
}
|
||||
|
||||
$current = $this->getCurrent();
|
||||
|
||||
if ($current === true) {
|
||||
$search->filterById($this->request->get("product_id"), Criteria::EQUAL);
|
||||
} elseif ($current === false) {
|
||||
$search->filterById($this->request->get("product_id"), Criteria::NOT_IN);
|
||||
}
|
||||
|
||||
$current_category = $this->getCurrent_category();
|
||||
|
||||
if ($current_category === true) {
|
||||
$search->filterByCategory(
|
||||
CategoryQuery::create()->filterByProduct(
|
||||
ProductCategoryQuery::create()->filterByProductId(
|
||||
$this->request->get("product_id"),
|
||||
Criteria::EQUAL
|
||||
)->find(),
|
||||
Criteria::IN
|
||||
)->find(),
|
||||
Criteria::IN
|
||||
);
|
||||
} elseif ($current_category === false) {
|
||||
$search->filterByCategory(
|
||||
CategoryQuery::create()->filterByProduct(
|
||||
ProductCategoryQuery::create()->filterByProductId(
|
||||
$this->request->get("product_id"),
|
||||
Criteria::EQUAL
|
||||
)->find(),
|
||||
Criteria::IN
|
||||
)->find(),
|
||||
Criteria::NOT_IN
|
||||
);
|
||||
}
|
||||
|
||||
$visible = $this->getVisible();
|
||||
|
||||
if ($visible !== Type\BooleanOrBothType::ANY) $search->filterByVisible($visible ? 1 : 0);
|
||||
|
||||
$exclude = $this->getExclude();
|
||||
|
||||
if (!is_null($exclude)) {
|
||||
$search->filterById($exclude, Criteria::NOT_IN);
|
||||
}
|
||||
|
||||
$exclude_category = $this->getExclude_category();
|
||||
|
||||
if (!is_null($exclude_category)) {
|
||||
$search->filterByCategory(
|
||||
CategoryQuery::create()->filterById($exclude_category, Criteria::IN)->find(),
|
||||
Criteria::NOT_IN
|
||||
);
|
||||
}
|
||||
|
||||
$feature_availability = $this->getFeature_availability();
|
||||
|
||||
$this->manageFeatureAv($search, $feature_availability);
|
||||
|
||||
$feature_values = $this->getFeature_values();
|
||||
|
||||
$this->manageFeatureValue($search, $feature_values);
|
||||
|
||||
$search->groupBy(ProductTableMap::ID);
|
||||
|
||||
$search->withColumn('`pse`.ID', 'pse_id');
|
||||
$search->withColumn('`pse`.NEWNESS', 'is_new');
|
||||
$search->withColumn('`pse`.PROMO', 'is_promo');
|
||||
$search->withColumn('`pse`.QUANTITY', 'quantity');
|
||||
$search->withColumn('`pse`.WEIGHT', 'weight');
|
||||
$search->withColumn('`pse`.EAN_CODE', 'ean_code');
|
||||
|
||||
$search->withColumn('ROUND(' . $priceToCompareAsSQL . ', 2)', 'real_price');
|
||||
$search->withColumn('`price`.PRICE', 'price');
|
||||
$search->withColumn('`price`.PROMO_PRICE', 'promo_price');
|
||||
|
||||
$orders = $this->getOrder();
|
||||
|
||||
foreach ($orders as $order) {
|
||||
switch ($order) {
|
||||
case "id":
|
||||
$search->orderById(Criteria::ASC);
|
||||
break;
|
||||
case "id_reverse":
|
||||
$search->orderById(Criteria::DESC);
|
||||
break;
|
||||
case "alpha":
|
||||
$search->addAscendingOrderByColumn('i18n_TITLE');
|
||||
break;
|
||||
case "alpha_reverse":
|
||||
$search->addDescendingOrderByColumn('i18n_TITLE');
|
||||
break;
|
||||
case "min_price":
|
||||
$search->addAscendingOrderByColumn('real_price');
|
||||
break;
|
||||
case "max_price":
|
||||
$search->addDescendingOrderByColumn('real_price');
|
||||
break;
|
||||
case "manual":
|
||||
if(null === $categoryIds || count($categoryIds) != 1)
|
||||
throw new \InvalidArgumentException('Manual order cannot be set without single category argument');
|
||||
$search->orderByPosition(Criteria::ASC);
|
||||
break;
|
||||
case "manual_reverse":
|
||||
if(null === $categoryIds || count($categoryIds) != 1)
|
||||
throw new \InvalidArgumentException('Manual order cannot be set without single category argument');
|
||||
$search->orderByPosition(Criteria::DESC);
|
||||
break;
|
||||
case "ref":
|
||||
$search->orderByRef(Criteria::ASC);
|
||||
break;
|
||||
case "promo":
|
||||
$search->addDescendingOrderByColumn('is_promo');
|
||||
break;
|
||||
case "new":
|
||||
$search->addDescendingOrderByColumn('is_new');
|
||||
break;
|
||||
case "given_id":
|
||||
if(null === $id)
|
||||
throw new \InvalidArgumentException('Given_id order cannot be set without `id` argument');
|
||||
foreach ($id as $singleId) {
|
||||
$givenIdMatched = 'given_id_matched_' . $singleId;
|
||||
$search->withColumn(ProductTableMap::ID . "='$singleId'", $givenIdMatched);
|
||||
$search->orderBy($givenIdMatched, Criteria::DESC);
|
||||
}
|
||||
break;
|
||||
case "random":
|
||||
$search->clearOrderByColumns();
|
||||
$search->addAscendingOrderByColumn('RAND()');
|
||||
break(2);
|
||||
}
|
||||
}
|
||||
|
||||
/* perform search */
|
||||
$products = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult($products);
|
||||
|
||||
$taxCountry = CountryQuery::create()->findPk(64); // @TODO : make it magic
|
||||
|
||||
foreach ($products as $product) {
|
||||
|
||||
$loopResultRow = new LoopResultRow($loopResult, $product, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$price = $product->getVirtualColumn('price');
|
||||
try {
|
||||
$taxedPrice = $product->getTaxedPrice(
|
||||
$taxCountry,
|
||||
$price
|
||||
);
|
||||
} catch (TaxEngineException $e) {
|
||||
$taxedPrice = null;
|
||||
}
|
||||
$promoPrice = $product->getVirtualColumn('promo_price');
|
||||
try {
|
||||
$taxedPromoPrice = $product->getTaxedPromoPrice(
|
||||
$taxCountry,
|
||||
$promoPrice
|
||||
);
|
||||
} catch (TaxEngineException $e) {
|
||||
$taxedPromoPrice = null;
|
||||
}
|
||||
|
||||
// Find previous and next product, in the default category.
|
||||
$default_category_id = $product->getDefaultCategoryId();
|
||||
|
||||
$previous = ProductQuery::create()
|
||||
->joinProductCategory()
|
||||
->where('ProductCategory.category_id = ?', $default_category_id)
|
||||
->filterByPosition($product->getPosition(), Criteria::LESS_THAN)
|
||||
->orderByPosition(Criteria::DESC)
|
||||
->findOne()
|
||||
;
|
||||
|
||||
$next = ProductQuery::create()
|
||||
->joinProductCategory()
|
||||
->where('ProductCategory.category_id = ?', $default_category_id)
|
||||
->filterByPosition($product->getPosition(), Criteria::GREATER_THAN)
|
||||
->orderByPosition(Criteria::ASC)
|
||||
->findOne()
|
||||
;
|
||||
|
||||
$loopResultRow
|
||||
->set("ID" , $product->getId())
|
||||
->set("REF" , $product->getRef())
|
||||
->set("IS_TRANSLATED" , $product->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE" , $locale)
|
||||
->set("TITLE" , $product->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO" , $product->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION" , $product->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM" , $product->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("URL" , $product->getUrl($locale))
|
||||
->set("BEST_PRICE" , $product->getVirtualColumn('is_promo') ? $promoPrice : $price)
|
||||
->set("BEST_PRICE_TAX" , $taxedPrice - $product->getVirtualColumn('is_promo') ? $taxedPromoPrice - $promoPrice : $taxedPrice - $price)
|
||||
->set("BEST_TAXED_PRICE" , $product->getVirtualColumn('is_promo') ? $taxedPromoPrice : $taxedPrice)
|
||||
->set("PRICE" , $price)
|
||||
->set("PRICE_TAX" , $taxedPrice - $price)
|
||||
->set("TAXED_PRICE" , $taxedPrice)
|
||||
->set("PROMO_PRICE" , $promoPrice)
|
||||
->set("PROMO_PRICE_TAX" , $taxedPromoPrice - $promoPrice)
|
||||
->set("TAXED_PROMO_PRICE" , $taxedPromoPrice)
|
||||
->set("PRODUCT_SALE_ELEMENT" , $product->getVirtualColumn('pse_id'))
|
||||
->set("WEIGHT" , $product->getVirtualColumn('weight'))
|
||||
->set("QUANTITY" , $product->getVirtualColumn('quantity'))
|
||||
->set("EAN_CODE" , $product->getVirtualColumn('ean_code'))
|
||||
->set("IS_PROMO" , $product->getVirtualColumn('is_promo'))
|
||||
->set("IS_NEW" , $product->getVirtualColumn('is_new'))
|
||||
->set("POSITION" , $product->getPosition())
|
||||
->set("VISIBLE" , $product->getVisible() ? "1" : "0")
|
||||
->set("TEMPLATE" , $product->getTemplateId())
|
||||
->set("HAS_PREVIOUS" , $previous != null ? 1 : 0)
|
||||
->set("HAS_NEXT" , $next != null ? 1 : 0)
|
||||
->set("PREVIOUS" , $previous != null ? $previous->getId() : -1)
|
||||
->set("NEXT" , $next != null ? $next->getId() : -1)
|
||||
->set("DEFAULT_CATEGORY" , $default_category_id)
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $pagination
|
||||
*
|
||||
* @return \Thelia\Core\Template\Element\LoopResult
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function execComplex(&$pagination)
|
||||
{
|
||||
$currencyId = $this->getCurrency();
|
||||
if (null !== $currencyId) {
|
||||
@@ -313,7 +730,7 @@ class Product extends BaseI18nLoop
|
||||
* In propel we trust : $currency->getRate() always returns a float.
|
||||
* Or maybe not : rate value is checked as a float in overloaded getRate method.
|
||||
*/
|
||||
$MinPriceToCompareAsSQL = 'CASE WHEN ISNULL(CASE WHEN `is_min_price`.PROMO=1 THEN `min_price_data`.PROMO_PRICE ELSE `min_price_data`.PRICE END) THEN
|
||||
$MinPriceToCompareAsSQL = 'CASE WHEN ISNULL(CASE WHEN `is_min_price`.PROMO=1 THEN `min_price_data`.PROMO_PRICE ELSE `min_price_data`.PRICE END) OR `min_price_data`.FROM_DEFAULT_CURRENCY = 1 THEN
|
||||
CASE WHEN `is_min_price`.PROMO=1 THEN `min_price_data' . $defaultCurrencySuffix . '`.PROMO_PRICE ELSE `min_price_data' . $defaultCurrencySuffix . '`.PRICE END * ' . $currency->getRate() . '
|
||||
ELSE
|
||||
CASE WHEN `is_min_price`.PROMO=1 THEN `min_price_data`.PROMO_PRICE ELSE `min_price_data`.PRICE END
|
||||
@@ -351,7 +768,7 @@ class Product extends BaseI18nLoop
|
||||
* In propel we trust : $currency->getRate() always returns a float.
|
||||
* Or maybe not : rate value is checked as a float in overloaded getRate method.
|
||||
*/
|
||||
$MaxPriceToCompareAsSQL = 'CASE WHEN ISNULL(CASE WHEN `is_max_price`.PROMO=1 THEN `max_price_data`.PROMO_PRICE ELSE `max_price_data`.PRICE END) THEN
|
||||
$MaxPriceToCompareAsSQL = 'CASE WHEN ISNULL(CASE WHEN `is_max_price`.PROMO=1 THEN `max_price_data`.PROMO_PRICE ELSE `max_price_data`.PRICE END) OR `min_price_data`.FROM_DEFAULT_CURRENCY = 1 THEN
|
||||
CASE WHEN `is_max_price`.PROMO=1 THEN `max_price_data' . $defaultCurrencySuffix . '`.PROMO_PRICE ELSE `max_price_data' . $defaultCurrencySuffix . '`.PRICE END * ' . $currency->getRate() . '
|
||||
ELSE
|
||||
CASE WHEN `is_max_price`.PROMO=1 THEN `max_price_data`.PROMO_PRICE ELSE `max_price_data`.PRICE END
|
||||
@@ -492,59 +909,11 @@ class Product extends BaseI18nLoop
|
||||
|
||||
$feature_availability = $this->getFeature_availability();
|
||||
|
||||
if (null !== $feature_availability) {
|
||||
foreach ($feature_availability as $feature => $feature_choice) {
|
||||
foreach ($feature_choice['values'] as $feature_av) {
|
||||
$featureAlias = 'fa_' . $feature;
|
||||
if($feature_av != '*')
|
||||
$featureAlias .= '_' . $feature_av;
|
||||
$search->joinFeatureProduct($featureAlias, Criteria::LEFT_JOIN)
|
||||
->addJoinCondition($featureAlias, "`$featureAlias`.FEATURE_ID = ?", $feature, null, \PDO::PARAM_INT);
|
||||
if($feature_av != '*')
|
||||
$search->addJoinCondition($featureAlias, "`$featureAlias`.FEATURE_AV_ID = ?", $feature_av, null, \PDO::PARAM_INT);
|
||||
}
|
||||
|
||||
/* format for mysql */
|
||||
$sqlWhereString = $feature_choice['expression'];
|
||||
if ($sqlWhereString == '*') {
|
||||
$sqlWhereString = 'NOT ISNULL(`fa_' . $feature . '`.ID)';
|
||||
} else {
|
||||
$sqlWhereString = preg_replace('#([0-9]+)#', 'NOT ISNULL(`fa_' . $feature . '_' . '\1`.ID)', $sqlWhereString);
|
||||
$sqlWhereString = str_replace('&', ' AND ', $sqlWhereString);
|
||||
$sqlWhereString = str_replace('|', ' OR ', $sqlWhereString);
|
||||
}
|
||||
|
||||
$search->where("(" . $sqlWhereString . ")");
|
||||
}
|
||||
}
|
||||
$this->manageFeatureAv($search, $feature_availability);
|
||||
|
||||
$feature_values = $this->getFeature_values();
|
||||
|
||||
if (null !== $feature_values) {
|
||||
foreach ($feature_values as $feature => $feature_choice) {
|
||||
foreach ($feature_choice['values'] as $feature_value) {
|
||||
$featureAlias = 'fv_' . $feature;
|
||||
if($feature_value != '*')
|
||||
$featureAlias .= '_' . $feature_value;
|
||||
$search->joinFeatureProduct($featureAlias, Criteria::LEFT_JOIN)
|
||||
->addJoinCondition($featureAlias, "`$featureAlias`.FEATURE_ID = ?", $feature, null, \PDO::PARAM_INT);
|
||||
if($feature_value != '*')
|
||||
$search->addJoinCondition($featureAlias, "`$featureAlias`.BY_DEFAULT = ?", $feature_value, null, \PDO::PARAM_STR);
|
||||
}
|
||||
|
||||
/* format for mysql */
|
||||
$sqlWhereString = $feature_choice['expression'];
|
||||
if ($sqlWhereString == '*') {
|
||||
$sqlWhereString = 'NOT ISNULL(`fv_' . $feature . '`.ID)';
|
||||
} else {
|
||||
$sqlWhereString = preg_replace('#([a-zA-Z0-9_\-]+)#', 'NOT ISNULL(`fv_' . $feature . '_' . '\1`.ID)', $sqlWhereString);
|
||||
$sqlWhereString = str_replace('&', ' AND ', $sqlWhereString);
|
||||
$sqlWhereString = str_replace('|', ' OR ', $sqlWhereString);
|
||||
}
|
||||
|
||||
$search->where("(" . $sqlWhereString . ")");
|
||||
}
|
||||
}
|
||||
$this->manageFeatureValue($search, $feature_values);
|
||||
|
||||
$search->groupBy(ProductTableMap::ID);
|
||||
|
||||
@@ -620,7 +989,8 @@ class Product extends BaseI18nLoop
|
||||
|
||||
try {
|
||||
$taxedPrice = $product->getTaxedPrice(
|
||||
$taxCountry
|
||||
$taxCountry,
|
||||
$product->getRealLowestPrice()
|
||||
);
|
||||
} catch (TaxEngineException $e) {
|
||||
$taxedPrice = null;
|
||||
@@ -670,11 +1040,69 @@ class Product extends BaseI18nLoop
|
||||
->set("DEFAULT_CATEGORY" , $default_category_id)
|
||||
->set("TAX_RULE_ID" , $product->getTaxRuleId())
|
||||
|
||||
;
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
|
||||
protected function manageFeatureAv(&$search, $feature_availability)
|
||||
{
|
||||
if (null !== $feature_availability) {
|
||||
foreach ($feature_availability as $feature => $feature_choice) {
|
||||
foreach ($feature_choice['values'] as $feature_av) {
|
||||
$featureAlias = 'fa_' . $feature;
|
||||
if($feature_av != '*')
|
||||
$featureAlias .= '_' . $feature_av;
|
||||
$search->joinFeatureProduct($featureAlias, Criteria::LEFT_JOIN)
|
||||
->addJoinCondition($featureAlias, "`$featureAlias`.FEATURE_ID = ?", $feature, null, \PDO::PARAM_INT);
|
||||
if($feature_av != '*')
|
||||
$search->addJoinCondition($featureAlias, "`$featureAlias`.FEATURE_AV_ID = ?", $feature_av, null, \PDO::PARAM_INT);
|
||||
}
|
||||
|
||||
/* format for mysql */
|
||||
$sqlWhereString = $feature_choice['expression'];
|
||||
if ($sqlWhereString == '*') {
|
||||
$sqlWhereString = 'NOT ISNULL(`fa_' . $feature . '`.ID)';
|
||||
} else {
|
||||
$sqlWhereString = preg_replace('#([0-9]+)#', 'NOT ISNULL(`fa_' . $feature . '_' . '\1`.ID)', $sqlWhereString);
|
||||
$sqlWhereString = str_replace('&', ' AND ', $sqlWhereString);
|
||||
$sqlWhereString = str_replace('|', ' OR ', $sqlWhereString);
|
||||
}
|
||||
|
||||
$search->where("(" . $sqlWhereString . ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function manageFeatureValue(&$search, $feature_values)
|
||||
{
|
||||
if (null !== $feature_values) {
|
||||
foreach ($feature_values as $feature => $feature_choice) {
|
||||
foreach ($feature_choice['values'] as $feature_value) {
|
||||
$featureAlias = 'fv_' . $feature;
|
||||
if($feature_value != '*')
|
||||
$featureAlias .= '_' . $feature_value;
|
||||
$search->joinFeatureProduct($featureAlias, Criteria::LEFT_JOIN)
|
||||
->addJoinCondition($featureAlias, "`$featureAlias`.FEATURE_ID = ?", $feature, null, \PDO::PARAM_INT);
|
||||
if($feature_value != '*')
|
||||
$search->addJoinCondition($featureAlias, "`$featureAlias`.BY_DEFAULT = ?", $feature_value, null, \PDO::PARAM_STR);
|
||||
}
|
||||
|
||||
/* format for mysql */
|
||||
$sqlWhereString = $feature_choice['expression'];
|
||||
if ($sqlWhereString == '*') {
|
||||
$sqlWhereString = 'NOT ISNULL(`fv_' . $feature . '`.ID)';
|
||||
} else {
|
||||
$sqlWhereString = preg_replace('#([a-zA-Z0-9_\-]+)#', 'NOT ISNULL(`fv_' . $feature . '_' . '\1`.ID)', $sqlWhereString);
|
||||
$sqlWhereString = str_replace('&', ' AND ', $sqlWhereString);
|
||||
$sqlWhereString = str_replace('|', ' OR ', $sqlWhereString);
|
||||
}
|
||||
|
||||
$search->where("(" . $sqlWhereString . ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,8 +136,8 @@ class ProductSaleElements extends BaseLoop
|
||||
/**
|
||||
* 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)';
|
||||
$priceSelectorAsSQL = 'ROUND(CASE WHEN ISNULL(`price`.PRICE) OR `price`.FROM_DEFAULT_CURRENCY = 1 THEN `price_default_currency`.PRICE * ' . $currency->getRate() . ' ELSE `price`.PRICE END, 2)';
|
||||
$promoPriceSelectorAsSQL = 'ROUND(CASE WHEN ISNULL(`price`.PRICE) OR `price`.FROM_DEFAULT_CURRENCY = 1 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');
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Propel;
|
||||
use Thelia\Model\Base\OrderQuery as BaseOrderQuery;
|
||||
@@ -52,4 +53,5 @@ class OrderQuery extends BaseOrderQuery
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
} // OrderQuery
|
||||
|
||||
@@ -41,11 +41,16 @@ class Product extends BaseProduct
|
||||
return $amount;
|
||||
}
|
||||
|
||||
public function getTaxedPrice(Country $country)
|
||||
public function getTaxedPrice(Country $country, $price)
|
||||
{
|
||||
$taxCalculator = new Calculator();
|
||||
return round($taxCalculator->load($this, $country)->getTaxedPrice($price), 2);
|
||||
}
|
||||
|
||||
return $taxCalculator->load($this, $country)->getTaxedPrice($this->getRealLowestPrice());
|
||||
public function getTaxedPromoPrice(Country $country, $price)
|
||||
{
|
||||
$taxCalculator = new Calculator();
|
||||
return round($taxCalculator->load($this, $country)->getTaxedPrice($price), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -151,7 +151,7 @@
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="pcc6" role="ADMIN" resource="admin.configuration.mailing-system" access="VIEW"}
|
||||
{* {loop type="auth" name="pcc6" role="ADMIN" resource="admin.configuration.mailing-system" access="VIEW"}
|
||||
<tr>
|
||||
<td><a href="{url path='/admin/configuration/mailing_system'}">{intl l='Mailing system'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/mailing_system'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
@@ -170,7 +170,7 @@
|
||||
<td><a href="{url path='/admin/configuration/system_logs'}">{intl l='System logs'}</a></td>
|
||||
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/system_logs'}"><i class="glyphicon glyphicon-edit"></i></a></td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{/loop}*}
|
||||
|
||||
{module_include location='system_configuration_bottom'}
|
||||
</table>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<div class="form-container">
|
||||
<div class="col-md-12">
|
||||
|
||||
{form name="thelia.admin.customer.modification"}
|
||||
{form name="thelia.admin.customer.update"}
|
||||
<form method="POST" action="{url path="/admin/customer/update/{$ID}"}" {form_enctype form=$form} class="clearfix">
|
||||
|
||||
<div class="row inner-toolbar clearfix">
|
||||
|
||||
238
templates/admin/default/search.html
Normal file
238
templates/admin/default/search.html
Normal file
@@ -0,0 +1,238 @@
|
||||
{extends file="admin-layout.tpl"}
|
||||
|
||||
{block name="page-title"}{intl l='Modules'}{/block}
|
||||
|
||||
{block name="check-resource"}admin.configuration.search{/block}
|
||||
{block name="check-access"}view{/block}
|
||||
|
||||
{block name="main-content"}
|
||||
<div class="modules">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
<div class="clearfix">
|
||||
<ul class="breadcrumb pull-left">
|
||||
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
||||
<li><a href="#">{intl l="Search"}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{module_include location='modules_top'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
{* customer search *}
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
{intl l='Customer'}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="object-title">
|
||||
{intl l="customer ref"}
|
||||
</th>
|
||||
|
||||
<th class="object-title">
|
||||
{intl l="company"}
|
||||
</th>
|
||||
|
||||
<th>
|
||||
{intl l="firstname & lastname"}
|
||||
</th>
|
||||
|
||||
<th>
|
||||
{intl l="last order"}
|
||||
</th>
|
||||
|
||||
<th>{intl l='order amount'}</th>
|
||||
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="customer_list" type="customer" current="false" visible="*" backend_context="1" search_term=$smarty.get.search_term search_in="ref,firstname,lastname,email"}
|
||||
{assign "lastOrderDate" ''}
|
||||
{assign "lastOrderAmount" ''}
|
||||
{assign "lastOrderCurrency" ''}
|
||||
|
||||
{loop type="order" name="last-order" customer=$ID order="create-date-reverse" limit="1"}
|
||||
{assign "lastOrderDate" "{format_date date=$CREATE_DATE}"}
|
||||
{assign "lastOrderAmount" "{format_number number=$TOTAL_TAXED_AMOUNT}"}
|
||||
{loop type="currency" name="order-currency" id=$CURRENCY}
|
||||
{assign "lastOrderCurrency" $SYMBOL}
|
||||
{/loop}
|
||||
{/loop}
|
||||
|
||||
<tr>
|
||||
<td><a href="{url path="/admin/customer/update/{$ID}"}">{$REF}</a></td>
|
||||
|
||||
<td>
|
||||
{$COMPANY}
|
||||
</td>
|
||||
|
||||
<td class="object-title">
|
||||
{$FIRSTNAME} {$LASTNAME}
|
||||
</td>
|
||||
|
||||
{module_include location='customer_list_row'}
|
||||
|
||||
<td>
|
||||
{$lastOrderDate}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{$lastOrderCurrency} {$lastOrderAmount}
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.customer" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this customer'}" href="{url path="/admin/customer/update/{$ID}" }"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_send_mail" role="ADMIN" resource="admin.customer" access="VIEW"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l="Send a mail to this customer"}" href="mailto:{$EMAIL}"><span class="glyphicon glyphicon-envelope"></span></a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.customer" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs customer-delete" title="{intl l='Delete this customer and all his orders'}" href="#delete_customer_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{* end customer search *}
|
||||
|
||||
{* order search *}
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
{intl l='Orders'}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="Order n°"}</th>
|
||||
<th>{intl l="Date & Hour"}</th>
|
||||
<th>{intl l="Company"}</th>
|
||||
<th>{intl l="Name"}</th>
|
||||
<th>{intl l="Amount"}</th>
|
||||
<th>{intl l="Status"}</th>
|
||||
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop type="order" name="order-search" backend_context=1 customer="*" search_term=$smarty.get.search_term search_in="ref,customer_ref,customer_firstname,customer_lastname,customer_email"}
|
||||
{loop type="order_address" name="order-invoice-address" id=$INVOICE_ADDRESS}
|
||||
{assign "orderInvoiceFirstName" $FIRSTNAME}
|
||||
{assign "orderInvoiceLastName" $LASTNAME}
|
||||
{assign "orderInvoiceCompany" $COMPANY}
|
||||
{/loop}
|
||||
|
||||
{loop type="order-status" name="order-status" id=$STATUS}
|
||||
{assign "orderStatus" $TITLE}
|
||||
{assign "orderStatusLabel" "order_$CODE"}
|
||||
{/loop}
|
||||
|
||||
<tr>
|
||||
|
||||
<td><a href="{url path="/admin/order/update/$ID"}">{$REF}</a></td>
|
||||
<td>{format_date date=$CREATE_DATE}</td>
|
||||
<td>{$orderInvoiceCompany}</td>
|
||||
<td><a href="{url path="/admin/customer/update/$CUSTOMER"}">{$orderInvoiceFirstName|ucwords} {$orderInvoiceLastName|upper}</a></td>
|
||||
<td>{$TOTAL_TAXED_AMOUNT}</td>
|
||||
<td><span class="label label-{#$orderStatusLabel#}">{$orderStatus}</span></td>
|
||||
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.order" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this order'}" href="{url path="/admin/order/update/$ID"}"><span class="glyphicon glyphicon-edit"></span></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{* end order search *}
|
||||
|
||||
{* product search *}
|
||||
<div class="general-block-decorator">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
{intl l='Product'}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l="ID"}</th>
|
||||
<th></th>
|
||||
<th>{intl l="Reference"}</th>
|
||||
<th>{intl l="Product title"}</th>
|
||||
|
||||
<th class="actions">{intl l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop type="product" name="product-search" visible="*" search_mode="sentence" search_term=$smarty.get.search_term search_in="ref,title"}
|
||||
|
||||
<tr>
|
||||
<td>{$ID}</td>
|
||||
|
||||
<td>
|
||||
{loop type="image" name="cat_image" source="product" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"}
|
||||
<a href="{url path='/admin/products/update' product_id=$ID}" title="{intl l='Edit this product'}">
|
||||
<img src="{$IMAGE_URL}" alt="{$TITLE}" />
|
||||
</a>
|
||||
{/loop}
|
||||
|
||||
<td class="object-title"><a href="{url path='/admin/products/update' product_id=$ID}" title="{intl l='Edit this product'}">{$REF}</a></td>
|
||||
|
||||
<td class="object-title"><a href="{url path='/admin/products/update' product_id=$ID}" title="{intl l='Edit this product'}">{$TITLE}</a></td>
|
||||
|
||||
|
||||
<td class="actions">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" role="ADMIN" resource="admin.product" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this product'}" href="{url path='/admin/products/update' product_id=$ID}"><i class="glyphicon glyphicon-edit"></i></a>
|
||||
{/loop}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{* end product search *}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{module_include location='modules_bottom'}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
|
||||
<script>
|
||||
</script>
|
||||
{/block}
|
||||
@@ -58,7 +58,7 @@
|
||||
<span class="email">{mailto address="{$EMAIL}" encode="hex"}</span>
|
||||
</li>
|
||||
<li class="group-btn">
|
||||
<a href="{url path="/account/update"}" class="btn btn-change-account"><i class="icon-pencil"></i> {intl l="Change my account informations"}</a>
|
||||
<a href="{url path="/account/update"}" class="btn btn-change-account"><i class="icon-pencil"></i> {intl l="Change my account information"}</a>
|
||||
<a href="{url path="/account/password"}" class="btn btn-change-password"><i class="icon-lock"></i> {intl l="Change my password"}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
{/elseloop}
|
||||
</td>
|
||||
<td class="product" >
|
||||
<h3 class="name"><a href="{$URL}">
|
||||
<h3 class="name"><a href="{$PRODUCT_URL}">
|
||||
{$TITLE}
|
||||
</a></h3>
|
||||
<div class="product-options">
|
||||
|
||||
@@ -222,22 +222,29 @@ URL: http://www.thelia.net
|
||||
</div>
|
||||
<div class="col">
|
||||
<section class="block block-default">
|
||||
<div class="block-heading"><h3 class="block-title">Usefull links</h3></div>
|
||||
<div class="block-heading"><h3 class="block-title">{intl l="Usefull links"}</h3></div>
|
||||
<div class="block-content">
|
||||
<ul>
|
||||
{loop name="footer_links" type="content" folder="2"}
|
||||
<li><a href="{$URL}">{$TITLE}</a></li>
|
||||
{/loop}
|
||||
<li><a href="{url path="/login"}">Login</a></li>
|
||||
<li><a href="{url path="/register"}">Register</a></li>
|
||||
<li><a href="{url path="/order/delivery"}">Checkout</a></li>
|
||||
{loop type="auth" name="customer_is_logged" role="CUSTOMER" context="front"}
|
||||
<li><a href="{url path="/logout"}" class="logout">{intl l="Log out!"}</a></li>
|
||||
<li><a href="{url path="/account"}" class="account">{intl l="My Account"}</a></li>
|
||||
{/loop}
|
||||
{elseloop rel="customer_is_logged"}
|
||||
<li><a href="{url path="/login"}">{intl l="Login"}</a></li>
|
||||
<li><a href="{url path="/register"}">{intl l="Register"}</a></li>
|
||||
{/elseloop}
|
||||
<li><a href="{url path="/Cart"}">{intl l="Cart"}</a></li>
|
||||
<li><a href="{url path="/order/delivery"}">{intl l="Checkout"}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div class="col">
|
||||
<section class="block block-social">
|
||||
<div class="block-heading"><h3 class="block-title">Follow us</h3></div>
|
||||
<div class="block-heading"><h3 class="block-title">{intl l="Follow us"}</h3></div>
|
||||
<div class="block-content">
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
|
||||
<ul role="presentation">
|
||||
@@ -315,7 +322,7 @@ URL: http://www.thelia.net
|
||||
|
||||
<div class="col">
|
||||
<section class="block block-contact" itemscope itemtype="http://schema.org/Organization">
|
||||
<div class="block-heading"><h3 class="block-title">Contact Us</h3></div>
|
||||
<div class="block-heading"><h3 class="block-title">{intl l="Contact Us"}</h3></div>
|
||||
<div class="block-content">
|
||||
<meta itemprop="name" content="{config key="company_name"}">
|
||||
<ul>
|
||||
@@ -351,7 +358,7 @@ URL: http://www.thelia.net
|
||||
{/loop}
|
||||
{*<li><a href="#">Site Map</a></li>
|
||||
<li><a href="#">Terms & Conditions</a></li>*}
|
||||
<li><a href="{url path="/contact"}">Contact Us</a></li>
|
||||
<li><a href="{url path="/contact"}">{intl l="Contact Us"}</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
|
||||
@@ -73,12 +73,11 @@
|
||||
|
||||
<tr>
|
||||
<td class="image">
|
||||
<a href="{$PRODUCT_URL}" class="thumbnail">
|
||||
|
||||
{assign "cart_count" $LOOP_COUNT}
|
||||
{ifloop rel='product-image'}
|
||||
{loop type="image" name="product-image" product=$PRODUCT_ID limit="1" width="118" height="85" force_return="true"}
|
||||
<img src="{$IMAGE_URL}" alt="Product #{$cart_count}"></a>
|
||||
<img src="{$IMAGE_URL}" alt="Product #{$cart_count}">
|
||||
{/loop}
|
||||
{/ifloop}
|
||||
{elseloop rel="product-image"}
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
{loop type="order_address" name="delivery_address" id=$DELIVERY_ADDRESS}
|
||||
{loop type="title" name="order-invoice-address-title" id=$TITLE}{$LONG}{/loop}{$FIRSTNAME} {$LASTNAME}<br />
|
||||
{$ADDRESS1} {$ADDRESS2} {$ADDRESS3}<br />
|
||||
{$ZIPCODE} {$COUNTRY}<br/>
|
||||
{$ZIPCODE} {$CITY}<br/>
|
||||
{loop type="country" name="country_delivery" id=$COUNTRY}{$TITLE}{/loop}
|
||||
{/loop}
|
||||
</td>
|
||||
@@ -108,7 +108,7 @@
|
||||
{loop type="order_address" name="delivery_address" id=$INVOICE_ADDRESS}
|
||||
{loop type="title" name="order-invoice-address-title" id=$TITLE}{$LONG}{/loop}{$FIRSTNAME} {$LASTNAME}<br />
|
||||
{$ADDRESS1} {$ADDRESS2} {$ADDRESS3}<br />
|
||||
{$ZIPCODE} {$COUNTRY}<br/>
|
||||
{$ZIPCODE} {$CITY}<br/>
|
||||
{loop type="country" name="country_delivery" id=$COUNTRY}{$TITLE}{/loop}
|
||||
{/loop}
|
||||
</td>
|
||||
|
||||
@@ -96,6 +96,10 @@ $_SESSION['install']['step'] = $step;
|
||||
<label for="site_name">Company name :</label>
|
||||
<input id="site_name" class="form-control" type="text" name="company_name" placeholder="" value="" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="site_name">website url :</label>
|
||||
<input id="site_name" class="form-control" type="text" name="url_site" placeholder="" value="http://<?php echo $_SERVER['SERVER_NAME']; ?>" required>
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
<div class="control-btn">
|
||||
<button type="submit" class="pull-right btn btn-default btn-primary">Continue</button>
|
||||
|
||||
@@ -43,6 +43,10 @@ if($_SESSION['install']['step'] == 5) {
|
||||
\Thelia\Model\ConfigQuery::create()
|
||||
->filterByName('company_name')
|
||||
->update(array('Value' => $_POST['company_name']));
|
||||
|
||||
\Thelia\Model\ConfigQuery::create()
|
||||
->filterByName('url_site')
|
||||
->update(array('Value' => $_POST['url_site']));
|
||||
}
|
||||
|
||||
//clean up cache directories
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* Date: 15/10/13
|
||||
* Time: 11:37
|
||||
*
|
||||
* @author Guillaume MOREL <gmorel@openstudio.fr>
|
||||
*/
|
||||
|
||||
phpinfo();
|
||||
Reference in New Issue
Block a user