Skip to content

Commit

Permalink
[FEATURE] Enable link to detail view
Browse files Browse the repository at this point in the history
Further adaptions are needed in product
extensions.

Fixes: #522
  • Loading branch information
rintisch committed Jun 19, 2024
1 parent 69db21e commit a07326f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
16 changes: 16 additions & 0 deletions Classes/Domain/Model/Cart/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ 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 @@ -697,4 +698,19 @@ public function setHandleStockInVariants(bool $handleStockInVariants): void
{
$this->handleStockInVariants = $handleStockInVariants;
}

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

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

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

0 comments on commit a07326f

Please sign in to comment.