first commit
This commit is contained in:
38
bundles/KupShop/GTMOldBundle/Ecommerce/RemoveFromCart.php
Normal file
38
bundles/KupShop/GTMOldBundle/Ecommerce/RemoveFromCart.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace KupShop\GTMOldBundle\Ecommerce;
|
||||
|
||||
use KupShop\GTMOldBundle\Utils\PriceComputer;
|
||||
|
||||
class RemoveFromCart extends AbstractEcommerce
|
||||
{
|
||||
/**
|
||||
* @var PriceComputer
|
||||
*/
|
||||
protected $priceComputer;
|
||||
|
||||
public function __construct(PriceComputer $priceComputer)
|
||||
{
|
||||
$this->priceComputer = $priceComputer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specific PageData.
|
||||
*/
|
||||
public function getData(&$dataContainer)
|
||||
{
|
||||
foreach ($this->pageData['products'] as $product) {
|
||||
$id = !empty($product['id_variation']) ? ($product['id'].'_'.$product['id_variation']) : $product['id'];
|
||||
|
||||
$dataContainer->{$id} = [
|
||||
'name' => $product['product']->title,
|
||||
'id' => $id,
|
||||
'price' => $this->priceComputer->getPrice($product['price']),
|
||||
'brand' => $product['producer'],
|
||||
// 'category' => $product['section_name'], TODO: neni zatim odkud vzit?
|
||||
'variant' => $product['product']->variationTitle ?? '',
|
||||
'quantity' => $product['pieces'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user