Merge pull request #99 from thelia/frontend

Frontend
This commit is contained in:
Manuel Raynaud
2013-11-07 07:20:46 -08:00
15 changed files with 70 additions and 52 deletions

View File

@@ -104,6 +104,24 @@ class CustomerController extends BaseFrontController
$this->dispatch(TheliaEvents::CUSTOMER_CREATEACCOUNT, $customerCreateEvent);
$newCustomer = $customerCreateEvent->getCustomer();
// Newsletter
if (true === $form->get('newsletter')->getData()) {
$newsletterEmail = $newCustomer->getEmail();
$nlEvent = new NewsletterEvent($newsletterEmail, $this->getRequest()->getSession()->getLang()->getLocale());
$nlEvent->setFirstname($newCustomer->getFirstname());
$nlEvent->setLastname($newCustomer->getLastname());
// Security : Check if this new Email address already exist
if (null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterEmail)) {
$nlEvent->setId($newsletter->getId());
$this->dispatch(TheliaEvents::NEWSLETTER_UPDATE, $nlEvent);
} else {
$this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $nlEvent);
}
}
$this->processLogin($customerCreateEvent->getCustomer());
$cart = $this->getCart($this->getRequest());

View File

@@ -89,6 +89,14 @@ class CustomerCreateForm extends AddressCreateForm
"for" => "password_confirmation"
)
))
// Add Newsletter
->add("newsletter", "checkbox", array(
"label" => Translator::getInstance()->trans('I would like to receive the newsletter or the latest news.'),
"label_attr" => array(
"for" => "newsletter"
),
"required" => false
))
// Add terms & conditions
->add("agreed", "checkbox", array(
"constraints" => array(

View File

@@ -55,16 +55,7 @@ class CustomerProfileUpdateForm extends CustomerCreateForm
->remove("password")
->remove("password_confirm")
// Remove Terms & conditions
->remove("agreed")
// Add Newsletter
->add("newsletter", "checkbox", array(
"label" => Translator::getInstance()->trans('I would like to receive the newsletter or the latest news.'),
"label_attr" => array(
"for" => "newsletter"
),
"required" => false
));
->remove("agreed");
}
/**

View File

@@ -83,7 +83,7 @@ class NewsletterForm extends BaseForm
{
$customer = NewsletterQuery::create()->findOneByEmail($value);
if ($customer) {
$context->addViolation("You are already subscribed!");
$context->addViolation("You are already registered!");
}
}

View File

@@ -79,7 +79,7 @@ return array (
'Address Line 2' => 'Adresse suite',
'Additional address' => 'Adresse complémentaire',
'Address Line 3' => 'Adresse suite',
'Zip code' => 'Code posta',
'Zip code' => 'Code postal',
'City' => 'Ville',
'Country' => 'Pays',
'Email Address' => 'Adresse e-mail',

View File

@@ -148,7 +148,7 @@ return array(
'Rating' => 'Avis',
'Ref.' => '',
'Register!' => 'S\'inscrire !',
'Register' => 'Se connecter',
'Register' => 'S\'inscrire',
'Regular Price:' => 'Prix :',
'Related' => 'Liés', // voir le contexte pour l'accord
'Remove this address' => 'Supprimer cette adresse',
@@ -165,7 +165,7 @@ return array(
'Send' => 'Envoyer',
'Shipping Tax' => 'Frais de livraison',
'Show' => 'Voir',
'Sign In' => 'S\'inscrire',
'Sign In' => 'Se connecter',
'Sign up to receive our latest news.' => 'Inscrivez-vous pour recevoir nos actualités.',
'Skip to content' => 'Aller au contenu',
'Sort By' => 'Trier par',

View File

@@ -156,7 +156,7 @@
<tr>
<td>{$REF}</td>
<td>{format_date date=$CREATE_DATE}</td>
<td>{loop type="currency" name="order.currency" id={$CURRENCY}}{$SYMBOL}{/loop} {format_number number=$TOTAL_TAXED_AMOUNT}</td>
<td>{format_number number=$TOTAL_TAXED_AMOUNT} {loop type="currency" name="order.currency" id={$CURRENCY}}{$SYMBOL}{/loop}</td>
<td><span class="label-delivered">{loop type="order-status" name="order.status" id={$STATUS}}{$TITLE}{/loop}</span></td>
<td><a href="#" class="btn btn-order-details" data-toggle="tooltip" title="{intl l="View order %ref as pdf document" ref={$REF}}"><span class="icon-cloud-download"></span> {intl l="Order details"}</a></td>
</tr>

View File

@@ -89,11 +89,11 @@
<td class="unitprice">
{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">{intl l="instead of"} <span class="price">{currency attr="symbol"} {$TAXED_PRICE}</span></small>
<div class="special-price"><span class="price">{$PROMO_TAXED_PRICE} {currency attr="symbol"}</span></div>
<small class="old-price">{intl l="instead of"} <span class="price">{$TAXED_PRICE} {currency attr="symbol"}</span></small>
{else}
{assign "real_price" $TAXED_PRICE}
<div class="special-price"><span class="price">{currency attr="symbol"} {$TAXED_PRICE}</span></div>
<div class="special-price"><span class="price">{$TAXED_PRICE} {currency attr="symbol"}</span></div>
{/if}
</td>
<td class="qty">
@@ -109,7 +109,7 @@
</div>
</td>
<td class="subprice">
<span class="price">{currency attr="symbol"} {$real_price * $QUANTITY}</span>
<span class="price">{$real_price * $QUANTITY} {currency attr="symbol"}</span>
</td>
</tr>
@@ -121,7 +121,7 @@
<th class="total">{intl l="Total"}</th>
<td class="total">
<div class="total-price">
<span class="price">{currency attr="symbol"} {cart attr="total_taxed_price"}</span>
<span class="price">{cart attr="total_taxed_price"} {currency attr="symbol"}</span>
</div>
</td>
</tr>

View File

@@ -18,11 +18,11 @@
{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>
<div class="special-price"><span class="price">{$PROMO_TAXED_PRICE} {currency attr="symbol"}</span></div>
<small class="old-price"> <span class="price">{$TAXED_PRICE} {currency attr="symbol"}</span></small>
{else}
{assign "real_price" $TAXED_PRICE}
<div class="special-price"><span class="price">{currency attr="symbol"} {$TAXED_PRICE}</span></div>
<div class="special-price"><span class="price">{$TAXED_PRICE} {currency attr="symbol"}</span></div>
{/if}
</td>

View File

@@ -34,7 +34,7 @@
{else}
{assign "real_price" $TAXED_PRICE}
{/if}
<span class="qty">{$QUANTITY}</span> X <span class="price" style="font-size:1em;">{currency attr="symbol"}{$real_price}</span></div>
<span class="qty">{$QUANTITY}</span> X <span class="price" style="font-size:1em;">{$real_price} {currency attr="symbol"}</span></div>
{assign "total_price" $total_price + ($QUANTITY * $real_price)}
</td>
</tr>
@@ -49,7 +49,7 @@
</td>
<td class="total">
<div class="total-price">
<span class="price">{currency attr="symbol"}{$total_price}</span>
<span class="price">{$total_price} {currency attr="symbol"}</span>
</div>
</td>
</tr>

View File

@@ -41,25 +41,11 @@
<div class="pagination-container" role="pagination" aria-labelledby="pagination-label-{$toolbar}}">
<strong id="pagination-label-{$toolbar}}" class="pagination-label">{intl l="Pagination"}</strong>
<ul class="pagination">
{if $product_page > 1}
<li><a href="{url path={navigate to="current"} page={$product_page-1} }" title="{intl l="Previous"}" class="prev"><i class="icon-prev"></i></a></li>
{else}
<li><a href="#" title="{intl l="Previous"}" class="prev"><i class="icon-prev"></i></a></li>
{/if}
<li{if $product_page le 1} class="disabled"{/if}><a href="{url path={navigate to="current"} page={$product_page-1} }" title="{intl l="Previous"}" class="prev"><i class="icon-prev"></i></a></li>
{pageloop rel="product_list"}
{if $PAGE != $CURRENT}
<li><a href="{url path={navigate to="current"} page=$PAGE }"> {$PAGE} </a></li>
{else}
<li class="active"><a href="#" tabindex="-1">{$PAGE}</a></li>
{/if}
{if $PAGE == $LAST}
{if $CURRENT < $LAST}
<li><a href="{url path={navigate to="current"} page={$CURRENT+1} }" title="{intl l="Next"}" class="next"><i class="icon-next"></i></a></li>
{else}
<li><a href="#" title="{intl l="Next"}" class="next"><i class="icon-next"></i></a></li>
{/if}
<li{if $PAGE eq $CURRENT} class="active"{/if}><a href="{url path={navigate to="current"} page=$PAGE }"> {$PAGE} </a></li>
{if $PAGE eq $LAST}
<li{if $CURRENT eq $LAST} class="disabled"{/if}><a href="{url path={navigate to="current"} page={$CURRENT+1} }" title="{intl l="Next"}" class="next"><i class="icon-next"></i></a></li>
{/if}
{/pageloop}
</ul>

View File

@@ -134,7 +134,7 @@
{/if}
<label for="delivery-method_{$ID}">
<input type="radio" name="{$name}" id="delivery-method_{$ID}"{if $isDeliveryMethodChecked} checked="checked"{/if} value="{$ID}">
<strong>{$TITLE}</strong> / {currency attr="symbol"} {$POSTAGE}
<strong>{$TITLE}</strong> / {$POSTAGE} {currency attr="symbol"}
</label>
{/form_field}
</div>

View File

@@ -103,18 +103,18 @@
<td class="unitprice">
{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">{intl l="instead of"} <span class="price">{currency attr="symbol"} {$TAXED_PRICE}</span></small>
<div class="special-price"><span class="price">{$PROMO_TAXED_PRICE} {currency attr="symbol"}</span></div>
<small class="old-price">{intl l="instead of"} <span class="price">{$TAXED_PRICE} {currency attr="symbol"}</span></small>
{else}
{assign "real_price" $TAXED_PRICE}
<div class="special-price"><span class="price">{currency attr="symbol"} {$TAXED_PRICE}</span></div>
<div class="special-price"><span class="price">{$TAXED_PRICE} {currency attr="symbol"} </span></div>
{/if}
</td>
<td class="qty">
<span class="price">{$QUANTITY}</span>
</td>
<td class="subprice">
<span class="price">{currency attr="symbol"} {$real_price * $QUANTITY}</span>
<span class="price">{$real_price * $QUANTITY} {currency attr="symbol"}</span>
</td>
</tr>
@@ -127,7 +127,7 @@
<th class="shipping">{intl l="Shipping Tax"}</th>
<td class="shipping">
<div class="shipping-price">
<span class="price">{currency attr="symbol"} {order attr="postage"}</span>
<span class="price">{order attr="postage"} {currency attr="symbol"}</span>
</div>
</td>
</tr>
@@ -153,7 +153,7 @@
<th class="total">{intl l="Total"}</th>
<td class="total">
<div class="total-price">
<span class="price">{currency attr="symbol"} {{cart attr="total_taxed_price"} + {order attr="postage"}}</span>
<span class="price">{{cart attr="total_taxed_price"} + {order attr="postage"}} {currency attr="symbol"}</span>
</div>
</td>
</tr>

View File

@@ -42,7 +42,7 @@
<dt>{intl l="Date"} : </dt>
<dd>{format_date date=$CREATE_DATE output="date"}</dd>
<dt>{intl l="Total"} : </dt>
<dd>{loop type="currency" name="order-currency" id=$CURRENCY}{$SYMBOL}{/loop} {$TOTAL_TAXED_AMOUNT}</dd>
<dd>{$TOTAL_TAXED_AMOUNT} {loop type="currency" name="order-currency" id=$CURRENCY}{$SYMBOL}{/loop}</dd>
</dl>
</div>
</div>

View File

@@ -245,6 +245,21 @@
</div>
</fieldset>
{form_field form=$form field="newsletter"}
<div class="form-group group-newsletter{if $error} has-error{/if}">
<div class="control-input">
<div class="checkbox">
<label class="control-label" for="{$label_attr.for}">
<input type="checkbox" name="{$name}" id="{$label_attr.for}" value="{$value}"{if $checked} checked{/if} {if $required} aria-required="true" required{/if}>{$label}
</label>
{if $error }
<span class="help-block">{$message}</span>
{/if}
</div>
</div>
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field="agreed"}
<div class="form-group group-agreed{if $error} has-error{/if}">
<div class="control-input">
@@ -262,7 +277,7 @@
<div class="form-group group-btn">
<div class="control-btn">
<button type="submit" class="btn btn-register">{intl l="Sign In"}</button>
<button type="submit" class="btn btn-register">{intl l="Register"}</button>
</div>
</div><!--/.form-group-->
</form>