Merge branch 'master' into loops

This commit is contained in:
Etienne Roudeix
2013-10-24 17:15:48 +02:00
76 changed files with 3432 additions and 2403 deletions

View File

@@ -124,11 +124,17 @@ class Coupon extends BaseAction implements EventSubscriberInterface
// @todo insert false product in cart with the name of the coupon and the discount as negative price
// Decrement coupon quantity
// @todo move this part in after order event
$couponQuery = CouponQuery::create();
$couponModel = $couponQuery->findOneByCode($coupon->getCode());
$couponManager->decrementeQuantity($couponModel);
$request->getSession()->getCart()->setDiscount($totalDiscount);
$request
->getSession()
->getCart()
->setDiscount($totalDiscount)
->save()
;
}

View File

@@ -60,6 +60,27 @@ class Customer extends BaseAction implements EventSubscriberInterface
}
public function updateProfil(CustomerCreateOrUpdateEvent $event)
{
$customer = $event->getCustomer();
$customer->setDispatcher($this->getDispatcher());
$customer
->setTitleId($event->getTitle())
->setFirstname($event->getFirstname())
->setLastname($event->getLastname())
->setEmail($event->getEmail(), true)
->setPassword($event->getPassword())
->setReseller($event->getReseller())
->setSponsor($event->getSponsor())
->setDiscount($event->getDiscount())
->save();
$event->setCustomer($customer);
}
public function delete(CustomerEvent $event)
{
$customer = $event->getCustomer();
@@ -110,11 +131,6 @@ class Customer extends BaseAction implements EventSubscriberInterface
$this->getSecurityContext()->clearCustomerUser();
}
public function changePassword(ActionEvent $event)
{
// TODO
}
/**
* Return the security context
*
@@ -150,6 +166,7 @@ class Customer extends BaseAction implements EventSubscriberInterface
return array(
TheliaEvents::CUSTOMER_CREATEACCOUNT => array('create', 128),
TheliaEvents::CUSTOMER_UPDATEACCOUNT => array('modify', 128),
TheliaEvents::CUSTOMER_UPDATEPROFIL => array('updateProfil', 128),
TheliaEvents::CUSTOMER_LOGOUT => array('logout', 128),
TheliaEvents::CUSTOMER_LOGIN => array('login', 128),
TheliaEvents::CUSTOMER_DELETEACCOUNT => array('delete', 128),

View File

@@ -26,6 +26,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Newsletter\NewsletterEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Action\BaseAction;
use Thelia\Model\NewsletterQuery;
use Thelia\Model\Newsletter as NewsletterModel;
@@ -49,6 +50,24 @@ class Newsletter extends BaseAction implements EventSubscriberInterface
->save();
}
public function unsubscribe(NewsletterEvent $event)
{
if(null !== $nl = NewsletterQuery::create()->findPk($event->getId())) {
$nl->delete();
}
}
public function update(NewsletterEvent $event)
{
if(null !== $nl = NewsletterQuery::create()->findPk($event->getId())) {
$nl->setEmail($event->getEmail())
->setFirstname($event->getFirstname())
->setLastname($event->getLastname())
->setLocale($event->getLocale())
->save();
}
}
/**
* Returns an array of event names this subscriber wants to listen to.
*
@@ -72,7 +91,9 @@ class Newsletter extends BaseAction implements EventSubscriberInterface
public static function getSubscribedEvents()
{
return array(
TheliaEvents::NEWSLETTER_SUBSCRIBE => array('subscribe', 128)
TheliaEvents::NEWSLETTER_SUBSCRIBE => array('subscribe', 128),
TheliaEvents::NEWSLETTER_UPDATE => array('update', 128),
TheliaEvents::NEWSLETTER_UNSUBSCRIBE => array('unsubscribe', 128)
);
}
}

View File

@@ -67,11 +67,11 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
->findOne($con);
if ($salesElement == null) {
// Create a new product sale element
// Create a new default product sale element
$salesElement = $event->getProduct()->createDefaultProductSaleElement($con, 0, 0, $event->getCurrencyId(), true);
}
else {
// This one is the default
// This (new) one is the default
$salesElement->setIsDefault(true)->save($con);
}
@@ -122,6 +122,9 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
try {
// Update the product's tax rule
$event->getProduct()->setTaxRuleId($event->getTaxRuleId())->save($con);
// If product sale element is not defined, create it.
if ($salesElement == null) {
$salesElement = new ProductSaleElements();
@@ -158,11 +161,25 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
;
}
$productPrice
->setPromoPrice($event->getSalePrice())
->setPrice($event->getPrice())
->save($con)
;
// Check if we have to store the price
$productPrice->setFromDefaultCurrency($event->getFromDefaultCurrency());
if ($event->getFromDefaultCurrency() == 0) {
// Store the price
$productPrice
->setPromoPrice($event->getSalePrice())
->setPrice($event->getPrice())
;
}
else {
// Do not store the price.
$productPrice
->setPromoPrice(0)
->setPrice(0)
;
}
$productPrice->save($con);
// Store all the stuff !
$con->commit();

View File

@@ -55,18 +55,27 @@
</loops>
<forms>
<!-- Forms for Frontend -->
<form name="thelia.front.customer.login" class="Thelia\Form\CustomerLogin"/>
<form name="thelia.front.customer.lostpassword" class="Thelia\Form\CustomerLostPasswordForm"/>
<form name="thelia.front.customer.create" class="Thelia\Form\CustomerCreateForm"/>
<form name="thelia.front.customer.profil.update" class="Thelia\Form\CustomerProfilUpdateForm"/>
<form name="thelia.front.customer.password.update" class="Thelia\Form\CustomerPasswordUpdateForm"/>
<form name="thelia.front.address.create" class="Thelia\Form\AddressCreateForm"/>
<form name="thelia.front.address.update" class="Thelia\Form\AddressUpdateForm"/>
<form name="thelia.front.contact" class="Thelia\Form\ContactForm"/>
<form name="thelia.front.newsletter" class="Thelia\Form\NewsletterForm"/>
<!-- Forms for Admin -->
<form name="thelia.install.step3" class="Thelia\Form\InstallStep3Form"/>
<form name="thelia.customer.creation" class="Thelia\Form\CustomerCreation"/>
<form name="thelia.customer.update" class="Thelia\Form\CustomerUpdateForm"/>
<form name="thelia.customer.modification" class="Thelia\Form\CustomerModification"/>
<form name="thelia.customer.lostpassword" class="Thelia\Form\CustomerLostPasswordForm"/>
<form name="thelia.customer.login" class="Thelia\Form\CustomerLogin"/>
<form name="thelia.admin.login" class="Thelia\Form\AdminLogin"/>
<form name="thelia.address.create" class="Thelia\Form\AddressCreateForm" />
<form name="thelia.address.update" class="Thelia\Form\AddressUpdateForm" />
<form name="thelia.admin.customer.create" class="Thelia\Form\CustomerCreateForm"/>
<form name="thelia.admin.customer.update" class="Thelia\Form\CustomerUpdateForm"/>
<form name="thelia.admin.address.create" class="Thelia\Form\AddressCreateForm" />
<form name="thelia.admin.address.update" class="Thelia\Form\AddressUpdateForm" />
<form name="thelia.admin.category.creation" class="Thelia\Form\CategoryCreationForm"/>
<form name="thelia.admin.category.modification" class="Thelia\Form\CategoryModificationForm"/>
@@ -75,6 +84,7 @@
<form name="thelia.admin.product.creation" class="Thelia\Form\ProductCreationForm"/>
<form name="thelia.admin.product.modification" class="Thelia\Form\ProductModificationForm"/>
<form name="thelia.admin.product.details.modification" class="Thelia\Form\ProductDetailsModificationForm"/>
<form name="thelia.admin.product.image.modification" class="Thelia\Form\ProductImageModification"/>
<form name="thelia.admin.product.document.modification" class="Thelia\Form\ProductDocumentModification"/>
@@ -152,10 +162,6 @@
<form name="thelia.shopping_zone_area" class="Thelia\Form\ShippingZone\ShippingZoneAddArea"/>
<form name="thelia.shopping_zone_remove_area" class="Thelia\Form\ShippingZone\ShippingZoneRemoveArea"/>
<form name="thelia.contact" class="Thelia\Form\ContactForm"/>
<form name="thelia.newsletter" class="Thelia\Form\NewsletterForm"/>
<form name="thelia.lang.update" class="Thelia\Form\Lang\LangUpdateForm"/>
<form name="thelia.lang.create" class="Thelia\Form\Lang\LangCreateForm"/>
<form name="thelia.lang.defaultBehavior" class="Thelia\Form\Lang\LangDefaultBehaviorForm"/>

View File

@@ -303,10 +303,14 @@
<default key="_controller">Thelia\Controller\Admin\ProductController::updateContentPositionAction</default>
</route>
<route id="admin.product.update-content-position" path="/admin/product/calculate-price">
<route id="admin.product.calculate-price" path="/admin/product/calculate-price">
<default key="_controller">Thelia\Controller\Admin\ProductController::priceCaclulator</default>
</route>
<route id="admin.product.load-converted-prices" path="/admin/product/load-converted-prices">
<default key="_controller">Thelia\Controller\Admin\ProductController::loadConvertedPrices</default>
</route>
<!-- accessories -->
<route id="admin.products.accessories.add" path="/admin/products/accessory/add">

View File

@@ -4,56 +4,40 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="home" path="/">
<route id="ajax.mini-cart" path="/ajax/mini-cart">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">index</default>
<default key="_view">includes/mini-cart</default>
</route>
<route id="ajax.addCartMessage" path="/ajax/addCartMessage">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">includes/addedToCart</default>
</route>
<!-- Search routes -->
<route id="search" path="/search">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">search</default>
</route>
<route id="view_all" path="/view_all" methods="get">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">view_all</default>
</route>
<!-- Customer routes : Register -->
<!-- Register -->
<route id="customer.create.process" path="/register" methods="post">
<default key="_controller">Thelia\Controller\Front\CustomerController::createAction</default>
<default key="_view">register</default>
</route>
<route id="customer.create.view" path="/register">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">register</default>
</route>
<!-- Customer routes : Login -->
<!-- Login -->
<route id="customer.login.process" path="/login" methods="post">
<default key="_controller">Thelia\Controller\Front\CustomerController::loginAction</default>
<default key="_view">login</default>
</route>
<route id="customer.login.view" path="/login">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">login</default>
<!-- Forgot Password -->
<route id="customer.password.retrieve.process" path="/password" methods="post">
<default key="_controller">Thelia\Controller\Front\CustomerController::newPasswordAction</default>
<default key="_view">password</default>
</route>
<!-- Customer routes : Logout -->
<!-- Logout -->
<route id="customer.logout.process" path="/logout">
<default key="_controller">Thelia\Controller\Front\CustomerController::logoutAction</default>
</route>
<!-- Customer routes : Account -->
<route id="customer.account.view" path="/account">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">account</default>
</route>
<!-- Account -->
<route id="customer.update.view" path="/account/update" methods="get">
<default key="_controller">Thelia\Controller\Front\CustomerController::viewAction</default>
<default key="_view">account-update</default>
@@ -65,16 +49,15 @@
</route>
<route id="customer.password.retrieve.process" path="/account/password" methods="post">
<default key="_controller">Thelia\Controller\Front\CustomerController::newPasswordAction</default>
<route id="customer.password.change.process" path="/account/password" methods="post">
<default key="_controller">Thelia\Controller\Front\CustomerController::updatePasswordAction</default>
<default key="_view">account-password</default>
</route>
<route id="customer.password.retrieve.view" path="account/password" methods="get">
<route id="customer.password.change.view" path="/account/password" methods="get">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">account-password</default>
</route>
<!-- end customer routes -->
<!-- customer address routes -->
@@ -112,11 +95,6 @@
<!-- 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>
@@ -130,7 +108,6 @@
<default key="_controller">Thelia\Controller\Front\CartController::changeItem</default>
<default key="_view">cart</default>
</route>
<!-- end cart routes -->
<!-- order management process -->
@@ -174,11 +151,6 @@
</route>
<!-- contact management -->
<route id="contact.display" path="/contact" methods="get">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">contact</default>
</route>
<route id="contact.send" path="/contact" methods="post">
<default key="_controller">Thelia\Controller\Front\ContactController::sendAction</default>
<default key="_view">contact</default>
@@ -191,21 +163,17 @@
<!-- end contact management -->
<!-- newsletter management -->
<route id="newsletter.display" path="/newsletter" methods="get">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">newsletter</default>
</route>
<route id="newsletter.process" path="/newsletter" methods="post">
<default key="_controller">Thelia\Controller\Front\NewsletterController::subscribeAction</default>
<default key="_view">newsletter</default>
</route>
<!-- end newsletter management -->
<route id="newsletter.success" path="/newsletter/success">
<!-- Default Route -->
<route id="default" path="/{_view}">
<default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
<default key="_view">newsletter-success</default>
<default key="_view">index</default>
<requirement key="_view">^(?!admin)[^/]+</requirement>
</route>
<!-- end newsletter management -->
</routes>

View File

@@ -522,7 +522,7 @@ class CouponController extends BaseAdminController
$condition = array();
$condition['serviceId'] = $availableCondition->getServiceId();
$condition['name'] = $availableCondition->getName();
$condition['toolTip'] = $availableCondition->getToolTip();
// $condition['toolTip'] = $availableCondition->getToolTip();
$cleanedConditions[] = $condition;
}

View File

@@ -32,6 +32,7 @@ use Thelia\Model\CurrencyQuery;
use Thelia\Form\CurrencyModificationForm;
use Thelia\Form\CurrencyCreationForm;
use Thelia\Core\Event\UpdatePositionEvent;
use Thelia\Core\Security\AccessManager;
/**
* Manages currencies

View File

@@ -65,6 +65,8 @@ use Thelia\Model\Country;
use Thelia\Model\CountryQuery;
use Thelia\Model\TaxRuleQuery;
use Thelia\Tools\NumberFormat;
use Thelia\Model\Product;
use Thelia\Model\CurrencyQuery;
/**
* Manages products
@@ -187,6 +189,23 @@ class ProductController extends AbstractCrudController
return $event->hasProduct();
}
protected function updatePriceFromDefaultCurrency($productPrice, $saleElement, $defaultCurrency, $currentCurrency) {
// Get price for default currency
$priceForDefaultCurrency = ProductPriceQuery::create()
->filterByCurrency($defaultCurrency)
->filterByProductSaleElements($saleElement)
->findOne()
;
if ($priceForDefaultCurrency !== null) {
$productPrice
->setPrice($priceForDefaultCurrency->getPrice() * $currentCurrency->getRate())
->setPromoPrice($priceForDefaultCurrency->getPromoPrice() * $currentCurrency->getRate())
;
}
}
protected function hydrateObjectForm($object)
{
$defaultPseData = $combinationPseData = array();
@@ -196,17 +215,36 @@ class ProductController extends AbstractCrudController
->filterByProduct($object)
->find();
$defaultCurrency = Currency::getDefaultCurrency();
$currentCurrency = $this->getCurrentEditionCurrency();
foreach($saleElements as $saleElement) {
// Get the product price for the current currency
$productPrice = ProductPriceQuery::create()
->filterByCurrency($this->getCurrentEditionCurrency())
->filterByCurrency($currentCurrency)
->filterByProductSaleElements($saleElement)
->findOne()
;
if ($productPrice == null) $productPrice = new ProductPrice();
// No one exists ?
if ($productPrice === null) {
$productPrice = new ProductPrice();
// If the current currency is not the default one, calculate the price
// using default currency price and current currency rate
if ($currentCurrency->getId() != $defaultCurrency->getId()) {
$productPrice->setFromDefaultCurrency(true);
$this->updatePriceFromDefaultCurrency($productPrice, $saleElement, $defaultCurrency, $currentCurrency);
}
}
// Caclulate prices if we have to use the rate * defaulkt currency price
if ($productPrice->getFromDefaultCurrency() == true) {
$this->updatePriceFromDefaultCurrency($productPrice, $saleElement, $defaultCurrency, $currentCurrency);
}
$isDefaultPse = count($saleElement->getAttributeCombinations()) == 0;
@@ -219,18 +257,19 @@ class ProductController extends AbstractCrudController
"product_sale_element_id" => $saleElement->getId(),
"reference" => $saleElement->getRef(),
"price" => $productPrice->getPrice(),
"price_with_tax" => $this->computePrice($productPrice->getPrice(), 'without_tax', $object),
"use_exchange_rate" => $productPrice->getFromDefaultCurrency() ? 1 : 0,
"tax_rule" => $object->getTaxRuleId(),
"currency" => $productPrice->getCurrencyId(),
"weight" => $saleElement->getWeight(),
"quantity" => $saleElement->getQuantity(),
"sale_price" => $productPrice->getPromoPrice(),
"sale_price_with_tax" => $this->computePrice($productPrice->getPromoPrice(), 'without_tax', $object),
"onsale" => $saleElement->getPromo() > 0 ? 1 : 0,
"isnew" => $saleElement->getNewness() > 0 ? 1 : 0,
"isdefault" => $saleElement->getIsDefault() > 0 ? 1 : 0,
"ean_code" => $saleElement->getEanCode()
);
}
else {
}
@@ -242,7 +281,7 @@ class ProductController extends AbstractCrudController
$this->getParserContext()->addForm($combinationPseForm);
}
// Prepare the data that will hydrate the form
// Prepare the data that will hydrate the form(s)
$data = array(
'id' => $object->getId(),
'ref' => $object->getRef(),
@@ -254,8 +293,6 @@ class ProductController extends AbstractCrudController
'visible' => $object->getVisible(),
'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
'default_category' => $object->getDefaultCategoryId()
// A terminer pour les prix
);
// Setup the object form
@@ -847,7 +884,7 @@ class ProductController extends AbstractCrudController
protected function processProductSaleElementUpdate($changeForm) {
// Check current user authorization
if (null !== $response = $this->checkAuth("admin.products.update")) return $response;
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
$error_msg = false;
@@ -875,7 +912,8 @@ class ProductController extends AbstractCrudController
->setIsnew($data['isnew'])
->setIsdefault($data['isdefault'])
->setEanCode($data['ean_code'])
->setTaxrule($data['tax_rule'])
->setTaxRuleId($data['tax_rule'])
->setFromDefaultCurrency($data['use_exchange_rate'])
;
$this->dispatch(TheliaEvents::PRODUCT_UPDATE_PRODUCT_SALE_ELEMENT, $event);
@@ -928,24 +966,102 @@ class ProductController extends AbstractCrudController
);
}
/**
* Invoked through Ajax; this methow calculate the taxed price from the unaxed price, and
* vice versa.
*/
public function priceCaclulator() {
$price = floatval($this->getRequest()->get('price', 0));
$tax_rule = intval($this->getRequest()->get('tax_rule_id', 0)); // The tax rule ID
$action = $this->getRequest()->get('action', ''); // With ot without tax
$convert = intval($this->getRequest()->get('convert_from_default_currency', 0));
$return_price = 0;
$price = floatval($this->getRequest()->get('price', 0));
$product_id = intval($this->getRequest()->get('product_id', 0));
$action = $this->getRequest()->get('action', ''); // With ot without tax
$convert = intval($this->getRequest()->get('convert_from_default_currency', 0));
if (null !== $product = ProductQuery::create()->findPk($product_id)) {
if ($action == 'to_tax') {
$return_price = $this->computePrice($price, 'without_tax', $product);
}
else if ($action == 'from_tax') {
$return_price = $this->computePrice($price, 'with_tax', $product);
}
else {
$return_price = $price;
}
if ($convert != 0) {
$return_price = $prix * Currency::getDefaultCurrency()->getRate();
}
}
return new JsonResponse(array('result' => $return_price));
}
public function loadConvertedPrices() {
$product_sale_element_id = intval($this->getRequest()->get('product_sale_element_id', 0));
$currency_id = intval($this->getRequest()->get('currency_id', 0));
$price_with_tax = $price_without_tax = $sale_price_with_tax = $sale_price_without_tax = 0;
if (null !== $pse = ProductSaleElementsQuery::create()->findPk($product_sale_element_id)) {
if ($currency_id > 0
&&
$currency_id != Currency::getDefaultCurrency()->getId()
&&
null !== $currency = CurrencyQuery::create()->findPk($currency_id)) {
// Get the default currency price
$productPrice = ProductPriceQuery::create()
->filterByCurrency(Currency::getDefaultCurrency())
->filterByProductSaleElementsId($product_sale_element_id)
->findOne()
;
// Calculate the converted price
if (null !== $productPrice) {
$price_without_tax = $productPrice->getPrice() * $currency->getRate();
$sale_price_without_tax = $productPrice->getPromoPrice() * $currency->getRate();
}
}
if (null !== $product = $pse->getProduct()) {
$price_with_tax = $this->computePrice($price_without_tax, 'with_tax', $product);
$sale_price_with_tax = $this->computePrice($sale_price_without_tax, 'with_tax', $product);
}
}
return new JsonResponse(array(
'price_with_tax' => NumberFormat::getInstance($this->getRequest())->format($price_with_tax, null, '.'),
'price_without_tax' => NumberFormat::getInstance($this->getRequest())->format($price_without_tax, null, '.'),
'sale_price_with_tax' => NumberFormat::getInstance($this->getRequest())->format($sale_price_with_tax, null, '.'),
'sale_price_without_tax' => NumberFormat::getInstance($this->getRequest())->format($sale_price_without_tax, null, '.')
));
}
/**
* Calculate taxed/untexted price for a product
*
* @param unknown $price
* @param unknown $price_type
* @param Product $product
* @return Ambigous <unknown, number>
*/
protected function computePrice($price, $price_type, Product $product, $convert = false) {
$calc = new Calculator();
$calc->loadTaxRule(
TaxRuleQuery::create()->findPk($tax_rule),
$calc->load(
$product,
Country::getShopLocation()
);
if ($action == 'to_tax') {
if ($price_type == 'without_tax') {
$return_price = $calc->getTaxedPrice($price);
}
else if ($action == 'from_tax') {
else if ($price_type == 'with_tax') {
$return_price = $calc->getUntaxedPrice($price);
}
else {
@@ -955,10 +1071,7 @@ class ProductController extends AbstractCrudController
if ($convert != 0) {
$return_price = $prix * Currency::getDefaultCurrency()->getRate();
}
// Format the number using '.', to perform further calculation
$return_price = NumberFormat::getInstance($this->getRequest())->format($return_price, null, '.');
return new JsonResponse(array('result' => $return_price));
return NumberFormat::getInstance($this->getRequest())->format($return_price, null, '.');
}
}

View File

@@ -61,6 +61,13 @@ class CartController extends BaseFrontController
$message = $e->getMessage();
}
// If Ajax Request
if ($this->getRequest()->isXmlHttpRequest()) {
$request = $this->getRequest();
$request->attributes->set('_view', "includes/mini-cart");
}
if ($message) {
$cartAdd->setErrorMessage($message);
$this->getParserContext()->addForm($cartAdd);

View File

@@ -46,7 +46,7 @@ class ContactController extends BaseFrontController
$form = $this->validateForm($contactForm);
$message = \Swift_Message::newInstance($form->get('subject')->getData())
->addFrom($form->get('email')->getData(), $form->get('firstname')->getData().' '.$form->get('lastname')->getData())
->addFrom($form->get('email')->getData(), $form->get('name')->getData())
->addTo(ConfigQuery::read('contact_email'), ConfigQuery::read('company_name'))
->setBody($form->get('message')->getData())
;

View File

@@ -25,17 +25,19 @@ namespace Thelia\Controller\Front;
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
use Thelia\Core\Event\Customer\CustomerLoginEvent;
use Thelia\Core\Event\LostPasswordEvent;
use Thelia\Core\Event\Newsletter\NewsletterEvent;
use Thelia\Core\Security\Authentication\CustomerUsernamePasswordFormAuthenticator;
use Thelia\Core\Security\Exception\AuthenticationException;
use Thelia\Core\Security\Exception\UsernameNotFoundException;
use Thelia\Form\CustomerCreation;
use Thelia\Form\CustomerCreateForm;
use Thelia\Form\CustomerLogin;
use Thelia\Form\CustomerLostPasswordForm;
use Thelia\Form\CustomerUpdateForm;
use Thelia\Form\CustomerPasswordUpdateForm;
use Thelia\Form\CustomerProfilUpdateForm;
use Thelia\Form\Exception\FormValidationException;
use Thelia\Model\Customer;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\CustomerQuery;
use Thelia\Model\NewsletterQuery;
use Thelia\Tools\URL;
use Thelia\Log\Tlog;
use Thelia\Core\Security\Exception\WrongPasswordException;
@@ -49,6 +51,7 @@ class CustomerController extends BaseFrontController
{
use \Thelia\Cart\CartTrait;
public function newPasswordAction()
{
if (! $this->getSecurityContext()->hasCustomerUser()) {
@@ -93,7 +96,7 @@ class CustomerController extends BaseFrontController
$message = false;
$customerCreation = new CustomerCreation($this->getRequest());
$customerCreation = new CustomerCreateForm($this->getRequest());
try {
$form = $this->validateForm($customerCreation, "post");
@@ -129,12 +132,6 @@ class CustomerController extends BaseFrontController
}
}
protected function getExistingCustomer($customer_id)
{
return CustomerQuery::create()
->findOneById($customer_id);
}
/**
* Update customer data. On success, redirect to success_url if exists.
* Otherwise, display the same view again.
@@ -150,12 +147,51 @@ class CustomerController extends BaseFrontController
'firstname' => $customer->getFirstName(),
'lastname' => $customer->getLastName(),
'email' => $customer->getEmail(),
'newsletter' => null !== NewsletterQuery::create()->findOneByEmail($customer->getEmail()),
);
$customerUpdateForm = new CustomerUpdateForm($this->getRequest(), 'form', $data);
$customerProfilUpdateForm = new CustomerProfilUpdateForm($this->getRequest(), 'form', $data);
// Pass it to the parser
$this->getParserContext()->addForm($customerUpdateForm);
$this->getParserContext()->addForm($customerProfilUpdateForm);
}
public function updatePasswordAction()
{
if ($this->getSecurityContext()->hasCustomerUser()) {
$message = false;
$customerPasswordUpdateForm = new CustomerPasswordUpdateForm($this->getRequest());
try {
$customer = $this->getSecurityContext()->getCustomerUser();
$form = $this->validateForm($customerPasswordUpdateForm, "post");
$customerChangeEvent = $this->createEventInstance($form->getData());
$customerChangeEvent->setCustomer($customer);
$this->dispatch(TheliaEvents::CUSTOMER_UPDATEPROFIL, $customerChangeEvent);
$this->redirectSuccess($customerPasswordUpdateForm);
} catch (FormValidationException $e) {
$message = sprintf("Please check your input: %s", $e->getMessage());
} catch (\Exception $e) {
$message = sprintf("Sorry, an error occured: %s", $e->getMessage());
}
if ($message !== false) {
Tlog::getInstance()->error(sprintf("Error during customer password modification process : %s.", $message));
$customerPasswordUpdateForm->setErrorMessage($message);
$this->getParserContext()
->addForm($customerPasswordUpdateForm)
->setGeneralError($message)
;
}
}
}
public function updateAction()
@@ -164,21 +200,43 @@ class CustomerController extends BaseFrontController
$message = false;
$customerUpdateForm = new CustomerUpdateForm($this->getRequest());
$customerProfilUpdateForm = new CustomerProfilUpdateForm($this->getRequest());
try {
$customer = $this->getSecurityContext()->getCustomerUser();
$newsletterOldEmail = $customer->getEmail();
$form = $this->validateForm($customerUpdateForm, "post");
$form = $this->validateForm($customerProfilUpdateForm, "post");
$customerChangeEvent = $this->createEventInstance($form->getData());
$customerChangeEvent->setCustomer($customer);
$this->dispatch(TheliaEvents::CUSTOMER_UPDATEACCOUNT, $customerChangeEvent);
$this->dispatch(TheliaEvents::CUSTOMER_UPDATEPROFIL, $customerChangeEvent);
$this->processLogin($customerChangeEvent->getCustomer());
$updatedCustomer = $customerChangeEvent->getCustomer();
$this->redirectSuccess($customerUpdateForm);
// Newsletter
if (true === $form->get('newsletter')->getData()) {
$nlEvent = new NewsletterEvent($updatedCustomer->getEmail(), $this->getRequest()->getSession()->getLang()->getLocale());
$nlEvent->setFirstname($updatedCustomer->getFirstname());
$nlEvent->setLastname($updatedCustomer->getLastname());
if(null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterOldEmail)) {
$nlEvent->setId($newsletter->getId());
$this->dispatch(TheliaEvents::NEWSLETTER_UPDATE, $nlEvent);
} else {
$this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $nlEvent);
}
} else {
if(null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterOldEmail)) {
$nlEvent = new NewsletterEvent($updatedCustomer->getEmail(), $this->getRequest()->getSession()->getLang()->getLocale());
$nlEvent->setId($newsletter->getId());
$this->dispatch(TheliaEvents::NEWSLETTER_UNSUBSCRIBE, $nlEvent);
}
}
$this->processLogin($updatedCustomer);
$this->redirectSuccess($customerProfilUpdateForm);
} catch (FormValidationException $e) {
$message = sprintf("Please check your input: %s", $e->getMessage());
@@ -189,10 +247,10 @@ class CustomerController extends BaseFrontController
if ($message !== false) {
Tlog::getInstance()->error(sprintf("Error during customer modification process : %s.", $message));
$customerUpdateForm->setErrorMessage($message);
$customerProfilUpdateForm->setErrorMessage($message);
$this->getParserContext()
->addForm($customerUpdateForm)
->addForm($customerProfilUpdateForm)
->setGeneralError($message)
;
}
@@ -289,9 +347,9 @@ class CustomerController extends BaseFrontController
private function createEventInstance($data)
{
$customerCreateEvent = new CustomerCreateOrUpdateEvent(
$data["title"],
$data["firstname"],
$data["lastname"],
isset($data["title"])?$data["title"]:null,
isset($data["firstname"])?$data["firstname"]:null,
isset($data["lastname"])?$data["lastname"]:null,
isset($data["address1"])?$data["address1"]:null,
isset($data["address2"])?$data["address2"]:null,
isset($data["address3"])?$data["address3"]:null,

View File

@@ -62,17 +62,32 @@ class NewsletterController extends BaseFrontController
$error_message = $e->getMessage();
}
if($error_message !== false) {
\Thelia\Log\Tlog::getInstance()->error(sprintf('Error during newsletter subscription : %s', $error_message));
\Thelia\Log\Tlog::getInstance()->error(sprintf('Error during newsletter subscription : %s', $error_message));
// If Ajax Request
if ($this->getRequest()->isXmlHttpRequest()) {
if ($error_message) {
$response = $this->jsonResponse(json_encode(array(
"success" => false,
"message" => $error_message
)));
} else {
$response = $this->jsonResponse(json_encode(array(
"success" => true,
"message" => "Thanks for signing up! We'll keep you posted whenever we have any new updates."
)));;
}
return $response;
} else {
$newsletterForm->setErrorMessage($error_message);
$this->getParserContext()
->addForm($newsletterForm)
->setGeneralError($error_message)
;
} else {
$this->redirectToRoute('newsletter.success');
}
}
}

View File

@@ -32,6 +32,11 @@ use Thelia\Core\Event\ActionEvent;
*/
class NewsletterEvent extends ActionEvent
{
/**
* @var string email to save
*/
protected $id;
/**
* @var string email to save
*/
@@ -138,6 +143,22 @@ class NewsletterEvent extends ActionEvent
return $this->locale;
}
/**
* @param string $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getId()
{
return $this->id;
}

View File

@@ -41,7 +41,8 @@ class ProductSaleElementUpdateEvent extends ProductSaleElementEvent
protected $isnew;
protected $isdefault;
protected $ean_code;
protected $taxrule;
protected $tax_rule_id;
protected $from_default_currency;
public function __construct(Product $product, $product_sale_element_id)
{
@@ -196,16 +197,27 @@ class ProductSaleElementUpdateEvent extends ProductSaleElementEvent
return $this;
}
public function getTaxrule()
public function getTaxRuleId()
{
return $this->taxrule;
return $this->tax_rule_id;
}
public function setTaxrule($taxrule)
public function setTaxRuleId($tax_rule_id)
{
$this->taxrule = $taxrule;
$this->tax_rule_id = $tax_rule_id;
return $this;
}
public function getFromDefaultCurrency()
{
return $this->from_default_currency;
}
public function setFromDefaultCurrency($from_default_currency)
{
$this->from_default_currency = $from_default_currency;
return $this;
}
}

View File

@@ -71,6 +71,11 @@ final class TheliaEvents
*/
const CUSTOMER_UPDATEACCOUNT = "action.updateCustomer";
/**
* sent on customer account update profil
*/
const CUSTOMER_UPDATEPROFIL = "action.updateProfilCustomer";
/**
* sent on customer removal
*/
@@ -695,6 +700,8 @@ final class TheliaEvents
* sent for subscribing to the newsletter
*/
const NEWSLETTER_SUBSCRIBE = 'thelia.newsletter.subscribe';
const NEWSLETTER_UPDATE = 'thelia.newsletter.update';
const NEWSLETTER_UNSUBSCRIBE = 'thelia.newsletter.unsubscribe';
/************ LANG MANAGEMENT ****************************/

View File

@@ -12,8 +12,11 @@ namespace Thelia\Core\Template\Loop;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Model\CountryQuery;
use Thelia\Type;
use Thelia\Type\TypeCollection;
class Cart extends BaseLoop
{
@@ -40,7 +43,8 @@ class Cart extends BaseLoop
protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntTypeArgument('limit'),
Argument::createAnyTypeArgument('position')
);
}
@@ -74,6 +78,7 @@ class Cart extends BaseLoop
{
$cart = $this->getCart($this->request);
$cartItems = $cart->getCartItems();
$result = new LoopResult($cartItems);
@@ -81,9 +86,32 @@ class Cart extends BaseLoop
return $result;
}
$limit = $this->getLimit();
$countCartItems = count($cartItems);
if($limit <= 0 || $limit >= $countCartItems){
$limit = $countCartItems;
}
$position = $this->getPosition();
if(isset($position)){
if($position == "first"){
$limit = 1;
$cartItems = array($cartItems[0]);
}else if($position == "last"){
$limit = 1;
$cartItems = array(end($cartItems));
}
// @TODO : if the position is a number
}
$taxCountry = CountryQuery::create()->findPk(64); // @TODO : make it magic;
foreach ($cartItems as $cartItem) {
for ($i=0; $i<$limit; $i ++) {
$cartItem = $cartItems[$i];
$product = $cartItem->getProduct();
$productSaleElement = $cartItem->getProductSaleElements();

View File

@@ -1001,6 +1001,7 @@ class Product extends BaseI18nLoop
->set("PREVIOUS" , $previous != null ? $previous->getId() : -1)
->set("NEXT" , $next != null ? $next->getId() : -1)
->set("DEFAULT_CATEGORY" , $default_category_id)
->set("TAX_RULE_ID" , $product->getTaxRuleId())
;

View File

@@ -8,6 +8,7 @@ use \Symfony\Component\EventDispatcher\EventDispatcherInterface;
use \Smarty;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Thelia\Core\Template\ParserInterface;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
@@ -139,7 +140,7 @@ class SmartyParser extends Smarty implements ParserInterface
try {
$templateFile = $this->getTemplateFilePath();
} catch (\RuntimeException $e) {
return new Response($e->getMessage(), "404");
return new Response($this->render(\Thelia\Model\ConfigQuery::getPageNotFoundView()), "404");
}
return $this->render($templateFile);

View File

@@ -22,6 +22,8 @@
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
@@ -57,115 +59,122 @@ class AddressCreateForm extends BaseForm
{
$this->formBuilder
->add("label", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Address label"),
"label_attr" => array(
"for" => "label_create"
),
"required" => true
))
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Address label"),
"label_attr" => array(
"for" => "address_label"
)
))
->add("title", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Title"),
"label_attr" => array(
"for" => "title_create"
)
))
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Title"),
"label_attr" => array(
"for" => "title"
)
))
->add("firstname", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Firstname"),
"label_attr" => array(
"for" => "firstname_create"
)
))
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("First Name"),
"label_attr" => array(
"for" => "firstname"
)
))
->add("lastname", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Lastname"),
"label_attr" => array(
"for" => "lastname_create"
)
))
->add("address1", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Street Address"),
"label_attr" => array(
"for" => "address1_create"
)
))
->add("address2", "text", array(
"label" => Translator::getInstance()->trans("Additional address"),
"label_attr" => array(
"for" => "address2_create"
)
))
->add("address3", "text", array(
"label" => Translator::getInstance()->trans("Additional address"),
"label_attr" => array(
"for" => "address3_create"
)
))
->add("zipcode", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Zip code"),
"label_attr" => array(
"for" => "zipcode_create"
)
))
->add("city", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("City"),
"label_attr" => array(
"for" => "city_create"
)
))
->add("country", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Country"),
"label_attr" => array(
"for" => "country_create"
)
))
->add("phone", "text", array(
"label" => Translator::getInstance()->trans("Phone"),
"label_attr" => array(
"for" => "phone_create"
)
))
->add("cellphone", "text", array(
"label" => Translator::getInstance()->trans("Cellphone"),
"label_attr" => array(
"for" => "cellphone_create"
)
))
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Last Name"),
"label_attr" => array(
"for" => "lastname"
)
))
->add("company", "text", array(
"label" => Translator::getInstance()->trans("Company"),
"label_attr" => array(
"for" => "company_create"
)
))
->add("is_default", "integer", array(
"label" => Translator::getInstance()->trans("Make this address has my primary address"),
"label_attr" => array(
"for" => "default_address"
)
))
;
"label" => Translator::getInstance()->trans("Company Name"),
"label_attr" => array(
"for" => "company"
),
"required" => false
))
->add("address1", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Street Address"),
"label_attr" => array(
"for" => "address1"
)
))
->add("address2", "text", array(
"label" => Translator::getInstance()->trans("Address Line 2"),
"label_attr" => array(
"for" => "address2"
),
"required" => false
))
->add("address3", "text", array(
"label" => Translator::getInstance()->trans("Address Line 3"),
"label_attr" => array(
"for" => "address3"
),
"required" => false
))
->add("city", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("City"),
"label_attr" => array(
"for" => "city"
)
))
->add("zipcode", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Zip code"),
"label_attr" => array(
"for" => "zipcode"
)
))
->add("country", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Country"),
"label_attr" => array(
"for" => "country"
)
))
// Phone
->add("phone", "text", array(
"label" => Translator::getInstance()->trans("Phone"),
"label_attr" => array(
"for" => "phone"
),
"required" => false
))
->add("cellphone", "text", array(
"label" => Translator::getInstance()->trans("Cellphone"),
"label_attr" => array(
"for" => "cellphone"
),
"required" => false
))
// Default address
->add("is_default", "checkbox", array(
"label" => Translator::getInstance()->trans("Make this address has my primary address"),
"label_attr" => array(
"for" => "default_address"
),
"required" => false
))
;
}
/**

View File

@@ -22,8 +22,6 @@
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
/**
* Class AddressUpdateForm
@@ -32,136 +30,11 @@ use Thelia\Core\Translation\Translator;
*/
class AddressUpdateForm extends AddressCreateForm
{
/**
*
* in this function you add all the fields you need for your Form.
* Form this you have to call add method on $this->formBuilder attribute :
*
* $this->formBuilder->add("name", "text")
* ->add("email", "email", array(
* "attr" => array(
* "class" => "field"
* ),
* "label" => "email",
* "constraints" => array(
* new \Symfony\Component\Validator\Constraints\NotBlank()
* )
* )
* )
* ->add('age', 'integer');
*
* @return null
*/
protected function buildForm()
{
parent::buildForm();
$this->formBuilder
->add("label", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Address label *"),
"label_attr" => array(
"for" => "label_update"
),
"required" => true
))
->add("title", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Title"),
"label_attr" => array(
"for" => "title_update"
)
))
->add("firstname", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Firstname"),
"label_attr" => array(
"for" => "firstname_update"
)
))
->add("lastname", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Lastname"),
"label_attr" => array(
"for" => "lastname_update"
)
))
->add("address1", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Street Address"),
"label_attr" => array(
"for" => "address1_update"
)
))
->add("address2", "text", array(
"label" => Translator::getInstance()->trans("Additional address"),
"label_attr" => array(
"for" => "address2_update"
)
))
->add("address3", "text", array(
"label" => Translator::getInstance()->trans("Additional address"),
"label_attr" => array(
"for" => "address3_update"
)
))
->add("zipcode", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Zip code"),
"label_attr" => array(
"for" => "zipcode_update"
)
))
->add("city", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("City"),
"label_attr" => array(
"for" => "city_update"
)
))
->add("country", "text", array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Country"),
"label_attr" => array(
"for" => "country_update"
)
))
->add("phone", "text", array(
"label" => Translator::getInstance()->trans("Phone"),
"label_attr" => array(
"for" => "phone_update"
)
))
->add("cellphone", "text", array(
"label" => Translator::getInstance()->trans("Cellphone"),
"label_attr" => array(
"for" => "cellphone_update"
)
))
->add("company", "text", array(
"label" => Translator::getInstance()->trans("Compagny"),
"label_attr" => array(
"for" => "company_update"
)
))
;
}
/**

View File

@@ -99,8 +99,8 @@ class CartAdd extends BaseForm
"for" => "quantity"
)
))
->add("append", "hidden")
->add("newness", "hidden")
->add("append", "integer")
->add("newness", "integer")
;
}

View File

@@ -59,22 +59,13 @@ class ContactForm extends BaseForm
protected function buildForm()
{
$this->formBuilder
->add('firstname', 'text', array(
->add('name', 'text', array(
'constraints' => array(
new NotBlank()
),
'label' => Translator::getInstance()->trans('firstname'),
'label' => Translator::getInstance()->trans('Full Name'),
'label_attr' => array(
'for' => 'firstname_contact'
)
))
->add('lastname', 'text', array(
'constraints' => array(
new NotBlank()
),
'label' => Translator::getInstance()->trans('lastname'),
'label_attr' => array(
'for' => 'lastname_contact'
'for' => 'name_contact'
)
))
->add('email', 'email', array(
@@ -82,7 +73,7 @@ class ContactForm extends BaseForm
new NotBlank(),
new Email()
),
'label' => Translator::getInstance()->trans('email'),
'label' => Translator::getInstance()->trans('Your Email Address'),
'label_attr' => array(
'for' => 'email_contact'
)
@@ -91,7 +82,7 @@ class ContactForm extends BaseForm
'constraints' => array(
new NotBlank()
),
'label' => Translator::getInstance()->trans('subject'),
'label' => Translator::getInstance()->trans('Subject'),
'label_attr' => array(
'for' => 'subject_contact'
)
@@ -100,7 +91,7 @@ class ContactForm extends BaseForm
'constraints' => array(
new NotBlank()
),
'label' => Translator::getInstance()->trans('message'),
'label' => Translator::getInstance()->trans('Your Message'),
'label_attr' => array(
'for' => 'message_contact'
)

View File

@@ -0,0 +1,124 @@
<?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\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\ConfigQuery;
use Thelia\Model\CustomerQuery;
use Thelia\Core\Translation\Translator;
/**
* Class CustomerCreateForm
* @package Thelia\Form
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class CustomerCreateForm extends AddressCreateForm
{
protected function buildForm()
{
parent::buildForm();
$this->formBuilder
// Remove From Address create form
->remove("label")
->remove("is_default")
// Add
->add("auto_login", "integer")
// Add Email address
->add("email", "email", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Email(),
new Constraints\Callback(array(
"methods" => array(
array($this,
"verifyExistingEmail")
)
))
),
"label" => Translator::getInstance()->trans("Email Address"),
"label_attr" => array(
"for" => "email"
)
))
// Add Login Information
->add("password", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4)))
),
"label" => Translator::getInstance()->trans("Password"),
"label_attr" => array(
"for" => "password"
)
))
->add("password_confirm", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4))),
new Constraints\Callback(array("methods" => array(
array($this, "verifyPasswordField")
)))
),
"label" => "Password confirmation",
"label_attr" => array(
"for" => "password_confirmation"
)
))
// Add terms & conditions
->add("agreed", "checkbox", array(
"constraints" => array(
new Constraints\True(array("message" => "Please accept the Terms and conditions in order to register."))
),
"label_attr" => array(
"for" => "agreed"
)
));
}
public function verifyPasswordField($value, ExecutionContextInterface $context)
{
$data = $context->getRoot()->getData();
if ($data["password"] != $data["password_confirm"]) {
$context->addViolation("password confirmation is not the same as password field.");
}
}
public function verifyExistingEmail($value, ExecutionContextInterface $context)
{
$customer = CustomerQuery::getCustomerByEmail($value);
if ($customer) {
$context->addViolation("This email already exists.");
}
}
public function getName()
{
return "thelia_customer_create";
}
}

View File

@@ -1,234 +0,0 @@
<?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\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\ConfigQuery;
use Thelia\Model\CustomerQuery;
use Thelia\Core\Translation\Translator;
/**
* Class CustomerCreation
* @package Thelia\Form
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class CustomerCreation extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add("auto_login", "integer")
// Personal Informations
->add("title", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Title"),
"label_attr" => array(
"for" => "title"
)
))
->add("firstname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("First Name"),
"label_attr" => array(
"for" => "firstname"
)
))
->add("lastname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Last Name"),
"label_attr" => array(
"for" => "lastname"
)
))
->add("email", "email", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Email(),
new Constraints\Callback(array(
"methods" => array(
array($this,
"verifyExistingEmail")
)
))
),
"label" => Translator::getInstance()->trans("Email Address"),
"label_attr" => array(
"for" => "email"
)
))
/* ->add("email_confirm", "email", array(
"constraints" => array(
new Constraints\Callback(array(
"methods" => array(
array($this,
"verifyEmailField")
)
))
),
"label" => "email confirmation"
))*/
->add("phone", "text", array(
"label" => Translator::getInstance()->trans("Phone"),
"label_attr" => array(
"for" => "phone"
),
"required" => false
))
->add("cellphone", "text", array(
"label" => Translator::getInstance()->trans("Cellphone"),
"label_attr" => array(
"for" => "cellphone"
),
"required" => false
))
// Delivery Informations
->add("company", "text", array(
"label" => Translator::getInstance()->trans("Company Name"),
"label_attr" => array(
"for" => "company"
),
"required" => false
))
->add("address1", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Street Address"),
"label_attr" => array(
"for" => "address1"
)
))
->add("address2", "text", array(
"label" => Translator::getInstance()->trans("Address Line 2"),
"label_attr" => array(
"for" => "address2"
),
"required" => false
))
->add("address3", "text", array(
"label" => Translator::getInstance()->trans("Address Line 3"),
"label_attr" => array(
"for" => "address3"
),
"required" => false
))
->add("city", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("City"),
"label_attr" => array(
"for" => "city"
)
))
->add("zipcode", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Zip code"),
"label_attr" => array(
"for" => "zipcode"
)
))
->add("country", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Country"),
"label_attr" => array(
"for" => "country"
)
))
// Login Information
->add("password", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4)))
),
"label" => Translator::getInstance()->trans("Password"),
"label_attr" => array(
"for" => "password"
)
))
->add("password_confirm", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4))),
new Constraints\Callback(array("methods" => array(
array($this, "verifyPasswordField")
)))
),
"label" => "Password confirmation",
"label_attr" => array(
"for" => "password_confirmation"
)
))
->add("agreed", "checkbox", array(
"constraints" => array(
new Constraints\True(array("message" => "Please accept the Terms and conditions in order to register."))
),
"label_attr" => array(
"for" => "agreed"
)
));
}
public function verifyPasswordField($value, ExecutionContextInterface $context)
{
$data = $context->getRoot()->getData();
if ($data["password"] != $data["password_confirm"]) {
$context->addViolation("password confirmation is not the same as password field");
}
}
public function verifyEmailField($value, ExecutionContextInterface $context)
{
$data = $context->getRoot()->getData();
if ($data["email"] != $data["email_confirm"]) {
$context->addViolation("email confirmation is not the same as email field");
}
}
public function verifyExistingEmail($value, ExecutionContextInterface $context)
{
$customer = CustomerQuery::create()->findOneByEmail($value);
if ($customer) {
$context->addViolation("This email already exists");
}
}
public function getName()
{
return "thelia_customer_creation";
}
}

View File

@@ -73,9 +73,11 @@ class CustomerLogin extends BaseForm
"data" => 0
))
->add("password", "password", array(
/*"constraints" => array(
new Constraints\NotBlank()
),*/
"constraints" => array(
new Constraints\NotBlank(array(
'groups' => array('existing_customer'),
))
),
"label" => Translator::getInstance()->trans("Please enter your password"),
"label_attr" => array(
"for" => "password"

View File

@@ -1,164 +0,0 @@
<?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\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Core\Translation\Translator;
/**
* Class CustomerModification
* @package Thelia\Form
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class CustomerModification extends BaseForm
{
/**
*
* in this function you add all the fields you need for your Form.
* Form this you have to call add method on $this->form attribute :
*
* $this->form->add("name", "text")
* ->add("email", "email", array(
* "attr" => array(
* "class" => "field"
* ),
* "label" => "email",
* "constraints" => array(
* new NotBlank()
* )
* )
* )
* ->add('age', 'integer');
*
* @return null
*/
protected function buildForm()
{
$this->formBuilder
->add('update_logged_in_user', 'integer') // In a front office context, update the in-memory logged-in user data
->add("company", "text", array(
"label" => Translator::getInstance()->trans("Company"),
"label_attr" => array(
"for" => "company"
)
))
->add("firstname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("First Name"),
"label_attr" => array(
"for" => "firstname"
)
))
->add("lastname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Last Name"),
"label_attr" => array(
"for" => "lastname"
)
))
->add("address1", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label_attr" => array(
"for" => "address"
),
"label" => Translator::getInstance()->trans("Street Address")
))
->add("address2", "text", array(
"label" => Translator::getInstance()->trans("Address Line 2"),
"label_attr" => array(
"for" => "address2"
)
))
->add("address3", "text", array(
"label" => Translator::getInstance()->trans("Address Line 3"),
"label_attr" => array(
"for" => "address3"
)
))
->add("phone", "text", array(
"label" => Translator::getInstance()->trans("Phone"),
"label_attr" => array(
"for" => "phone"
)
))
->add("cellphone", "text", array(
"label" => Translator::getInstance()->trans("Cellphone"),
"label_attr" => array(
"for" => "cellphone"
)
))
->add("zipcode", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Zip code"),
"label_attr" => array(
"for" => "zipcode"
)
))
->add("city", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("City"),
"label_attr" => array(
"for" => "city"
)
))
->add("country", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Country"),
"label_attr" => array(
"for" => "country"
)
))
->add("title", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Title"),
"label_attr" => array(
"for" => "title"
)
))
;
}
/**
* @return string the name of you form. This name must be unique
*/
public function getName()
{
return "thelia_customer_modification";
}
}

View File

@@ -0,0 +1,102 @@
<?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\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Translation\Translator;
use Thelia\Model\CustomerQuery;
/**
* Class CustomerPasswordUpdateForm
* @package Thelia\Form
* @author Christophe Laffont <claffont@openstudio.fr>
*/
class CustomerPasswordUpdateForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
// Login Information
->add("password_old", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Callback(array("methods" => array(
array($this, "verifyCurrentPasswordField")
)))
),
"label" => Translator::getInstance()->trans("Current Password"),
"label_attr" => array(
"for" => "password_old"
)
))
->add("password", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4)))
),
"label" => Translator::getInstance()->trans("New Password"),
"label_attr" => array(
"for" => "password"
)
))
->add("password_confirm", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4))),
new Constraints\Callback(array("methods" => array(
array($this, "verifyPasswordField")
)))
),
"label" => "Password confirmation",
"label_attr" => array(
"for" => "password_confirmation"
)
));
}
public function verifyCurrentPasswordField($value, ExecutionContextInterface $context)
{
// Check if value of the old password match the password of the current user
if (!password_verify($value, $this->getRequest()->getSession()->getCustomerUser()->getPassword())) {
$context->addViolation("Your current password does not match.");
}
}
public function verifyPasswordField($value, ExecutionContextInterface $context)
{
$data = $context->getRoot()->getData();
if ($data["password"] != $data["password_confirm"]) {
$context->addViolation("Password confirmation is not the same as password field.");
}
}
public function getName()
{
return "thelia_customer_password_update";
}
}

View File

@@ -0,0 +1,90 @@
<?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\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\CustomerQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Translation\Translator;
/**
* Class CustomerProfilUpdateForm
* @package Thelia\Form
* @author Christophe Laffont <claffont@openstudio.fr>
*/
class CustomerProfilUpdateForm extends CustomerCreateForm
{
protected function buildForm()
{
parent::buildForm();
$this->formBuilder
->remove("auto_login")
// Remove From Personal Informations
->remove("phone")
->remove("cellphone")
// Remove Delivery Informations
->remove("company")
->remove("address1")
->remove("address2")
->remove("address3")
->remove("city")
->remove("zipcode")
->remove("country")
// Remove Login Information
->remove("password")
->remove("password_confirm")
// Remove Terms & conditions
->remove("agreed")
// Add Newsletter
->add("newsletter", "checkbox", array(
"label" => "I would like to receive the newsletter our the latest news.",
"label_attr" => array(
"for" => "newsletter"
),
"required" => false
));
}
/**
* @param $value
* @param ExecutionContextInterface $context
*/
public function verifyExistingEmail($value, ExecutionContextInterface $context)
{
$customer = CustomerQuery::getCustomerByEmail($value);
// If there is already a customer for this email address and if the customer is different from the current user, do a violation
if ($customer && $customer->getId() != $this->getRequest()->getSession()->getCustomerUser()->getId()) {
$context->addViolation("This email already exists.");
}
}
public function getName()
{
return "thelia_customer_profil_update";
}
}

View File

@@ -1,10 +1,10 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
@@ -17,57 +17,146 @@
/* 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/>. */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Translation\Translator;
/**
* Class CustomerUpdateForm
* @package Thelia\Form
* @author Christophe Laffont <claffont@openstudio.fr>
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class CustomerUpdateForm extends CustomerCreation
class CustomerUpdateForm extends BaseForm
{
/**
*
* in this function you add all the fields you need for your Form.
* Form this you have to call add method on $this->form attribute :
*
* $this->form->add("name", "text")
* ->add("email", "email", array(
* "attr" => array(
* "class" => "field"
* ),
* "label" => "email",
* "constraints" => array(
* new NotBlank()
* )
* )
* )
* ->add('age', 'integer');
*
* @return null
*/
protected function buildForm()
{
parent::buildForm();
$this->formBuilder
->remove("auto_login")
// Remove From Personal Informations
->remove("phone")
->remove("cellphone")
// Remove Delivery Informations
->remove("company")
->remove("address1")
->remove("address2")
->remove("address3")
->remove("city")
->remove("zipcode")
->remove("country")
// Remove Login Information
->remove("password")
->remove("password_confirm")
// Remove Terms & conditions
->remove("agreed")
// Add Newsletter
->add("newsletter", "checkbox", array(
"label" => "I would like to receive the newsletter our the latest news.",
->add('update_logged_in_user', 'integer') // In a front office context, update the in-memory logged-in user data
->add("company", "text", array(
"label" => Translator::getInstance()->trans("Company"),
"label_attr" => array(
"for" => "newsletter"
"for" => "company"
)
))
->add("firstname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"required" => false
));
"label" => Translator::getInstance()->trans("First Name"),
"label_attr" => array(
"for" => "firstname"
)
))
->add("lastname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Last Name"),
"label_attr" => array(
"for" => "lastname"
)
))
->add("address1", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label_attr" => array(
"for" => "address"
),
"label" => Translator::getInstance()->trans("Street Address")
))
->add("address2", "text", array(
"label" => Translator::getInstance()->trans("Address Line 2"),
"label_attr" => array(
"for" => "address2"
)
))
->add("address3", "text", array(
"label" => Translator::getInstance()->trans("Address Line 3"),
"label_attr" => array(
"for" => "address3"
)
))
->add("phone", "text", array(
"label" => Translator::getInstance()->trans("Phone"),
"label_attr" => array(
"for" => "phone"
)
))
->add("cellphone", "text", array(
"label" => Translator::getInstance()->trans("Cellphone"),
"label_attr" => array(
"for" => "cellphone"
)
))
->add("zipcode", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Zip code"),
"label_attr" => array(
"for" => "zipcode"
)
))
->add("city", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("City"),
"label_attr" => array(
"for" => "city"
)
))
->add("country", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Country"),
"label_attr" => array(
"for" => "country"
)
))
->add("title", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => Translator::getInstance()->trans("Title"),
"label_attr" => array(
"for" => "title"
)
))
;
}
/**
* @return string the name of you form. This name must be unique
*/
public function getName()
{
return "thelia_customer_update";

View File

@@ -73,7 +73,7 @@ class NewsletterForm extends BaseForm
)
))
),
'label' => Translator::getInstance()->trans('email'),
'label' => Translator::getInstance()->trans('Email address'),
'label_attr' => array(
'for' => 'email_newsletter'
)
@@ -84,7 +84,7 @@ class NewsletterForm extends BaseForm
{
$customer = NewsletterQuery::create()->findOneByEmail($value);
if ($customer) {
$context->addViolation("This email already exists");
$context->addViolation("You are already subscribed!");
}
}

View File

@@ -28,4 +28,4 @@ class ProductDefaultSaleElementUpdateForm extends ProductSaleElementUpdateForm
{
return "thelia_product_default_sale_element_update_form";
}
}
}

View File

@@ -52,6 +52,10 @@ class ProductSaleElementUpdateForm extends BaseForm
"label" => Translator::getInstance()->trans("Product price excluding taxes *"),
"label_attr" => array("for" => "price_field")
))
->add("price_with_tax", "number", array(
"label" => Translator::getInstance()->trans("Product price including taxes"),
"label_attr" => array("for" => "price_with_tax_field")
))
->add("currency", "integer", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Price currency *"),
@@ -73,9 +77,13 @@ class ProductSaleElementUpdateForm extends BaseForm
"label_attr" => array("for" => "quantity_field")
))
->add("sale_price", "number", array(
"label" => Translator::getInstance()->trans("Sale price without taxes *"),
"label" => Translator::getInstance()->trans("Sale price without taxes"),
"label_attr" => array("for" => "price_with_tax_field")
))
->add("sale_price_with_tax", "number", array(
"label" => Translator::getInstance()->trans("Sale price including taxes"),
"label_attr" => array("for" => "sale_price_with_tax_field")
))
->add("onsale", "integer", array(
"label" => Translator::getInstance()->trans("This product is on sale"),
"label_attr" => array("for" => "onsale_field")
@@ -88,7 +96,7 @@ class ProductSaleElementUpdateForm extends BaseForm
"label" => Translator::getInstance()->trans("Is it the default product sale element ?"),
"label_attr" => array("for" => "isdefault_field")
))
->add("ean_code", "integer", array(
->add("ean_code", "text", array(
"label" => Translator::getInstance()->trans("EAN Code"),
"label_attr" => array("for" => "ean_code_field")
))

View File

@@ -2,6 +2,7 @@
namespace Thelia\Model\Base;
use \DateTime;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
@@ -14,6 +15,8 @@ use Propel\Runtime\Exception\BadMethodCallException;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Parser\AbstractParser;
use Propel\Runtime\Util\PropelDateTime;
use Thelia\Model\Newsletter as ChildNewsletter;
use Thelia\Model\NewsletterQuery as ChildNewsletterQuery;
use Thelia\Model\Map\NewsletterTableMap;
@@ -75,6 +78,24 @@ abstract class Newsletter implements ActiveRecordInterface
*/
protected $lastname;
/**
* The value for the locale field.
* @var string
*/
protected $locale;
/**
* The value for the created_at field.
* @var string
*/
protected $created_at;
/**
* The value for the updated_at field.
* @var string
*/
protected $updated_at;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -385,6 +406,57 @@ abstract class Newsletter implements ActiveRecordInterface
return $this->lastname;
}
/**
* Get the [locale] column value.
*
* @return string
*/
public function getLocale()
{
return $this->locale;
}
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw \DateTime object will be returned.
*
* @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
*
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getCreatedAt($format = NULL)
{
if ($format === null) {
return $this->created_at;
} else {
return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null;
}
}
/**
* Get the [optionally formatted] temporal [updated_at] column value.
*
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw \DateTime object will be returned.
*
* @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
*
* @throws PropelException - if unable to parse/validate the date/time value.
*/
public function getUpdatedAt($format = NULL)
{
if ($format === null) {
return $this->updated_at;
} else {
return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null;
}
}
/**
* Set the value of [id] column.
*
@@ -469,6 +541,69 @@ abstract class Newsletter implements ActiveRecordInterface
return $this;
} // setLastname()
/**
* Set the value of [locale] column.
*
* @param string $v new value
* @return \Thelia\Model\Newsletter The current object (for fluent API support)
*/
public function setLocale($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->locale !== $v) {
$this->locale = $v;
$this->modifiedColumns[] = NewsletterTableMap::LOCALE;
}
return $this;
} // setLocale()
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
* @param mixed $v string, integer (timestamp), or \DateTime value.
* Empty strings are treated as NULL.
* @return \Thelia\Model\Newsletter The current object (for fluent API support)
*/
public function setCreatedAt($v)
{
$dt = PropelDateTime::newInstance($v, null, '\DateTime');
if ($this->created_at !== null || $dt !== null) {
if ($dt !== $this->created_at) {
$this->created_at = $dt;
$this->modifiedColumns[] = NewsletterTableMap::CREATED_AT;
}
} // if either are not null
return $this;
} // setCreatedAt()
/**
* Sets the value of [updated_at] column to a normalized version of the date/time value specified.
*
* @param mixed $v string, integer (timestamp), or \DateTime value.
* Empty strings are treated as NULL.
* @return \Thelia\Model\Newsletter The current object (for fluent API support)
*/
public function setUpdatedAt($v)
{
$dt = PropelDateTime::newInstance($v, null, '\DateTime');
if ($this->updated_at !== null || $dt !== null) {
if ($dt !== $this->updated_at) {
$this->updated_at = $dt;
$this->modifiedColumns[] = NewsletterTableMap::UPDATED_AT;
}
} // if either are not null
return $this;
} // setUpdatedAt()
/**
* Indicates whether the columns in this object are only set to default values.
*
@@ -517,6 +652,21 @@ abstract class Newsletter implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : NewsletterTableMap::translateFieldName('Lastname', TableMap::TYPE_PHPNAME, $indexType)];
$this->lastname = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : NewsletterTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)];
$this->locale = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : NewsletterTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : NewsletterTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
$this->resetModified();
$this->setNew(false);
@@ -525,7 +675,7 @@ abstract class Newsletter implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 4; // 4 = NewsletterTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 7; // 7 = NewsletterTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\Newsletter object", 0, $e);
@@ -656,8 +806,19 @@ abstract class Newsletter implements ActiveRecordInterface
$ret = $this->preSave($con);
if ($isInsert) {
$ret = $ret && $this->preInsert($con);
// timestampable behavior
if (!$this->isColumnModified(NewsletterTableMap::CREATED_AT)) {
$this->setCreatedAt(time());
}
if (!$this->isColumnModified(NewsletterTableMap::UPDATED_AT)) {
$this->setUpdatedAt(time());
}
} else {
$ret = $ret && $this->preUpdate($con);
// timestampable behavior
if ($this->isModified() && !$this->isColumnModified(NewsletterTableMap::UPDATED_AT)) {
$this->setUpdatedAt(time());
}
}
if ($ret) {
$affectedRows = $this->doSave($con);
@@ -746,6 +907,15 @@ abstract class Newsletter implements ActiveRecordInterface
if ($this->isColumnModified(NewsletterTableMap::LASTNAME)) {
$modifiedColumns[':p' . $index++] = 'LASTNAME';
}
if ($this->isColumnModified(NewsletterTableMap::LOCALE)) {
$modifiedColumns[':p' . $index++] = 'LOCALE';
}
if ($this->isColumnModified(NewsletterTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
if ($this->isColumnModified(NewsletterTableMap::UPDATED_AT)) {
$modifiedColumns[':p' . $index++] = 'UPDATED_AT';
}
$sql = sprintf(
'INSERT INTO newsletter (%s) VALUES (%s)',
@@ -769,6 +939,15 @@ abstract class Newsletter implements ActiveRecordInterface
case 'LASTNAME':
$stmt->bindValue($identifier, $this->lastname, PDO::PARAM_STR);
break;
case 'LOCALE':
$stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
case 'UPDATED_AT':
$stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
}
}
$stmt->execute();
@@ -843,6 +1022,15 @@ abstract class Newsletter implements ActiveRecordInterface
case 3:
return $this->getLastname();
break;
case 4:
return $this->getLocale();
break;
case 5:
return $this->getCreatedAt();
break;
case 6:
return $this->getUpdatedAt();
break;
default:
return null;
break;
@@ -875,6 +1063,9 @@ abstract class Newsletter implements ActiveRecordInterface
$keys[1] => $this->getEmail(),
$keys[2] => $this->getFirstname(),
$keys[3] => $this->getLastname(),
$keys[4] => $this->getLocale(),
$keys[5] => $this->getCreatedAt(),
$keys[6] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -926,6 +1117,15 @@ abstract class Newsletter implements ActiveRecordInterface
case 3:
$this->setLastname($value);
break;
case 4:
$this->setLocale($value);
break;
case 5:
$this->setCreatedAt($value);
break;
case 6:
$this->setUpdatedAt($value);
break;
} // switch()
}
@@ -954,6 +1154,9 @@ abstract class Newsletter implements ActiveRecordInterface
if (array_key_exists($keys[1], $arr)) $this->setEmail($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setFirstname($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setLastname($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setLocale($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
}
/**
@@ -969,6 +1172,9 @@ abstract class Newsletter implements ActiveRecordInterface
if ($this->isColumnModified(NewsletterTableMap::EMAIL)) $criteria->add(NewsletterTableMap::EMAIL, $this->email);
if ($this->isColumnModified(NewsletterTableMap::FIRSTNAME)) $criteria->add(NewsletterTableMap::FIRSTNAME, $this->firstname);
if ($this->isColumnModified(NewsletterTableMap::LASTNAME)) $criteria->add(NewsletterTableMap::LASTNAME, $this->lastname);
if ($this->isColumnModified(NewsletterTableMap::LOCALE)) $criteria->add(NewsletterTableMap::LOCALE, $this->locale);
if ($this->isColumnModified(NewsletterTableMap::CREATED_AT)) $criteria->add(NewsletterTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(NewsletterTableMap::UPDATED_AT)) $criteria->add(NewsletterTableMap::UPDATED_AT, $this->updated_at);
return $criteria;
}
@@ -1035,6 +1241,9 @@ abstract class Newsletter implements ActiveRecordInterface
$copyObj->setEmail($this->getEmail());
$copyObj->setFirstname($this->getFirstname());
$copyObj->setLastname($this->getLastname());
$copyObj->setLocale($this->getLocale());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) {
$copyObj->setNew(true);
$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
@@ -1072,6 +1281,9 @@ abstract class Newsletter implements ActiveRecordInterface
$this->email = null;
$this->firstname = null;
$this->lastname = null;
$this->locale = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
$this->clearAllReferences();
$this->resetModified();
@@ -1105,6 +1317,20 @@ abstract class Newsletter implements ActiveRecordInterface
return (string) $this->exportTo(NewsletterTableMap::DEFAULT_STRING_FORMAT);
}
// timestampable behavior
/**
* Mark the current object so that the update date doesn't get updated during next save
*
* @return ChildNewsletter The current object (for fluent API support)
*/
public function keepUpdateDateUnchanged()
{
$this->modifiedColumns[] = NewsletterTableMap::UPDATED_AT;
return $this;
}
/**
* Code to be run before persisting the object
* @param ConnectionInterface $con

View File

@@ -22,11 +22,17 @@ use Thelia\Model\Map\NewsletterTableMap;
* @method ChildNewsletterQuery orderByEmail($order = Criteria::ASC) Order by the email column
* @method ChildNewsletterQuery orderByFirstname($order = Criteria::ASC) Order by the firstname column
* @method ChildNewsletterQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
* @method ChildNewsletterQuery orderByLocale($order = Criteria::ASC) Order by the locale column
* @method ChildNewsletterQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildNewsletterQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildNewsletterQuery groupById() Group by the id column
* @method ChildNewsletterQuery groupByEmail() Group by the email column
* @method ChildNewsletterQuery groupByFirstname() Group by the firstname column
* @method ChildNewsletterQuery groupByLastname() Group by the lastname column
* @method ChildNewsletterQuery groupByLocale() Group by the locale column
* @method ChildNewsletterQuery groupByCreatedAt() Group by the created_at column
* @method ChildNewsletterQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildNewsletterQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildNewsletterQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -39,11 +45,17 @@ use Thelia\Model\Map\NewsletterTableMap;
* @method ChildNewsletter findOneByEmail(string $email) Return the first ChildNewsletter filtered by the email column
* @method ChildNewsletter findOneByFirstname(string $firstname) Return the first ChildNewsletter filtered by the firstname column
* @method ChildNewsletter findOneByLastname(string $lastname) Return the first ChildNewsletter filtered by the lastname column
* @method ChildNewsletter findOneByLocale(string $locale) Return the first ChildNewsletter filtered by the locale column
* @method ChildNewsletter findOneByCreatedAt(string $created_at) Return the first ChildNewsletter filtered by the created_at column
* @method ChildNewsletter findOneByUpdatedAt(string $updated_at) Return the first ChildNewsletter filtered by the updated_at column
*
* @method array findById(int $id) Return ChildNewsletter objects filtered by the id column
* @method array findByEmail(string $email) Return ChildNewsletter objects filtered by the email column
* @method array findByFirstname(string $firstname) Return ChildNewsletter objects filtered by the firstname column
* @method array findByLastname(string $lastname) Return ChildNewsletter objects filtered by the lastname column
* @method array findByLocale(string $locale) Return ChildNewsletter objects filtered by the locale column
* @method array findByCreatedAt(string $created_at) Return ChildNewsletter objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildNewsletter objects filtered by the updated_at column
*
*/
abstract class NewsletterQuery extends ModelCriteria
@@ -132,7 +144,7 @@ abstract class NewsletterQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, EMAIL, FIRSTNAME, LASTNAME FROM newsletter WHERE ID = :p0';
$sql = 'SELECT ID, EMAIL, FIRSTNAME, LASTNAME, LOCALE, CREATED_AT, UPDATED_AT FROM newsletter WHERE ID = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -349,6 +361,121 @@ abstract class NewsletterQuery extends ModelCriteria
return $this->addUsingAlias(NewsletterTableMap::LASTNAME, $lastname, $comparison);
}
/**
* Filter the query on the locale column
*
* Example usage:
* <code>
* $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
* $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
* </code>
*
* @param string $locale The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildNewsletterQuery The current query, for fluid interface
*/
public function filterByLocale($locale = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($locale)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $locale)) {
$locale = str_replace('*', '%', $locale);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(NewsletterTableMap::LOCALE, $locale, $comparison);
}
/**
* Filter the query on the created_at column
*
* Example usage:
* <code>
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
* </code>
*
* @param mixed $createdAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildNewsletterQuery The current query, for fluid interface
*/
public function filterByCreatedAt($createdAt = null, $comparison = null)
{
if (is_array($createdAt)) {
$useMinMax = false;
if (isset($createdAt['min'])) {
$this->addUsingAlias(NewsletterTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(NewsletterTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(NewsletterTableMap::CREATED_AT, $createdAt, $comparison);
}
/**
* Filter the query on the updated_at column
*
* Example usage:
* <code>
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
* </code>
*
* @param mixed $updatedAt The value to use as filter.
* Values can be integers (unix timestamps), DateTime objects, or strings.
* Empty strings are treated as NULL.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ChildNewsletterQuery The current query, for fluid interface
*/
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
{
if (is_array($updatedAt)) {
$useMinMax = false;
if (isset($updatedAt['min'])) {
$this->addUsingAlias(NewsletterTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(NewsletterTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(NewsletterTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Exclude object from result
*
@@ -440,4 +567,70 @@ abstract class NewsletterQuery extends ModelCriteria
}
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildNewsletterQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(NewsletterTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildNewsletterQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(NewsletterTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildNewsletterQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(NewsletterTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildNewsletterQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(NewsletterTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildNewsletterQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(NewsletterTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildNewsletterQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(NewsletterTableMap::CREATED_AT);
}
} // NewsletterQuery

View File

@@ -72,19 +72,21 @@ abstract class ProductPrice implements ActiveRecordInterface
/**
* The value for the price field.
* Note: this column has a database default value of: 0
* @var double
*/
protected $price;
/**
* The value for the promo_price field.
* Note: this column has a database default value of: 0
* @var double
*/
protected $promo_price;
/**
* The value for the from_default_currency field.
* Note: this column has a database default value of: false
* Note: this column has a database default value of: true
* @var boolean
*/
protected $from_default_currency;
@@ -127,7 +129,9 @@ abstract class ProductPrice implements ActiveRecordInterface
*/
public function applyDefaultValues()
{
$this->from_default_currency = false;
$this->price = 0;
$this->promo_price = 0;
$this->from_default_currency = true;
}
/**
@@ -658,7 +662,15 @@ abstract class ProductPrice implements ActiveRecordInterface
*/
public function hasOnlyDefaultValues()
{
if ($this->from_default_currency !== false) {
if ($this->price !== 0) {
return false;
}
if ($this->promo_price !== 0) {
return false;
}
if ($this->from_default_currency !== true) {
return false;
}

View File

@@ -17,4 +17,8 @@ use Thelia\Model\Base\CustomerQuery as BaseCustomerQuery;
*/
class CustomerQuery extends BaseCustomerQuery {
public static function getCustomerByEmail($email)
{
return self::create()->findOneByEmail($email);
}
} // CustomerQuery

View File

@@ -57,7 +57,7 @@ class NewsletterTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 4;
const NUM_COLUMNS = 7;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class NewsletterTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 4;
const NUM_HYDRATE_COLUMNS = 7;
/**
* the column name for the ID field
@@ -89,6 +89,21 @@ class NewsletterTableMap extends TableMap
*/
const LASTNAME = 'newsletter.LASTNAME';
/**
* the column name for the LOCALE field
*/
const LOCALE = 'newsletter.LOCALE';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'newsletter.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'newsletter.UPDATED_AT';
/**
* The default string format for model objects of the related table
*/
@@ -101,12 +116,12 @@ class NewsletterTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'Email', 'Firstname', 'Lastname', ),
self::TYPE_STUDLYPHPNAME => array('id', 'email', 'firstname', 'lastname', ),
self::TYPE_COLNAME => array(NewsletterTableMap::ID, NewsletterTableMap::EMAIL, NewsletterTableMap::FIRSTNAME, NewsletterTableMap::LASTNAME, ),
self::TYPE_RAW_COLNAME => array('ID', 'EMAIL', 'FIRSTNAME', 'LASTNAME', ),
self::TYPE_FIELDNAME => array('id', 'email', 'firstname', 'lastname', ),
self::TYPE_NUM => array(0, 1, 2, 3, )
self::TYPE_PHPNAME => array('Id', 'Email', 'Firstname', 'Lastname', 'Locale', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'email', 'firstname', 'lastname', 'locale', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(NewsletterTableMap::ID, NewsletterTableMap::EMAIL, NewsletterTableMap::FIRSTNAME, NewsletterTableMap::LASTNAME, NewsletterTableMap::LOCALE, NewsletterTableMap::CREATED_AT, NewsletterTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'EMAIL', 'FIRSTNAME', 'LASTNAME', 'LOCALE', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'email', 'firstname', 'lastname', 'locale', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
);
/**
@@ -116,12 +131,12 @@ class NewsletterTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'Email' => 1, 'Firstname' => 2, 'Lastname' => 3, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, ),
self::TYPE_COLNAME => array(NewsletterTableMap::ID => 0, NewsletterTableMap::EMAIL => 1, NewsletterTableMap::FIRSTNAME => 2, NewsletterTableMap::LASTNAME => 3, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'EMAIL' => 1, 'FIRSTNAME' => 2, 'LASTNAME' => 3, ),
self::TYPE_FIELDNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, ),
self::TYPE_NUM => array(0, 1, 2, 3, )
self::TYPE_PHPNAME => array('Id' => 0, 'Email' => 1, 'Firstname' => 2, 'Lastname' => 3, 'Locale' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, 'locale' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
self::TYPE_COLNAME => array(NewsletterTableMap::ID => 0, NewsletterTableMap::EMAIL => 1, NewsletterTableMap::FIRSTNAME => 2, NewsletterTableMap::LASTNAME => 3, NewsletterTableMap::LOCALE => 4, NewsletterTableMap::CREATED_AT => 5, NewsletterTableMap::UPDATED_AT => 6, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'EMAIL' => 1, 'FIRSTNAME' => 2, 'LASTNAME' => 3, 'LOCALE' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
self::TYPE_FIELDNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, 'locale' => 4, 'created_at' => 5, 'updated_at' => 6, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
);
/**
@@ -144,6 +159,9 @@ class NewsletterTableMap extends TableMap
$this->addColumn('EMAIL', 'Email', 'VARCHAR', true, 255, null);
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', false, 255, null);
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', false, 255, null);
$this->addColumn('LOCALE', 'Locale', 'VARCHAR', false, 5, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
/**
@@ -153,6 +171,19 @@ class NewsletterTableMap extends TableMap
{
} // buildRelations()
/**
*
* Gets the list of behaviors registered for this table
*
* @return array Associative array (name => parameters) of behaviors
*/
public function getBehaviors()
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
);
} // getBehaviors()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
@@ -295,11 +326,17 @@ class NewsletterTableMap extends TableMap
$criteria->addSelectColumn(NewsletterTableMap::EMAIL);
$criteria->addSelectColumn(NewsletterTableMap::FIRSTNAME);
$criteria->addSelectColumn(NewsletterTableMap::LASTNAME);
$criteria->addSelectColumn(NewsletterTableMap::LOCALE);
$criteria->addSelectColumn(NewsletterTableMap::CREATED_AT);
$criteria->addSelectColumn(NewsletterTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.EMAIL');
$criteria->addSelectColumn($alias . '.FIRSTNAME');
$criteria->addSelectColumn($alias . '.LASTNAME');
$criteria->addSelectColumn($alias . '.LOCALE');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}

View File

@@ -157,9 +157,9 @@ class ProductPriceTableMap extends TableMap
// columns
$this->addForeignPrimaryKey('PRODUCT_SALE_ELEMENTS_ID', 'ProductSaleElementsId', 'INTEGER' , 'product_sale_elements', 'ID', true, null, null);
$this->addForeignPrimaryKey('CURRENCY_ID', 'CurrencyId', 'INTEGER' , 'currency', 'ID', true, null, null);
$this->addColumn('PRICE', 'Price', 'FLOAT', true, null, null);
$this->addColumn('PROMO_PRICE', 'PromoPrice', 'FLOAT', false, null, null);
$this->addColumn('FROM_DEFAULT_CURRENCY', 'FromDefaultCurrency', 'BOOLEAN', true, 1, false);
$this->addColumn('PRICE', 'Price', 'FLOAT', true, null, 0);
$this->addColumn('PROMO_PRICE', 'PromoPrice', 'FLOAT', true, null, 0);
$this->addColumn('FROM_DEFAULT_CURRENCY', 'FromDefaultCurrency', 'BOOLEAN', true, 1, true);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()

View File

@@ -426,6 +426,7 @@ try {
$stock->setNewness($faker->randomNumber(0,1));
$stock->setWeight($faker->randomFloat(2, 100,10000));
$stock->setIsDefault($i == 0);
$stock->setEanCode(strtoupper($faker->text(13)));
$stock->save();
$productPrice = new \Thelia\Model\ProductPrice();

View File

@@ -1270,9 +1270,9 @@ CREATE TABLE `product_price`
(
`product_sale_elements_id` INTEGER NOT NULL,
`currency_id` INTEGER NOT NULL,
`price` FLOAT NOT NULL,
`promo_price` FLOAT,
`from_default_currency` TINYINT(1) DEFAULT 0 NOT NULL,
`price` FLOAT DEFAULT 0 NOT NULL,
`promo_price` FLOAT DEFAULT 0 NOT NULL,
`from_default_currency` TINYINT(1) DEFAULT 1 NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`product_sale_elements_id`,`currency_id`),
@@ -1607,7 +1607,11 @@ CREATE TABLE `newsletter`
`email` VARCHAR(255) NOT NULL,
`firstname` VARCHAR(255),
`lastname` VARCHAR(255),
PRIMARY KEY (`id`)
`locale` VARCHAR(5),
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
UNIQUE INDEX `email_UNIQUE` (`email`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{* Update an Address *}
{form name="thelia.address.update"}
{form name="thelia.admin.address.update"}
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "edit_address_dialog"}

View File

@@ -107,7 +107,7 @@
<select name="{$name}" id="type" class="col-md-12 form-control">
<option value="-1" data-description="">{intl l='Please select a coupon type'}</option>
{foreach from=$availableCoupons item=availableCoupon}
<option value="{$availableCoupon.serviceId}" data-description="{$availableCoupon.toolTip}" {if $value == $availableCoupon.serviceId}selected{/if}>
<option value="{$availableCoupon.serviceId}" {if $value == $availableCoupon.serviceId}selected{/if}>
{$availableCoupon.name}
</option>
{/foreach}

View File

@@ -29,7 +29,7 @@
<div class="form-container">
<div class="col-md-12">
{form name="thelia.customer.modification"}
{form name="thelia.admin.customer.modification"}
<form method="POST" action="{url path="/admin/customer/update/{$ID}"}" {form_enctype form=$form} class="clearfix">
<div class="row inner-toolbar clearfix">
@@ -261,7 +261,7 @@
<div id="address-update-modal"></div>
{* Add an Address *}
{form name="thelia.address.create"}
{form name="thelia.admin.address.create"}
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "address_creation_dialog"}

View File

@@ -162,7 +162,7 @@
{* Adding a new Category *}
{form name="thelia.customer.creation"}
{form name="thelia.admin.customer.create"}
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "customer_creation_dialog"}

View File

@@ -83,7 +83,7 @@
<select id="tax_rule_field" required="required" name="{$name}" class="form-control">
<option value="">{intl l="Select a tax tule"}</option>
{loop name="tax" type="tax-rule" backend_context="1"}
<option value="{$ID}" {if $IS_DEFAULT}selected="selected"{/if}>{$TITLE}</option>
<option value="{$ID}" {if $ID == $TAX_RULE_ID}selected="selected"{/if}>{$TITLE}</option>
{/loop}
</select>
</div>
@@ -115,7 +115,7 @@
<div class="form-group {if $error}has-error{/if}">
<div class="checkbox">
<label>
<input type="checkbox" id="use_exchange_rate_box" name="{$name}" value="1" {if $value != 0}checked="checked"{/if}>
<input type="checkbox" data-pse-id="{$default_product_sale_element_id}" class="use_exchange_rate_box" name="{$name}" value="1" {if $value != 0}checked="checked"{/if}>
{$label}
</label>
</div>
@@ -129,19 +129,21 @@
<label for="price_without_tax" class="control-label">{$label} : </label>
<div class="input-group">
<input {if !$show_pricing_fields}readonly{/if} data-price-type="without-tax" data-rel-price="price_with_tax" type="text" id="price_without_tax" required="required" name="{$name}" class="automatic_price_field form-control" value="{$value}" title="{$label}" placeholder="{intl l='Price excl. taxes'}">
<input {if !$show_pricing_fields}readonly{/if} data-pse-id="{$default_product_sale_element_id}" data-price-type="price-without-tax" data-rel-price="price_with_tax" type="text" id="price_without_tax" required="required" name="{$name}" class="price_field automatic_price_field form-control" value="{$value}" title="{$label}" placeholder="{intl l='Price excl. taxes'}">
<span class="input-group-addon">{$currency_symbol}</span>
</div>
</div>
{/form_field}
<div class="form-group">
<label for="price_with_tax" class="control-label">{intl l="Product price including taxes"} : </label>
<div class="input-group">
<input {if !$show_pricing_fields}readonly{/if} data-price-type="with-tax" data-rel-price="price_without_tax" type="text" id="price_with_tax" name="price_with_tax" class="automatic_price_field form-control" value="" title="{intl l='Product price including taxes'}" placeholder="{intl l='Price incl. taxes'}">
<span class="input-group-addon">{$currency_symbol}</span>
</div>
</div>
{form_field form=$form field='price_with_tax'}
<div class="form-group">
<label for="price_with_tax" class="control-label">{intl l="Product price including taxes"} : </label>
<div class="input-group">
<input {if !$show_pricing_fields}readonly{/if} data-pse-id="{$default_product_sale_element_id}" data-price-type="price-with-tax" data-rel-price="price_without_tax" type="text" id="price_with_tax" name="{$name}" class="price_field automatic_price_field form-control" value="{$value}" title="{$value}" placeholder="{intl l='Price incl. taxes'}">
<span class="input-group-addon">{$currency_symbol}</span>
</div>
</div>
{/form_field}
{module_include location='product_details_pricing_form'}
</div>
@@ -203,19 +205,21 @@
<label for="sale_price_without_tax" class="control-label">{$label} : </label>
<div class="input-group">
<input {if !$show_pricing_fields}readonly{/if} data-price-type="without-tax" data-rel-price="sale_price_with_tax" type="text" id="sale_price_without_tax" required="required" name="{$name}" class="automatic_price_field form-control" value="{$value}" title="{$label}" placeholder="{intl l='Product price'}">
<input {if !$show_pricing_fields}readonly{/if} data-pse-id="{$default_product_sale_element_id}" data-price-type="sale-price-without-tax" data-rel-price="sale_price_with_tax" type="text" id="sale_price_without_tax" required="required" name="{$name}" class="price_field automatic_price_field form-control" value="{$value}" title="{$label}" placeholder="{intl l='Product price'}">
<span class="input-group-addon">{$currency_symbol}</span>
</div>
</div>
{/form_field}
{form_field form=$form field='sale_price_with_tax'}
<div class="form-group">
<label for="sale_price_with_tax" class="control-label">{intl l="Sale price including taxes"} : </label>
<label for="sale_price_with_tax" class="control-label">{$label} : </label>
<div class="input-group">
<input {if !$show_pricing_fields}readonly{/if} data-price-type="with-tax" data-rel-price="sale_price_without_tax" type="text" id="sale_price_with_tax" name="sale_price_with_tax" class="automatic_price_field form-control" value="" title="{intl l='Sale price including taxes'}" placeholder="{intl l='Sale price incl. taxes'}">
<input {if !$show_pricing_fields}readonly{/if} data-pse-id="{$default_product_sale_element_id}" data-price-type="sale-price-with-tax" data-rel-price="sale_price_without_tax" type="text" id="sale_price_with_tax" name="sale_price_with_tax" class="price_field automatic_price_field form-control" value="{$value}" title="{$label}" placeholder="{intl l='Sale price incl. taxes'}">
<span class="input-group-addon">{$currency_symbol}</span>
</div>
</div>
{/form_field}
{form_field form=$form field='onsale'}
<div class="form-group {if $error}has-error{/if}">
@@ -276,7 +280,7 @@
<select id="tax_rule_field" required="required" name="{$name}" class="form-control">
<option value="">{intl l="Select a tax tule"}</option>
{loop name="tax" type="tax-rule" backend_context="1"}
<option value="{$ID}" {if $IS_DEFAULT}selected="selected"{/if}>{$TITLE}</option>
<option value="{$ID}" {if $ID == $TAX_RULE_ID}selected="selected"{/if}>{$TITLE}</option>
{/loop}
</select>
</div>

View File

@@ -275,48 +275,83 @@ $(function() {
});
// In details tab, process exchange rate usage checkbox changes
$('use_exchange_rate_box').change(function(ev) {
$('.')
$('.use_exchange_rate_box').change(function(ev) {
if ($(this).is(':checked')) {
var pse_id = $(this).data('pse-id');
$('.price_field').prop('readonly', true);
// Reload prices
$.ajax({
url : '{url path="/admin/product/load-converted-prices"}',
data : {
product_sale_element_id : pse_id,
currency_id : {$edit_currency_id}
},
type : 'get',
dataType : 'json',
success : function(json) {
console.log(json);
$('input[data-pse-id="'+pse_id+'"][data-price-type="price-with-tax"]').val(json.price_with_tax);
$('input[data-pse-id="'+pse_id+'"][data-price-type="price-without-tax"]').val(json.price_without_tax);
$('input[data-pse-id="'+pse_id+'"][data-price-type="sale-price-with-tax"]').val(json.sale_price_with_tax);
$('input[data-pse-id="'+pse_id+'"][data-price-type="sale-price-without-tax"]').val(json.sale_price_without_tax);
},
error : function(jqXHR, textStatus, errorThrown) {
alert("{intl l='Failed to get converted prices. Please try again.'} (" +errorThrown+ ")");
}
});
}
else {
$('.price_field').prop('readonly', false)
}
});
function update_price(price, price_type, dest_field_id) {
var tax_rule_id = $('#tax_rule_field').val();
if (tax_rule_id != "") {
var operation;
if (price_type.indexOf('with-tax') != -1)
operation = 'from_tax';
else if (price_type.indexOf('without-tax') != -1)
operation = 'to_tax';
else
operation = '';
$.ajax({
url : '{url path="/admin/product/calculate-price"}',
data : {
price : price,
action : operation,
product_id : {$product_id}
},
type : 'get',
dataType : 'json',
success : function(json) {
$('#' + dest_field_id).val(json.result);
},
error : function(jqXHR, textStatus, errorThrown) {
alert("{intl l='Failed to get prices. Please try again.'} (" +errorThrown+ ")");
}
});
}
}
// Automatic update of price fields: any change in the taxed (resp. untaxed) price
// will update the untaxed (resp. taxed) one
$('.automatic_price_field').typeWatch({
captureLength: 1,
callback: function () {
var tax_rule_id = $('#tax_rule_field').val();
if (tax_rule_id != "") {
var priceType = $(this).data('price-type');
var dest_field_id = $(this).data('rel-price');
var operation;
if (priceType == 'with-tax')
operation = 'from_tax';
else if (priceType == 'without-tax')
operation = 'to_tax';
else
operation = '';
$.ajax({
url : '{url path="/admin/product/calculate-price"}',
data : {
price : $(this).val(),
action : operation,
tax_rule_id : $('#tax_rule_field').val()
},
type : 'get',
dataType : 'json',
success : function(json) {
$('#' + dest_field_id).val(json.result);
}
});
}
update_price($(this).val(), $(this).data('price-type'), $(this).data('rel-price'));
}
});
});
</script>

View File

@@ -0,0 +1,42 @@
{extends file="layout.tpl"}
{* Body Class *}
{block name="body-class"}page-404{/block}
{* Breadcrumb *}
{block name='no-return-functions' append}
{$breadcrumbs = [
['title' => {intl l="404"}, 'url'=>{url path="/404"}]
]}
{/block}
{block name="main-content"}
<div class="main">
<article id="cart" class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page_404">
404
<span>{intl l="The page cannot be found"}</span>
</h1>
{ifloop rel="product_upsell"}
<aside id="products-upsell" role="complementary" aria-labelledby="products-upsell-label">
<div class="products-heading">
<h3 id="products-upsell-label">{intl l="Upsell Products"}</h3>
</div>
<div class="products-content">
<ul class="products-grid product-col-5 hover-effect">
{loop name="product_upsell" type="product" promo="yes" limit="5"}
{include file="includes/single-product.html" product_id=$ID hasBtn=true hasDescription=true width="218" height="146"}
{/loop}
</ul>
</div>
</aside><!-- #products-upsell -->
{/ifloop}
</div>
{/block}

View File

@@ -0,0 +1,89 @@
{extends file="layout.tpl"}
{* Body Class *}
{block name="body-class"}page-account-password{/block}
{* Breadcrumb *}
{block name='no-return-functions' append}
{$breadcrumbs = [['title' => {intl l="Account"}, 'url'=>{url path="/account"}]]}
{$breadcrumbs = [
['title' => {intl l="Account"}, 'url'=>{url path="/account"}],
['title' => {intl l="Change Password"}, 'url'=>{url path="/account/password"}]
]}
{/block}
{block name="main-content"}
<div class="main">
<article class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page-header">{intl l="Change Password"}</h1>
{form name="thelia.front.customer.password.update"}
<form id="form-register" class="form-horizontal" action="{url path="/account/password"}" method="post" role="form">
{form_field form=$form field='success_url'}
<input type="hidden" name="{$name}" value="{url path="/account"}" />
{/form_field}
{form_hidden_fields form=$form}
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
<fieldset id="register-info" class="panel">
<div class="panel-heading">
{intl l="Login Information"}
</div>
<div class="panel-body">
{form_field form=$form field="password_old"}
<div class="form-group group-password_old {if $error}has-error{elseif $isPost && $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<input type="password" name="{$name}" id="{$label_attr.for}" class="form-control" value="{$value}" {if $required} aria-required="true" required{/if}{if $error} autofocus{/if}>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{assign var="error_focus" value="true"}
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field="password"}
<div class="form-group group-password {if $error}has-error{elseif $isPost && $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<input type="password" name="{$name}" id="{$label_attr.for}" class="form-control" value="{$value}" {if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{assign var="error_focus" value="true"}
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field="password_confirm"}
<div class="form-group group-password_confirm {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<input type="password" name="{$name}" id="{$label_attr.for}" class="form-control" autocomplete="off"{if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{assign var="error_focus" value="true"}
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
</div>
</fieldset>
<div class="form-group group-btn">
<div class="control-btn">
<button type="submit" class="btn btn-register">{intl l="Change Password"}</button>
</div>
</div><!--/.form-group-->
</form>
{/form}
</article>
</div><!-- /.layout -->
{/block}

View File

@@ -19,7 +19,7 @@
<h1 id="main-label" class="page-header">{intl l="Update Profil"}</h1>
{form name="thelia.customer.update"}
{form name="thelia.front.customer.profil.update"}
{assign var="isPost" value="{$smarty.post|count}"}
<form id="form-register" class="form-horizontal" action="{url path="/account/update"}" method="post" role="form">
{form_field form=$form field='success_url'}
@@ -30,7 +30,7 @@
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
<fieldset id="register-info" class="panel panel">
<fieldset id="register-info" class="panel">
<div class="panel-heading">
{intl l="Personal Informations"}
</div>

View File

@@ -21,7 +21,7 @@
<article class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page-header">{intl l="Create New Address"}</h1>
{form name="thelia.address.update"}
{form name="thelia.front.address.update"}
{loop name="customer.update" type="address" customer="current" id="{$address_id}"}
<form id="form-address" class="form-horizontal" action="{url path="/address/update/{$address_id}"}" method="post" role="form">
{form_field form=$form field='success_url'}

View File

@@ -21,7 +21,7 @@
<article class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page-header">{intl l="Create New Address"}</h1>
{form name="thelia.address.create"}
{form name="thelia.front.address.create"}
<form id="form-address" class="form-horizontal" action="{url path="/address/create"}" method="post" role="form">
{form_field form=$form field='success_url'}
<input type="hidden" name="{$name}" value="{url path="/account"}" /> {* the url the user is redirected to on login success *}

View File

@@ -27,9 +27,19 @@
$(this).addClass('open');
})
.on('mouseleave.subnav', '.dropdown', function(){
if(!$(this).hasClass('open'))
var $this = $(this);
if(!$this.hasClass('open'))
return;
$(this).removeClass('open');
//This will check if an input child has focus. If no then remove class open
if ($this.find(":input:focus").length == 0){
$this.removeClass('open');
} else {
$this.find(":input:focus").one('blur', function(){
$this.trigger('mouseleave.subnav');
});
}
});
// Tooltip
@@ -65,7 +75,6 @@
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;
@@ -89,6 +98,32 @@
}).find(':radio:checked').trigger('change.account');
}
// Mini Newsletter Subscription
var $form_newsletter = $('#form-newsletter-mini');
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) {
var $msg = '';
if(json.success){
$msg = json.message;
}else{
$msg = json.message;
}
bootbox.alert($msg);
}
});
return false;
});
}
// Forgot Password
/*
var $forgot_password = $('.forgot-password', $form_login);
@@ -159,6 +194,25 @@
}).filter(':has(:checked)').addClass('active');
});
// Apply validation
$('#form-contact, #form-register').validate({
highlight: function(element) {
$(element).closest('.form-group').addClass('has-error');
},
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('<i class="icon-remove"></i> ').insertAfter(element.parent());
}else{
error.prepend('<i class="icon-remove"></i> ').insertAfter(element);
}
}
});
if($("body").is(".page-product")){
@@ -174,10 +228,12 @@
var $old_price_container = $(".old-price", $("#product-details"));
var $select_quantity = $(this).find(":selected").attr("data-quantity");
// Switch Quantity in product page
$("select", $(".product-options")).change(function(){
var $select_quantity = $(this).find(":selected").attr("data-quantity");
$select_quantity = $(this).find(":selected").attr("data-quantity");
var $old_price = $(this).find(":selected").attr("data-old-price");
var $best_price = $(this).find(":selected").attr("data-price");
@@ -229,7 +285,31 @@
});
}
$(".form-product").submit(function(){
var url_action = $(this).attr("action");
var $cartContainer = $(".cart-container");
$.ajax({type:"POST", data: $(this).serialize(), url:url_action,
success: function(data){
$cartContainer.html($(data).html());
$.ajax({url:"ajax/addCartMessage",
success: function(data){
bootbox.dialog({
message : data,
buttons : {}
});
}
});
},
error: function(){
console.log('Error.');
}
});
return false;
});
$('#limit-top').change(function(e){
window.location = $(this).val()

View File

@@ -22,6 +22,7 @@
&.btn-checkout,
&.btn-checkout-next,
&.btn-checkout-home,
&.btn-contact,
&.btn-forgot,
&.btn-login,
&.btn-proceed-checkout,

View File

@@ -50,7 +50,6 @@
// Form Register
#form-address,
#form-contact,
#form-register {
.panel-body {
.control-label { .make-sm-column(3); }
@@ -65,3 +64,8 @@
.control-btn { .make-sm-column-offset(3); .make-sm-column(5); }
}
}
// Form Contact
#form-contact {
}

View File

@@ -3,6 +3,19 @@
// Main Title
.page-header { margin-top: 0; }
// 404 Page
.page_404{
color: @brand-primary;
font-size: 9em; font-weight: bold;
text-align: center;
span{
color : #CCC;
display: block;
font-size: 15px; font-weight: normal;
}
}
// Collapse
.no-js .collapse { display: block!important; }
@@ -101,3 +114,22 @@ ul {
}
}
}
.modal-dialog{
td{vertical-align: middle}
.close{
margin: 10px;
position: relative; z-index: 10;
}
.btn{
margin-left: 10px;
}
}
@media screen and (min-width: 768px){
.modal-dialog{
width: 800px;
}
}

View File

@@ -4,6 +4,11 @@
float: right;
font-size: .6em;
}
h3{
top: -14px !important;
margin: 0;
}
}
@@ -140,6 +145,7 @@
border: 1px solid @nav-tabs-border-color;
border-radius: 0 0 @border-radius-base @border-radius-base;
padding: 30px 15px;
min-height: 180px; height: auto!important; height: 180px;
}
}
}
}

View File

@@ -148,7 +148,7 @@ label { font-weight: 600; }
}
// Align the navbar with carousel
.container > .navbar-collapse { margin-left: -15px; }
.container > .navbar-collapse { margin-left: -15px; margin-right: -15px; }
// Search
header {
@@ -164,7 +164,7 @@ header {
/* Custom button */
.page .btn-primary {
.btn-primary {
border-left: 3px solid lighten(@brand-primary, 20%);
.border-radius(0);
color: #fff;
@@ -1214,3 +1214,14 @@ td.product,
}
}
}
// Page Contact
#google-map {
margin-bottom: @line-height-computed;
@filter-map: ~"grayscale(100%)";
-webkit-filter: @filter-map;
-moz-filter: @filter-map;
-ms-filter: @filter-map;
-o-filter: @filter-map;
filter: @filter-map;
}

View File

@@ -154,7 +154,7 @@
<div class="products-content">
<ul class="products-grid product-col-5 hover-effect">
{loop name="product_upsell" type="product" promo="yes" limit="5"}
{include file="includes/single-product.html" product_id=$ID hasBtn=true hasDescription=true width="218" height="146"}
{include file="includes/single-product.html" product_id=$ID hasBtn=false hasDescription=true width="218" height="146"}
{/loop}
</ul>

View File

@@ -18,24 +18,31 @@
{$product_page={$smarty.get.page|default:1}}
{$product_order={$smarty.get.order|default:'alpha'}}
<article class="col-main {$smarty.get.mode|default:"grid"}" role="main">
{include file="includes/toolbar.html" toolbar="top" limit=$limit order=$product_order}
<div id="category-products">
<div class="products-content">
<ul class="product-col-4">
{loop type="product" name="product_list" category={category attr="id"} limit=$limit page=$product_page order=$product_order}
{include file="includes/single-product.html" product_id=$ID hasBtn=true hasDescription=true width="218" height="146"}
{/loop}
</ul>
{ifloop rel="product_list"}
{include file="includes/toolbar.html" toolbar="top" limit=$limit order=$product_order}
<div id="category-products">
<div class="products-content">
<ul class="product-col-4">
{loop type="product" name="product_list" category={category attr="id"} limit=$limit page=$product_page order=$product_order}
{include file="includes/single-product.html" product_id=$ID hasBtn=true hasDescription=true width="218" height="146"}
{/loop}
</ul>
</div>
</div><!-- /#category-products -->
{include file="includes/toolbar.html" toolbar="bottom"}
{/ifloop}
{elseloop rel="product_list"}
<div class="address-warning">
{intl l="No products available in this category"}
</div>
</div><!-- /#category-products -->
{include file="includes/toolbar.html" toolbar="bottom"}
{/elseloop}
</article>
<aside class="col-left" role="complementary" itemscope itemtype="http://schema.org/WPSideBar">
{include file="includes/menu.html"}
{include file="includes/categories-filters.html"}
{*include file="includes/categories-filters.html"*}
</aside>

View File

@@ -1,15 +1,8 @@
{extends file="layout.tpl"}
{extends file="contact.html"}
{* Breadcrumb *}
{block name='no-return-functions' append}
{$breadcrumbs = [['title' => {intl l="Thanks !"}, 'url'=>{url path="/contact/success"}]]}
{/block}
{block name="main-content"}
<div class="main">
<article class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page-header">{intl l="Thanks !"}</h1>
<p>{intl l="Thanks for your message, we will contact as soon as possible"}</p>
</article>
{block name="contact-form"}
<div class="contact-success alert alert-success" style="text-align: center">
<h2 class="icon-comments">{intl l="Thanks !"}</h2>
<p>{intl l="Thanks for your message, we will contact as soon as possible."}</p>
</div>
{/block}

View File

@@ -10,96 +10,88 @@
<article class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page-header">{intl l="Contact us"}</h1>
{form name="thelia.contact"}
<form id="form-contact" class="form-horizontal" action="{url path="/contact"}" method="post" role="form">
{form_hidden_fields form=$form}
<fieldset id="contact-info" class="panel panel">
<div class="panel-heading">
1. {intl l="Personal Informations"}
</div>
<div class="panel-body">
{form_field form=$form field="firstname"}
<div class="form-group group-firstname {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="John" value="{$value}" {if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{assign var="error_focus" value="true"}
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field="lastname"}
<div class="form-group group-firstname {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="John" value="{$value}" {if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{assign var="error_focus" value="true"}
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field="email"}
<div class="form-group group-firstname {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<input type="email" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="johndoe@domain.com" value="{$value}" {if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{assign var="error_focus" value="true"}
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field="subject"}
<div class="form-group group-firstname {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="contact subject" value="{$value}" {if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{assign var="error_focus" value="true"}
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field="message"}
<div class="form-group group-firstname {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<textarea name="{$name}" id="{$label_attr.for}" class="form-control">
{$value}
</textarea>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{assign var="error_focus" value="true"}
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
<div id="google-map">
<iframe class="map" width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=london&aq=&sll=52.8382,-2.327815&sspn=9.377429,22.126465&ie=UTF8&hq=&hnear=London,+United+Kingdom&t=m&z=10&ll=51.511214,-0.119824&output=embed&iwloc=near"></iframe>
</div><!-- / #google-map-->
<div class="form-group group-btn">
<div class="control-btn">
<button type="submit" class="btn btn-register">{intl l="Send"}</button>
{block name="contact-form"}
{form name="thelia.front.contact"}
<form id="form-contact" action="{url path="/contact"}" method="post" role="form">
{form_hidden_fields form=$form}
<fieldset id="contact-info" class="panel">
<div class="panel-heading">
{intl l="Send us a message"}
</div>
<div class="panel-body">
<div class="row">
{form_field form=$form field="name"}
<div class="form-group group-name col-sm-6 {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="{intl l="What's your name?"}" value="{$value}" {if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{assign var="error_focus" value="true"}
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field="email"}
<div class="form-group group-email col-sm-6 {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<input type="email" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="{intl l="So I can get back to you."}" value="{$value}" {if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{assign var="error_focus" value="true"}
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
</div>
</div><!--/.form-group-->
</div>
</fieldset>
</form>
{/form}
{form_field form=$form field="subject"}
<div class="form-group group-firstname {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="{intl l="The subject of your message."}" value="{$value}" {if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{assign var="error_focus" value="true"}
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field="message"}
<div class="form-group group-message {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<textarea name="{$name}" id="{$label_attr.for}" placeholder="{intl l='And your message...'}" rows="6" class="form-control"{if $required} aria-required="true" required{/if}>{$value}</textarea>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{assign var="error_focus" value="true"}
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
<div class="form-group group-btn">
<div class="control-btn">
<button type="submit" class="btn btn-contact">{intl l="Send"}</button>
</div>
</div><!--/.form-group-->
</div>
</fieldset>
</form>
{/form}
{/block}
</article>
</div>
{/block}
{/block}

View File

@@ -0,0 +1,52 @@
<div class="clearfix">
{loop type="cart" name="cartloop" position="last"}
<table>
<tr>
<td class="col-md-4">
{loop name="product_thumbnail" type="image" product=$PRODUCT_ID width="218" height="146" resize_mode="borders" limit="1"}
<img itemprop="image" src="{$IMAGE_URL}" alt="Product #{$LOOP_COUNT}">
{/loop}
</td>
<td class="col-md-4">
<h2>{$TITLE}</h2>
{loop type="attribute_combination" name="product_options" product_sale_elements="$PRODUCT_SALE_ELEMENTS_ID"}
<p>{$ATTRIBUTE_TITLE}</p>
<p>{$ATTRIBUTE_AVAILABILITY_TITLE}</p>
{/loop}
</td>
<td class="col-md-4">
{if $IS_PROMO == 1}
{assign "real_price" $PROMO_TAXED_PRICE}
<div class="special-price"><span class="price">{currency attr="symbol"} {$PROMO_TAXED_PRICE}</span></div>
<small class="old-price"> <span class="price">{currency attr="symbol"} {$TAXED_PRICE}</span></small>
{else}
{assign "real_price" $TAXED_PRICE}
<div class="special-price"><span class="price">{currency attr="symbol"} {$TAXED_PRICE}</span></div>
{/if}
</td>
</tr>
</table>
{/loop}
<a href="{url path="/cart"}" role="button" class="btn btn_add_to_cart pull-right"><span>{intl l="View cart"}</span></a>
<button type="button" class="btn btn-checkout pull-right" data-dismiss="modal"><span>{intl l="Continue Shopping"}</span></button>
</div>
{ifloop rel="product_upsell"}
<aside id="products-upsell" role="complementary" aria-labelledby="products-upsell-label">
<div class="products-heading">
<h3 id="products-upsell-label">{intl l="Upsell Products"}</h3>
</div>
<div class="products-content">
<ul class="products-grid product-col-3 hover-effect">
{loop name="product_upsell" type="product" promo="yes" limit="3"}
{include file="includes/single-product.html" product_id=$ID hasBtn=false hasDescription=true width="218" height="146"}
{/loop}
</ul>
</div>
</aside><!-- #products-upsell -->
{/ifloop}

View File

@@ -2,29 +2,45 @@
<div class="block-heading"><h3 class="block-title" id="categories-label">{intl l="Categories"}</h3></div>
<div class="block-content">
<nav class="nav-categories">
<ul id="category" class="accordion">
{assign "previousLevel" 0}
{loop name="cat-parent" type="category-tree" category="0"}
{for $foo=1 to $previousLevel-$LEVEL}
</ul>
</li>
{/for}
{if $CHILD_COUNT > 0 }
<li>
<a class="accordion-toggle" data-toggle="collapse" data-parent="#category" href="{$URL}#collapse{$ID}">{$TITLE} <span class="amount">({$CHILD_COUNT})</span></a>
<ul id="collapse{$ID}" class="collapse">
{else}
<li><a href="{$URL}">{$TITLE} <span class="amount">(0)</span></a></li>
{/if}
{assign "previousLevel" $LEVEL}
{* define current ID *}
{loop name="current_cat" type="category" current="yes"}
{assign var="current_category_id" value="{$PARENT}"}
{/loop}
{for $i=$previousLevel to 1 step -1}
{* define the function *}
{function menu level=0}
{if $level == 0}
<ul id="category" class="accordion">
{else}
{if $parent == $current_category_id}
<ul id="collapse{$parent}" class="in">
{else}
<ul id="collapse{$parent}" class="collapse">
{/if}
{/if}
{loop name="cat-parent-$level" type="category" parent=$parent}
{assign var="product_count" value="0"}
{loop name="product_count" type="product" category="{$ID}"}
{if $LOOP_COUNT == 1}
{assign var="product_count" value="{$LOOP_TOTAL}"}
{/if}
{/loop}
{if $CHILD_COUNT> 0}
<li><a href="{$URL}#collapse{$ID}" class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#collapse{$ID}">{$TITLE} ({$PRODUCT_COUNT})</a>
{menu parent=$ID level=$level+1}
</li>
{else}
<li><a href="{$URL}">{$TITLE} ({$product_count})</a></li>
{/if}
{/loop}
</ul>
</li>
{/for}
</ul>
{/function}
{menu parent='0'}
</nav>
</div>
</section>

View File

@@ -1,5 +1,5 @@
{ifloop rel="cartloop"}
<li class="dropdown pull-right cart-not-empty">
<li class="dropdown pull-right cart-not-empty cart-container">
<a href="{url path="/cart"}" rel="nofollow" class="cart">
{intl l="Cart"} <span class="badge">{cart attr="count_item"}</span>
</a>
@@ -60,7 +60,7 @@
</li>
{/ifloop}
{elseloop rel="cartloop"}
<li class="dropdown pull-right">
<li class="dropdown pull-right cart-container">
<a href="{url path="/cart"}" rel="nofollow" class="cart">
{intl l="Cart"} <span class="badge">0</span>
</a>

View File

@@ -56,9 +56,9 @@
{/if}
</div>
{if $hasBtn == true}
{form name="thelia.cart.add" }
<form id="form-product-details" action="{url path="/cart/add" }" method="post" role="form">
<form id="form-product-details" action="{url path="/cart/add" }" method="post" role="form" class="form-product">
{form_hidden_fields form=$form}
<input type="hidden" name="view" value="product">
<input type="hidden" name="product_id" value="{$ID}">
@@ -115,11 +115,12 @@
</div>
<div>
<div class="product-btn">
{if $hasSubmit == true}
<button type="submit" class="btn btn-cart">{intl l="Add to cart"}</button>
{else}
<a href="{$URL}" class="btn btn-cart">{intl l="View product"}</a>
{/if}
{if $hasSubmit == true}
<button type="submit" class="btn btn-cart">{intl l="Add to cart"}</button>
{else}
<a href="{$URL}" class="btn btn-cart">{intl l="View product"}</a>
{/if}
</div>
</div>
@@ -127,7 +128,7 @@
</fieldset>
</form>
{/form}
{/if}
</div>
</article><!-- /product -->
</li>

View File

@@ -76,7 +76,7 @@ URL: http://www.thelia.net
<li class="dropdown">
<a href="{url path="/login"}" class="login">{intl l="Log In!"}</a>
<div class="dropdown-menu">
{form name="thelia.customer.login"}
{form name="thelia.front.customer.login"}
<form id="form-login-mini" action="{url path="/login"}" method="post" role="form" {form_enctype form=$form}>
{form_hidden_fields form=$form}
{form_field form=$form field="email"}
@@ -297,12 +297,13 @@ URL: http://www.thelia.net
<div class="block-heading"><h3 class="block-title">{intl l="Newsletter"}</h3></div>
<div class="block-content">
<p id="newletter-describe">{intl l="Sign up to receive our latest news."}</p>
{form name="thelia.newsletter"}
<form id="form-newsletter" action="{url path="/newsletter"}" method="post" role="form">
{form name="thelia.front.newsletter"}
<form id="form-newsletter-mini" action="{url path="/newsletter"}" method="post" role="form">
{form_hidden_fields form=$form}
{form_field form=$form field="email"}
<div class="form-group">
<label for="{$label_attr.for}">{intl l="Email address"}</label>
<input type="email" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="{intl l="Your email address"}" aria-describedby="newletter-describe" {if $required} aria-required="true" required{/if} autocomplete="off">
<label for="{$label_attr.for}-mini">{intl l="Email address"}</label>
<input type="email" name="{$name}" id="{$label_attr.for}-mini" class="form-control" placeholder="{intl l="Your email address"}" aria-describedby="newletter-describe" {if $required} aria-required="true" required{/if} autocomplete="off">
</div>
{/form_field}
<button type="submit" class="btn btn-subscribe">{intl l="Subscribe"}</button>
@@ -348,9 +349,9 @@ URL: http://www.thelia.net
{loop name="footer_links" type="content" folder="2"}
<li><a href="{$URL}">{$TITLE}</a></li>
{/loop}
<li><a href="#">Site Map</a></li>
<li><a href="#">Terms & Conditions</a></li>
<li><a href="#">Contact Us</a></li>
{*<li><a href="#">Site Map</a></li>
<li><a href="#">Terms & Conditions</a></li>*}
<li><a href="{url path="/contact"}">Contact Us</a></li>
</ul>
</nav>
@@ -375,6 +376,9 @@ URL: http://www.thelia.net
}
</script>
<script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
{javascripts file='assets/js/bootstrap/bootstrap.js'}
<script src="{$asset_url}"></script>
{/javascripts}

View File

@@ -15,8 +15,8 @@
<div class="main">
<article class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page-header">{intl l="Login"}</h1>
{form name="thelia.customer.login"}
<form id="form-login" action="{url path="/login"}" method="post" role="form" {form_enctype form=$form}>
{form name="thelia.front.customer.login"}
<form id="form-login" action="{url path="/login"}" method="post" role="form" {form_enctype form=$form} novalidate>
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
{form_field form=$form field='success_url'}
<input type="hidden" name="{$name}" value="{navigate to="return_to"}"> {* the url the user is redirected to on login success *}

View File

@@ -1,15 +0,0 @@
{extends file="layout.tpl"}
{* Breadcrumb *}
{block name='no-return-functions' append}
{$breadcrumbs = [['title' => {intl l="Thanks !"}, 'url'=>{url path="/contact/success"}]]}
{/block}
{block name="main-content"}
<div class="main">
<article class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page-header">{intl l="Thanks for signing up!"}</h1>
<p>{intl l="We'll keep you posted whenever we have any new updates. If you ever wish to unsubscribe, you can easily do so via the link that will be in every email."}</p>
</article>
</div>
{/block}

View File

@@ -8,37 +8,31 @@
{block name="main-content"}
<div class="main">
<article class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page-header">{intl l="Newsletter"}</h1>
<h1 id="main-label" class="page-header">{intl l="Newsletter Subscription"}</h1>
{form name="thelia.newsletter"}
<form id="form-contact" class="form-horizontal" action="{url path="/newsletter"}" method="post" role="form">
{form name="thelia.front.newsletter"}
<form id="form-newsletter" action="{url path="/newsletter"}" method="post" role="form">
{form_hidden_fields form=$form}
<fieldset id="contact-info" class="panel panel">
<div class="panel-heading">
1. {intl l="Personal Informations"}
<p>{intl l="You want to subscribe to the newsletter? Please enter your email address below."}</p>
{form_field form=$form field="email"}
<div class="form-group group-email {if $error}has-error{elseif !$error && $value != ""}has-success{/if}">
<label for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<input type="email" name="{$name}" id="{$label_attr.for}" value="{$value}" class="form-control" {if $required} aria-required="true" required{/if} autofocus>
{if $error}
<span class="help-block"><span class="icon-remove"></span> {$message}</span>
{elseif !$error && $value != ""}
<span class="help-block"><span class="icon-ok"></span> {intl l="Thanks for signing up! We'll keep you posted whenever we have any new updates."}</span>
{/if}
</div>
</div>
<div class="panel-body">
{form_field form=$form field="email"}
<div class="form-group group-firstname {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<input type="email" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="johndoe@domain.com" value="{$value}" {if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{assign var="error_focus" value="true"}
{elseif $value != "" && !$error}
<span class="help-block"><i class="icon-ok"></i></span>
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
<div class="form-group group-btn">
<div class="control-btn">
<button type="submit" class="btn btn-register">{intl l="Subscribe"}</button>
</div>
</div><!--/.form-group-->
{/form_field}
<div class="form-group group-btn">
<div class="control-btn">
<button type="submit" class="btn btn-submit">{intl l="Subscribe"}</button>
</div>
</fieldset>
</div><!--/.form-group-->
</form>
{/form}
</article>

View File

@@ -92,15 +92,17 @@
<div class="product-options">
<dl class="dl-horizontal">
<dt>{intl l="Available"} :</dt>
<dd>{intl l="In Stock"}</dd>
{if $STOCK > 0}
<dd>{intl l="In Stock"}</dd>
{else}
<dd>{intl l="Out of Stock"}</dd>
{/if}
<dt>{intl l="No."}</dt>
<dd>{$REF}</dd>
{*<dt>Select Size</dt>
<dd>Large</dd>
<dt>Select Delivery Date</dt>
<dd>Jan 2, 2013</dd>
<dt>Additional Option</dt>
<dd>Option 1</dd>*}
{loop type="attribute_combination" name="product_options" product_sale_elements="$PRODUCT_SALE_ELEMENTS_ID"}
<dt>{$ATTRIBUTE_TITLE}</dt>
<dd>{$ATTRIBUTE_AVAILABILITY_TITLE}</dd>
{/loop}
</dl>
</div>
</td>

View File

@@ -15,7 +15,7 @@
<div class="main">
<article class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page-header">{intl l="Password Forgotten"}</h1>
{form name="thelia.customer.lostpassword"}
{form name="thelia.front.customer.lostpassword"}
<form id="form-forgotpassword" action="{url path="/password"}" method="post" role="form">
<p>{intl l="Please enter your email address below."} {intl l="You will receive a link to reset your password."}</p>
@@ -33,7 +33,7 @@
</div>
{/form_field}
<div class="group-btn">
<a href="{url path="/"}" class="btn btn-cancel">{intl l="Cancel"}</a>
<a href="{url path="/login"}" class="btn btn-cancel">{intl l="Cancel"}</a>
<button type="submit" class="btn btn-forgot">{intl l="Send"}</button>
</div>
</form>

View File

@@ -73,7 +73,7 @@
</div>
{ifloop rel="image.carouselsup"}
<a class="left carousel-control" href="#product-thumbnails" data-slide="prev"><i class="icon-prev"></i></a>
<a class="right carousel-contol" href="#product-thumbnails" data-slide="next"><i class="icon-next"></i></a>
<a class="right carousel-control" href="#product-thumbnails" data-slide="next"><i class="icon-next"></i></a>
{/ifloop}
</div>
</section>
@@ -134,7 +134,7 @@
</div>
{form name="thelia.cart.add" }
<form id="form-product-details" action="{url path="/cart/add" }" method="post" role="form">
<form id="form-product-details" action="{url path="/cart/add" }" method="post" role="form" class="form-product">
{form_hidden_fields form=$form}
<input type="hidden" name="view" value="product">
<input type="hidden" name="product_id" value="{$ID}">
@@ -145,15 +145,7 @@
{if $form_error}<div class="alert alert-error">{$form_error_message}</div>{/if}
{form_field form=$form field='product_sale_elements_id'}
{if $default_product_sale_elements }
<input type="hidden" name="{$name}" value="{$default_product_sale_elements}" {$attr}>
{else}
{loop name="productSaleElements_promo" type="product_sale_elements" product="{$ID}" limit="1"}
<input type="hidden" name="{$name}" value="{$ID}" {$attr}>
{/loop}
{/if}
{/form_field}
{form_field form=$form field="product"}
<input id="{$label_attr.for}" type="hidden" name="{$name}" value="{$ID}" {$attr} >
{/form_field}
@@ -163,13 +155,15 @@
<div class="option">
<label for="options" class="option-heading">Options</label>
<div class="option-content">
<select name="options" class="form-control">
{loop name="stock" type="product_sale_elements" product="$ID" order="min_price"}
{loop name="combi" type="attribute_combination" product_sale_elements="$ID" order="alpha"}
<option value="{$ID}" data-quantity="{$QUANTITY}" data-price="{format_number number="{$BEST_TAXED_PRICE}"} {currency attr="symbol"}" data-old-price="{format_number number="{$TAXED_PRICE}"} {currency attr="symbol"}">{$ATTRIBUTE_AVAILABILITY_TITLE}</small></option>
{form_field form=$form field='product_sale_elements_id'}
<select name="{$name}" class="form-control">
{loop name="stock" type="product_sale_elements" product="$ID" order="min_price"}
{loop name="combi" type="attribute_combination" product_sale_elements="$ID" order="alpha"}
<option value="{$ID}" data-quantity="{$QUANTITY}" data-price="{format_number number="{$BEST_TAXED_PRICE}"} {currency attr="symbol"}" data-old-price="{format_number number="{$TAXED_PRICE}"} {currency attr="symbol"}">{$ATTRIBUTE_AVAILABILITY_TITLE}</option>
{/loop}
{/loop}
{/loop}
</select>
</select>
{/form_field}
</div>
</div>
{/ifloop}
@@ -178,7 +172,7 @@
{form_field form=$form field='quantity'}
<div class="form-group group-qty {if $error}has-error{elseif $value != "" && !$error}has-success{/if}">
<label for="{$label_attr.for}">{$label}</label>
<input type="number" name="{$name}" id="{$label_attr.for}" class="form-control" value="{$value|default:1}" min="0" required>
<input type="number" name="{$name}" id="{$label_attr.for}" class="form-control" value="{$value|default:1}" min="1" required>
{if $error }
<span class="help-block"><i class="icon-remove"></i> {$message}</span>
{elseif $value != "" && !$error}
@@ -221,13 +215,23 @@
</div>
</section>
</article><!-- /product -->
{/loop}
<ul class="pager">
<li class="previous"><a href="#">Previous product</a></li>
<li class="next"><a href="#">Next product</a></li>
</ul
></div>
<ul class="pager">
{if $HAS_PREVIOUS == 1}
{loop type="product" name="prev_product" id="{$PREVIOUS}"}
<li class="previous"><a href="{$URL}">{intl l="Previous product"}</a></li>
{/loop}
{/if}
{if $HAS_NEXT == 1}
{loop type="product" name="next_product" id="{$NEXT}"}
<li class="next"><a href="{$URL}">{intl l="Next product"}</a></li>
{/loop}
{/if}
</ul>
{/loop}
</div>
</div><!-- /.container -->
{/block}

View File

@@ -14,7 +14,7 @@
<article class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page-header">{intl l="Create New Account"}</h1>
{form name="thelia.customer.creation"}
{form name="thelia.front.customer.create"}
<form id="form-register" class="form-horizontal" action="{url path="/register"}" method="post" role="form">
{form_field form=$form field='success_url'}
<input type="hidden" name="{$name}" value="{url path="/account"}" /> {* the url the user is redirected to on registration success *}
@@ -25,7 +25,7 @@
{/form_field}
{form_hidden_fields form=$form}
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
<fieldset id="register-info" class="panel panel">
<fieldset id="register-info" class="panel">
<div class="panel-heading">
1. {intl l="Personal Informations"}
</div>