-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #381 from magento-south/MAGETWO-36960
[SOUTH] Shopping cart + Bugs
- Loading branch information
Showing
130 changed files
with
6,803 additions
and
2,431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
app/code/Magento/Checkout/Block/Cart/Item/Renderer/Actions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Checkout\Block\Cart\Item\Renderer; | ||
|
||
use Magento\Checkout\Block\Cart\Item\Renderer\Actions\Generic; | ||
use Magento\Framework\View\Element\Text; | ||
use Magento\Quote\Model\Quote\Item; | ||
|
||
class Actions extends Text | ||
{ | ||
/** | ||
* @var Item | ||
*/ | ||
protected $item; | ||
|
||
/** | ||
* Returns current quote item | ||
* | ||
* @return Item | ||
*/ | ||
public function getItem() | ||
{ | ||
return $this->item; | ||
} | ||
|
||
/** | ||
* Set current quote item | ||
* | ||
* @param Item $item | ||
* @return $this | ||
*/ | ||
public function setItem(Item $item) | ||
{ | ||
$this->item = $item; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Render html output | ||
* | ||
* @return string | ||
*/ | ||
protected function _toHtml() | ||
{ | ||
$this->setText(''); | ||
|
||
$layout = $this->getLayout(); | ||
foreach ($this->getChildNames() as $child) { | ||
/** @var Generic $childBlock */ | ||
$childBlock = $layout->getBlock($child); | ||
if ($childBlock instanceof Generic) { | ||
$childBlock->setItem($this->getItem()); | ||
$this->addText($layout->renderElement($child, false)); | ||
} | ||
} | ||
|
||
return parent::_toHtml(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
app/code/Magento/Checkout/Block/Cart/Item/Renderer/Actions/Edit.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Checkout\Block\Cart\Item\Renderer\Actions; | ||
|
||
class Edit extends Generic | ||
{ | ||
/** | ||
* Get item configure url | ||
* | ||
* @return string | ||
*/ | ||
public function getConfigureUrl() | ||
{ | ||
return $this->getUrl( | ||
'checkout/cart/configure', | ||
[ | ||
'id' => $this->getItem()->getId(), | ||
'product_id' => $this->getItem()->getProduct()->getId() | ||
] | ||
); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
app/code/Magento/Checkout/Block/Cart/Item/Renderer/Actions/Generic.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Checkout\Block\Cart\Item\Renderer\Actions; | ||
|
||
use Magento\Framework\View\Element\Template; | ||
use Magento\Quote\Model\Quote\Item; | ||
|
||
class Generic extends Template | ||
{ | ||
/** | ||
* @var Item | ||
*/ | ||
protected $item; | ||
|
||
/** | ||
* Returns current quote item | ||
* | ||
* @return Item | ||
*/ | ||
public function getItem() | ||
{ | ||
return $this->item; | ||
} | ||
|
||
/** | ||
* Set current quote item | ||
* | ||
* @param Item $item | ||
* @return $this | ||
*/ | ||
public function setItem(Item $item) | ||
{ | ||
$this->item = $item; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Check if product is visible in site visibility | ||
* | ||
* @return bool | ||
*/ | ||
public function isProductVisibleInSiteVisibility() | ||
{ | ||
return $this->getItem()->getProduct()->isVisibleInSiteVisibility(); | ||
} | ||
|
||
/** | ||
* Check if cart item is virtual | ||
* | ||
* @return bool | ||
*/ | ||
public function isVirtual() | ||
{ | ||
return (bool)$this->getItem()->getIsVirtual(); | ||
} | ||
} |
Oops, something went wrong.