Merge branch 'cart'
Conflicts: core/lib/Thelia/Core/HttpFoundation/Session/Session.php
This commit is contained in:
@@ -7,4 +7,30 @@ use Thelia\Model\Base\Cart as BaseCart;
|
||||
class Cart extends BaseCart
|
||||
{
|
||||
|
||||
public function duplicate($token, Customer $customer = null)
|
||||
{
|
||||
$cartItems = $this->getCartItems();
|
||||
|
||||
$cart = new Cart();
|
||||
$cart->setAddressDeliveryId($this->getAddressDeliveryId());
|
||||
$cart->setAddressInvoiceId($this->getAddressInvoiceId());
|
||||
$cart->setToken($token);
|
||||
|
||||
if ($customer){
|
||||
$cart->setCustomer($customer);
|
||||
}
|
||||
// TODO : set current Currency
|
||||
//$cart->setCurrency()
|
||||
$cart->save();
|
||||
|
||||
foreach ($cartItems as $cartItem){
|
||||
$item = new CartItem();
|
||||
$item->setCart($cart);
|
||||
$item->setProductId($cartItem->getProductId());
|
||||
$item->setQuantity($cartItem->getQuantity());
|
||||
$item->save();
|
||||
}
|
||||
|
||||
return $cart;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\CartQuery as BaseCartQuery;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'cart' table.
|
||||
@@ -18,4 +18,5 @@ use Thelia\Model\Base\CartQuery as BaseCartQuery;
|
||||
class CartQuery extends BaseCartQuery
|
||||
{
|
||||
|
||||
|
||||
} // CartQuery
|
||||
|
||||
@@ -116,7 +116,7 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
|
||||
protected function generateRef()
|
||||
{
|
||||
return date("YmdHisu");
|
||||
return uniqid(substr($this->getLastname(), 0, (strlen($this->getLastname()) >= 3) ? 3 : strlen($this->getLastname())), true);
|
||||
}
|
||||
|
||||
public function setPassword($password)
|
||||
|
||||
Reference in New Issue
Block a user