diff --git a/core/lib/Thelia/Config/Resources/routing/front.xml b/core/lib/Thelia/Config/Resources/routing/front.xml index 4d811599c..702c050ed 100755 --- a/core/lib/Thelia/Config/Resources/routing/front.xml +++ b/core/lib/Thelia/Config/Resources/routing/front.xml @@ -58,6 +58,11 @@ Thelia\Controller\Front\DefaultController::noAction account-password + + + Thelia\Controller\Front\OrderController::generateDeliveryPdf + \d+ + @@ -152,10 +157,6 @@ - - Thelia\Controller\Front\Mail::test - - Thelia\Controller\Front\ContactController::sendAction diff --git a/core/lib/Thelia/Controller/Admin/OrderController.php b/core/lib/Thelia/Controller/Admin/OrderController.php index 0a293278e..285098580 100644 --- a/core/lib/Thelia/Controller/Admin/OrderController.php +++ b/core/lib/Thelia/Controller/Admin/OrderController.php @@ -202,48 +202,28 @@ class OrderController extends BaseAdminController public function generateInvoicePdf($order_id) { - return $this->generatePdf($order_id, ConfigQuery::read('pdf_invoice_file', 'invoice')); + if (null !== $response = $this->checkAuth(AdminResources::ORDER, AccessManager::UPDATE)) return $response; + + return $this->generateBackOfficeOrderPdf($order_id, ConfigQuery::read('pdf_invoice_file', 'invoice')); } public function generateDeliveryPdf($order_id) { - return $this->generatePdf($order_id, ConfigQuery::read('pdf_delivery_file', 'delivery')); + if (null !== $response = $this->checkAuth(AdminResources::ORDER, AccessManager::UPDATE)) return $response; + + return $this->generateBackOfficeOrderPdf($order_id, ConfigQuery::read('pdf_delivery_file', 'delivery')); } - protected function generatePdf($order_id, $fileName) + private function generateBackOfficeOrderPdf($order_id, $fileName) { - if (null !== $response = $this->checkAuth(AdminResources::ORDER, array(), AccessManager::UPDATE)) return $response; - - $html = $this->renderRaw( - $fileName, - array( + if(null === $response = $this->generateOrderPdf($order_id, $fileName)){ + $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute("admin.order.update.view", array( 'order_id' => $order_id - ), - TemplateHelper::getInstance()->getActivePdfTemplate()->getPath() - ); - - $order = OrderQuery::create()->findPk($order_id); - - try { - $pdfEvent = new PdfEvent($html); - - $this->dispatch(TheliaEvents::GENERATE_PDF, $pdfEvent); - - if ($pdfEvent->hasPdf()) { - return Response::create($pdfEvent->getPdf(), 200, - array( - 'Content-type' => "application/pdf", - 'Content-Disposition' => sprintf('Attachment;filename=%s.pdf', $order->getRef()), - )); - } - - } catch (\Exception $e) { - \Thelia\Log\Tlog::getInstance()->error(sprintf('error during generating invoice pdf for order id : %d with message "%s"', $order_id, $e->getMessage())); - + )))); } - $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute("admin.order.update.view", array( - 'order_id' => $order_id - )))); + return $response; } + + } diff --git a/core/lib/Thelia/Controller/BaseController.php b/core/lib/Thelia/Controller/BaseController.php index 450f98e74..a8f7b3a63 100755 --- a/core/lib/Thelia/Controller/BaseController.php +++ b/core/lib/Thelia/Controller/BaseController.php @@ -22,6 +22,8 @@ /*************************************************************************************/ namespace Thelia\Controller; +use Thelia\Core\Event\PdfEvent; +use Thelia\Core\Event\TheliaEvents; use Thelia\Core\HttpFoundation\Response; use Symfony\Component\DependencyInjection\ContainerAware; @@ -31,7 +33,9 @@ use Symfony\Component\Routing\Exception\MissingMandatoryParametersException; use Symfony\Component\Routing\Exception\RouteNotFoundException; use Symfony\Component\Routing\Router; use Thelia\Core\Security\SecurityContext; +use Thelia\Core\Template\TemplateHelper; use Thelia\Core\Translation\Translator; +use Thelia\Model\OrderQuery; use Thelia\Tools\URL; use Thelia\Tools\Redirect; use Thelia\Core\Template\ParserContext; @@ -52,7 +56,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; * @author Manuel Raynaud */ -class BaseController extends ContainerAware +abstract class BaseController extends ContainerAware { /** @@ -73,6 +77,21 @@ class BaseController extends ContainerAware return new Response($json_data, $status, array('content-type' => 'application/json')); } + /** + * @param $pdf + * @param $fileName + * @param $status + * @return \Symfony\Component\HttpFoundation\Response + */ + protected function pdfResponse($pdf, $fileName, $status = 200) + { + return Response::create($pdf, $status, + array( + 'Content-type' => "application/pdf", + 'Content-Disposition' => sprintf('Attachment;filename=%s.pdf', $fileName), + )); + } + /** * Dispatch a Thelia event * @@ -207,6 +226,35 @@ class BaseController extends ContainerAware } } + protected function generateOrderPdf($order_id, $fileName) + { + $html = $this->renderRaw( + $fileName, + array( + 'order_id' => $order_id + ), + TemplateHelper::getInstance()->getActivePdfTemplate()->getPath() + ); + + $order = OrderQuery::create()->findPk($order_id); + + try { + $pdfEvent = new PdfEvent($html); + + $this->dispatch(TheliaEvents::GENERATE_PDF, $pdfEvent); + + if ($pdfEvent->hasPdf()) { + return $this->pdfResponse($pdfEvent->getPdf(), $order->getRef()); + } + + } catch (\Exception $e) { + \Thelia\Log\Tlog::getInstance()->error(sprintf('error during generating invoice pdf for order id : %d with message "%s"', $order_id, $e->getMessage())); + + } + + + } + /** * * redirect request to the specified url @@ -311,20 +359,28 @@ class BaseController extends ContainerAware } /** - * - * return an instance of SmartyParser - * - * Caution : maybe there is still not default template defined. - * - * @return ParserInterface instance parser + * @return a ParserInterface instance parser */ - protected function getParser() - { - return $this->container->get("thelia.parser"); - } + abstract protected function getParser($template = null); - protected function render($inline) - { - return $this->getParser()->fetch(sprintf("string:%s", $inline)); - } + /** + * Render the given template, and returns the result as an Http Response. + * + * @param $templateName the complete template name, with extension + * @param array $args the template arguments + * @param int $status http code status + * @return \Thelia\Core\HttpFoundation\Response + */ + abstract protected function render($templateName, $args = array(), $status = 200); + + /** + * Render the given template, and returns the result as a string. + * + * @param $templateName the complete template name, with extension + * @param array $args the template arguments + * @param null $templateDir + * + * @return string + */ + abstract protected function renderRaw($templateName, $args = array(), $templateDir = null); } diff --git a/core/lib/Thelia/Controller/Front/BaseFrontController.php b/core/lib/Thelia/Controller/Front/BaseFrontController.php index 60628bbc1..124a91296 100755 --- a/core/lib/Thelia/Controller/Front/BaseFrontController.php +++ b/core/lib/Thelia/Controller/Front/BaseFrontController.php @@ -24,9 +24,13 @@ namespace Thelia\Controller\Front; use Symfony\Component\Routing\Router; use Thelia\Controller\BaseController; +use Thelia\Core\HttpFoundation\Response; +use Thelia\Core\Security\Exception\AuthenticationException; +use Thelia\Core\Template\TemplateHelper; use Thelia\Model\AddressQuery; use Thelia\Model\ConfigQuery; use Thelia\Model\ModuleQuery; +use Thelia\Tools\Redirect; use Thelia\Tools\URL; class BaseFrontController extends BaseController @@ -88,12 +92,59 @@ class BaseFrontController extends BaseController /** * @return ParserInterface instance parser */ - protected function getParser() + protected function getParser($template = null) { $parser = $this->container->get("thelia.parser"); - $parser->setTemplate(ConfigQuery::getActiveTemplate()); + // Define the template that should be used + $parser->setTemplate($template ?: TemplateHelper::getInstance()->getActiveFrontTemplate()->getPath()); return $parser; } + + /** + * Render the given template, and returns the result as an Http Response. + * + * @param $templateName the complete template name, with extension + * @param array $args the template arguments + * @param int $status http code status + * @return \Thelia\Core\HttpFoundation\Response + */ + protected function render($templateName, $args = array(), $status = 200) + { + return Response::create($this->renderRaw($templateName, $args), $status); + } + + /** + * Render the given template, and returns the result as a string. + * + * @param $templateName the complete template name, with extension + * @param array $args the template arguments + * @param null $templateDir + * + * @return string + */ + protected function renderRaw($templateName, $args = array(), $templateDir = null) + { + + // Add the template standard extension + $templateName .= '.html'; + + $session = $this->getSession(); + + // Prepare common template variables + $args = array_merge($args, array( + 'locale' => $session->getLang()->getLocale(), + 'lang_code' => $session->getLang()->getCode(), + 'lang_id' => $session->getLang()->getId(), + 'current_url' => $this->getRequest()->getUri() + )); + + // Render the template. + + $data = $this->getParser($templateDir)->render($templateName, $args); + + return $data; + + } } diff --git a/core/lib/Thelia/Controller/Front/Mail.php b/core/lib/Thelia/Controller/Front/Mail.php deleted file mode 100644 index f25024f99..000000000 --- a/core/lib/Thelia/Controller/Front/Mail.php +++ /dev/null @@ -1,48 +0,0 @@ -. */ -/* */ -/*************************************************************************************/ - -namespace Thelia\Controller\Front; - -/** - * Class Mail - * @package Thelia\Controller\Front - * @author Manuel Raynaud - */ -class Mail extends BaseFrontController -{ - /** - * This is a demo how to send a mail using swiftmailer + smarty - */ - public function test() - { - $message = \Swift_Message::newInstance('Wonderful Subject') - ->setFrom(array('john@doe.com' => 'John Doe')) - ->setTo(array('mraynaud@openstudio.fr' => 'name')) - ->setBody($this->render('Here is the message itself')) - ; - - $this->getMailer()->send($message); - - exit; - } -} diff --git a/core/lib/Thelia/Controller/Front/OrderController.php b/core/lib/Thelia/Controller/Front/OrderController.php index bb0604bd1..dc3f5b20f 100755 --- a/core/lib/Thelia/Controller/Front/OrderController.php +++ b/core/lib/Thelia/Controller/Front/OrderController.php @@ -23,6 +23,9 @@ namespace Thelia\Controller\Front; use Propel\Runtime\Exception\PropelException; +use Thelia\Core\Event\PdfEvent; +use Thelia\Core\HttpFoundation\Response; +use Thelia\Core\Template\TemplateHelper; use Thelia\Exception\TheliaProcessException; use Thelia\Form\Exception\FormValidationException; use Thelia\Core\Event\Order\OrderEvent; @@ -34,6 +37,7 @@ use Thelia\Log\Tlog; use Thelia\Model\AddressQuery; use Thelia\Model\AreaDeliveryModuleQuery; use Thelia\Model\Base\OrderQuery; +use Thelia\Model\ConfigQuery; use Thelia\Model\ModuleQuery; use Thelia\Model\Order; use Thelia\Tools\URL; @@ -67,7 +71,6 @@ class OrderController extends BaseFrontController $deliveryModule = ModuleQuery::create()->findPk($deliveryModuleId); /* check that the delivery address belongs to the current customer */ - $deliveryAddress = AddressQuery::create()->findPk($deliveryAddressId); if ($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) { throw new \Exception("Delivery address does not belong to the current customer"); } @@ -242,4 +245,20 @@ class OrderController extends BaseFrontController return $order; } + + public function generateInvoicePdf($order_id) + { + /* check customer */ + $this->checkAuth(); + return $this->generateOrderPdf($order_id, ConfigQuery::read('pdf_invoice_file', 'invoice')); + } + + public function generateDeliveryPdf($order_id) + { + /* check customer */ + $this->checkAuth(); + return $this->generateOrderPdf($order_id, ConfigQuery::read('pdf_delivery_file', 'delivery')); + } + + } diff --git a/core/lib/Thelia/Core/Template/Loop/Lang.php b/core/lib/Thelia/Core/Template/Loop/Lang.php index f473b8589..399e3e8b0 100755 --- a/core/lib/Thelia/Core/Template/Loop/Lang.php +++ b/core/lib/Thelia/Core/Template/Loop/Lang.php @@ -33,6 +33,8 @@ use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Model\LangQuery; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; +use Thelia\Type\TypeCollection; +use Thelia\Type; /** * Language loop, to get a list of available languages @@ -56,7 +58,14 @@ class Lang extends BaseLoop implements PropelSearchLoopInterface return new ArgumentCollection( Argument::createIntTypeArgument('id', null), Argument::createIntListTypeArgument('exclude'), - Argument::createBooleanTypeArgument('default_only', false) + Argument::createBooleanTypeArgument('default_only', false), + new Argument( + 'order', + new TypeCollection( + new Type\EnumListType(array('id', 'id_reverse', 'alpha', 'alpha_reverse', 'position', 'position_reverse')) + ), + 'position' + ) ); } @@ -79,6 +88,30 @@ class Lang extends BaseLoop implements PropelSearchLoopInterface } $search->orderByPosition(Criteria::ASC); + $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->orderByTitle(Criteria::ASC); + break; + case "alpha_reverse": + $search->orderByTitle(Criteria::DESC); + break; + case "position": + $search->orderByPosition(Criteria::ASC); + break; + case "position_reverse": + $search->orderByPosition(Criteria::DESC); + break; + } + } return $search; diff --git a/templates/default/account-password.html b/templates/default/account-password.html index 1e67d4520..653ed9eef 100644 --- a/templates/default/account-password.html +++ b/templates/default/account-password.html @@ -25,7 +25,7 @@

{intl l="Change Password"}

{form name="thelia.front.customer.password.update"} -
+ {form_field form=$form field='success_url'} {/form_field} diff --git a/templates/default/account-update.html b/templates/default/account-update.html index d7b38e773..d4ba0fadb 100644 --- a/templates/default/account-update.html +++ b/templates/default/account-update.html @@ -24,7 +24,7 @@

{intl l="Update Profile"}

{form name="thelia.front.customer.profile.update"} - + {form_field form=$form field='success_url'} {/form_field} diff --git a/templates/default/account.html b/templates/default/account.html index 73da05a66..9904760f9 100644 --- a/templates/default/account.html +++ b/templates/default/account.html @@ -158,7 +158,7 @@ {format_date date=$CREATE_DATE} {format_number number=$TOTAL_TAXED_AMOUNT} {loop type="currency" name="order.currency" id={$CURRENCY}}{$SYMBOL}{/loop} {loop type="order-status" name="order.status" id={$STATUS}}{$TITLE}{/loop} - {intl l="Order details"} + {intl l="Order details"} {/loop} diff --git a/templates/default/address-update.html b/templates/default/address-update.html index 8ab66107d..f31d3eaaa 100644 --- a/templates/default/address-update.html +++ b/templates/default/address-update.html @@ -24,7 +24,7 @@

{intl l="Address Update"}

{form name="thelia.front.address.update"} {loop name="customer.update" type="address" customer="current" id="{$address_id}"} - + {form_field form=$form field='success_url'} {/form_field} diff --git a/templates/default/address.html b/templates/default/address.html index ac625af2b..771d4aad5 100644 --- a/templates/default/address.html +++ b/templates/default/address.html @@ -23,7 +23,7 @@

{intl l="Create New Address"}

{form name="thelia.front.address.create"} - + {form_field form=$form field='success_url'} {/form_field} diff --git a/templates/default/assets/js/script.js b/templates/default/assets/js/script.js index c6f695114..c9ecf99ab 100644 --- a/templates/default/assets/js/script.js +++ b/templates/default/assets/js/script.js @@ -1,22 +1,23 @@ /* JQUERY PREVENT CONFLICT */ -(function($) { +(function ($) { -/* ------------------------------------------------------------------ +/* ------------------------------------------------------------------ callback Function -------------------------------------------------- */ var confirmCallback = { - 'address.delete': function($elm){ - $.post($elm.attr('href'), function(data){ - if(data.success) + 'address.delete': function ($elm) { + $.post($elm.attr('href'), function (data) { + if (data.success) { $elm.closest('tr').remove(); - else + } else { bootbox.alert(data.message); + } }); } - } + }; -/* ------------------------------------------------------------------ +/* ------------------------------------------------------------------ onLoad Function -------------------------------------------------- */ - $(document).ready(function(){ + $(document).ready(function () { // Loader var $loader = $('
'); @@ -24,32 +25,29 @@ // Display loader if we do ajax call $(document) - .ajaxStart(function() { $loader.show(); }) - .ajaxStop(function(){ $loader.hide(); }); + .ajaxStart(function () { $loader.show(); }) + .ajaxStop(function () { $loader.hide(); }); // Main Navigation Hover $('.nav-main') - .on('click.subnav', '[data-toggle=dropdown]', function(event){ - if($(this).parent().hasClass('open') && $(this).is(event.target)) - return false; + .on('click.subnav', '[data-toggle=dropdown]', function (event) { + if ($(this).parent().hasClass('open') && $(this).is(event.target)) { return false; } }) - .on('mouseenter.subnav', '.dropdown', function(event){ - if($(this).hasClass('open')) - return; + .on('mouseenter.subnav', '.dropdown', function () { + if ($(this).hasClass('open')) { return; } $(this).addClass('open'); }) - .on('mouseleave.subnav', '.dropdown', function(){ + .on('mouseleave.subnav', '.dropdown', function () { var $this = $(this); - if(!$this.hasClass('open')) - return; + if (!$this.hasClass('open')) { return; } //This will check if an input child has focus. If no then remove class open - if ($this.find(":input:focus").length == 0){ + if ($this.find(":input:focus").length === 0) { $this.removeClass('open'); } else { - $this.find(":input:focus").one('blur', function(){ + $this.find(":input:focus").one('blur', function () { $this.trigger('mouseleave.subnav'); }); } @@ -61,56 +59,55 @@ }); // Confirm Dialog - $(document).on('click.confirm', '[data-confirm]', function (e) { + $(document).on('click.confirm', '[data-confirm]', function () { var $this = $(this), href = $this.attr('href'), callback = $this.attr('data-confirm-callback'), - title = $this.attr('data-confirm') != '' ? $this.attr('data-confirm') : 'Are you sure?'; + title = $this.attr('data-confirm') !== '' ? $this.attr('data-confirm') : 'Are you sure?'; - bootbox.confirm(title, function(confirm) { - if(confirm){ - //Check if callback and if it's a function - if (callback && $.isFunction(confirmCallback[callback])) { - confirmCallback[callback]($this); + bootbox.confirm(title, function (confirm) { + if (confirm) { + //Check if callback and if it's a function + if (callback && $.isFunction(confirmCallback[callback])) { + confirmCallback[callback]($this); + } else { + if (href) { + window.location.href = href; } else { - if(href){ - window.location.href = href; - } else { - // If forms - var $form = $this.closest("form"); - if($form.size() > 0){ - $form.submit(); - } + // If forms + var $form = $this.closest("form"); + if ($form.size() > 0) { + $form.submit(); } } } - }); + } + }); return false; }); // Toolbar - var $category_products = $('#category-products'); - if($category_products.size() > 0){ + var $category_products = $ ('#category-products'); + if ($category_products.size() > 0) { var $parent = $category_products.parent(); - $parent.on('click.view-mode', '[data-toggle=view]', function(){ - if( ($(this).hasClass('btn-grid') && $parent.hasClass('grid')) || ($(this).hasClass('btn-list') && $parent.hasClass('list'))) - return; + $parent.on('click.view-mode', '[data-toggle=view]', function () { + if (($(this).hasClass('btn-grid') && $parent.hasClass('grid')) || ($(this).hasClass('btn-list') && $parent.hasClass('list'))) { return; } // Add loader effect $loader.show(); - setTimeout(function(){ $parent.toggleClass('grid').toggleClass('list'); $loader.hide(); }, 400); + setTimeout(function () { $parent.toggleClass('grid').toggleClass('list'); $loader.hide(); }, 400); return false; }); - } + }; // Login var $form_login = $('#form-login'); - if($form_login.size() > 0) { - $form_login.on('change.account', ':radio', function(){ - if($(this).val() === '0') + if ($form_login.size() > 0) { + $form_login.on('change.account', ':radio', function () { + if ($(this).val() === '0') $('#password', $form_login).val('').prop('disabled', true); // Disabled (new customer) else $('#password', $form_login).prop('disabled', false); // Enabled @@ -119,19 +116,19 @@ // Mini Newsletter Subscription var $form_newsletter = $('#form-newsletter-mini'); - if($form_newsletter.size() > 0) { - $form_newsletter.on('submit.newsletter', function(){ + if ($form_newsletter.size() > 0) { + $form_newsletter.on('submit.newsletter', function () { $.ajax({ url: $(this).attr('action'), type: $(this).attr('method'), data: $(this).serialize(), dataType: 'json', - success: function(json) { + success: function (json) { var $msg = ''; - if(json.success){ + if (json.success) { $msg = json.message; - }else{ + } else { $msg = json.message; } bootbox.alert($msg); @@ -153,14 +150,14 @@ content: function() { 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'); return false; }); - $('.btn-close').click(function(){ + $('.btn-close').click(function () { $forgot_password.popover('hide'); }); @@ -170,11 +167,11 @@ */ //.Form Filters - $('#form-filters').each(function(){ + $('#form-filters').each(function () { var $form = $(this); $form - .on('change.filter', ':checkbox', function(){ + .on('change.filter', ':checkbox', function () { $loader.show(); $form.submit(); }) @@ -182,19 +179,18 @@ }); // Product details Thumbnails - $('#product-gallery').each(function(){ + $('#product-gallery').each(function () { var $item = $('.item', this), $thumbnails = $('.thumbnail', this), $image = $('.product-image > img', this); // Show Carousel control if needed - if($item.size() > 1){ + if ($item.size() > 1) { $('#product-thumbnails', this).carousel({interval: false}).find('.carousel-control').show(); } - $(this).on('click.thumbnails', '.thumbnail', function(){ - if($(this).hasClass('active')) - return false; + $(this).on('click.thumbnails', '.thumbnail', function () { + if ($(this).hasClass('active')) { return false; } $image.attr('src',$(this).attr('href')); $thumbnails.removeClass('active'); @@ -205,9 +201,9 @@ }); // Payment Method - $('#payment-method').each(function(){ + $('#payment-method').each(function () { var $label = $('label', this); - $label.on('change', ':radio', function(){ + $label.on('change', ':radio', function () { $label.removeClass('active'); $label.filter('[for="' + $(this).attr('id') + '"]').addClass('active'); }).filter(':has(:checked)').addClass('active'); @@ -215,21 +211,14 @@ // Apply validation $('#form-contact, #form-register, #form-address').validate({ - highlight: function(element) { + highlight: function (element) { $(element).closest('.form-group').addClass('has-error'); }, - unhighlight: function(element) { + unhighlight: function (element) { $(element).closest('.form-group').removeClass('has-error'); }, errorElement: 'span', - errorClass: 'help-block'/*, - errorPlacement: function(error, element) { - if(element.parent('.input-group').length || element.prop('type') === 'checkbox' || element.prop('type') === 'radio'){ - error.prepend(' ').insertAfter(element.parent()); - }else{ - error.prepend(' ').insertAfter(element); - } - }*/ + errorClass: 'help-block' }); @@ -253,14 +242,14 @@ // Switch Quantity in product page $("select", $(".product-options")).change(function(){ $select_quantity = $(this).find(":selected").attr("data-quantity"); - var $old_price = $(this).find(":selected").attr("data-old-price"); + var $old_price = $(this).find(":selected").attr("data-old-price"); - var $best_price = $(this).find(":selected").attr("data-price"); + var $best_price = $(this).find(":selected").attr("data-price"); $quantityInput.attr("max", $select_quantity); // Show Out Of Stock OR In Stock - if($select_quantity == 0){ + if ($select_quantity == 0) { $btnAddToCart.attr("disabled", true); $productMeta.removeClass("in-stock"); @@ -271,7 +260,7 @@ $outOfStock.show(); $inStock.hide(); - }else{ + } else { $btnAddToCart.attr("disabled", false); $productMeta.removeClass("out-of-stock"); @@ -283,38 +272,38 @@ $outOfStock.hide(); } - if(parseInt($quantityInput.val()) > parseInt($select_quantity)){ + if (parseInt($quantityInput.val()) > parseInt($select_quantity)) { $quantityInput.val($select_quantity); } - if($old_price_container.size() > 0 ){ + if ($old_price_container.size() > 0) { $(".price", $old_price_container).html($old_price); $(".price", $(".special-price")).html($best_price); - }else{ + } else { $(".price", $(".regular-price")).html($best_price); } }).change(); - $quantityInput.focusout(function() { + $quantityInput.focusout(function () { $quantityInput.attr("max", $select_quantity); - if(parseInt($quantityInput.val()) > parseInt($select_quantity)){ + if (parseInt($quantityInput.val()) > parseInt($select_quantity)) { $quantityInput.val($select_quantity); } }); } - $(".form-product").submit(function(){ + $(".form-product").submit(function () { var url_action = $(this).attr("action"); var $cartContainer = $(".cart-container"); - $.ajax({type:"POST", data: $(this).serialize(), url:url_action, + $.ajax({type: "POST", data: $(this).serialize(), url: url_action, success: function(data){ $cartContainer.html($(data).html()); $.ajax({url:"ajax/addCartMessage", - success: function(data){ + success: function (data) { bootbox.dialog({ message : data, buttons : {} @@ -322,7 +311,7 @@ } }); }, - error: function(){ + error: function () { console.log('Error.'); } }); @@ -330,11 +319,11 @@ return false; }); - $('#limit-top').change(function(e){ + $('#limit-top').change(function (e) { window.location = $(this).val() }); - $('#sortby-top').change(function(e){ + $('#sortby-top').change(function (e) { window.location = $(this).val() }); diff --git a/templates/default/assets/less/thelia/global.less b/templates/default/assets/less/thelia/global.less index 29c19c0c5..7b2344136 100755 --- a/templates/default/assets/less/thelia/global.less +++ b/templates/default/assets/less/thelia/global.less @@ -6,6 +6,9 @@ // Collapse .no-js .collapse { display: block!important; } +// Hide carousel arrow if no js +.no-js #carousel .carousel-control { display: none; } + // Loader (Overlay) .loader { position: fixed; diff --git a/templates/default/assets/less/thelia/navbar.less b/templates/default/assets/less/thelia/navbar.less index 969f19c3e..bce4f9b28 100755 --- a/templates/default/assets/less/thelia/navbar.less +++ b/templates/default/assets/less/thelia/navbar.less @@ -78,7 +78,7 @@ // Icons (Accordion and Dropdown) //.accordion-toggle, -.dropdown-toggle { +.js .dropdown-toggle { &:after { .icon(@chevron-down); float:right; diff --git a/templates/default/cart.html b/templates/default/cart.html index 592b5f34c..22d0af420 100644 --- a/templates/default/cart.html +++ b/templates/default/cart.html @@ -98,7 +98,7 @@
- + diff --git a/templates/default/language.html b/templates/default/language.html new file mode 100644 index 000000000..d1ced33cf --- /dev/null +++ b/templates/default/language.html @@ -0,0 +1,25 @@ +{extends file="layout.tpl"} + +{* Body Class *} +{block name="body-class"}page-language{/block} + +{* Breadcrumb *} +{block name='no-return-functions' append} + {$breadcrumbs = [ + ['title' => {intl l="Language"}, 'url'=>{url path="/language"}] + ]} +{/block} + + +{block name="main-content"} +
+
+

{intl l="SELECT YOUR LANGUAGE"}

+ +
+
+{/block} diff --git a/templates/default/layout.tpl b/templates/default/layout.tpl index 6261893d7..d8433e848 100644 --- a/templates/default/layout.tpl +++ b/templates/default/layout.tpl @@ -1,6 +1,10 @@ {* Declare assets directory, relative to template base directory *} {declare_assets directory='assets'} {block name="no-return-functions"}{/block} +{assign var="company_name" value="{config key="company_name"}"} +{if not $company_name} + {assign var="company_name" value="{intl l='Thelia V2'}"} +{/if} @@ -85,7 +86,7 @@ GNU General Public License : http://www.gnu.org/licenses/ - {config key="company_name"} + {$company_name}
@@ -102,18 +103,18 @@ GNU General Public License : http://www.gnu.org/licenses/