Merge branch 'cart'
Conflicts: core/lib/Thelia/Config/Resources/config.xml
This commit is contained in:
@@ -11,8 +11,37 @@ 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\ArgumentCollection;
|
||||
|
||||
class Cart extends BaseLoop {
|
||||
use \Thelia\Cart\CartTrait;
|
||||
/**
|
||||
*
|
||||
* define all args used in your loop
|
||||
*
|
||||
* array key is your arg name.
|
||||
*
|
||||
* example :
|
||||
*
|
||||
* return array (
|
||||
* "ref",
|
||||
* "id" => "optional",
|
||||
* "stock" => array(
|
||||
* "optional",
|
||||
* "default" => 10
|
||||
* )
|
||||
* );
|
||||
*
|
||||
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -42,30 +71,33 @@ class Cart extends BaseLoop {
|
||||
*/
|
||||
public function exec(&$pagination)
|
||||
{
|
||||
// TODO: Implement exec() method.
|
||||
$result = new LoopResult();
|
||||
$cart = $this->getCart($this->request);
|
||||
|
||||
if($cart === null) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
$cartItems = $cart->getCartItems();
|
||||
|
||||
foreach ($cartItems as $cartItem) {
|
||||
$product = $cartItem->getProduct();
|
||||
//$product->setLocale($this->request->getSession()->getLocale());
|
||||
|
||||
$loopResultRow = new LoopResultRow();
|
||||
|
||||
$loopResultRow->set("ITEM_ID", $cartItem->getId());
|
||||
$loopResultRow->set("TITLE", $product->getTitle());
|
||||
$loopResultRow->set("REF", $product->getRef());
|
||||
$loopResultRow->set("QUANTITY", $cartItem->getQuantity());
|
||||
$loopResultRow->set("PRICE", $cartItem->getPrice());
|
||||
$loopResultRow->set("PRODUCT_ID", $product->getId());
|
||||
$result->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* define all args used in your loop
|
||||
*
|
||||
* array key is your arg name.
|
||||
*
|
||||
* example :
|
||||
*
|
||||
* return array (
|
||||
* "ref",
|
||||
* "id" => "optional",
|
||||
* "stock" => array(
|
||||
* "optional",
|
||||
* "default" => 10
|
||||
* )
|
||||
* );
|
||||
*
|
||||
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
// TODO: Implement getArgDefinitions() method.
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user