Skip to content

Commit

Permalink
[BUGFIX] Change shippingSameAsBilling Checkbox Handling to Item
Browse files Browse the repository at this point in the history
Resolves: extcode#404
  • Loading branch information
extcode committed Nov 1, 2022
1 parent 4ffa6f4 commit f7d8505
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 3 deletions.
11 changes: 11 additions & 0 deletions Classes/Controller/Cart/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ public function showAction(
$orderItem = GeneralUtility::makeInstance(
Item::class
);

if ($this->request->getOriginalRequest() &&
$this->request->getOriginalRequest()->hasArgument('orderItem')
) {
$originalRequestOrderItem = $this->request->getOriginalRequest()->getArgument('orderItem');

if (isset($originalRequestOrderItem['shippingSameAsBilling'])) {
$this->cart->setShippingSameAsBilling($originalRequestOrderItem['shippingSameAsBilling']);
$this->sessionHandler->write($this->cart, $this->settings['cart']['pid']);
}
}
} else {
$this->cart->setShippingSameAsBilling($orderItem->isShippingSameAsBilling());
$this->sessionHandler->write($this->cart, $this->settings['cart']['pid']);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Controller/Cart/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function createAction(
$billingAddress->setPid($storagePid);
$orderItem->setBillingAddress($billingAddress);

if ($this->cart->isShippingSameAsBilling()) {
if ($orderItem->isShippingSameAsBilling()) {
$shippingAddress = null;
$orderItem->removeShippingAddress();
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.. include:: ../../Includes.txt

===================================================
Breaking: #404 - Change Checkbox Value in OrderForm
===================================================

See :issue:`360`

Description
===========

In the `OrderForm.html` partial the the value of the checkbox should not depend on the shippingSameAsBilling property
of the shopping cart.
This property should only be responsible for the checkbox.

Affected Installations
======================

This affects all installations overriding the `OrderForm.html`.

Migration
=========

Replace the fluid condition of the value attribute with the value 1.

.. index:: Template, Frontend
20 changes: 20 additions & 0 deletions Documentation/Changelog/8.5/Index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. include:: ../../Includes.txt

8.3 Changes
===========

**Table of contents**

.. contents::
:local:
:depth: 1

Important
^^^^^^^^^

.. toctree::
:maxdepth: 1
:titlesonly:
:glob:

Important-*
1 change: 1 addition & 0 deletions Documentation/Changelog/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ChangeLog
:maxdepth: 5
:titlesonly:

8.5/Index
8.4/Index
8.3/Index
8.1/Index
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Partials/Cart/OrderForm.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<label for="shipping-same-as-billing">
<f:form.checkbox property="shippingSameAsBilling"
id="shipping-same-as-billing"
value="{f:if(condition:'{cart.shippingSameAsBilling}', then: 'true', else: 'false')}"
value="1"
title="{f:translate(key:'tx_cart.same_address')}"
additionalAttributes="{f:if(condition:'{cart.shippingSameAsBilling}', then: '{checked: \'checked\'}')}"/>
<span>
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'title' => 'Cart',
'description' => 'Shopping Cart(s) for TYPO3',
'category' => 'plugin',
'version' => '8.5.0',
'version' => '8.5.1',
'state' => 'stable',
'clearCacheOnLoad' => true,
'author' => 'Daniel Gohlke',
Expand Down

0 comments on commit f7d8505

Please sign in to comment.