Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/code/Magento/Catalog/Controller/Product/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ public function execute()
{
// Get initial data from request
$categoryId = (int) $this->getRequest()->getParam('category', false);
$productId = (int) $this->getRequest()->getParam('id');
$specifyOptions = $this->getRequest()->getParam('options');

if ($this->getRequest()->isPost() && $this->getRequest()->getParam(self::PARAM_NAME_URL_ENCODED)) {
Expand Down Expand Up @@ -174,12 +173,15 @@ public function execute()

// Render page
try {
$productId = (int) number_format($this->getRequest()->getParam('id', false), 0, "", "");
$this->applyCustomDesign($productId);
$page = $this->resultPageFactory->create();
$this->viewHelper->prepareAndRender($page, $productId, $this, $params);
return $page;
} catch (NoSuchEntityException $e) {
return $this->noProductRedirect();
} catch (\TypeError $e) {
return $this->noProductRedirect();
} catch (\Exception $e) {
$this->logger->critical($e);
$resultForward = $this->resultForwardFactory->create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ public function testExecute(): void
$themeId = 3;
$this->requestMock->method('isPost')
->willReturn(false);
$this->requestMock->method('getParam')
->willReturn(1);
$this->productRepositoryMock->method('getById')
->willReturn($this->productInterfaceMock);
$dataObjectMock = $this->getMockBuilder(DataObject::class)
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/Review/Block/Form.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2013 Adobe
* All Rights Reserved.
*/
namespace Magento\Review\Block;

Expand Down Expand Up @@ -214,6 +214,6 @@ public function getRegisterUrl()
*/
protected function getProductId()
{
return $this->getRequest()->getParam('id', false);
return (int) $this->getRequest()->getParam('id', false);
}
}