Skip to content

Commit

Permalink
[TASK] Improve naming and adapt parameter structure
Browse files Browse the repository at this point in the history
  • Loading branch information
rintisch committed Jun 19, 2024
1 parent a07326f commit 33c37ea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
15 changes: 8 additions & 7 deletions Classes/Domain/Model/Cart/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class Product
*/
protected bool $handleStockInVariants = false;

protected array $detailPageParameter = [];

public function __construct(
protected string $productType,
protected int $productId,
Expand All @@ -69,7 +71,6 @@ public function __construct(
protected TaxClass $taxClass,
protected int $quantity,
protected bool $isNetPrice = false,
protected array $detailViewParameter = [],
FeVariant $feVariant = null
) {
if ($feVariant) {
Expand Down Expand Up @@ -699,18 +700,18 @@ public function setHandleStockInVariants(bool $handleStockInVariants): void
$this->handleStockInVariants = $handleStockInVariants;
}

public function getDetailViewParameter(): array
public function getDetailPageParameter(): array
{
return $this->detailViewParameter;
return $this->detailPageParameter;
}

public function setDetailViewParameter(array $detailViewParameter): void
public function setDetailPageParameter(array $detailPageParameter): void
{
$this->detailViewParameter = $detailViewParameter;
$this->detailPageParameter = $detailPageParameter;
}

public function addDetailViewParameter(string $key, int|string $value): void
public function addDetailPageParameter(string $key, int|string $value): void
{
$this->detailViewParameter[$key] = $value;
$this->detailPageParameter[$key] = $value;
}
}
20 changes: 10 additions & 10 deletions Resources/Private/Partials/Cart/ProductForm/ProductList.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<tr class="{f:if(condition: product.quantityInRange, then: '', else: 'danger')}">
<td colspan="2" class="col-md-6">
<div class="product-name">
<f:if condition="{product.detailViewParameter.pageUid} && {product.detailViewParameter.extensionName}">
<f:if condition="{product.detailPageParameter.pageUid} && {product.detailPageParameter.extensionName}">
<f:then>
<f:link.action
pageUid="{product.detailViewParameter.pageUid}"
extensionName="{product.detailViewParameter.extensionName}"
pluginName="{product.detailViewParameter.pluginName}"
controller="{product.detailViewParameter.controller}"
pageUid="{product.detailPageParameter.pageUid}"
extensionName="{product.detailPageParameter.extensionName}"
pluginName="{product.detailPageParameter.pluginName}"
controller="{product.detailPageParameter.controller}"
arguments="{product: product.productId}">
{product.title} {f:if(condition:'{product.feVariant.value}',then:'- {product.feVariant.value}')}
</f:link.action>
Expand Down Expand Up @@ -74,13 +74,13 @@
<td class="col-md-1">&nbsp;</td>
<td class="col-md-5">
<div class="product-name">
<f:if condition="{product.detailViewParameter.pageUid} && {product.detailViewParameter.extensionName}">
<f:if condition="{product.detailPageParameter.pageUid} && {product.detailPageParameter.extensionName}">
<f:then>
<f:link.action
pageUid="{product.detailViewParameter.pageUid}"
extensionName="{product.detailViewParameter.extensionName}"
pluginName="{product.detailViewParameter.pluginName}"
controller="{product.detailViewParameter.controller}"
pageUid="{product.detailPageParameter.pageUid}"
extensionName="{product.detailPageParameter.extensionName}"
pluginName="{product.detailPageParameter.pluginName}"
controller="{product.detailPageParameter.controller}"
arguments="{product: product.productId}">
{variant.title}
</f:link.action>
Expand Down

0 comments on commit 33c37ea

Please sign in to comment.