Skip to content

Commit cd016f7

Browse files
committed
Merge pull request #156 from magento-sparta/SUPEE-7245
[SUPPORT] SUPEE-7245 Add To Cart issue on Compare Products Page when enabling SSL using the blank theme
2 parents 930f1f8 + 63ef4ee commit cd016f7

File tree

5 files changed

+7
-3
lines changed

5 files changed

+7
-3
lines changed

app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
<div class="actions-primary">
6666
<?php if ($_item->isSaleable()): ?>
6767
<form data-role="tocart-form" action="<?php echo $this->helper('Magento\Catalog\Helper\Product\Compare')->getAddToCartUrl($_item); ?>" method="post">
68+
<?php echo $block->getBlockHtml('formkey')?>
6869
<button type="submit" class="action tocart primary">
6970
<span><?php echo __('Add to Cart'); ?></span>
7071
</button>

app/code/Magento/Catalog/view/frontend/templates/product/list.phtml

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ $imageBlock = $block->getLayout()->createBlock('Magento\Catalog\Block\Product\I
7979
<form data-role="tocart-form" action="<?php echo $postParams['action']; ?>" method="post">
8080
<input type="hidden" name="product" value="<?php echo $postParams['data']['product']; ?>">
8181
<input type="hidden" name="<?php echo Action::PARAM_NAME_URL_ENCODED; ?>" value="<?php echo $postParams['data'][Action::PARAM_NAME_URL_ENCODED]; ?>">
82+
<?php echo $block->getBlockHtml('formkey')?>
8283
<button type="submit"
8384
title="<?php echo $block->escapeHtml(__('Add to Cart')); ?>"
8485
class="action tocart primary">

app/code/Magento/Catalog/view/frontend/templates/product/view/form.phtml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
2222
<input type="hidden" name="selected_configurable_option" value="" />
2323
<input type="hidden" name="related_product" id="related-products-field" value="" />
24+
<?php echo $block->getBlockHtml('formkey')?>
2425
<?php echo $block->getChildHtml('form_top'); ?>
2526
<?php if (!$block->hasOptions()):?>
2627
<?php echo $block->getChildHtml('product_info_form_content'); ?>

app/code/Magento/Checkout/Controller/Cart/Add.php

+4
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ protected function _initProduct()
7979
*/
8080
public function execute()
8181
{
82+
if (!$this->_formKeyValidator->validate($this->getRequest())) {
83+
return $this->resultRedirectFactory->create()->setPath('*/*/');
84+
}
85+
8286
$params = $this->getRequest()->getParams();
8387
try {
8488
if (isset($params['qty'])) {

app/code/Magento/Reports/Test/Unit/Model/Resource/Order/CollectionTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,8 @@ public function testPrepareSummary($useAggregatedData, $mainTable, $isFilter, $g
255255
*/
256256
public function testGetDateRangeFirstPart($range, $customStart, $customEnd, $expectedInterval)
257257
{
258-
$timeZoneToReturn = date_default_timezone_get();
259-
date_default_timezone_set('UTC');
260258
$result = $this->collection->getDateRange($range, $customStart, $customEnd);
261259
$interval = $result['to']->diff($result['from']);
262-
date_default_timezone_set($timeZoneToReturn);
263260
$intervalResult = $interval->format('%y %m %d %h:%i:%s');
264261
$this->assertEquals($expectedInterval, $intervalResult);
265262
}

0 commit comments

Comments
 (0)