Skip to content

Commit

Permalink
Merge pull request #156 from magento-sparta/SUPEE-7245
Browse files Browse the repository at this point in the history
[SUPPORT] SUPEE-7245 Add To Cart issue on Compare Products Page when enabling SSL using the blank theme
  • Loading branch information
slavvka committed Nov 12, 2015
2 parents 930f1f8 + 63ef4ee commit cd016f7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<div class="actions-primary">
<?php if ($_item->isSaleable()): ?>
<form data-role="tocart-form" action="<?php echo $this->helper('Magento\Catalog\Helper\Product\Compare')->getAddToCartUrl($_item); ?>" method="post">
<?php echo $block->getBlockHtml('formkey')?>
<button type="submit" class="action tocart primary">
<span><?php echo __('Add to Cart'); ?></span>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ $imageBlock = $block->getLayout()->createBlock('Magento\Catalog\Block\Product\I
<form data-role="tocart-form" action="<?php echo $postParams['action']; ?>" method="post">
<input type="hidden" name="product" value="<?php echo $postParams['data']['product']; ?>">
<input type="hidden" name="<?php echo Action::PARAM_NAME_URL_ENCODED; ?>" value="<?php echo $postParams['data'][Action::PARAM_NAME_URL_ENCODED]; ?>">
<?php echo $block->getBlockHtml('formkey')?>
<button type="submit"
title="<?php echo $block->escapeHtml(__('Add to Cart')); ?>"
class="action tocart primary">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
<input type="hidden" name="selected_configurable_option" value="" />
<input type="hidden" name="related_product" id="related-products-field" value="" />
<?php echo $block->getBlockHtml('formkey')?>
<?php echo $block->getChildHtml('form_top'); ?>
<?php if (!$block->hasOptions()):?>
<?php echo $block->getChildHtml('product_info_form_content'); ?>
Expand Down
4 changes: 4 additions & 0 deletions app/code/Magento/Checkout/Controller/Cart/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ protected function _initProduct()
*/
public function execute()
{
if (!$this->_formKeyValidator->validate($this->getRequest())) {
return $this->resultRedirectFactory->create()->setPath('*/*/');
}

$params = $this->getRequest()->getParams();
try {
if (isset($params['qty'])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,8 @@ public function testPrepareSummary($useAggregatedData, $mainTable, $isFilter, $g
*/
public function testGetDateRangeFirstPart($range, $customStart, $customEnd, $expectedInterval)
{
$timeZoneToReturn = date_default_timezone_get();
date_default_timezone_set('UTC');
$result = $this->collection->getDateRange($range, $customStart, $customEnd);
$interval = $result['to']->diff($result['from']);
date_default_timezone_set($timeZoneToReturn);
$intervalResult = $interval->format('%y %m %d %h:%i:%s');
$this->assertEquals($expectedInterval, $intervalResult);
}
Expand Down

0 comments on commit cd016f7

Please sign in to comment.