Skip to content

Commit 264c105

Browse files
Merge pull request #381 from magento-south/MAGETWO-36960
[SOUTH] Shopping cart + Bugs
2 parents 3ad1194 + 8bd029f commit 264c105

File tree

130 files changed

+6803
-2431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+6803
-2431
lines changed

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@
253253
<label>European Union Countries</label>
254254
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
255255
</field>
256+
<field id="destinations" translate="label" type="multiselect" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0">
257+
<label>Top destinations</label>
258+
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
259+
</field>
256260
</group>
257261
<group id="locale" translate="label" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" showInStore="1">
258262
<label>Locale Options</label>

app/code/Magento/Bundle/Block/Checkout/Cart/Item/Renderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class Renderer extends \Magento\Checkout\Block\Cart\Item\Renderer
3030
* @param \Magento\Framework\Url\Helper\Data $urlHelper
3131
* @param \Magento\Framework\Message\ManagerInterface $messageManager
3232
* @param PriceCurrencyInterface $priceCurrency
33-
* @param Configuration $bundleProductConfiguration
3433
* @param \Magento\Framework\Module\Manager $moduleManager
34+
* @param Configuration $bundleProductConfiguration
3535
* @param array $data
3636
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
3737
*/

app/code/Magento/Bundle/view/frontend/layout/checkout_cart_item_renderers.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
99
<body>
1010
<referenceBlock name="checkout.cart.item.renderers">
11-
<block class="Magento\Bundle\Block\Checkout\Cart\Item\Renderer" as="bundle" template="Magento_Checkout::cart/item/default.phtml"/>
11+
<block class="Magento\Bundle\Block\Checkout\Cart\Item\Renderer" as="bundle" template="Magento_Checkout::cart/item/default.phtml">
12+
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions" name="checkout.cart.item.renderers.bundle.actions" as="actions">
13+
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit" name="checkout.cart.item.renderers.bundle.actions.edit" template="Magento_Checkout::cart/item/renderer/actions/edit.phtml"/>
14+
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.bundle.actions.remove" template="Magento_Checkout::cart/item/renderer/actions/remove.phtml"/>
15+
</block>
16+
</block>
1217
</referenceBlock>
1318
</body>
1419
</page>

app/code/Magento/Catalog/Block/Product/View/Options/Type/Select.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function getValuesHtml()
4646
if ($_option->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_DROP_DOWN) {
4747
$select->setName('options[' . $_option->getid() . ']')->addOption('', __('-- Please Select --'));
4848
} else {
49-
$select->setName('options[' . $_option->getid() . ']');
49+
$select->setName('options[' . $_option->getid() . '][]');
5050
$select->setClass('multiselect admin__control-multiselect' . $require . ' product-custom-option');
5151
}
5252
foreach ($_option->getValues() as $_value) {

app/code/Magento/Catalog/view/frontend/layout/checkout_cart_item_renderers.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
99
<body>
1010
<referenceBlock name="checkout.cart.item.renderers">
11-
<block class="Magento\Checkout\Block\Cart\Item\Renderer" as="virtual" template="cart/item/default.phtml"/>
11+
<block class="Magento\Checkout\Block\Cart\Item\Renderer" as="virtual" template="cart/item/default.phtml">
12+
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions" name="checkout.cart.item.renderers.virtual.actions" as="actions">
13+
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Edit" name="checkout.cart.item.renderers.virtual.actions.edit" template="Magento_Checkout::cart/item/renderer/actions/edit.phtml"/>
14+
<block class="Magento\Checkout\Block\Cart\Item\Renderer\Actions\Remove" name="checkout.cart.item.renderers.virtual.actions.remove" template="Magento_Checkout::cart/item/renderer/actions/remove.phtml"/>
15+
</block>
16+
</block>
1217
</referenceBlock>
1318
</body>
1419
</page>

app/code/Magento/Checkout/Block/Cart/Item/Renderer.php

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
namespace Magento\Checkout\Block\Cart\Item;
1010

11+
use Magento\Checkout\Block\Cart\Item\Renderer\Actions;
1112
use Magento\Framework\Pricing\PriceCurrencyInterface;
13+
use Magento\Framework\View\Element\AbstractBlock;
1214
use Magento\Quote\Model\Quote\Item;
1315
use Magento\Catalog\Pricing\Price\ConfiguredPriceInterface;
1416

@@ -120,10 +122,10 @@ public function __construct(
120122
/**
121123
* Set item for render
122124
*
123-
* @param \Magento\Quote\Model\Quote\Item\AbstractItem $item
125+
* @param Item $item
124126
* @return $this
125127
*/
126-
public function setItem(\Magento\Quote\Model\Quote\Item\AbstractItem $item)
128+
public function setItem(Item $item)
127129
{
128130
$this->_item = $item;
129131
return $this;
@@ -316,19 +318,6 @@ public function getOptionList()
316318
return $this->getProductOptions();
317319
}
318320

319-
/**
320-
* Get item configure url
321-
*
322-
* @return string
323-
*/
324-
public function getConfigureUrl()
325-
{
326-
return $this->getUrl(
327-
'checkout/cart/configure',
328-
['id' => $this->getItem()->getId(), 'product_id' => $this->getItem()->getProduct()->getId()]
329-
);
330-
}
331-
332321
/**
333322
* Get quote item qty
334323
*
@@ -432,7 +421,7 @@ public function isProductVisible()
432421
/**
433422
* Return product additional information block
434423
*
435-
* @return \Magento\Framework\View\Element\AbstractBlock
424+
* @return AbstractBlock
436425
*/
437426
public function getProductAdditionalInformationBlock()
438427
{
@@ -529,10 +518,10 @@ public function convertPrice($amount, $format = false)
529518
/**
530519
* Return the unit price html
531520
*
532-
* @param \Magento\Quote\Model\Quote\Item\AbstractItem $item
521+
* @param Item $item
533522
* @return string
534523
*/
535-
public function getUnitPriceHtml(\Magento\Quote\Model\Quote\Item\AbstractItem $item)
524+
public function getUnitPriceHtml(Item $item)
536525
{
537526
/** @var Renderer $block */
538527
$block = $this->getLayout()->getBlock('checkout.item.price.unit');
@@ -543,10 +532,10 @@ public function getUnitPriceHtml(\Magento\Quote\Model\Quote\Item\AbstractItem $
543532
/**
544533
* Return row total html
545534
*
546-
* @param \Magento\Quote\Model\Quote\Item\AbstractItem $item
535+
* @param Item $item
547536
* @return string
548537
*/
549-
public function getRowTotalHtml(\Magento\Quote\Model\Quote\Item\AbstractItem $item)
538+
public function getRowTotalHtml(Item $item)
550539
{
551540
/** @var Renderer $block */
552541
$block = $this->getLayout()->getBlock('checkout.item.price.row');
@@ -557,10 +546,10 @@ public function getRowTotalHtml(\Magento\Quote\Model\Quote\Item\AbstractItem $i
557546
/**
558547
* Return item price html for sidebar
559548
*
560-
* @param \Magento\Quote\Model\Quote\Item\AbstractItem $item
549+
* @param Item $item
561550
* @return string
562551
*/
563-
public function getSidebarItemPriceHtml(\Magento\Quote\Model\Quote\Item\AbstractItem $item)
552+
public function getSidebarItemPriceHtml(Item $item)
564553
{
565554
/** @var Renderer $block */
566555
$block = $this->getLayout()->getBlock('checkout.cart.item.price.sidebar');
@@ -571,10 +560,10 @@ public function getSidebarItemPriceHtml(\Magento\Quote\Model\Quote\Item\Abstract
571560
/**
572561
* Get unit price excluding tax html
573562
*
574-
* @param Item\AbstractItem $item
563+
* @param Item $item
575564
* @return string
576565
*/
577-
public function getUnitPriceExclTaxHtml(\Magento\Quote\Model\Quote\Item\AbstractItem $item)
566+
public function getUnitPriceExclTaxHtml(Item $item)
578567
{
579568
/** @var Renderer $block */
580569
$block = $this->getLayout()->getBlock('checkout.onepage.review.item.price.unit.excl');
@@ -585,10 +574,10 @@ public function getUnitPriceExclTaxHtml(\Magento\Quote\Model\Quote\Item\Abstract
585574
/**
586575
* Get unit price including tax html
587576
*
588-
* @param Item\AbstractItem $item
577+
* @param Item $item
589578
* @return string
590579
*/
591-
public function getUnitPriceInclTaxHtml(\Magento\Quote\Model\Quote\Item\AbstractItem $item)
580+
public function getUnitPriceInclTaxHtml(Item $item)
592581
{
593582
/** @var Renderer $block */
594583
$block = $this->getLayout()->getBlock('checkout.onepage.review.item.price.unit.incl');
@@ -599,10 +588,10 @@ public function getUnitPriceInclTaxHtml(\Magento\Quote\Model\Quote\Item\Abstract
599588
/**
600589
* Get row total excluding tax html
601590
*
602-
* @param Item\AbstractItem $item
591+
* @param Item $item
603592
* @return string
604593
*/
605-
public function getRowTotalExclTaxHtml(\Magento\Quote\Model\Quote\Item\AbstractItem $item)
594+
public function getRowTotalExclTaxHtml(Item $item)
606595
{
607596
/** @var Renderer $block */
608597
$block = $this->getLayout()->getBlock('checkout.onepage.review.item.price.rowtotal.excl');
@@ -613,14 +602,32 @@ public function getRowTotalExclTaxHtml(\Magento\Quote\Model\Quote\Item\AbstractI
613602
/**
614603
* Get row total including tax html
615604
*
616-
* @param Item\AbstractItem $item
605+
* @param Item $item
617606
* @return string
618607
*/
619-
public function getRowTotalInclTaxHtml(\Magento\Quote\Model\Quote\Item\AbstractItem $item)
608+
public function getRowTotalInclTaxHtml(Item $item)
620609
{
621610
/** @var Renderer $block */
622611
$block = $this->getLayout()->getBlock('checkout.onepage.review.item.price.rowtotal.incl');
623612
$block->setItem($item);
624613
return $block->toHtml();
625614
}
615+
616+
/**
617+
* Get row total including tax html
618+
*
619+
* @param Item $item
620+
* @return string
621+
*/
622+
public function getActions(Item $item)
623+
{
624+
/** @var Actions $block */
625+
$block = $this->getChildBlock('actions');
626+
if ($block instanceof Actions) {
627+
$block->setItem($item);
628+
return $block->toHtml();
629+
} else {
630+
return '';
631+
}
632+
}
626633
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Checkout\Block\Cart\Item\Renderer;
7+
8+
use Magento\Checkout\Block\Cart\Item\Renderer\Actions\Generic;
9+
use Magento\Framework\View\Element\Text;
10+
use Magento\Quote\Model\Quote\Item;
11+
12+
class Actions extends Text
13+
{
14+
/**
15+
* @var Item
16+
*/
17+
protected $item;
18+
19+
/**
20+
* Returns current quote item
21+
*
22+
* @return Item
23+
*/
24+
public function getItem()
25+
{
26+
return $this->item;
27+
}
28+
29+
/**
30+
* Set current quote item
31+
*
32+
* @param Item $item
33+
* @return $this
34+
*/
35+
public function setItem(Item $item)
36+
{
37+
$this->item = $item;
38+
return $this;
39+
}
40+
41+
/**
42+
* Render html output
43+
*
44+
* @return string
45+
*/
46+
protected function _toHtml()
47+
{
48+
$this->setText('');
49+
50+
$layout = $this->getLayout();
51+
foreach ($this->getChildNames() as $child) {
52+
/** @var Generic $childBlock */
53+
$childBlock = $layout->getBlock($child);
54+
if ($childBlock instanceof Generic) {
55+
$childBlock->setItem($this->getItem());
56+
$this->addText($layout->renderElement($child, false));
57+
}
58+
}
59+
60+
return parent::_toHtml();
61+
}
62+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Checkout\Block\Cart\Item\Renderer\Actions;
7+
8+
class Edit extends Generic
9+
{
10+
/**
11+
* Get item configure url
12+
*
13+
* @return string
14+
*/
15+
public function getConfigureUrl()
16+
{
17+
return $this->getUrl(
18+
'checkout/cart/configure',
19+
[
20+
'id' => $this->getItem()->getId(),
21+
'product_id' => $this->getItem()->getProduct()->getId()
22+
]
23+
);
24+
}
25+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Checkout\Block\Cart\Item\Renderer\Actions;
7+
8+
use Magento\Framework\View\Element\Template;
9+
use Magento\Quote\Model\Quote\Item;
10+
11+
class Generic extends Template
12+
{
13+
/**
14+
* @var Item
15+
*/
16+
protected $item;
17+
18+
/**
19+
* Returns current quote item
20+
*
21+
* @return Item
22+
*/
23+
public function getItem()
24+
{
25+
return $this->item;
26+
}
27+
28+
/**
29+
* Set current quote item
30+
*
31+
* @param Item $item
32+
* @return $this
33+
*/
34+
public function setItem(Item $item)
35+
{
36+
$this->item = $item;
37+
return $this;
38+
}
39+
40+
/**
41+
* Check if product is visible in site visibility
42+
*
43+
* @return bool
44+
*/
45+
public function isProductVisibleInSiteVisibility()
46+
{
47+
return $this->getItem()->getProduct()->isVisibleInSiteVisibility();
48+
}
49+
50+
/**
51+
* Check if cart item is virtual
52+
*
53+
* @return bool
54+
*/
55+
public function isVirtual()
56+
{
57+
return (bool)$this->getItem()->getIsVirtual();
58+
}
59+
}

0 commit comments

Comments
 (0)