diff --git a/.gitignore b/.gitignore index 8de5039ed..2af71adba 100755 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,6 @@ web/cache/* web/.htaccess phpdoc*.log php-cs -xhprof +xhprof/ phpunit.phar .DS_Store \ No newline at end of file diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index 09c95d2ff..8eaeb2547 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -37,6 +37,11 @@ Thelia\Controller\Admin\CustomerController::indexAction + + Thelia\Controller\Admin\CustomerController::viewAction + \d+ + + diff --git a/core/lib/Thelia/Controller/Admin/CustomerController.php b/core/lib/Thelia/Controller/Admin/CustomerController.php index c53c2b3d3..ddf4681b9 100644 --- a/core/lib/Thelia/Controller/Admin/CustomerController.php +++ b/core/lib/Thelia/Controller/Admin/CustomerController.php @@ -35,4 +35,12 @@ class CustomerController extends BaseAdminController if (null !== $response = $this->checkAuth("admin.customers.view")) return $response; return $this->render("customers", array("display_customer" => 20)); } -} + + public function viewAction($customer_id) + { + + return $this->render("customer-edit", array( + "customer_id" => $customer_id + )); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php b/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php index f1bbb198d..980ade454 100755 --- a/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php +++ b/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php @@ -34,6 +34,7 @@ use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Model\Base\ProductSaleElementsQuery; use Thelia\Model\CountryQuery; use Thelia\Model\CurrencyQuery; +use Thelia\Model\Map\ProductSaleElementsTableMap; use Thelia\Type\TypeCollection; use Thelia\Type; @@ -41,7 +42,7 @@ use Thelia\Type; * * Product Sale Elements loop * - * @todo : manage currency and attribute_availability + * @todo : manage attribute_availability ? * * Class ProductSaleElements * @package Thelia\Core\Template\Loop @@ -68,9 +69,9 @@ class ProductSaleElements extends BaseLoop new Argument( 'order', new TypeCollection( - new Type\EnumListType(array('alpha', 'alpha_reverse', 'attribute', 'attribute_reverse')) + new Type\EnumListType(array('min_price', 'max_price', 'promo', 'new', 'random')) ), - 'attribute' + 'random' ) ); } @@ -94,16 +95,16 @@ class ProductSaleElements extends BaseLoop foreach ($orders as $order) { switch ($order) { case "min_price": - $search->addAscendingOrderByColumn('real_lowest_price', Criteria::ASC); + $search->addAscendingOrderByColumn('price_FINAL_PRICE', Criteria::ASC); break; case "max_price": - $search->addDescendingOrderByColumn('real_lowest_price'); + $search->addDescendingOrderByColumn('price_FINAL_PRICE'); break; case "promo": - $search->addDescendingOrderByColumn('main_product_is_promo'); + $search->orderByPromo(Criteria::DESC); break; case "new": - $search->addDescendingOrderByColumn('main_product_is_new'); + $search->orderByNewness(Criteria::DESC); break; case "random": $search->clearOrderByColumns(); @@ -125,12 +126,22 @@ class ProductSaleElements extends BaseLoop $defaultCurrency = CurrencyQuery::create()->findOneByByDefault(1); $defaultCurrencySuffix = '_default_currency'; - $search->joinProductPrice('price', Criteria::INNER_JOIN); - //->addJoinCondition('price', ''); + $search->joinProductPrice('price', Criteria::LEFT_JOIN) + ->addJoinCondition('price', '`price`.`currency_id` = ?', $currency->getId(), null, \PDO::PARAM_INT); - $search->withColumn('`price`.CURRENCY_ID', 'price_CURRENCY_ID') - ->withColumn('`price`.PRICE', 'price_PRICE') - ->withColumn('`price`.PROMO_PRICE', 'price_PROMO_PRICE'); + $search->joinProductPrice('price' . $defaultCurrencySuffix, Criteria::LEFT_JOIN) + ->addJoinCondition('price_default_currency', '`price' . $defaultCurrencySuffix . '`.`currency_id` = ?', $defaultCurrency->getId(), null, \PDO::PARAM_INT); + + /** + * rate value is checked as a float in overloaded getRate method. + */ + $priceSelectorAsSQL = 'ROUND(CASE WHEN ISNULL(`price`.PRICE) THEN `price_default_currency`.PRICE * ' . $currency->getRate() . ' ELSE `price`.PRICE END, 2)'; + $promoPriceSelectorAsSQL = 'ROUND(CASE WHEN ISNULL(`price`.PRICE) THEN `price_default_currency`.PROMO_PRICE * ' . $currency->getRate() . ' ELSE `price`.PROMO_PRICE END, 2)'; + $search->withColumn($priceSelectorAsSQL, 'price_PRICE') + ->withColumn($promoPriceSelectorAsSQL, 'price_PROMO_PRICE') + ->withColumn('CASE WHEN ' . ProductSaleElementsTableMap::PROMO . ' = 1 THEN ' . $promoPriceSelectorAsSQL . ' ELSE ' . $priceSelectorAsSQL . ' END', 'price_FINAL_PRICE'); + + $search->groupById(); $PSEValues = $this->search($search, $pagination); @@ -153,8 +164,6 @@ class ProductSaleElements extends BaseLoop ->set("IS_PROMO", $PSEValue->getPromo() === 1 ? 1 : 0) ->set("IS_NEW", $PSEValue->getNewness() === 1 ? 1 : 0) ->set("WEIGHT", $PSEValue->getWeight()) - - ->set("CURRENCY", $PSEValue->getVirtualColumn('price_CURRENCY_ID')) ->set("PRICE", $price) ->set("PRICE_TAX", $taxedPrice - $price) ->set("TAXED_PRICE", $taxedPrice) diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php index 9aedaaa29..402059ddd 100755 --- a/core/lib/Thelia/Core/Thelia.php +++ b/core/lib/Thelia/Core/Thelia.php @@ -83,7 +83,7 @@ class Thelia extends Kernel $con = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME); $con->setAttribute(ConnectionWrapper::PROPEL_ATTR_CACHE_PREPARES, true); if ($this->isDebug()) { - + //$serviceContainer->setLogger('defaultLogger', \Thelia\Log\Tlog::getInstance()); $con->useDebug(true); } } diff --git a/core/lib/Thelia/Form/CustomerCreation.php b/core/lib/Thelia/Form/CustomerCreation.php index 958f781b5..e6f77c0de 100755 --- a/core/lib/Thelia/Form/CustomerCreation.php +++ b/core/lib/Thelia/Form/CustomerCreation.php @@ -1,7 +1,7 @@ . */ +/* along with this program. If not, see . */ /* */ /*************************************************************************************/ namespace Thelia\Form; @@ -217,4 +217,4 @@ class CustomerCreation extends BaseForm { return "thelia_customer_creation"; } -} +} \ No newline at end of file diff --git a/templates/admin/default/assets/img/bg.jpg b/templates/admin/default/assets/img/bg.jpg index 76304b5cf..e29da1fc5 100644 Binary files a/templates/admin/default/assets/img/bg.jpg and b/templates/admin/default/assets/img/bg.jpg differ diff --git a/templates/admin/default/assets/less/thelia/scaffolding.less b/templates/admin/default/assets/less/thelia/scaffolding.less index 1bc1a373c..1309638e4 100755 --- a/templates/admin/default/assets/less/thelia/scaffolding.less +++ b/templates/admin/default/assets/less/thelia/scaffolding.less @@ -7,7 +7,8 @@ // ------------------------- body { - background: url("@{imgDir}/bg.jpg") repeat; + background: #FFF url("@{imgDir}/bg.jpg") top left no-repeat; + background-size: cover; } diff --git a/templates/admin/default/customers.html b/templates/admin/default/customers.html index 1ccacd4db..570c38bdc 100644 --- a/templates/admin/default/customers.html +++ b/templates/admin/default/customers.html @@ -10,99 +10,99 @@
-
+
- {module_include location='customer_top'} + {module_include location='customer_top'} -
-
-
- -
- {intl l="Customers list"} +
+
+
+ + + {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.customers.create"} + + + + {/loop} + - {ifloop rel="customer_list"} - - - + {ifloop rel="customer_list"} + + + - + - {module_include location='category_list_header'} + {module_include location='category_list_header'} - + - + - + - - - + + + - - {loop name="customer_list" type="customer" current="false" visible="*" last_order="1" backend_context="1" page={$customer_page} limit={$display_customer}} - - + + {loop name="customer_list" type="customer" current="false" visible="*" last_order="1" backend_context="1" page={$customer_page} limit={$display_customer}} + + - + - + - {module_include location='customer_list_row'} + {module_include location='customer_list_row'} - + - - + + {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.customer.edit"} + + {/loop} + {loop type="auth" name="can_send_mail" roles="ADMIN" permissions="admin.customer.sendMail"} + + {/loop} + {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.customer.delete"} + + {/loop} + + - - {/loop} - - {/ifloop} -
+ {intl l="Customers list"} - {module_include location='customer_list_caption'} + {module_include location='customer_list_caption'} - {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.customers.create"} - - - - {/loop} -
- {intl l="customer ref"} -
+ {intl l="customer ref"} + - {intl l="company"} - + {intl l="company"} + - {intl l="firstname & lastname"} - + {intl l="firstname & lastname"} + - {intl l="last order"} - + {intl l="last order"} + {intl l='order amount'}{intl l='order amount'}{intl l='Actions'}
{intl l='Actions'}
{$REF}
{$REF} - {$COMPANY} - + {$COMPANY} + - {$FIRSTNAME} {$LASTNAME} - + {$FIRSTNAME} {$LASTNAME} + - {format_date date=$LASTORDER_DATE} - + {format_date date=$LASTORDER_DATE} + - {format_number number=$LASTORDER_AMOUNT} - -
+
+ {format_number number=$LASTORDER_AMOUNT} + +
- {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.customer.edit"} - - {/loop} - {loop type="auth" name="can_send_mail" roles="ADMIN" permissions="admin.customer.sendMail"} - - {/loop} - {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.customer.delete"} - - {/loop} -
-
+ + {/loop} + + {/ifloop} +
+
+
-
-
{module_include location='customer_bottom'} @@ -131,10 +131,136 @@ {/if} {/pageloop} +
- - + {* Adding a new Category *} + + + {form name="thelia.customer.creation"} + + {* Capture the dialog body, to pass it to the generic dialog *} + {capture "customer_creation_dialog"} + + {form_hidden_fields form=$form} + + {form_field form=$form field='success_url'} + {* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *} + + {/form_field} + + + {form_field form=$form field='title'} +
+ + + +
+ {/form_field} + + {form_field form=$form field='firstname'} +
+ + +
+ {/form_field} + + {form_field form=$form field='lastname'} +
+ + +
+ {/form_field} + + {form_field form=$form field='address1'} +
+ + +
+ +
+ {form_field form=$form field='address2'} + + {/form_field} +
+ +
+ {form_field form=$form field='address3'} + + {/form_field} +
+ {/form_field} + + {form_field form=$form field='zipcode'} +
+ + +
+ {/form_field} + + {form_field form=$form field='city'} +
+ + +
+ {/form_field} + + {form_field form=$form field='country'} +
+ + +
+ {/form_field} + + {form_field form=$form field='email'} +
+ + +
+ {/form_field} + + {/capture} + + {include + file = "includes/generic-create-dialog.html" + + dialog_id = "add_customer_dialog" + dialog_title = {intl l="Create a new customer"} + dialog_body = {$smarty.capture.customer_creation_dialog nofilter} + + dialog_ok_label = {intl l="Create this customer"} + dialog_cancel_label = {intl l="Cancel"} + + form_action = {url path='/admin/customer/create'} + form_enctype = {form_enctype form=$form} + form_error_message = $form_error_message + } + {/form} + + {* Delete confirmation dialog *} + + {capture "delete_customer_dialog"} + + {/capture} + + {include + file = "includes/generic-confirm-dialog.html" + + dialog_id = "delete_customer_dialog" + dialog_title = {intl l="Delete customer"} + dialog_message = {intl l="Do you really want to delete this customer ?"} + + form_action = {url path='/admin/customer/delete'} + form_content = {$smarty.capture.delete_dialog nofilter} + } {/block} \ No newline at end of file diff --git a/templates/admin/default/product-attributes-edit.html b/templates/admin/default/product-attributes-edit.html index 30d74d258..e69de29bb 100644 --- a/templates/admin/default/product-attributes-edit.html +++ b/templates/admin/default/product-attributes-edit.html @@ -1 +0,0 @@ -test \ No newline at end of file diff --git a/templates/default_save/product.html b/templates/default_save/product.html index f78b7e296..441585aba 100755 --- a/templates/default_save/product.html +++ b/templates/default_save/product.html @@ -1,3 +1,5 @@ +{*include file="includes/header.html"*} + Here you are : {navigate to="current"}
From : {navigate to="return_to"}
Index : {navigate to="index"}
@@ -60,7 +62,7 @@ Index : {navigate to="index"}

Product sale elements

{assign var=current_product value=$ID} - {loop name="pse" type="product_sale_elements" product="$ID"} + {loop name="pse" type="product_sale_elements" product="$ID" order="promo,min_price"}
{loop name="combi" type="attribute_combination" product_sale_elements="$ID"} {$ATTRIBUTE_TITLE} = {$ATTRIBUTE_AVAILABILITY_TITLE}
@@ -87,4 +89,6 @@ Index : {navigate to="index"}
{elseloop rel="product"}

Produit introuvable !

-{/elseloop} \ No newline at end of file +{/elseloop} + +{*include file="includes/footer.html"*} \ No newline at end of file diff --git a/web/index_dev.php b/web/index_dev.php index 4d0063268..bb90e6ab0 100755 --- a/web/index_dev.php +++ b/web/index_dev.php @@ -34,7 +34,8 @@ require __DIR__ . '/../core/bootstrap.php'; // List of allowed IP $trustedIp = array( '::1', - '127.0.0.1' + '127.0.0.1', + '192.168.56.1' ); $request = Request::createFromGlobals();