diff --git a/CHANGELOG.md b/CHANGELOG.md index 4532e6f1855f1..644fd1a5c88c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,61 @@ +2.0.0.0-dev76 +============= +* Pricing improvements: + * Eliminated code duplication from templates and implemented new calculation models for the following modules: + * ConfigurableProduct + * Wishlist + * Rss + * ProductAlert +* JavaScript improvements: + * Removed head.js usages from frontend + * Removed head.js usages from adminhtml +* Themes update: + * Plushe styles are removed, Plushe theme is now based on blank +* Fixed bugs: + * Unable to place order with product that contains custom option 'file' + * OnePageCheckout is not working if PayPal method is enabled to work via Payment Bridge + * Impossible to reset password for admin user (incorrect reset password link in email) + * Errors when deleting customer group specified as default one in the config + * A number of essential buttons do not work and block other functionality in Internet Explorer 10 + * "Insert Widget" button is missing in Insert Widget popup while creating CMS page + * Impossible to change status for rating in admin + * System email templates are not loaded when user creates new email template + * Billing Agreements tab displays during New Customer creation in admin panel + * Images are not displayed in WYSIWYG when editing default pages + * Error message "Asymmetric transaction rollback" when creating simple product with flat catalog product option enabled in config + * Fatal error when trying to preview sample(type=link) or view link for download(type="link") for downloadable product + * Customer is redirected to Home Page after adding new address during multiple address checkout if secure URLs are enabled for frontend in config + * Impossible to select value in the State/Province field in the customer registration form when customer uses multiple address checkout + * Manage Stock option is not editable when using mass action on several products in the admin panel + * Category is not displayed in layered navigation block when Flat Catalog is enabled in config +* GitHub requests: + * [#489] (https://github.com/magento/magento2/issues/489) -- PHPUnit 4.0 Compatibility + * [#535] (https://github.com/magento/magento2/issues/535) -- Image management for products +* Framework improvements: + * Covered Magento lib form elements with unit tests: + * `lib/Magento/Framework/Data/Form/Element/AbstractElement.php` + * `lib/Magento/Framework/Data/Form/Element/Button.php` + * `lib/Magento/Framework/Data/Form/Element/Checkbox.php` + * `lib/Magento/Framework/Data/Form/Element/CollectionFactory.php` + * `lib/Magento/Framework/Data/Form/Element/Column.php` + * `lib/Magento/Framework/Data/Form/Element/File.php` + * `lib/Magento/Framework/Data/Form/Element/Hidden.php` + * `lib/Magento/Framework/Data/Form/Element/Editablemultiselect.php` + * `lib/Magento/Framework/Data/Form/Element/Factory.php` + * `lib/Magento/Framework/Data/Form/Element/Image.php` + * `lib/Magento/Framework/Data/Form/Element/Imagefile.php` + * `lib/Magento/Framework/Data/Form/Element/Label.php` + * `lib/Magento/Framework/Data/Form/Element/Link.php` + * `lib/Magento/Framework/Data/Form/Element/Multiselect.php` + * `lib/Magento/Framework/Data/Form/Element/Note.php` + * `lib/Magento/Framework/Data/Form/Element/Obscure.php` + * `lib/Magento/Framework/Data/Form/Element/Password.php` + * `lib/Magento/Framework/Data/Form/Element/Radio.php` + * `lib/Magento/Framework/Data/Form/Element/Reset.php` + * `lib/Magento/Framework/Data/Form/Element/Submit.php` + * `lib/Magento/Framework/Data/Form/Element/Text.php` + * `lib/Magento/Framework/Data/Form/Element/Textarea.php` + 2.0.0.0-dev75 ============= * Modularity improvements: diff --git a/app/autoload.php b/app/autoload.php index 50d3ccd77cdf3..1a52fe5a9bc40 100644 --- a/app/autoload.php +++ b/app/autoload.php @@ -24,4 +24,4 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ require_once __DIR__ . '/../lib/Magento/Framework/Autoload/IncludePath.php'; -spl_autoload_register('\Magento\Framework\Autoload\IncludePath::load'); +spl_autoload_register([new \Magento\Framework\Autoload\IncludePath(), 'load']); diff --git a/app/bootstrap.php b/app/bootstrap.php index 74f7d43835dfe..e356336ce0fac 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -63,7 +63,7 @@ require_once BP . '/app/functions.php'; require_once __DIR__ . '/autoload.php'; -\Magento\Framework\Autoload\IncludePath::addIncludePath(array(BP . '/app/code', BP . '/lib')); +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath(array(BP . '/app/code', BP . '/lib')); $classMapPath = BP . '/var/classmap.ser'; if (file_exists($classMapPath)) { require_once BP . '/lib/Magento/Framework/Autoload/ClassMap.php'; diff --git a/app/code/Magento/Authorizenet/view/frontend/form/cc.phtml b/app/code/Magento/Authorizenet/view/frontend/form/cc.phtml index 9d67b54ee9522..f45a4ccdb3071 100644 --- a/app/code/Magento/Authorizenet/view/frontend/form/cc.phtml +++ b/app/code/Magento/Authorizenet/view/frontend/form/cc.phtml @@ -34,23 +34,16 @@ isPartialAuthorization()): ?> getChildHtml('cards') ?> -
+
showNoticeMessage(__('Please enter a different credit card number to complete your purchase.')) ?> - diff --git a/app/code/Magento/Authorizenet/view/frontend/js/components.phtml b/app/code/Magento/Authorizenet/view/frontend/js/components.phtml new file mode 100644 index 0000000000000..920b70b475a8c --- /dev/null +++ b/app/code/Magento/Authorizenet/view/frontend/js/components.phtml @@ -0,0 +1,40 @@ + + +getChildHtml() ?> diff --git a/app/code/Magento/Authorizenet/view/frontend/layout/checkout_onepage_index.xml b/app/code/Magento/Authorizenet/view/frontend/layout/checkout_onepage_index.xml index 423ca04f8ccaf..738038f686f06 100644 --- a/app/code/Magento/Authorizenet/view/frontend/layout/checkout_onepage_index.xml +++ b/app/code/Magento/Authorizenet/view/frontend/layout/checkout_onepage_index.xml @@ -31,4 +31,7 @@ + + + diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php index a5e956d90a91c..6c7ec0a722dc3 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php @@ -83,7 +83,7 @@ protected function _convertDate($date, $locale) { if ($this->getColumn()->getFilterTime()) { try { - $dateObj = $this->getLocaleDate()->date(null, null, $locale, false); + $dateObj = $this->_localeDate->date(null, null, $locale, false); //set default timezone for store (admin) $dateObj->setTimezone( @@ -96,7 +96,7 @@ protected function _convertDate($date, $locale) //set date with applying timezone of store $dateObj->set( $date, - $this->getLocaleDate()->getDateTimeFormat( + $this->_localeDate->getDateTimeFormat( \Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_SHORT ), $locale diff --git a/app/code/Magento/Backend/view/adminhtml/layout/default.xml b/app/code/Magento/Backend/view/adminhtml/layout/default.xml index fc4a5c1a427bc..176052180d447 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/default.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/default.xml @@ -44,9 +44,9 @@ jquery/jquery-ui-1.9.2.js - + - headjs/head.load.min.js + headjs/head.min.js diff --git a/app/code/Magento/Backend/view/adminhtml/media/uploader.phtml b/app/code/Magento/Backend/view/adminhtml/media/uploader.phtml index 0dc97108f1ab8..6d160e1fe1cf2 100644 --- a/app/code/Magento/Backend/view/adminhtml/media/uploader.phtml +++ b/app/code/Magento/Backend/view/adminhtml/media/uploader.phtml @@ -51,7 +51,7 @@ $(function () { $('#fileupload').fileupload({ dataType: 'json', - dropZone: '#media_gallery_content', + dropZone: '[data-tab-panel=image-management]', sequentialUploads: true, acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, maxFileSize: getFileSizeService()->getMaxFileSize() ?>, diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Bundle.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Bundle.php index 6aa9711f8ac06..373a054f931a1 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Bundle.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Composite/Fieldset/Bundle.php @@ -27,10 +27,6 @@ /** * Adminhtml block for fieldset of bundle product - * - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team */ class Bundle extends \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle { diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/Price.php b/app/code/Magento/Bundle/Block/Catalog/Product/Price.php index 9e523dd38d3f1..0de8cb4ac4da8 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/Price.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/Price.php @@ -81,13 +81,13 @@ public function __construct( */ public function isRatesGraterThenZero() { - $_request = $this->_taxCalc->getRateRequest(false, false, false); - $_request->setProductClassId($this->getProduct()->getTaxClassId()); - $defaultTax = $this->_taxCalc->getRate($_request); + $request = $this->_taxCalc->getRateRequest(false, false, false); + $request->setProductClassId($this->getProduct()->getTaxClassId()); + $defaultTax = $this->_taxCalc->getRate($request); - $_request = $this->_taxCalc->getRateRequest(); - $_request->setProductClassId($this->getProduct()->getTaxClassId()); - $currentTax = $this->_taxCalc->getRate($_request); + $request = $this->_taxCalc->getRateRequest(); + $request->setProductClassId($this->getProduct()->getTaxClassId()); + $currentTax = $this->_taxCalc->getRate($request); return floatval($defaultTax) > 0 || floatval($currentTax) > 0; } @@ -101,54 +101,14 @@ public function isRatesGraterThenZero() public function displayBothPrices() { $product = $this->getProduct(); - if ($product->getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC && - $product->getPriceModel()->getIsPricesCalculatedByIndex() !== false + if ($product->getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC + && $product->getPriceModel()->getIsPricesCalculatedByIndex() !== false ) { return false; } return $this->_taxData->displayBothPrices(); } - /** - * Convert block to html string - * - * @return string - */ - protected function _toHtml() - { - $product = $this->getProduct(); - if ($this->getMAPTemplate() && $this->_catalogData->canApplyMsrp( - $product - ) && $product->getPriceType() != \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC - ) { - $hiddenPriceHtml = parent::_toHtml(); - if ($this->_catalogData->isShowPriceOnGesture($product)) { - $this->setWithoutPrice(true); - } - $realPriceHtml = parent::_toHtml(); - $this->unsWithoutPrice(); - $addToCartUrl = $this->getLayout()->getBlock('product.info.bundle')->getAddToCartUrl($product); - $product->setAddToCartUrl($addToCartUrl); - $html = $this->getLayout()->createBlock( - 'Magento\Catalog\Block\Product\Price' - )->setTemplate( - $this->getMAPTemplate() - )->setRealPriceHtml( - $hiddenPriceHtml - )->setPriceElementIdPrefix( - 'bundle-price-' - )->setIdSuffix( - $this->getIdSuffix() - )->setProduct( - $product - )->toHtml(); - - return $realPriceHtml . $html; - } - - return parent::_toHtml(); - } - /** * @param null|string|bool|int|\Magento\Store\Model\Store $storeId * @return bool|\Magento\Store\Model\Website diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View.php b/app/code/Magento/Bundle/Block/Catalog/Product/View.php deleted file mode 100644 index 917f0382cf58b..0000000000000 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View.php +++ /dev/null @@ -1,72 +0,0 @@ -getProduct(); - } - - $res = array(); - - $prices = $product->getFormatedTierPrice(); - if (is_array($prices)) { - $store = $this->_storeManager->getStore(); - $specialPrice = $product->getSpecialPrice(); - $defaultDiscount = max($product->getGroupPrice(), $specialPrice ? 100 - $specialPrice : 0); - foreach ($prices as $price) { - if ($defaultDiscount < $price['price']) { - $price['price_qty'] += 0; - $price['savePercent'] = ceil(100 - $price['price']); - - $priceExclTax = $this->_taxData->getPrice($product, $price['website_price']); - $price['formated_price'] = $store->formatPrice($store->convertPrice($priceExclTax)); - - $priceInclTax = $this->_taxData->getPrice($product, $price['website_price'], true); - $price['formated_price_incl_tax'] = $store->formatPrice($store->convertPrice($priceInclTax)); - - $res[] = $price; - } - } - } - - return $res; - } -} diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php index 6fe9106aca136..3d9a2f6510d50 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php @@ -25,19 +25,17 @@ */ namespace Magento\Bundle\Block\Catalog\Product\View\Type; +use Magento\Framework\Pricing\PriceCurrencyInterface; + /** * Catalog bundle product info block - * - * @category Magento - * @package Magento_Bundle - * @author Magento Core Team */ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView { /** - * @var mixed + * @var array */ - protected $_options = null; + protected $_options; /** * Default MAP renderer type @@ -51,18 +49,13 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView * * @var \Magento\Catalog\Helper\Product */ - protected $_catalogProduct = null; + protected $_catalogProduct; /** * @var \Magento\Bundle\Model\Product\PriceFactory */ protected $_productPrice; - /** - * @var \Magento\Core\Helper\Data - */ - protected $coreData; - /** * @var \Magento\Framework\Json\EncoderInterface */ @@ -73,12 +66,17 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView */ protected $_localeFormat; + /** + * @var PriceCurrencyInterface + */ + protected $priceCurrency; + /** * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils * @param \Magento\Catalog\Helper\Product $catalogProduct * @param \Magento\Bundle\Model\Product\PriceFactory $productPrice - * @param \Magento\Core\Helper\Data $coreData + * @param PriceCurrencyInterface $priceCurrency * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param \Magento\Framework\Locale\FormatInterface $localeFormat * @param array $data @@ -89,7 +87,7 @@ public function __construct( \Magento\Framework\Stdlib\ArrayUtils $arrayUtils, \Magento\Catalog\Helper\Product $catalogProduct, \Magento\Bundle\Model\Product\PriceFactory $productPrice, - \Magento\Core\Helper\Data $coreData, + PriceCurrencyInterface $priceCurrency, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Framework\Locale\FormatInterface $localeFormat, array $data = array(), @@ -97,19 +95,18 @@ public function __construct( ) { $this->_catalogProduct = $catalogProduct; $this->_productPrice = $productPrice; - $this->coreData = $coreData; + $this->priceCurrency = $priceCurrency; $this->jsonEncoder = $jsonEncoder; $this->_localeFormat = $localeFormat; parent::__construct( $context, $arrayUtils, - $data, - $priceBlockTypes + $data ); } /** - * @return mixed + * @return array */ public function getOptions() { @@ -159,8 +156,6 @@ public function getJsonConfig() $options = array(); $selected = array(); $currentProduct = $this->getProduct(); - /* @var $bundlePriceModel \Magento\Bundle\Model\Product\Price */ - $bundlePriceModel = $this->_productPrice->create(); if ($preConfiguredFlag = $currentProduct->hasPreconfiguredValues()) { $preConfiguredValues = $currentProduct->getPreconfiguredValues(); @@ -169,84 +164,55 @@ public function getJsonConfig() $position = 0; - foreach ($optionsArray as $_option) { - /* @var $_option \Magento\Bundle\Model\Option */ - if (!$_option->getSelections()) { + foreach ($optionsArray as $optionItem) { + /* @var $optionItem \Magento\Bundle\Model\Option */ + if (!$optionItem->getSelections()) { continue; } - $optionId = $_option->getId(); + $optionId = $optionItem->getId(); $option = array( 'selections' => array(), - 'title' => $_option->getTitle(), - 'isMulti' => in_array($_option->getType(), array('multi', 'checkbox')), + 'title' => $optionItem->getTitle(), + 'isMulti' => in_array($optionItem->getType(), array('multi', 'checkbox')), 'position' => $position++ ); - $selectionCount = count($_option->getSelections()); + $selectionCount = count($optionItem->getSelections()); - foreach ($_option->getSelections() as $_selection) { - /* @var $_selection \Magento\Catalog\Model\Product */ - $selectionId = $_selection->getSelectionId(); - $_qty = !($_selection->getSelectionQty() * 1) ? '1' : $_selection->getSelectionQty() * 1; + foreach ($optionItem->getSelections() as $selectionItem) { + /* @var $selectionItem \Magento\Catalog\Model\Product */ + $selectionId = $selectionItem->getSelectionId(); + $qty = !($selectionItem->getSelectionQty() * 1) ? '1' : $selectionItem->getSelectionQty() * 1; // recalculate currency - $tierPrices = $_selection->getTierPrice(); + $tierPrices = $selectionItem->getPriceInfo() + ->getPrice(\Magento\Catalog\Pricing\Price\TierPrice::PRICE_CODE) + ->getTierPriceList(); foreach ($tierPrices as &$tierPriceInfo) { - $tierPriceAmount = $_selection->getPriceInfo()->getPrice('regular_price') - ->getCustomAmount($tierPriceInfo['price']); - $tierPriceInfo['price'] = $this->coreData->currency($tierPriceInfo['price'], false, false); - $tierPriceInfo['inclTaxPrice'] = $this->coreData->currency( - $tierPriceAmount->getValue(), - false, - false - ); - $tierPriceInfo['exclTaxPrice'] = $this->coreData->currency( - $tierPriceAmount->getBaseAmount(), - false, - false + $price = $tierPriceInfo['price']; + $tierPriceInfo['price'] = $this->priceCurrency->convert( + $this->_taxData->displayPriceIncludingTax() ? $price->getValue() : $price->getBaseAmount() ); + $tierPriceInfo['exclTaxPrice'] = $this->priceCurrency->convert($price->getBaseAmount()); + $tierPriceInfo['inclTaxPrice'] = $this->priceCurrency->convert($price->getValue()); } - // unset($tierPriceInfo); // break the reference with the last element $canApplyMAP = false; - $bundleOptionPriceAmount = $currentProduct->getPriceInfo()->getPrice('bundle_option') - ->getOptionSelectionAmount($_selection); - $_priceInclTax = $bundleOptionPriceAmount->getValue(); - $_priceExclTax = $bundleOptionPriceAmount->getBaseAmount(); - - //if ($currentProduct->getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED) { - // $_priceInclTax = $this->_taxData->getPrice($currentProduct, $itemPrice, true); - // $_priceExclTax = $this->_taxData->getPrice($currentProduct, $itemPrice); - //} - //$itemPrice = $bundlePriceModel->getSelectionFinalTotalPrice( - // $currentProduct, - // $_selection, - // $currentProduct->getQty(), - // $_selection->getQty(), - // false, - // false - //); + ->getOptionSelectionAmount($selectionItem); + $priceInclTax = $bundleOptionPriceAmount->getValue(); + $priceExclTax = $bundleOptionPriceAmount->getBaseAmount(); $selection = array( - 'qty' => $_qty, - 'customQty' => $_selection->getSelectionCanChangeQty(), - 'inclTaxPrice' => $this->coreData->currency( - $_priceInclTax, - false, - false - ), - 'exclTaxPrice' => $this->coreData->currency( - $_priceExclTax, - false, - false - ), - 'priceValue' => $this->coreData->currency($_selection->getSelectionPriceValue(), false, false), - 'priceType' => $_selection->getSelectionPriceType(), + 'qty' => $qty, + 'customQty' => $selectionItem->getSelectionCanChangeQty(), + 'inclTaxPrice' => $this->priceCurrency->convert($priceInclTax), + 'exclTaxPrice' => $this->priceCurrency->convert($priceExclTax), + 'priceType' => $selectionItem->getSelectionPriceType(), 'tierPrice' => $tierPrices, - 'name' => $_selection->getName(), + 'name' => $selectionItem->getName(), 'plusDisposition' => 0, 'minusDisposition' => 0, 'canApplyMAP' => $canApplyMAP @@ -257,17 +223,17 @@ public function getJsonConfig() : $selection['exclTaxPrice']; $responseObject = new \Magento\Framework\Object(); - $args = array('response_object' => $responseObject, 'selection' => $_selection); + $args = array('response_object' => $responseObject, 'selection' => $selectionItem); $this->_eventManager->dispatch('bundle_product_view_config', $args); if (is_array($responseObject->getAdditionalOptions())) { - foreach ($responseObject->getAdditionalOptions() as $o => $v) { - $selection[$o] = $v; + foreach ($responseObject->getAdditionalOptions() as $index => $value) { + $selection[$index] = $value; } } $option['selections'][$selectionId] = $selection; - if (($_selection->getIsDefault() || - $selectionCount == 1 && $_option->getRequired()) && $_selection->isSalable() + if (($selectionItem->getIsDefault() || $selectionCount == 1 && $optionItem->getRequired()) + && $selectionItem->isSalable() ) { $selected[$optionId][] = $selectionId; } @@ -284,24 +250,32 @@ public function getJsonConfig() } $isFixedPrice = $this->getProduct()->getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED; + $productAmount = $currentProduct + ->getPriceInfo() + ->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE) + ->getAmount(); + + $baseProductAmount = $currentProduct + ->getPriceInfo() + ->getPrice(\Magento\Catalog\Pricing\Price\RegularPrice::PRICE_CODE) + ->getAmount(); + $config = array( 'options' => $options, 'selected' => $selected, 'bundleId' => $currentProduct->getId(), 'priceFormat' => $this->_localeFormat->getPriceFormat(), - 'basePrice' => $this->coreData->currency($currentProduct->getPrice(), false, false), - 'showIncludeTax' => $this->_taxData->displayPriceIncludingTax(), - 'finalBasePriceInclTax' => $this->coreData->currency( - $this->_taxData->getPrice($currentProduct, $currentProduct->getFinalPrice(), true), - false, - false - ), - 'finalBasePriceExclTax' => $this->coreData->currency($currentProduct->getFinalPrice(), false, false), + 'basePrice' => $this->priceCurrency->convert($baseProductAmount->getValue()), + 'finalBasePriceInclTax' => $this->priceCurrency->convert($productAmount->getValue()), + 'finalBasePriceExclTax' => $this->priceCurrency->convert($productAmount->getBaseAmount()), 'priceType' => $currentProduct->getPriceType(), - 'specialPrice' => $currentProduct->getSpecialPrice(), + 'specialPrice' => $currentProduct + ->getPriceInfo() + ->getPrice(\Magento\Catalog\Pricing\Price\SpecialPrice::PRICE_CODE) + ->getValue(), 'includeTax' => $this->_taxData->priceIncludesTax() ? 'true' : 'false', 'isFixedPrice' => $isFixedPrice, - 'isMAPAppliedDirectly' => $this->_catalogData->canApplyMsrp($this->getProduct(), null, false) + //'isMAPAppliedDirectly' => $this->_catalogData->canApplyMsrp($this->getProduct(), null, false) ); $config['finalPrice'] = $this->_taxData->displayPriceIncludingTax() diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php index 0510e58ffcdf6..773dd24ce48c2 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php @@ -25,28 +25,26 @@ */ namespace Magento\Bundle\Block\Catalog\Product\View\Type\Bundle; +use Magento\Bundle\Model\Product\Price; + /** * Bundle option renderer - * - * @category Magento - * @package Magento_Bundle - * @author Magento Core Team */ class Option extends \Magento\Bundle\Block\Catalog\Product\Price { /** - * Store preconfigured options + * Store pre-configured options * * @var int|array|string */ - protected $_selectedOptions = null; + protected $_selectedOptions; /** * Show if option has a single selection * * @var bool */ - protected $_showSingle = null; + protected $_showSingle; /** * @var \Magento\Core\Helper\Data @@ -104,10 +102,10 @@ public function __construct( public function showSingle() { if (is_null($this->_showSingle)) { - $_option = $this->getOption(); - $_selections = $_option->getSelections(); + $option = $this->getOption(); + $selections = $option->getSelections(); - $this->_showSingle = count($_selections) == 1 && $_option->getRequired(); + $this->_showSingle = count($selections) == 1 && $option->getRequired(); } return $this->_showSingle; @@ -120,29 +118,29 @@ public function showSingle() */ public function getDefaultValues() { - $_option = $this->getOption(); - $_default = $_option->getDefaultSelection(); - $_selections = $_option->getSelections(); + $option = $this->getOption(); + $default = $option->getDefaultSelection(); + $selections = $option->getSelections(); $selectedOptions = $this->_getSelectedOptions(); $inPreConfigured = $this->getProduct()->hasPreconfiguredValues() && - $this->getProduct()->getPreconfiguredValues()->getData('bundle_option_qty/' . $_option->getId()); + $this->getProduct()->getPreconfiguredValues()->getData('bundle_option_qty/' . $option->getId()); - if (empty($selectedOptions) && $_default) { - $_defaultQty = $_default->getSelectionQty() * 1; - $_canChangeQty = $_default->getSelectionCanChangeQty(); + if (empty($selectedOptions) && $default) { + $defaultQty = $default->getSelectionQty() * 1; + $canChangeQty = $default->getSelectionCanChangeQty(); } elseif (!$inPreConfigured && $selectedOptions && is_numeric($selectedOptions)) { - $selectedSelection = $_option->getSelectionById($selectedOptions); - $_defaultQty = $selectedSelection->getSelectionQty() * 1; - $_canChangeQty = $selectedSelection->getSelectionCanChangeQty(); + $selectedSelection = $option->getSelectionById($selectedOptions); + $defaultQty = $selectedSelection->getSelectionQty() * 1; + $canChangeQty = $selectedSelection->getSelectionCanChangeQty(); } elseif (!$this->showSingle() || $inPreConfigured) { - $_defaultQty = $this->_getSelectedQty(); - $_canChangeQty = (bool)$_defaultQty; + $defaultQty = $this->_getSelectedQty(); + $canChangeQty = (bool)$defaultQty; } else { - $_defaultQty = $_selections[0]->getSelectionQty() * 1; - $_canChangeQty = $_selections[0]->getSelectionCanChangeQty(); + $defaultQty = $selections[0]->getSelectionQty() * 1; + $canChangeQty = $selections[0]->getSelectionCanChangeQty(); } - return array($_defaultQty, $_canChangeQty); + return array($defaultQty, $canChangeQty); } /** @@ -226,18 +224,17 @@ public function getProduct() } /** - * @param \Magento\Catalog\Model\Product $_selection + * @param \Magento\Catalog\Model\Product $selection * @param bool $includeContainer * @return string */ - public function getSelectionQtyTitlePrice($_selection, $includeContainer = true) + public function getSelectionQtyTitlePrice($selection, $includeContainer = true) { - $price = $this->getProduct()->getPriceModel()->getSelectionPreFinalPrice($this->getProduct(), $_selection); - $this->setFormatProduct($_selection); - $priceTitle = $_selection->getSelectionQty() * 1 . ' x ' . $this->escapeHtml($_selection->getName()); + $this->setFormatProduct($selection); + $priceTitle = $selection->getSelectionQty() * 1 . ' x ' . $this->escapeHtml($selection->getName()); $priceTitle .= '   ' . ($includeContainer ? '' : '') . '+' . - $this->renderPriceString($_selection, $includeContainer) . ($includeContainer ? '' : ''); + $this->renderPriceString($selection, $includeContainer) . ($includeContainer ? '' : ''); return $priceTitle; } @@ -245,17 +242,17 @@ public function getSelectionQtyTitlePrice($_selection, $includeContainer = true) /** * Get price for selection product * - * @param \Magento\Catalog\Model\Product $_selection + * @param \Magento\Catalog\Model\Product $selection * @return int|float */ - public function getSelectionPrice($_selection) + public function getSelectionPrice($selection) { $price = 0; $store = $this->getProduct()->getStore(); - if ($_selection) { + if ($selection) { $price = $this->getProduct()->getPriceModel()->getSelectionPreFinalPrice( $this->getProduct(), - $_selection, + $selection, 1 ); if (is_numeric($price)) { @@ -268,15 +265,15 @@ public function getSelectionPrice($_selection) /** * Get title price for selection product * - * @param \Magento\Catalog\Model\Product $_selection + * @param \Magento\Catalog\Model\Product $selection * @param bool $includeContainer * @return string */ - public function getSelectionTitlePrice($_selection, $includeContainer = true) + public function getSelectionTitlePrice($selection, $includeContainer = true) { - $priceTitle = $this->escapeHtml($_selection->getName()); - $priceTitle .= '   ' . ($includeContainer ? '' : '') . '+' . - $this->renderPriceString($_selection, $includeContainer) . ($includeContainer ? '' : ''); + $priceTitle = $this->escapeHtml($selection->getName()); + $priceTitle .= '   ' . ($includeContainer ? '' : '') . '+' + . $this->renderPriceString($selection, $includeContainer) . ($includeContainer ? '' : ''); return $priceTitle; } @@ -305,9 +302,7 @@ public function formatPriceString($price, $includeContainer = true) $taxHelper = $this->_taxData; $coreHelper = $this->_coreHelper; $currentProduct = $this->getProduct(); - if ($currentProduct->getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC && - $this->getFormatProduct() - ) { + if ($currentProduct->getPriceType() == Price::PRICE_TYPE_DYNAMIC && $this->getFormatProduct()) { $product = $this->getFormatProduct(); } else { $product = $currentProduct; @@ -316,9 +311,9 @@ public function formatPriceString($price, $includeContainer = true) $priceTax = $taxHelper->getPrice($product, $price); $priceIncTax = $taxHelper->getPrice($product, $price, true); - $formated = $coreHelper->currencyByStore($priceTax, $product->getStore(), true, $includeContainer); + $formatted = $coreHelper->currencyByStore($priceTax, $product->getStore(), true, $includeContainer); if ($taxHelper->displayBothPrices() && $priceTax != $priceIncTax) { - $formated .= ' (+' . $coreHelper->currencyByStore( + $formatted .= ' (+' . $coreHelper->currencyByStore( $priceIncTax, $product->getStore(), true, @@ -328,7 +323,7 @@ public function formatPriceString($price, $includeContainer = true) ) . ')'; } - return $formated; + return $formatted; } /** diff --git a/app/code/Magento/Bundle/Helper/Catalog/Product/Configuration.php b/app/code/Magento/Bundle/Helper/Catalog/Product/Configuration.php index 214914552f33a..b0a840fba4e19 100644 --- a/app/code/Magento/Bundle/Helper/Catalog/Product/Configuration.php +++ b/app/code/Magento/Bundle/Helper/Catalog/Product/Configuration.php @@ -25,31 +25,28 @@ */ namespace Magento\Bundle\Helper\Catalog\Product; +use Magento\Catalog\Helper\Product\Configuration\ConfigurationInterface; use Magento\Catalog\Model\Product\Configuration\Item\ItemInterface; +use Magento\Framework\App\Helper\AbstractHelper; /** * Helper for fetching properties by product configurational item - * - * @category Magento - * @package Magento_Bundle - * @author Magento Core Team */ -class Configuration extends \Magento\Framework\App\Helper\AbstractHelper implements - \Magento\Catalog\Helper\Product\Configuration\ConfigurationInterface +class Configuration extends AbstractHelper implements ConfigurationInterface { /** * Core data * * @var \Magento\Core\Helper\Data */ - protected $_coreData = null; + protected $_coreData; /** * Catalog product configuration * * @var \Magento\Catalog\Helper\Product\Configuration */ - protected $_ctlgProdConfigur = null; + protected $productConfiguration; /** * @var \Magento\Framework\Escaper @@ -58,17 +55,17 @@ class Configuration extends \Magento\Framework\App\Helper\AbstractHelper impleme /** * @param \Magento\Framework\App\Helper\Context $context - * @param \Magento\Catalog\Helper\Product\Configuration $ctlgProdConfigur + * @param \Magento\Catalog\Helper\Product\Configuration $productConfiguration * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Framework\Escaper $escaper */ public function __construct( \Magento\Framework\App\Helper\Context $context, - \Magento\Catalog\Helper\Product\Configuration $ctlgProdConfigur, + \Magento\Catalog\Helper\Product\Configuration $productConfiguration, \Magento\Core\Helper\Data $coreData, \Magento\Framework\Escaper $escaper ) { - $this->_ctlgProdConfigur = $ctlgProdConfigur; + $this->productConfiguration = $productConfiguration; $this->_coreData = $coreData; $this->_escaper = $escaper; parent::__construct($context); @@ -102,7 +99,9 @@ public function getSelectionQty($product, $selectionId) public function getSelectionFinalPrice(ItemInterface $item, $selectionProduct) { $selectionProduct->unsetData('final_price'); - return $item->getProduct()->getPriceModel()->getSelectionFinalTotalPrice( + /** @var \Magento\Bundle\Model\Product\Price $priceModel */ + $priceModel = $item->getProduct()->getPriceModel(); + return $priceModel->getSelectionFinalTotalPrice( $item->getProduct(), $selectionProduct, $item->getQty() * 1, @@ -126,18 +125,14 @@ public function getBundleOptions(ItemInterface $item) $options = array(); $product = $item->getProduct(); - /** - * @var \Magento\Bundle\Model\Product\Type - */ + /** @var \Magento\Bundle\Model\Product\Type $typeInstance */ $typeInstance = $product->getTypeInstance(); // get bundle options $optionsQuoteItemOption = $item->getOptionByCode('bundle_option_ids'); $bundleOptionsIds = $optionsQuoteItemOption ? unserialize($optionsQuoteItemOption->getValue()) : array(); if ($bundleOptionsIds) { - /** - * @var \Magento\Bundle\Model\Resource\Option\Collection - */ + /** @var \Magento\Bundle\Model\Resource\Option\Collection $optionsCollection */ $optionsCollection = $typeInstance->getOptionsByIds($bundleOptionsIds, $product); // get and add bundle selections collection @@ -146,10 +141,7 @@ public function getBundleOptions(ItemInterface $item) $bundleSelectionIds = unserialize($selectionsQuoteItemOption->getValue()); if (!empty($bundleSelectionIds)) { - $selectionsCollection = $typeInstance->getSelectionsByIds( - unserialize($selectionsQuoteItemOption->getValue()), - $product - ); + $selectionsCollection = $typeInstance->getSelectionsByIds($bundleSelectionIds, $product); $bundleOptions = $optionsCollection->appendSelections($selectionsCollection, true); foreach ($bundleOptions as $bundleOption) { @@ -188,6 +180,9 @@ public function getBundleOptions(ItemInterface $item) */ public function getOptions(ItemInterface $item) { - return array_merge($this->getBundleOptions($item), $this->_ctlgProdConfigur->getCustomOptions($item)); + return array_merge( + $this->getBundleOptions($item), + $this->productConfiguration->getCustomOptions($item) + ); } } diff --git a/app/code/Magento/Bundle/Model/Product/Type.php b/app/code/Magento/Bundle/Model/Product/Type.php index fd7e030bd1ee2..c920cd7b36be5 100644 --- a/app/code/Magento/Bundle/Model/Product/Type.php +++ b/app/code/Magento/Bundle/Model/Product/Type.php @@ -27,10 +27,6 @@ /** * Bundle Type Model - * - * @category Magento - * @package Magento_Bundle - * @author Magento Core Team */ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType { @@ -245,7 +241,7 @@ public function getChildrenIds($parentId, $required = true) } /** - * Retrieve parent ids array by requered child + * Retrieve parent ids array by required child * * @param int|array $childId * @return array @@ -369,17 +365,15 @@ public function beforeSave($product) if ($product->getCanSaveBundleSelections()) { $product->canAffectOptions(true); $selections = $product->getBundleSelectionsData(); - if ($selections) { - if (!empty($selections)) { - $options = $product->getBundleOptionsData(); - if ($options) { - foreach ($options as $option) { - if (empty($option['delete']) || 1 != (int)$option['delete']) { - $product->setTypeHasOptions(true); - if (1 == (int)$option['required']) { - $product->setTypeHasRequiredOptions(true); - break; - } + if ($selections && !empty($selections)) { + $options = $product->getBundleOptionsData(); + if ($options) { + foreach ($options as $option) { + if (empty($option['delete']) || 1 != (int) $option['delete']) { + $product->setTypeHasOptions(true); + if (1 == (int) $option['required']) { + $product->setTypeHasRequiredOptions(true); + break; } } } @@ -409,17 +403,13 @@ public function save($product) unset($option['option_id']); } - $optionModel = $this->_bundleOption->create()->setData( - $option - )->setParentId( - $product->getId() - )->setStoreId( - $product->getStoreId() - ); + $optionModel = $this->_bundleOption->create() + ->setData($option) + ->setParentId($product->getId()) + ->setStoreId($product->getStoreId()); - $optionModel->isDeleted((bool)$option['delete']); + $optionModel->isDeleted((bool) $option['delete']); $optionModel->save(); - $options[$key]['option_id'] = $optionModel->getOptionId(); } @@ -429,7 +419,7 @@ public function save($product) $selections = $product->getBundleSelectionsData(); if ($selections) { foreach ($selections as $index => $group) { - foreach ($group as $key => $selection) { + foreach ($group as $selection) { if (isset($selection['selection_id']) && $selection['selection_id'] == '') { unset($selection['selection_id']); } @@ -438,17 +428,13 @@ public function save($product) $selection['is_default'] = 0; } - $selectionModel = $this->_bundleModelSelection->create()->setData( - $selection - )->setOptionId( - $options[$index]['option_id'] - )->setWebsiteId( - $this->_storeManager->getStore($product->getStoreId())->getWebsiteId() - )->setParentProductId( - $product->getId() - ); + $selectionModel = $this->_bundleModelSelection->create() + ->setData($selection) + ->setOptionId($options[$index]['option_id']) + ->setWebsiteId($this->_storeManager->getStore($product->getStoreId())->getWebsiteId()) + ->setParentProductId($product->getId()); - $selectionModel->isDeleted((bool)$selection['delete']); + $selectionModel->isDeleted((bool) $selection['delete']); $selectionModel->save(); $selection['selection_id'] = $selectionModel->getSelectionId(); @@ -503,10 +489,10 @@ public function getOptionsIds($product) public function getOptionsCollection($product) { if (!$product->hasData($this->_keyOptionsCollection)) { - $optionsCollection = $this->_bundleOption->create()->getResourceCollection()->setProductIdFilter( - $product->getId() - )->setPositionOrder(); - + $optionsCollection = $this->_bundleOption->create() + ->getResourceCollection() + ->setProductIdFilter($product->getId()) + ->setPositionOrder(); $storeId = $this->getStoreFilter($product); if ($storeId instanceof \Magento\Store\Model\Store) { $storeId = $storeId->getId(); @@ -531,23 +517,16 @@ public function getSelectionsCollection($optionIds, $product) $key = $this->_keySelectionsCollection . $keyOptionIds; if (!$product->hasData($key)) { $storeId = $product->getStoreId(); - $selectionsCollection = $this->_bundleCollection->create()->addAttributeToSelect( - $this->_config->getProductAttributes() - )->addAttributeToSelect( - 'tax_class_id' //used for calculation item taxes in Bundle with Dynamic Price - )->setFlag( - 'require_stock_items', - true - )->setFlag( - 'product_children', - true - )->setPositionOrder()->addStoreFilter( - $this->getStoreFilter($product) - )->setStoreId( - $storeId - )->addFilterByRequiredOptions()->setOptionIdsFilter( - $optionIds - ); + $selectionsCollection = $this->_bundleCollection->create() + ->addAttributeToSelect($this->_config->getProductAttributes()) + ->addAttributeToSelect('tax_class_id') //used for calculation item taxes in Bundle with Dynamic Price + ->setFlag('require_stock_items', true) + ->setFlag('product_children', true) + ->setPositionOrder() + ->addStoreFilter($this->getStoreFilter($product)) + ->setStoreId($storeId) + ->addFilterByRequiredOptions() + ->setOptionIdsFilter($optionIds); if (!$this->_catalogData->isPriceGlobal() && $storeId) { $websiteId = $this->_storeManager->getStore($storeId)->getWebsiteId(); @@ -562,7 +541,7 @@ public function getSelectionsCollection($optionIds, $product) /** * Method is needed for specific actions to change given quote options values * according current product type logic - * Example: the cataloginventory validation of decimal qty can change qty to int, + * Example: the catalog inventory validation of decimal qty can change qty to int, * so need to change quote item qty option value too. * * @param array $options @@ -672,7 +651,7 @@ protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $produ $isStrictProcessMode = $this->_isStrictProcessMode($processMode); $skipSaleableCheck = $this->_catalogProduct->getSkipSaleableCheck(); - $_appendAllSelections = (bool)$product->getSkipCheckRequiredOption() || $skipSaleableCheck; + $_appendAllSelections = (bool) $product->getSkipCheckRequiredOption() || $skipSaleableCheck; $options = $buyRequest->getBundleOption(); if (is_array($options)) { @@ -700,15 +679,15 @@ protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $produ } $selectionIds = array(); - foreach ($options as $optionId => $selectionId) { + foreach ($options as $selectionId) { if (!is_array($selectionId)) { if ($selectionId != '') { - $selectionIds[] = (int)$selectionId; + $selectionIds[] = (int) $selectionId; } } else { foreach ($selectionId as $id) { if ($id != '') { - $selectionIds[] = (int)$id; + $selectionIds[] = (int) $id; } } } @@ -718,7 +697,7 @@ protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $produ $selections = $this->getSelectionsByIds($selectionIds, $product); // Check if added selections are still on sale - foreach ($selections->getItems() as $key => $selection) { + foreach ($selections->getItems() as $selection) { if (!$selection->isSalable() && !$skipSaleableCheck) { $_option = $optionsCollection->getItemById($selection->getOptionId()); if (is_array($options[$_option->getId()]) && count($options[$_option->getId()]) > 1) { @@ -745,12 +724,8 @@ protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $produ $product->getTypeInstance()->setStoreFilter($product->getStoreId(), $product); $optionCollection = $product->getTypeInstance()->getOptionsCollection($product); - $optionIds = $product->getTypeInstance()->getOptionsIds($product); - $selectionIds = array(); - $selectionCollection = $product->getTypeInstance()->getSelectionsCollection($optionIds, $product); - $options = $optionCollection->appendSelections($selectionCollection, false, $_appendAllSelections); foreach ($options as $option) { @@ -771,11 +746,11 @@ protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $produ foreach ($selections as $selection) { if ($selection->getSelectionCanChangeQty() && isset($qtys[$selection->getOptionId()])) { - $qty = (double)$qtys[$selection->getOptionId()] > 0 ? $qtys[$selection->getOptionId()] : 1; + $qty = (float) $qtys[$selection->getOptionId()] > 0 ? $qtys[$selection->getOptionId()] : 1; } else { - $qty = (double)$selection->getSelectionQty() ? $selection->getSelectionQty() : 1; + $qty = (float) $selection->getSelectionQty() ? $selection->getSelectionQty() : 1; } - $qty = (double)$qty; + $qty = (float) $qty; $product->addCustomOption('selection_qty_' . $selection->getSelectionId(), $qty, $selection); $selection->addCustomOption('selection_id', $selection->getSelectionId()); @@ -783,7 +758,7 @@ protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $produ $beforeQty = 0; $customOption = $product->getCustomOption('product_qty_' . $selection->getId()); if ($customOption && $customOption->getProduct()->getId() == $selection->getId()) { - $beforeQty = (double)$customOption->getValue(); + $beforeQty = (float) $customOption->getValue(); } $product->addCustomOption('product_qty_' . $selection->getId(), $qty + $beforeQty, $selection); @@ -808,15 +783,9 @@ protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $produ return __('We cannot add this item to your shopping cart.'); } - $result[] = $_result[0]->setParentProductId( - $product->getId() - )->addCustomOption( - 'bundle_option_ids', - serialize(array_map('intval', $optionIds)) - )->addCustomOption( - 'bundle_selection_attributes', - serialize($attributes) - ); + $result[] = $_result[0]->setParentProductId($product->getId()) + ->addCustomOption('bundle_option_ids', serialize(array_map('intval', $optionIds))) + ->addCustomOption('bundle_selection_attributes', serialize($attributes)); if ($isStrictProcessMode) { $_result[0]->setCartQty($qty); @@ -867,21 +836,16 @@ public function getSelectionsByIds($selectionIds, $product) if (!$usedSelections || serialize($usedSelectionsIds) != serialize($selectionIds)) { $storeId = $product->getStoreId(); - $usedSelections = $this->_bundleCollection->create()->addAttributeToSelect( - '*' - )->setFlag( - 'require_stock_items', - true - )->setFlag( - 'product_children', - true - )->addStoreFilter( - $this->getStoreFilter($product) - )->setStoreId( - $storeId - )->setPositionOrder()->addFilterByRequiredOptions()->setSelectionIdsFilter( - $selectionIds - ); + $usedSelections = $this->_bundleCollection + ->create() + ->addAttributeToSelect('*') + ->setFlag('require_stock_items', true) + ->setFlag('product_children', true) + ->addStoreFilter($this->getStoreFilter($product)) + ->setStoreId($storeId) + ->setPositionOrder() + ->addFilterByRequiredOptions() + ->setSelectionIdsFilter($selectionIds); if (!$this->_catalogData->isPriceGlobal() && $storeId) { $websiteId = $this->_storeManager->getStore($storeId)->getWebsiteId(); @@ -908,13 +872,13 @@ public function getOptionsByIds($optionIds, $product) $usedOptionsIds = $product->getData($this->_keyUsedOptionsIds); if (!$usedOptions || serialize($usedOptionsIds) != serialize($optionIds)) { - $usedOptions = $this->_bundleOption->create()->getResourceCollection()->setProductIdFilter( - $product->getId() - )->setPositionOrder()->joinValues( - $this->_storeManager->getStore()->getId() - )->setIdFilter( - $optionIds - ); + $usedOptions = $this->_bundleOption + ->create() + ->getResourceCollection() + ->setProductIdFilter($product->getId()) + ->setPositionOrder() + ->joinValues($this->_storeManager->getStore()->getId()) + ->setIdFilter($optionIds); $product->setData($this->_keyUsedOptions, $usedOptions); $product->setData($this->_keyUsedOptionsIds, $optionIds); } @@ -990,14 +954,24 @@ public function getOrderOptions($product) * Sort selections method for usort function * Sort selections by option position, selection position and selection id * - * @param \Magento\Catalog\Model\Product $a - * @param \Magento\Catalog\Model\Product $b + * @param \Magento\Catalog\Model\Product $firstItem + * @param \Magento\Catalog\Model\Product $secondItem * @return int */ - public function shakeSelections($a, $b) + public function shakeSelections($firstItem, $secondItem) { - $aPosition = array($a->getOption()->getPosition(), $a->getOptionId(), $a->getPosition(), $a->getSelectionId()); - $bPosition = array($b->getOption()->getPosition(), $b->getOptionId(), $b->getPosition(), $b->getSelectionId()); + $aPosition = array( + $firstItem->getOption()->getPosition(), + $firstItem->getOptionId(), + $firstItem->getPosition(), + $firstItem->getSelectionId() + ); + $bPosition = array( + $secondItem->getOption()->getPosition(), + $secondItem->getOptionId(), + $secondItem->getPosition(), + $secondItem->getSelectionId() + ); if ($aPosition == $bPosition) { return 0; } else { @@ -1025,7 +999,7 @@ public function hasOptions($product) } /** - * Allow for updates of chidren qty's + * Allow for updates of children qty's * * @param \Magento\Catalog\Model\Product $product * @return boolean true diff --git a/app/code/Magento/Bundle/Model/Resource/Option/Collection.php b/app/code/Magento/Bundle/Model/Resource/Option/Collection.php index ce0c4a11240dd..05637f454e832 100644 --- a/app/code/Magento/Bundle/Model/Resource/Option/Collection.php +++ b/app/code/Magento/Bundle/Model/Resource/Option/Collection.php @@ -171,7 +171,7 @@ public function setIdFilter($ids) { if (is_array($ids)) { $this->addFieldToFilter('main_table.option_id', array('in' => $ids)); - } else if ($ids != '') { + } elseif ($ids != '') { $this->addFieldToFilter('main_table.option_id', $ids); } return $this; diff --git a/app/code/Magento/Bundle/Pricing/Adjustment/BundleCalculatorInterface.php b/app/code/Magento/Bundle/Pricing/Adjustment/BundleCalculatorInterface.php index 9e9923493f5df..0c24bb0aee716 100644 --- a/app/code/Magento/Bundle/Pricing/Adjustment/BundleCalculatorInterface.php +++ b/app/code/Magento/Bundle/Pricing/Adjustment/BundleCalculatorInterface.php @@ -24,7 +24,7 @@ namespace Magento\Bundle\Pricing\Adjustment; -use Magento\Framework\Pricing\Object\SaleableInterface; +use Magento\Catalog\Model\Product; use Magento\Framework\Pricing\Adjustment\CalculatorInterface; /** @@ -34,9 +34,55 @@ interface BundleCalculatorInterface extends CalculatorInterface { /** * @param float|string $amount - * @param SaleableInterface $saleableItem + * @param Product $saleableItem * @param null|bool $exclude * @return \Magento\Framework\Pricing\Amount\AmountInterface */ - public function getMaxAmount($amount, SaleableInterface $saleableItem, $exclude = null); + public function getMaxAmount($amount, Product $saleableItem, $exclude = null); + + /** + * Option amount calculation for saleable item + * + * @param Product $saleableItem + * @param null|string $exclude + * @param bool $searchMin + * @param \Magento\Framework\Pricing\Amount\AmountInterface|null $bundleProductAmount + * @return \Magento\Framework\Pricing\Amount\AmountInterface + */ + public function getOptionsAmount( + Product $saleableItem, + $exclude = null, + $searchMin = true, + $bundleProductAmount = null + ); + + /** + * Calculate amount for bundle product with all selection prices + * + * @param float $basePriceValue + * @param Product $bundleProduct + * @param \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] $selectionPriceList + * @param null|string $exclude code of adjustment that has to be excluded + * @return \Magento\Framework\Pricing\Amount\AmountInterface + */ + public function calculateBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude = null); + + /** + * Create selection price list for the retrieved options + * + * @param \Magento\Bundle\Model\Option $option + * @param Product $bundleProduct + * @return \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] + */ + public function createSelectionPriceList($option, $bundleProduct); + + /** + * Find minimal or maximal price for existing options + * + * @param \Magento\Bundle\Model\Option $option + * @param \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] $selectionPriceList + * @param bool $searchMin + * @return \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] + */ + public function processOptions($option, $selectionPriceList, $searchMin = true); } diff --git a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php index a018f1a33d2e9..0c32a23043f7a 100644 --- a/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php +++ b/app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php @@ -24,12 +24,12 @@ namespace Magento\Bundle\Pricing\Adjustment; +use Magento\Catalog\Model\Product; use Magento\Framework\Pricing\Object\SaleableInterface; use Magento\Framework\Pricing\Amount\AmountFactory; +use Magento\Bundle\Pricing\Price\BundleSelectionFactory; use Magento\Framework\Pricing\Adjustment\Calculator as CalculatorBase; use Magento\Bundle\Model\Product\Price; -use Magento\Bundle\Pricing\Price\BundleOptionPriceInterface; -use Magento\Bundle\Pricing\Price\BundleSelectionFactory; use Magento\Bundle\Pricing\Price\BundleOptionPrice; /** @@ -56,6 +56,7 @@ class Calculator implements BundleCalculatorInterface * @param CalculatorBase $calculator * @param AmountFactory $amountFactory * @param BundleSelectionFactory $bundleSelectionFactory + * @return Calculator */ public function __construct( CalculatorBase $calculator, @@ -77,147 +78,243 @@ public function __construct( */ public function getAmount($amount, SaleableInterface $saleableItem, $exclude = null) { - return $this->getOptionsAmount($amount, $saleableItem, $exclude, true); + return $this->getOptionsAmount($saleableItem, $exclude, true, $amount); } /** * Get amount for current product which is included price of existing options with maximal price * * @param float $amount - * @param SaleableInterface $saleableItem - * @param null $exclude + * @param Product $saleableItem + * @param null|string $exclude * @return \Magento\Framework\Pricing\Amount\AmountInterface */ - public function getMaxAmount($amount, SaleableInterface $saleableItem, $exclude = null) + public function getMaxAmount($amount, Product $saleableItem, $exclude = null) { - return $this->getOptionsAmount($amount, $saleableItem, $exclude, false); + return $this->getOptionsAmount($saleableItem, $exclude, false, $amount); } /** - * Base calculation of amount for saleable item + * Option amount calculation for bundle product * - * @param float $amount - * @param SaleableInterface $saleableItem + * @param Product $saleableItem * @param null|string $exclude * @param bool $searchMin + * @param float $baseAmount * @return \Magento\Framework\Pricing\Amount\AmountInterface */ - protected function getOptionsAmount($amount, SaleableInterface $saleableItem, $exclude = null, $searchMin = true) + public function getOptionsAmount( + Product $saleableItem, + $exclude = null, + $searchMin = true, + $baseAmount = 0. + ) { + return $this->calculateBundleAmount( + $baseAmount, + $saleableItem, + $this->getSelectionAmounts($saleableItem, $searchMin), + $exclude + ); + } + + /** + * Filter all options for bundle product + * + * @param Product $bundleProduct + * @param bool $searchMin + * @return array + */ + protected function getSelectionAmounts(Product $bundleProduct, $searchMin) { - $fullAmount = 0.; - $adjustments = []; - // Get amount for bundle product - $amountList[] = $this->calculator->getAmount($amount, $saleableItem); + // Flag shows - is it necessary to find minimal option amount in case if all options are not required + $shouldFindMinOption = false; + if ($searchMin + && $bundleProduct->getPriceType() == Price::PRICE_TYPE_DYNAMIC + && !$this->hasRequiredOption($bundleProduct) + ) { + $shouldFindMinOption = true; + } + $canSkipRequiredOptions = $searchMin && !$shouldFindMinOption; - $minOptionAmount = null; - /* @var $option \Magento\Bundle\Model\Option */ - foreach ($this->getBundleOptionPrice($saleableItem)->getOptions() as $option) { - if (!$option->getSelections()) { + $currentPrice = false; + $priceList = []; + foreach ($this->getBundleOptions($bundleProduct) as $option) { + if ($this->canSkipOption($option, $canSkipRequiredOptions)) { continue; } - // Add amounts for custom options - $optionsAmounts = $this->processOptions($option, $saleableItem, $searchMin); - if ($searchMin - && ($minOptionAmount === null || end($optionsAmounts)->getValue() < $minOptionAmount->getValue()) + $selectionPriceList = $this->createSelectionPriceList($option, $bundleProduct); + $selectionPriceList = $this->processOptions($option, $selectionPriceList, $searchMin); + + $lastValue = end($selectionPriceList)->getAmount()->getValue(); + if ($shouldFindMinOption + && (!$currentPrice || $lastValue < $currentPrice->getAmount()->getValue()) ) { - $minOptionAmount = end($optionsAmounts); - } elseif (!$searchMin) { - $amountList = array_merge($amountList, $optionsAmounts); + $currentPrice = end($selectionPriceList); + } elseif (!$shouldFindMinOption) { + $priceList = array_merge($priceList, $selectionPriceList); } } + return $shouldFindMinOption ? [$currentPrice] : $priceList; + } - if ($searchMin && $minOptionAmount) { - $amountList[] = $minOptionAmount; - } + /** + * Check this option if it should be skipped + * + * @param \Magento\Bundle\Model\Option $option + * @param bool $canSkipRequiredOption + * @return bool + */ + protected function canSkipOption($option, $canSkipRequiredOption) + { + return !$option->getSelections() || ($canSkipRequiredOption && !$option->getRequired()); + } - /** @var \Magento\Framework\Pricing\Amount\AmountInterface $itemAmount */ - foreach ($amountList as $itemAmount) { - $fullAmount += $itemAmount->getValue(); - foreach ($itemAmount->getAdjustmentAmounts() as $code => $adjustment) { - if ($exclude === null || $exclude !== $code) { - $adjustments[$code] = isset($adjustments[$code]) ? $adjustments[$code] + $adjustment : $adjustment; - } + /** + * Check the bundle product for availability of required options + * + * @param Product $bundleProduct + * @return bool + */ + protected function hasRequiredOption($bundleProduct) + { + $options = array_filter( + $this->getBundleOptions($bundleProduct), + function ($item) { + return $item->getRequired(); } - } - return $this->amountFactory->create($fullAmount, $adjustments); + ); + return !empty($options); } /** - * @param SaleableInterface $saleableItem - * @return BundleOptionPrice + * Get bundle options + * + * @param Product $saleableItem + * @return \Magento\Bundle\Model\Resource\Option\Collection */ - protected function getBundleOptionPrice(SaleableInterface $saleableItem) + protected function getBundleOptions(Product $saleableItem) { - return $saleableItem->getPriceInfo()->getPrice(BundleOptionPriceInterface::PRICE_TYPE_BUNDLE_OPTION); + /** @var BundleOptionPrice $bundlePrice */ + $bundlePrice = $saleableItem->getPriceInfo()->getPrice(BundleOptionPrice::PRICE_CODE); + return $bundlePrice->getOptions(); } /** - * @param \Magento\Bundle\Model\Option $option - * @param SaleableInterface $saleableItem - * @param bool $searchMin - * @return \Magento\Framework\Pricing\Amount\AmountInterface[] + * Calculate amount for bundle product with all selection prices + * + * @param float $basePriceValue + * @param Product $bundleProduct + * @param \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] $selectionPriceList + * @param null|string $exclude + * @return \Magento\Framework\Pricing\Amount\AmountInterface */ - protected function processOptions($option, $saleableItem, $searchMin = true) + public function calculateBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude = null) { - $result = []; - foreach ($option->getSelections() as $selection) { - /* @var $selection \Magento\Bundle\Model\Selection|\Magento\Catalog\Model\Product */ - if (!$selection->isSalable()/* || ($searchMin && !$option->getRequired())*/) { - // @todo CatalogInventory Show out of stock Products - continue; - } - $current = $this->getSelection($selection, $saleableItem); - if (empty($result)) { - $result = [$current]; - continue; - } - if ($searchMin && end($result)->getValue() > $current->getValue()) { - $result = [$current]; - } elseif (!$searchMin && $option->isMultiSelection()) { - $result[] = $current; - } elseif (!$searchMin && !$option->isMultiSelection() && end($result)->getValue() < $current->getValue()) { - $result = [$current]; - } + if ($bundleProduct->getPriceType() == Price::PRICE_TYPE_FIXED) { + return $this->calculateFixedBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude); + } else { + return $this->calculateDynamicBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude); } - return $result; } /** - * @param \Magento\Bundle\Model\Selection $selection - * @param SaleableInterface $saleableItem + * Calculate amount for fixed bundle product + * + * @param float $basePriceValue + * @param Product $bundleProduct + * @param \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] $selectionPriceList + * @param null|string $exclude * @return \Magento\Framework\Pricing\Amount\AmountInterface */ - protected function getSelection($selection, $saleableItem) + protected function calculateFixedBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude) { - if ($saleableItem->getPriceType() == Price::PRICE_TYPE_FIXED) { - return $this->createFixedAmount($selection, $saleableItem); - } else { - return $this->createDynamicAmount($selection, $saleableItem); + $fullAmount = $basePriceValue; + /** @var $option \Magento\Bundle\Model\Option */ + foreach ($selectionPriceList as $selectionPrice) { + $fullAmount += $selectionPrice->getValue(); } + return $this->calculator->getAmount($fullAmount, $bundleProduct, $exclude); } /** - * @param \Magento\Bundle\Model\Selection $selection - * @param SaleableInterface $saleableItem + * Calculate amount for dynamic bundle product + * + * @param float $basePriceValue + * @param Product $bundleProduct + * @param \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] $selectionPriceList + * @param null|string $exclude * @return \Magento\Framework\Pricing\Amount\AmountInterface */ - protected function createDynamicAmount($selection, $saleableItem) + protected function calculateDynamicBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude) { - /** @var \Magento\Bundle\Pricing\Price\BundleSelectionPrice $price */ - $price = $this->selectionFactory->create($saleableItem, $selection, $selection->getSelectionQty()); - return $price->getAmount(); + $fullAmount = 0.; + $adjustments = []; + $amountList = [$this->calculator->getAmount($basePriceValue, $bundleProduct, $exclude)]; + /** @var $option \Magento\Bundle\Model\Option */ + foreach ($selectionPriceList as $selectionPrice) { + $amountList[] = $selectionPrice->getAmount(); + } + /** @var \Magento\Framework\Pricing\Amount\AmountInterface $itemAmount */ + foreach ($amountList as $itemAmount) { + $fullAmount += $itemAmount->getValue(); + foreach ($itemAmount->getAdjustmentAmounts() as $code => $adjustment) { + $adjustments[$code] = isset($adjustments[$code]) ? $adjustments[$code] + $adjustment : $adjustment; + } + } + if ($exclude && isset($adjustments[$exclude])) { + $fullAmount -= $adjustments[$exclude]; + unset($adjustments[$exclude]); + } + return $this->amountFactory->create($fullAmount, $adjustments); } /** - * @param \Magento\Bundle\Model\Selection $selection - * @param SaleableInterface $saleableItem - * @return \Magento\Framework\Pricing\Amount\AmountInterface + * Create selection price list for the retrieved options + * + * @param \Magento\Bundle\Model\Option $option + * @param Product $bundleProduct + * @return \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] + */ + public function createSelectionPriceList($option, $bundleProduct) + { + $priceList = []; + /* @var $selection \Magento\Bundle\Model\Selection|\Magento\Catalog\Model\Product */ + foreach ($option->getSelections() as $selection) { + if (!$selection->isSalable()) { + // @todo CatalogInventory Show out of stock Products + continue; + } + $priceList[] = $this->selectionFactory->create($bundleProduct, $selection, $selection->getSelectionQty()); + } + return $priceList; + } + + /** + * Find minimal or maximal price for existing options + * + * @param \Magento\Bundle\Model\Option $option + * @param \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] $selectionPriceList + * @param bool $searchMin + * @return \Magento\Bundle\Pricing\Price\BundleSelectionPrice[] */ - protected function createFixedAmount($selection, $saleableItem) + public function processOptions($option, $selectionPriceList, $searchMin = true) { - $selectionPrice = $this->selectionFactory - ->create($saleableItem, $selection, $selection->getSelectionQty()) - ->getValue(); - return $this->calculator->getAmount($selectionPrice, $saleableItem); + $result = []; + foreach ($selectionPriceList as $current) { + $currentValue = $current->getAmount()->getValue(); + if (empty($result)) { + $result = [$current]; + } elseif ($searchMin && end($result)->getAmount()->getValue() > $currentValue) { + $result = [$current]; + } elseif (!$searchMin && $option->isMultiSelection()) { + $result[] = $current; + } elseif (!$searchMin + && !$option->isMultiSelection() + && end($result)->getAmount()->getValue() < $currentValue + ) { + $result = [$current]; + } + } + return $result; } } diff --git a/app/code/Magento/Bundle/Pricing/Price/BasePrice.php b/app/code/Magento/Bundle/Pricing/Price/BasePrice.php index bcef83dff1f13..28df06a393d01 100644 --- a/app/code/Magento/Bundle/Pricing/Price/BasePrice.php +++ b/app/code/Magento/Bundle/Pricing/Price/BasePrice.php @@ -29,7 +29,7 @@ /** * Bundle Base Price model */ -class BasePrice extends CatalogPrice\BasePrice +class BasePrice extends CatalogPrice\BasePrice implements BasePriceInterface { /** * Get Base Price Value @@ -39,30 +39,24 @@ class BasePrice extends CatalogPrice\BasePrice public function getValue() { if ($this->value === null) { - $this->value = $this->applyDiscount(parent::getValue()); + $this->value = $this->calculateBaseValue(parent::getValue()); } return $this->value; } /** - * Apply discount type prices + * Calculate base price for passed regular one * * @param float $price * @return float */ - public function applyDiscount($price) + public function calculateBaseValue($price) { $discount = [ 0, - $this->priceInfo - ->getPrice(CatalogPrice\TierPriceInterface::PRICE_TYPE_TIER, $this->quantity) - ->getValue(), - $this->priceInfo - ->getPrice(CatalogPrice\GroupPriceInterface::PRICE_TYPE_GROUP, $this->quantity) - ->getValue(), - $this->priceInfo - ->getPrice(CatalogPrice\SpecialPriceInterface::PRICE_TYPE_SPECIAL, $this->quantity) - ->getValue() + $this->priceInfo->getPrice(CatalogPrice\TierPrice::PRICE_CODE, $this->quantity)->getValue(), + $this->priceInfo->getPrice(CatalogPrice\GroupPrice::PRICE_CODE, $this->quantity)->getValue(), + $this->priceInfo->getPrice(CatalogPrice\SpecialPrice::PRICE_CODE, $this->quantity)->getValue() ]; $discount = max($discount); if ($discount) { diff --git a/app/code/Magento/Bundle/Pricing/Price/BundleSelectionPriceInterface.php b/app/code/Magento/Bundle/Pricing/Price/BasePriceInterface.php similarity index 82% rename from app/code/Magento/Bundle/Pricing/Price/BundleSelectionPriceInterface.php rename to app/code/Magento/Bundle/Pricing/Price/BasePriceInterface.php index 020f94061f210..0ba4fa0f70bcc 100644 --- a/app/code/Magento/Bundle/Pricing/Price/BundleSelectionPriceInterface.php +++ b/app/code/Magento/Bundle/Pricing/Price/BasePriceInterface.php @@ -21,15 +21,19 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Bundle\Pricing\Price; /** - * Bundle selection price interface + * Bundle base price interface */ -interface BundleSelectionPriceInterface +interface BasePriceInterface { /** - * Price model code + * Calculate base price for passed regular one + * + * @param float $price + * @return float */ - const PRICE_TYPE_BUNDLE_SELECTION = 'bundle_selection'; + public function calculateBaseValue($price); } diff --git a/app/code/Magento/Bundle/Pricing/Price/BundleOptionPrice.php b/app/code/Magento/Bundle/Pricing/Price/BundleOptionPrice.php index 9c77ef6aaf905..5cecd761e8c9a 100644 --- a/app/code/Magento/Bundle/Pricing/Price/BundleOptionPrice.php +++ b/app/code/Magento/Bundle/Pricing/Price/BundleOptionPrice.php @@ -23,24 +23,24 @@ */ namespace Magento\Bundle\Pricing\Price; -use Magento\Catalog\Pricing\Price\RegularPrice; -use Magento\Framework\Pricing\Object\SaleableInterface; +use Magento\Framework\Pricing\Price\AbstractPrice; use Magento\Bundle\Pricing\Adjustment\BundleCalculatorInterface; +use Magento\Catalog\Model\Product; /** * Bundle option price model */ -class BundleOptionPrice extends RegularPrice implements BundleOptionPriceInterface +class BundleOptionPrice extends AbstractPrice implements BundleOptionPriceInterface { /** - * @var string + * Price model code */ - protected $priceType = self::PRICE_TYPE_BUNDLE_OPTION; + const PRICE_CODE = 'bundle_option'; /** - * @var array + * @var BundleCalculatorInterface */ - protected $priceOptions; + protected $calculator; /** * @var BundleSelectionFactory @@ -53,20 +53,20 @@ class BundleOptionPrice extends RegularPrice implements BundleOptionPriceInterfa protected $maximalPrice; /** - * @param SaleableInterface $salableItem + * @param Product $saleableItem * @param float $quantity * @param BundleCalculatorInterface $calculator * @param BundleSelectionFactory $bundleSelectionFactory */ public function __construct( - SaleableInterface $salableItem, + Product $saleableItem, $quantity, BundleCalculatorInterface $calculator, BundleSelectionFactory $bundleSelectionFactory ) { $this->selectionFactory = $bundleSelectionFactory; - parent::__construct($salableItem, $quantity, $calculator); - $this->salableItem->setQty($this->quantity); + parent::__construct($saleableItem, $quantity, $calculator); + $this->product->setQty($this->quantity); } /** @@ -80,6 +80,19 @@ public function getValue() return $this->value; } + /** + * Getter for maximal price of options + * + * @return bool|float + */ + public function getMaxValue() + { + if (null === $this->maximalPrice) { + $this->maximalPrice = $this->calculateOptions(false); + } + return $this->maximalPrice; + } + /** * Get Options with attached Selections collection * @@ -87,112 +100,64 @@ public function getValue() */ public function getOptions() { - if (null !== $this->priceOptions) { - return $this->priceOptions; - } - $this->salableItem->getTypeInstance()->setStoreFilter($this->salableItem->getStoreId(), $this->salableItem); + $bundleProduct = $this->product; + /** @var \Magento\Bundle\Model\Product\Type $typeInstance */ + $typeInstance = $bundleProduct->getTypeInstance(); + $typeInstance->setStoreFilter($bundleProduct->getStoreId(), $bundleProduct); - $optionCollection = $this->salableItem->getTypeInstance()->getOptionsCollection($this->salableItem); + /** @var \Magento\Bundle\Model\Resource\Option\Collection $optionCollection */ + $optionCollection = $typeInstance->getOptionsCollection($bundleProduct); - $selectionCollection = $this->salableItem->getTypeInstance()->getSelectionsCollection( - $this->salableItem->getTypeInstance()->getOptionsIds($this->salableItem), - $this->salableItem + $selectionCollection = $typeInstance->getSelectionsCollection( + $typeInstance->getOptionsIds($bundleProduct), + $bundleProduct ); - $this->priceOptions = $optionCollection->appendSelections($selectionCollection, false, false); - return $this->priceOptions; + $priceOptions = $optionCollection->appendSelections($selectionCollection, false, false); + return $priceOptions; } /** + * Get selection amount + * * @param \Magento\Bundle\Model\Selection $selection * @return \Magento\Framework\Pricing\Amount\AmountInterface */ public function getOptionSelectionAmount($selection) { - return $this->createSelection($selection)->getAmount(); - } - - /** - * @param \Magento\Bundle\Model\Selection $selection - * @return \Magento\Bundle\Pricing\Price\BundleSelectionPriceInterface - */ - protected function createSelection($selection) - { - return $this->selectionFactory->create($this->salableItem, $selection, $selection->getSelectionQty()); + $selectionPrice = $this->selectionFactory->create($this->product, $selection, $selection->getSelectionQty()); + return $selectionPrice->getAmount(); } /** + * Calculate maximal or minimal options value + * * @param bool $searchMin * @return bool|float */ protected function calculateOptions($searchMin = true) { - $price = false; - $amountList = []; + $priceList = []; /* @var $option \Magento\Bundle\Model\Option */ foreach ($this->getOptions() as $option) { - if (!$option->getSelections()) { - continue; - } - $amountList = array_merge($amountList, $this->processOptions($option, $searchMin)); - } - if (!empty($amountList)) { - $price = 0.; - foreach ($amountList as $itemAmount) { - $price += $itemAmount->getValue(); - } - } - return $price; - } - - /** - * @param \Magento\Bundle\Model\Option $option - * @param bool $searchMin - * @return \Magento\Framework\Pricing\Amount\AmountInterface[] - */ - protected function processOptions($option, $searchMin = true) - { - $result = []; - foreach ($option->getSelections() as $selection) { - /* @var $selection \Magento\Bundle\Model\Selection */ - if (!$selection->isSalable() || ($searchMin && !$option->getRequired())) { - // @todo CatalogInventory Show out of stock Products + if ($searchMin && !$option->getRequired()) { continue; } - $current = $this->createSelection($selection); - if (empty($result)) { - $result = [$current]; - continue; - } - if ($searchMin && end($result)->getValue() > $current->getValue()) { - $result = [$current]; - } elseif (!$searchMin && $option->isMultiSelection()) { - $result[] = $current; - } elseif (!$searchMin && !$option->isMultiSelection() && end($result)->getValue() < $current->getValue()) { - $result = [$current]; - } + $selectionPriceList = $this->calculator->createSelectionPriceList($option, $this->product); + $selectionPriceList = $this->calculator->processOptions($option, $selectionPriceList, $searchMin); + $priceList = array_merge($priceList, $selectionPriceList); } - return $result; + $amount = $this->calculator->calculateBundleAmount(0., $this->product, $priceList); + return $amount->getValue(); } /** - * Getter for maximal price of options + * Get minimal amount of bundle price with options * - * @return bool|float - */ - public function getMaxValue() - { - if (null === $this->maximalPrice) { - $this->maximalPrice = $this->calculateOptions(false); - } - return $this->maximalPrice; - } - - /** * @return \Magento\Framework\Pricing\Amount\AmountInterface */ public function getAmount() { - return $this->calculator->getAmount(0, $this->salableItem); + return $this->calculator->getOptionsAmount($this->product); } } diff --git a/app/code/Magento/Bundle/Pricing/Price/BundleOptionPriceInterface.php b/app/code/Magento/Bundle/Pricing/Price/BundleOptionPriceInterface.php index 735d2a5345b52..1ebfaf9760657 100644 --- a/app/code/Magento/Bundle/Pricing/Price/BundleOptionPriceInterface.php +++ b/app/code/Magento/Bundle/Pricing/Price/BundleOptionPriceInterface.php @@ -28,11 +28,6 @@ */ interface BundleOptionPriceInterface { - /** - * Price model code - */ - const PRICE_TYPE_BUNDLE_OPTION = 'bundle_option'; - /** * Return calculated options * diff --git a/app/code/Magento/Bundle/Pricing/Price/BundleSelectionFactory.php b/app/code/Magento/Bundle/Pricing/Price/BundleSelectionFactory.php index 34312009cc27b..473cd58d3cf94 100644 --- a/app/code/Magento/Bundle/Pricing/Price/BundleSelectionFactory.php +++ b/app/code/Magento/Bundle/Pricing/Price/BundleSelectionFactory.php @@ -24,7 +24,7 @@ namespace Magento\Bundle\Pricing\Price; -use Magento\Framework\Pricing\Object\SaleableInterface; +use Magento\Catalog\Model\Product; /** * Bundle selection price factory @@ -34,7 +34,7 @@ class BundleSelectionFactory /** * Default selection class */ - const SELECTION_CLASS_DEFAULT = 'Magento\Bundle\Pricing\Price\BundleSelectionPriceInterface'; + const SELECTION_CLASS_DEFAULT = 'Magento\Bundle\Pricing\Price\BundleSelectionPrice'; /** * Object Manager @@ -56,26 +56,26 @@ public function __construct(\Magento\Framework\ObjectManager $objectManager) /** * Create Price object for particular product * - * @param SaleableInterface $bundleProduct - * @param SaleableInterface $selection + * @param Product $bundleProduct + * @param Product $selection * @param float $quantity * @param array $arguments * @throws \InvalidArgumentException - * @return BundleSelectionPriceInterface + * @return BundleSelectionPrice */ public function create( - SaleableInterface $bundleProduct, - SaleableInterface $selection, + Product $bundleProduct, + Product $selection, $quantity, array $arguments = [] ) { $arguments['bundleProduct'] = $bundleProduct; - $arguments['salableItem'] = $selection; + $arguments['saleableItem'] = $selection; $arguments['quantity'] = $quantity ? floatval($quantity) : 1.; $selectionPrice = $this->objectManager->create(self::SELECTION_CLASS_DEFAULT, $arguments); - if (!$selectionPrice instanceof BundleSelectionPriceInterface) { + if (!$selectionPrice instanceof BundleSelectionPrice) { throw new \InvalidArgumentException( - get_class($selectionPrice) . ' doesn\'t implement BundleSelectionPriceInterface' + get_class($selectionPrice) . ' doesn\'t extend BundleSelectionPrice' ); } return $selectionPrice; diff --git a/app/code/Magento/Bundle/Pricing/Price/BundleSelectionPrice.php b/app/code/Magento/Bundle/Pricing/Price/BundleSelectionPrice.php index 465eee99417d4..80e089c3366c9 100644 --- a/app/code/Magento/Bundle/Pricing/Price/BundleSelectionPrice.php +++ b/app/code/Magento/Bundle/Pricing/Price/BundleSelectionPrice.php @@ -26,26 +26,33 @@ namespace Magento\Bundle\Pricing\Price; use Magento\Catalog\Pricing\Price as CatalogPrice; -use Magento\Framework\Pricing\Object\SaleableInterface; +use Magento\Catalog\Model\Product; use Magento\Bundle\Model\Product\Price; -use Magento\Catalog\Pricing\Price\FinalPriceInterface; use Magento\Framework\Pricing\Adjustment\CalculatorInterface; +use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\Pricing\Object\SaleableInterface; +use Magento\Framework\Pricing\Price\AbstractPrice; /** * Bundle option price */ -class BundleSelectionPrice extends CatalogPrice\RegularPrice implements BundleSelectionPriceInterface +class BundleSelectionPrice extends AbstractPrice { /** - * @var string + * Price model code */ - protected $priceType = self::PRICE_TYPE_BUNDLE_SELECTION; + const PRICE_CODE = 'bundle_selection'; /** * @var \Magento\Catalog\Model\Product */ protected $bundleProduct; + /** + * @var BasePrice + */ + protected $bundleBasePrice; + /** * Event manager * @@ -54,25 +61,29 @@ class BundleSelectionPrice extends CatalogPrice\RegularPrice implements BundleSe protected $eventManager; /** - * @param SaleableInterface $salableItem + * @param Product $saleableItem * @param float $quantity * @param CalculatorInterface $calculator - * @param \Magento\Catalog\Model\Product $bundleProduct - * @param \Magento\Framework\Event\ManagerInterface $eventManager + * @param SaleableInterface $bundleProduct + * @param ManagerInterface $eventManager */ public function __construct( - SaleableInterface $salableItem, + Product $saleableItem, $quantity, CalculatorInterface $calculator, - \Magento\Catalog\Model\Product $bundleProduct, - \Magento\Framework\Event\ManagerInterface $eventManager + SaleableInterface $bundleProduct, + ManagerInterface $eventManager ) { + parent::__construct($saleableItem, $quantity, $calculator); $this->bundleProduct = $bundleProduct; + $this->bundleBasePrice = $this->bundleProduct->getPriceInfo() + ->getPrice(CatalogPrice\BasePrice::PRICE_CODE, $this->quantity); $this->eventManager = $eventManager; - parent::__construct($salableItem, $quantity, $calculator); } /** + * Get the price value for one of selection product + * * @return bool|float */ public function getValue() @@ -83,30 +94,27 @@ public function getValue() if ($this->bundleProduct->getPriceType() == Price::PRICE_TYPE_DYNAMIC) { $value = $this->priceInfo - ->getPrice(FinalPriceInterface::PRICE_TYPE_FINAL, $this->quantity) + ->getPrice(FinalPrice::PRICE_CODE, $this->quantity) ->getValue(); } else { - if ($this->salableItem->getSelectionPriceType()) { + if ($this->product->getSelectionPriceType()) { // calculate price for selection type percent - // @todo get rid of final price data manipulation that should fire event to apply catalog rules $product = clone $this->bundleProduct; $price = $product->getPriceInfo() - ->getPrice(CatalogPrice\RegularPrice::PRICE_TYPE_PRICE_DEFAULT, $this->quantity) + ->getPrice(CatalogPrice\RegularPrice::PRICE_CODE, $this->quantity) ->getValue(); $product->setFinalPrice($price); $this->eventManager->dispatch( 'catalog_product_get_final_price', array('product' => $product, 'qty' => $this->bundleProduct->getQty()) ); - $value = $product->getData('final_price') * ($this->salableItem->getSelectionPriceValue() / 100); + $value = $product->getData('final_price') * ($this->product->getSelectionPriceValue() / 100); } else { // calculate price for selection type fixed - $value = $this->salableItem->getSelectionPriceValue() * $this->quantity; + $value = $this->product->getSelectionPriceValue() * $this->quantity; } } - $this->value = $this->bundleProduct->getPriceInfo() - ->getPrice(CatalogPrice\BasePrice::PRICE_TYPE_BASE_PRICE, $this->quantity) - ->applyDiscount($value); + $this->value = $this->bundleBasePrice->calculateBaseValue($value); return $this->value; } } diff --git a/app/code/Magento/Bundle/Pricing/Price/ConfiguredPrice.php b/app/code/Magento/Bundle/Pricing/Price/ConfiguredPrice.php new file mode 100644 index 0000000000000..63cff4f22b96a --- /dev/null +++ b/app/code/Magento/Bundle/Pricing/Price/ConfiguredPrice.php @@ -0,0 +1,156 @@ +item = $item; + parent::__construct($saleableItem, $quantity, $calculator); + } + + /** + * @param ItemInterface $item + * @return $this + */ + public function setItem(ItemInterface $item) + { + $this->item = $item; + return $this; + } + + /** + * Get Options with attached Selections collection + * + * @return array|\Magento\Bundle\Model\Resource\Option\Collection + */ + public function getOptions() + { + $bundleProduct = $this->product; + $bundleOptions = []; + /** @var \Magento\Bundle\Model\Product\Type $typeInstance */ + $typeInstance = $bundleProduct->getTypeInstance(); + + // get bundle options + $optionsQuoteItemOption = $this->item->getOptionByCode('bundle_option_ids'); + $bundleOptionsIds = $optionsQuoteItemOption ? unserialize($optionsQuoteItemOption->getValue()) : array(); + if ($bundleOptionsIds) { + /** @var \Magento\Bundle\Model\Resource\Option\Collection $optionsCollection */ + $optionsCollection = $typeInstance->getOptionsByIds($bundleOptionsIds, $bundleProduct); + // get and add bundle selections collection + $selectionsQuoteItemOption = $this->item->getOptionByCode('bundle_selection_ids'); + $bundleSelectionIds = unserialize($selectionsQuoteItemOption->getValue()); + if ($bundleSelectionIds) { + $selectionsCollection = $typeInstance->getSelectionsByIds($bundleSelectionIds, $bundleProduct); + $bundleOptions = $optionsCollection->appendSelections($selectionsCollection, true); + } + } + return $bundleOptions; + } + + /** + * Option amount calculation for bundle product + * + * @param float $baseValue + * @return \Magento\Framework\Pricing\Amount\AmountInterface + */ + public function getConfiguredAmount($baseValue = 0.) + { + $selectionPriceList = []; + foreach ($this->getOptions() as $option) { + $selectionPriceList = array_merge( + $selectionPriceList, + $this->calculator->createSelectionPriceList($option, $this->product) + ); + } + return $this->calculator->calculateBundleAmount( + $baseValue, + $this->product, + $selectionPriceList + ); + } + + /** + * Get price value + * + * @return float + */ + public function getValue() + { + if ($this->item) { + $configuredOptionsAmount = $this->getConfiguredAmount()->getBaseAmount(); + return parent::getValue() + $this->basePrice->calculateBaseValue($configuredOptionsAmount); + } else { + return parent::getValue(); + } + } + + /** + * Get Amount for configured price which is included amount for all selected options + * + * @return \Magento\Framework\Pricing\Amount\AmountInterface + */ + public function getAmount() + { + return $this->item ? $this->getConfiguredAmount($this->basePrice->getValue()) : parent::getAmount(); + } +} diff --git a/app/code/Magento/Bundle/Pricing/Price/FinalPrice.php b/app/code/Magento/Bundle/Pricing/Price/FinalPrice.php index 459bdca89097d..d56223f591812 100644 --- a/app/code/Magento/Bundle/Pricing/Price/FinalPrice.php +++ b/app/code/Magento/Bundle/Pricing/Price/FinalPrice.php @@ -26,7 +26,7 @@ namespace Magento\Bundle\Pricing\Price; -use Magento\Framework\Pricing\Object\SaleableInterface; +use Magento\Catalog\Model\Product; use Magento\Bundle\Pricing\Adjustment\BundleCalculatorInterface; /** @@ -34,30 +34,27 @@ */ class FinalPrice extends \Magento\Catalog\Pricing\Price\FinalPrice { + /** + * Price type final + */ + const PRICE_CODE = 'final_price'; + /** * @var BundleCalculatorInterface */ protected $calculator; /** - * @param SaleableInterface $salableItem - * @param float $quantity - * @param BundleCalculatorInterface $calculator + * @var BasePrice */ - public function __construct( - SaleableInterface $salableItem, - $quantity, - BundleCalculatorInterface $calculator - ) { - parent::__construct($salableItem, $quantity, $calculator); - } + protected $basePrice; /** * @return float */ public function getValue() { - return parent::getValue() + $this->basePrice->applyDiscount($this->getBundleOptionPrice()->getValue()); + return parent::getValue() + $this->basePrice->calculateBaseValue($this->getBundleOptionPrice()->getValue()); } /** @@ -65,7 +62,7 @@ public function getValue() */ public function getMaximalPrice() { - return $this->calculator->getMaxAmount($this->basePrice->getValue(), $this->salableItem); + return $this->calculator->getMaxAmount($this->basePrice->getValue(), $this->product); } /** @@ -76,13 +73,12 @@ public function getMinimalPrice() return $this->getAmount(); } - /** * @return \Magento\Framework\Pricing\Amount\AmountInterface */ public function getAmount() { - return $this->calculator->getAmount(parent::getValue(), $this->salableItem); + return $this->calculator->getAmount(parent::getValue(), $this->product); } /** @@ -90,6 +86,6 @@ public function getAmount() */ protected function getBundleOptionPrice() { - return $this->priceInfo->getPrice(BundleOptionPriceInterface::PRICE_TYPE_BUNDLE_OPTION, $this->quantity); + return $this->priceInfo->getPrice(BundleOptionPrice::PRICE_CODE, $this->quantity); } } diff --git a/app/code/Magento/Bundle/Pricing/Price/GroupPrice.php b/app/code/Magento/Bundle/Pricing/Price/GroupPrice.php index 5ea82cde8ceb3..4ad01eb76498f 100644 --- a/app/code/Magento/Bundle/Pricing/Price/GroupPrice.php +++ b/app/code/Magento/Bundle/Pricing/Price/GroupPrice.php @@ -33,6 +33,11 @@ */ class GroupPrice extends \Magento\Catalog\Pricing\Price\GroupPrice { + /** + * Price type group + */ + const PRICE_CODE = 'group_price'; + /** * @return float|bool */ @@ -59,7 +64,7 @@ public function getValue() protected function getBasePrice($qty = null) { return $this->priceInfo - ->getPrice(\Magento\Catalog\Pricing\Price\BasePrice::PRICE_TYPE_BASE_PRICE, $qty) + ->getPrice(\Magento\Catalog\Pricing\Price\BasePrice::PRICE_CODE) ->getValue(); } } diff --git a/app/code/Magento/Bundle/Pricing/Price/SpecialPrice.php b/app/code/Magento/Bundle/Pricing/Price/SpecialPrice.php index 71632bc0a7eed..91f7077ed2b60 100644 --- a/app/code/Magento/Bundle/Pricing/Price/SpecialPrice.php +++ b/app/code/Magento/Bundle/Pricing/Price/SpecialPrice.php @@ -26,11 +26,18 @@ namespace Magento\Bundle\Pricing\Price; +use Magento\Catalog\Pricing\Price\BasePrice as CatalogBasePrice; + /** * Special price model */ class SpecialPrice extends \Magento\Catalog\Pricing\Price\SpecialPrice { + /** + * Price type special + */ + const PRICE_CODE = 'special_price'; + /** * @return bool|float */ @@ -51,13 +58,12 @@ public function getValue() } /** - * @param null|float $qty * @return bool|float */ - protected function getBasePrice($qty = null) + protected function getBasePrice() { return $this->priceInfo - ->getPrice(\Magento\Catalog\Pricing\Price\BasePrice::PRICE_TYPE_BASE_PRICE, $qty) + ->getPrice(CatalogBasePrice::PRICE_CODE) ->getValue(); } } diff --git a/app/code/Magento/Bundle/Pricing/Price/TierPrice.php b/app/code/Magento/Bundle/Pricing/Price/TierPrice.php index 28b3bca19e310..da2b8654b4000 100644 --- a/app/code/Magento/Bundle/Pricing/Price/TierPrice.php +++ b/app/code/Magento/Bundle/Pricing/Price/TierPrice.php @@ -29,6 +29,11 @@ */ class TierPrice extends \Magento\Catalog\Pricing\Price\TierPrice { + /** + * Price type tier + */ + const PRICE_CODE = 'tier_price'; + /** * @var bool */ diff --git a/app/code/Magento/Bundle/Pricing/Render/FinalPriceBox.php b/app/code/Magento/Bundle/Pricing/Render/FinalPriceBox.php index 3cfe54abfd804..56204fd682ebe 100644 --- a/app/code/Magento/Bundle/Pricing/Render/FinalPriceBox.php +++ b/app/code/Magento/Bundle/Pricing/Render/FinalPriceBox.php @@ -41,7 +41,7 @@ class FinalPriceBox extends CatalogRender\FinalPriceBox public function showRangePrice() { /** @var Price\BundleOptionPrice $optionPrice */ - $optionPrice = $this->getPriceType(Price\BundleOptionPriceInterface::PRICE_TYPE_BUNDLE_OPTION); + $optionPrice = $this->getPriceType(Price\BundleOptionPrice::PRICE_CODE); return $optionPrice->getValue() !== $optionPrice->getMaxValue(); } } diff --git a/app/code/Magento/Bundle/etc/di.xml b/app/code/Magento/Bundle/etc/di.xml index fc5df0b8e6c7a..2fb137e4cdfcb 100644 --- a/app/code/Magento/Bundle/etc/di.xml +++ b/app/code/Magento/Bundle/etc/di.xml @@ -48,69 +48,53 @@ - + - - Magento\Bundle\Pricing\PriceInfo + + Magento\Tax\Pricing\Adjustment::ADJUSTMENT_CODE + Magento\Weee\Pricing\Adjustment::ADJUSTMENT_CODE - + + - Magento\Bundle\Pricing\PriceComposite Magento\Bundle\Pricing\Adjustment\Collection - + - - - Magento\Catalog\Pricing\Price\RegularPrice - true - - - Magento\Bundle\Pricing\Price\FinalPrice - false - - - Magento\Bundle\Pricing\Price\TierPrice - false - - - Magento\Catalog\Pricing\Price\GroupPrice - false - - - Magento\Catalog\Pricing\Price\SpecialPrice - false - - - Magento\Catalog\Pricing\Price\MsrpPrice - false - - - Magento\Bundle\Pricing\Price\BasePrice - false - - - Magento\Catalog\Pricing\Price\OptionPrice - false - - - Magento\Bundle\Pricing\Price\BundleOptionPrice - false - + + Magento\Catalog\Pricing\Price\RegularPrice + Magento\Bundle\Pricing\Price\FinalPrice + Magento\Bundle\Pricing\Price\TierPrice + Magento\Catalog\Pricing\Price\GroupPrice + Magento\Catalog\Pricing\Price\SpecialPrice + Magento\Catalog\Pricing\Price\MsrpPrice + Magento\Bundle\Pricing\Price\BasePrice + Magento\Bundle\Pricing\Price\ConfiguredPrice + Magento\Bundle\Pricing\Price\BundleOptionPrice - + - - Magento\Tax\Pricing\Adjustment::CODE - Magento\Weee\Pricing\Adjustment::CODE - + Magento\Bundle\Pricing\Price\Pool - - + + + + + Magento\Bundle\Pricing\PriceInfo + Magento\Bundle\Pricing\Price\Collection + + + + + + + Magento\Bundle\Pricing\Adjustment\BundleCalculatorInterface + + diff --git a/app/code/Magento/Bundle/view/adminhtml/product/edit/bundle.phtml b/app/code/Magento/Bundle/view/adminhtml/product/edit/bundle.phtml index 13f1ba425c402..d49c257189422 100644 --- a/app/code/Magento/Bundle/view/adminhtml/product/edit/bundle.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/product/edit/bundle.phtml @@ -81,10 +81,10 @@ 'getViewFileUrl('Magento_Bundle::product/validation-rules.js'); ?>'); jQuery(function($) { - head.js("getViewFileUrl('Magento_Bundle::js/bundle-product.js') ?>", function () { + head.js("getViewFileUrl('Magento_Bundle::js/bundle-product.js') ?>", head.ready(function () { $('#bundle_product_container').mage('bundleProduct'); $('#product_bundle_container .collapse').collapse('hide'); - }); + })); }); diff --git a/app/code/Magento/Bundle/view/adminhtml/product/stock/disabler.phtml b/app/code/Magento/Bundle/view/adminhtml/product/stock/disabler.phtml index cf245c03770fe..611221f650a83 100644 --- a/app/code/Magento/Bundle/view/adminhtml/product/stock/disabler.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/product/stock/disabler.phtml @@ -24,7 +24,7 @@ ?>
- productAttribute($_product, $_product->getName(), 'name')) ?> + productAttribute($product, $product->getName(), 'name')) ?>
- - getSelections()): ?> + + getSelections()): ?> - getOptionHtml($_option) ?> + getOptionHtml($option) ?>
diff --git a/app/code/Magento/Bundle/view/frontend/js/components.phtml b/app/code/Magento/Bundle/view/frontend/js/components.phtml new file mode 100644 index 0000000000000..290162c25349a --- /dev/null +++ b/app/code/Magento/Bundle/view/frontend/js/components.phtml @@ -0,0 +1,46 @@ + + +getChildHtml() ?> \ No newline at end of file diff --git a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_compare_index.xml b/app/code/Magento/Bundle/view/frontend/layout/catalog_product_compare_index.xml deleted file mode 100644 index e552001556c1d..0000000000000 --- a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_compare_index.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - bundle - Magento\Bundle\Block\Catalog\Product\Price - catalog/product/price.phtml - - - diff --git a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view.xml deleted file mode 100644 index 6455858a3ef64..0000000000000 --- a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - bundle - Magento\Bundle\Block\Catalog\Product\Price - catalog/product/price.phtml - - - diff --git a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_bundle.xml b/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_bundle.xml index 8066d67661cb6..a477b24356795 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_bundle.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_bundle.xml @@ -25,11 +25,6 @@ --> - - - Magento_Bundle::bundle.js - - Magento_Bundle::js/product-summary.js @@ -42,11 +37,13 @@ - - - - Magento_Catalog::product/price_msrp_item.phtml - + + + + product.price.render.default + configured_price + item_view + @@ -64,7 +61,7 @@ - + product.info.addtocart @@ -80,21 +77,8 @@ - - - bundle - Magento\Bundle\Block\Catalog\Product\Price - catalog/product/view/price.phtml - - + - + - - - bundle - Magento\Bundle\Block\Catalog\Product\Price - catalog/product/view/price.phtml - - diff --git a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_simple.xml b/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_simple.xml index 75418ce963251..de213eab989f0 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_simple.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/catalog_product_view_type_simple.xml @@ -25,11 +25,6 @@ --> - - bundle - Magento\Bundle\Block\Catalog\Product\Price - catalog/product/price.phtml - bundle 4 diff --git a/app/code/Magento/Bundle/view/frontend/layout/catalogsearch_advanced_result.xml b/app/code/Magento/Bundle/view/frontend/layout/catalogsearch_advanced_result.xml deleted file mode 100644 index 403b2e3b52a6c..0000000000000 --- a/app/code/Magento/Bundle/view/frontend/layout/catalogsearch_advanced_result.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - bundle - Magento\Bundle\Block\Catalog\Product\Price - catalog/product/price.phtml - - - diff --git a/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_configure_type_bundle.xml b/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_configure_type_bundle.xml index a96747e548292..d1c5bffba06a6 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_configure_type_bundle.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_configure_type_bundle.xml @@ -25,6 +25,9 @@ --> + + + Magento_Checkout::cart/item/configure/updatecart.phtml diff --git a/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_index.xml b/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_index.xml deleted file mode 100644 index 6970987b0d2f2..0000000000000 --- a/app/code/Magento/Bundle/view/frontend/layout/checkout_cart_index.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - bundle - Magento\Bundle\Block\Catalog\Product\Price - catalog/product/price.phtml - - - diff --git a/app/code/Magento/Bundle/view/frontend/layout/default.xml b/app/code/Magento/Bundle/view/frontend/layout/default.xml index 795e85e565d37..b7ad9b861ed00 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/default.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/default.xml @@ -24,18 +24,7 @@ */ --> - - - bundle - Magento\Bundle\Block\Catalog\Product\Price - catalog/product/price.phtml - - - - - bundle - Magento\Bundle\Block\Catalog\Product\Price - catalog/product/price.phtml - + + diff --git a/app/code/Magento/Bundle/view/frontend/layout/tag_product_list.xml b/app/code/Magento/Bundle/view/frontend/layout/tag_product_list.xml deleted file mode 100644 index 403b2e3b52a6c..0000000000000 --- a/app/code/Magento/Bundle/view/frontend/layout/tag_product_list.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - bundle - Magento\Bundle\Block\Catalog\Product\Price - catalog/product/price.phtml - - - diff --git a/app/code/Magento/Captcha/view/frontend/default.phtml b/app/code/Magento/Captcha/view/frontend/default.phtml index c7fcca18f0816..04d94e068da3b 100644 --- a/app/code/Magento/Captcha/view/frontend/default.phtml +++ b/app/code/Magento/Captcha/view/frontend/default.phtml @@ -31,26 +31,20 @@
-
+
<?php echo __('Please type the letters below')?> isCaseSensitive()) :?> -
- Attention: Captcha is case sensitive.') ?> -
+
+ Attention: Captcha is case sensitive.') ?> +
-
diff --git a/app/code/Magento/Catalog/view/frontend/product/view/price.phtml b/app/code/Magento/Captcha/view/frontend/js/components.phtml similarity index 69% rename from app/code/Magento/Catalog/view/frontend/product/view/price.phtml rename to app/code/Magento/Captcha/view/frontend/js/components.phtml index 82ddae66f4a11..637c92eb747c4 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/price.phtml +++ b/app/code/Magento/Captcha/view/frontend/js/components.phtml @@ -19,9 +19,22 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category design + * @package base_default * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -getProduct() ?> -getPriceHtml($_product) ?> + +getChildHtml() ?> diff --git a/app/code/Magento/Captcha/view/frontend/layout/checkout_onepage_index.xml b/app/code/Magento/Captcha/view/frontend/layout/checkout_onepage_index.xml index c81985c1bc3d1..5d61af923cc92 100644 --- a/app/code/Magento/Captcha/view/frontend/layout/checkout_onepage_index.xml +++ b/app/code/Magento/Captcha/view/frontend/layout/checkout_onepage_index.xml @@ -68,4 +68,7 @@ + + + diff --git a/app/code/Magento/Captcha/view/frontend/layout/contacts_index_index.xml b/app/code/Magento/Captcha/view/frontend/layout/contacts_index_index.xml index 4a4996ea5f89b..affbbb616da3d 100644 --- a/app/code/Magento/Captcha/view/frontend/layout/contacts_index_index.xml +++ b/app/code/Magento/Captcha/view/frontend/layout/contacts_index_index.xml @@ -37,4 +37,7 @@ + + + diff --git a/app/code/Magento/Captcha/view/frontend/layout/customer_account_create.xml b/app/code/Magento/Captcha/view/frontend/layout/customer_account_create.xml index 6f2c7772e4f84..67cc574af8ca5 100644 --- a/app/code/Magento/Captcha/view/frontend/layout/customer_account_create.xml +++ b/app/code/Magento/Captcha/view/frontend/layout/customer_account_create.xml @@ -37,4 +37,7 @@ + + + diff --git a/app/code/Magento/Captcha/view/frontend/layout/customer_account_forgotpassword.xml b/app/code/Magento/Captcha/view/frontend/layout/customer_account_forgotpassword.xml index 208286eb72480..5ce7ad5e5541a 100644 --- a/app/code/Magento/Captcha/view/frontend/layout/customer_account_forgotpassword.xml +++ b/app/code/Magento/Captcha/view/frontend/layout/customer_account_forgotpassword.xml @@ -37,4 +37,7 @@ + + + diff --git a/app/code/Magento/Captcha/view/frontend/layout/customer_account_login.xml b/app/code/Magento/Captcha/view/frontend/layout/customer_account_login.xml index c345dae694fcd..f458c779d69ed 100644 --- a/app/code/Magento/Captcha/view/frontend/layout/customer_account_login.xml +++ b/app/code/Magento/Captcha/view/frontend/layout/customer_account_login.xml @@ -37,4 +37,7 @@ + + + diff --git a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php index 08c0ac7bf0e12..283a717867c72 100644 --- a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php @@ -34,8 +34,6 @@ */ namespace Magento\Catalog\Block\Product; -use Magento\Framework\View\Element\BlockInterface; - /** * Class AbstractProduct */ @@ -58,16 +56,6 @@ abstract class AbstractProduct extends \Magento\Framework\View\Element\Template */ protected $_priceBlockDefaultTemplate = 'product/price.phtml'; - /** - * @var string - */ - protected $_tierPriceDefaultTemplate = 'product/view/tierprices.phtml'; - - /** - * @var array - */ - protected $_priceBlockTypes = array(); - /** * Flag which allow/disallow to use link for as low as price * @@ -162,12 +150,10 @@ abstract class AbstractProduct extends \Magento\Framework\View\Element\Template /** * @param Context $context * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->_imageHelper = $context->getImageHelper(); $this->_layoutHelper = $context->getLayoutHelper(); @@ -179,7 +165,6 @@ public function __construct( $this->_taxData = $context->getTaxData(); $this->_catalogData = $context->getCatalogHelper(); $this->_mathRandom = $context->getMathRandom(); - $this->_priceBlockTypes = $priceBlockTypes; $this->reviewRenderer = $context->getReviewRenderer(); parent::__construct($context, $data); } @@ -267,51 +252,6 @@ public function getMinimalQty($product) return null; } - /** - * @param string $productTypeId - * @return BlockInterface - */ - protected function _getPriceBlock($productTypeId) - { - if (!isset($this->_priceBlock[$productTypeId])) { - $block = $this->_block; - if (isset($this->_priceBlockTypes[$productTypeId])) { - if ($this->_priceBlockTypes[$productTypeId]['block'] != '') { - $block = $this->_priceBlockTypes[$productTypeId]['block']; - } - } - $this->_priceBlock[$productTypeId] = $this->getLayout()->createBlock($block); - } - return $this->_priceBlock[$productTypeId]; - } - - /** - * @param string $productTypeId - * @return string - */ - protected function _getPriceBlockTemplate($productTypeId) - { - if (isset($this->_priceBlockTypes[$productTypeId])) { - if ($this->_priceBlockTypes[$productTypeId]['template'] != '') { - return $this->_priceBlockTypes[$productTypeId]['template']; - } - } - return $this->_priceBlockDefaultTemplate; - } - - /** - * Prepares and returns block to render some product type - * - * @param string $productType - * @return \Magento\Framework\View\Element\Template - */ - public function _preparePriceRenderer($productType) - { - return $this->_getPriceBlock($productType) - ->setTemplate($this->_getPriceBlockTemplate($productType)) - ->setUseLinkForAsLowAs($this->_useLinkForAsLowAs); - } - /** * Returns product price block html * @@ -342,21 +282,6 @@ public function getPriceHtml($product, $displayMinimalPrice = false, $idSuffix = ->toHtml(); } - /** - * Adding customized price template for product type - * - * @param string $type - * @param string $block - * @param string $template - * @return void - */ - public function addPriceBlockType($type, $block = '', $template = '') - { - if ($type) { - $this->_priceBlockTypes[$type] = array('block' => $block, 'template' => $template); - } - } - /** * Get product reviews summary * @@ -386,102 +311,6 @@ public function getProduct() return $this->getData('product'); } - /** - * Retrieve tier price template - * - * @return string - */ - public function getTierPriceTemplate() - { - if (!$this->hasData('tier_price_template')) { - return $this->_tierPriceDefaultTemplate; - } - - return $this->getData('tier_price_template'); - } - - /** - * Returns product tier price block html - * - * @param \Magento\Catalog\Model\Product $product - * @return string - */ - public function getTierPriceHtml($product = null) - { - if (is_null($product)) { - $product = $this->getProduct(); - } - return $this->_getPriceBlock($product->getTypeId()) - ->setTemplate($this->getTierPriceTemplate()) - ->setProduct($product) - ->toHtml(); - } - - /** - * Get tier prices (formatted) - * - * @param \Magento\Catalog\Model\Product $product - * @return array - * - * @deprecated see \Magento\Catalog\Pricing\Price\TierPrice - */ - public function getTierPrices($product = null) - { - if (is_null($product)) { - $product = $this->getProduct(); - } - $prices = $product->getFormatedTierPrice(); - - $res = array(); - if (is_array($prices)) { - foreach ($prices as $price) { - $price['price_qty'] = $price['price_qty'] * 1; - - $productPrice = $product->getPrice(); - if ($productPrice != $product->getFinalPrice()) { - $productPrice = $product->getFinalPrice(); - } - - // Group price must be used for percent calculation if it is lower - $groupPrice = $product->getGroupPrice(); - if ($productPrice > $groupPrice) { - $productPrice = $groupPrice; - } - - if ($price['price'] < $productPrice) { - $price['savePercent'] = ceil(100 - ((100 / $productPrice) * $price['price'])); - - $tierPrice = $this->_storeManager->getStore()->convertPrice( - $this->_taxData->getPrice($product, $price['website_price']) - ); - $price['formated_price'] = $this->_storeManager->getStore()->formatPrice($tierPrice); - $price['formated_price_incl_tax'] = $this->_storeManager->getStore()->formatPrice( - $this->_storeManager->getStore()->convertPrice( - $this->_taxData->getPrice($product, $price['website_price'], true) - ) - ); - - if ($this->_catalogData->canApplyMsrp($product)) { - $oldPrice = $product->getFinalPrice(); - $product->setPriceCalculation(false); - $product->setPrice($tierPrice); - $product->setFinalPrice($tierPrice); - - $this->getPriceHtml($product); - $product->setPriceCalculation(true); - - $price['real_price_html'] = $product->getRealPriceHtml(); - $product->setFinalPrice($oldPrice); - } - - $res[] = $price; - } - } - } - - return $res; - } - /** * Add all attributes and apply pricing logic to products collection * to get correct values in different products lists. @@ -656,26 +485,6 @@ public function displayProductStockStatus() return (bool) $statusInfo->getDisplayStatus(); } - /** - * If exists price template block, retrieve price blocks from it - * - * @return \Magento\Catalog\Block\Product\AbstractProduct - */ - protected function _prepareLayout() - { - parent::_prepareLayout(); - - /* @var $block \Magento\Catalog\Block\Product\Price\Template */ - $block = $this->getLayout()->getBlock('catalog_product_price_template'); - if ($block) { - foreach ($block->getPriceBlockTypes() as $type => $priceBlock) { - $this->addPriceBlockType($type, $priceBlock['block'], $priceBlock['template']); - } - } - - return $this; - } - /** * Product thumbnail image url getter * @@ -830,7 +639,7 @@ public function getProductPrice(\Magento\Catalog\Model\Product $product) { return $this->getProductPriceHtml( $product, - \Magento\Catalog\Pricing\Price\FinalPriceInterface::PRICE_TYPE_FINAL, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST ); } diff --git a/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php b/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php index 0c7420b732372..21f2196a89fb8 100644 --- a/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php +++ b/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php @@ -114,7 +114,6 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare * @param \Magento\Framework\App\Http\Context $httpContext * @param \Magento\Customer\Service\V1\CustomerCurrentService $currentCustomer * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, @@ -124,8 +123,7 @@ public function __construct( \Magento\Log\Model\Visitor $logVisitor, \Magento\Framework\App\Http\Context $httpContext, \Magento\Customer\Service\V1\CustomerCurrentService $currentCustomer, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->_coreData = $coreData; $this->_itemCollectionFactory = $itemCollectionFactory; @@ -135,8 +133,7 @@ public function __construct( $this->currentCustomer = $currentCustomer; parent::__construct( $context, - $data, - $priceBlockTypes + $data ); $this->_isScopePrivate = true; } @@ -279,7 +276,7 @@ public function getProductPrice(\Magento\Catalog\Model\Product $product, $idSuff $price = ''; if ($priceRender) { $price = $priceRender->render( - \Magento\Catalog\Pricing\Price\FinalPriceInterface::PRICE_TYPE_FINAL, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, $product, [ 'price_id' => 'product-price-' . $product->getId() . $idSuffix, diff --git a/app/code/Magento/Catalog/Block/Product/ListProduct.php b/app/code/Magento/Catalog/Block/Product/ListProduct.php index 8db2d9d61e81c..58ccf88a6ca11 100644 --- a/app/code/Magento/Catalog/Block/Product/ListProduct.php +++ b/app/code/Magento/Catalog/Block/Product/ListProduct.php @@ -73,23 +73,20 @@ class ListProduct extends AbstractProduct implements IdentityInterface * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Layer $catalogLayer * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Core\Helper\PostData $postDataHelper, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Layer $catalogLayer, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->_categoryFactory = $categoryFactory; $this->_catalogLayer = $catalogLayer; $this->_postDataHelper = $postDataHelper; parent::__construct( $context, - $data, - $priceBlockTypes + $data ); } @@ -359,7 +356,7 @@ public function getProductPrice(\Magento\Catalog\Model\Product $product) $price = ''; if ($priceRender) { $price = $priceRender->render( - \Magento\Catalog\Pricing\Price\FinalPriceInterface::PRICE_TYPE_FINAL, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, $product, [ 'include_container' => true, diff --git a/app/code/Magento/Catalog/Block/Product/NewProduct.php b/app/code/Magento/Catalog/Block/Product/NewProduct.php index 4c30c076853c6..61583653839f9 100644 --- a/app/code/Magento/Catalog/Block/Product/NewProduct.php +++ b/app/code/Magento/Catalog/Block/Product/NewProduct.php @@ -70,23 +70,20 @@ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct implemen * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Framework\App\Http\Context $httpContext * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Framework\App\Http\Context $httpContext, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->_productCollectionFactory = $productCollectionFactory; $this->_catalogProductVisibility = $catalogProductVisibility; $this->httpContext = $httpContext; parent::__construct( $context, - $data, - $priceBlockTypes + $data ); $this->_isScopePrivate = true; } diff --git a/app/code/Magento/Catalog/Block/Product/Price.php b/app/code/Magento/Catalog/Block/Product/Price.php index 01915db11b21d..41c937600354e 100644 --- a/app/code/Magento/Catalog/Block/Product/Price.php +++ b/app/code/Magento/Catalog/Block/Product/Price.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Block\Product; /** * Product price block - * - * @category Magento - * @package Magento_Catalog */ -namespace Magento\Catalog\Block\Product; - class Price extends \Magento\Framework\View\Element\Template implements \Magento\Framework\View\Block\IdentityInterface { /** @@ -158,70 +154,6 @@ public function getIdSuffix() return $this->_idSuffix; } - /** - * Get tier prices (formatted) - * - * @param \Magento\Catalog\Model\Product $product - * @return array - * @deprecated - */ - public function getTierPrices($product = null) - { - if (is_null($product)) { - $product = $this->getProduct(); - } - $prices = $product->getFormatedTierPrice(); - - $res = array(); - if (is_array($prices)) { - foreach ($prices as $price) { - $price['price_qty'] = $price['price_qty'] * 1; - - $productPrice = $product->getPrice(); - if ($product->getPrice() != $product->getFinalPrice()) { - $productPrice = $product->getFinalPrice(); - } - - // Group price must be used for percent calculation if it is lower - $groupPrice = $product->getGroupPrice(); - if ($productPrice > $groupPrice) { - $productPrice = $groupPrice; - } - - if ($price['price'] < $productPrice) { - $price['savePercent'] = ceil(100 - 100 / $productPrice * $price['price']); - - $tierPrice = $this->_storeManager->getStore()->convertPrice( - $this->_taxData->getPrice($product, $price['website_price']) - ); - $price['formated_price'] = $this->_storeManager->getStore()->formatPrice($tierPrice); - $price['formated_price_incl_tax'] = $this->_storeManager->getStore()->formatPrice( - $this->_storeManager->getStore()->convertPrice( - $this->_taxData->getPrice($product, $price['website_price'], true) - ) - ); - - if ($this->_catalogData->canApplyMsrp($product)) { - $oldPrice = $product->getFinalPrice(); - $product->setPriceCalculation(false); - $product->setPrice($tierPrice); - $product->setFinalPrice($tierPrice); - - $this->getLayout()->getBlock('product.info')->getPriceHtml($product); - $product->setPriceCalculation(true); - - $price['real_price_html'] = $product->getRealPriceHtml(); - $product->setFinalPrice($oldPrice); - } - - $res[] = $price; - } - } - } - - return $res; - } - /** * Retrieve url for direct adding product to cart * diff --git a/app/code/Magento/Catalog/Block/Product/Price/Template.php b/app/code/Magento/Catalog/Block/Product/Price/Template.php deleted file mode 100644 index 9155725e6bf09..0000000000000 --- a/app/code/Magento/Catalog/Block/Product/Price/Template.php +++ /dev/null @@ -1,89 +0,0 @@ - - */ -namespace Magento\Catalog\Block\Product\Price; - -class Template extends \Magento\Framework\View\Element\AbstractBlock -{ - /** - * Product Price block types cache - * - * @var array - */ - protected $_priceBlockTypes = array(); - - /** - * @param \Magento\Framework\View\Element\Context $context - * @param array $priceBlockTypes - * @param array $data - */ - public function __construct( - \Magento\Framework\View\Element\Context $context, - array $priceBlockTypes = array(), - array $data = array() - ) { - $this->_priceBlockTypes = $priceBlockTypes; - parent::__construct($context, $data); - } - - /** - * Retrieve array of Price Block Types - * - * Key is price block type name and value is array of - * template and block strings - * - * @return array - */ - public function getPriceBlockTypes() - { - return $this->_priceBlockTypes; - } - - /** - * Adding customized price template for product type - * - * @param string $type - * @param string $block - * @param string $template - * @return \Magento\Catalog\Block\Product\Price\Template - */ - public function addPriceBlockType($type, $block = '', $template = '') - { - if ($type) { - $this->_priceBlockTypes[$type] = array('block' => $block, 'template' => $template); - } - - return $this; - } -} diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php b/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php index 72b6d870be933..cb74b0418b297 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php @@ -52,7 +52,6 @@ class Promotion extends \Magento\Catalog\Block\Product\ListProduct * @param \Magento\Catalog\Model\LayerFactory $layerFactory * @param CollectionFactory $productCollectionFactory * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, @@ -61,8 +60,7 @@ public function __construct( \Magento\Catalog\Model\Layer\Category $catalogLayer, \Magento\Catalog\Model\LayerFactory $layerFactory, CollectionFactory $productCollectionFactory, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->_layerFactory = $layerFactory; $this->_productCollectionFactory = $productCollectionFactory; @@ -71,8 +69,7 @@ public function __construct( $postDataHelper, $categoryFactory, $catalogLayer, - $data, - $priceBlockTypes + $data ); } diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Random.php b/app/code/Magento/Catalog/Block/Product/ProductList/Random.php index 0f953016224d9..b17024a08151b 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Random.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Random.php @@ -54,7 +54,6 @@ class Random extends \Magento\Catalog\Block\Product\ListProduct * @param \Magento\Catalog\Model\LayerFactory $layerFactory * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, @@ -63,8 +62,7 @@ public function __construct( \Magento\Catalog\Model\Layer\Category $catalogLayer, \Magento\Catalog\Model\LayerFactory $layerFactory, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->_layerFactory = $layerFactory; $this->_productCollectionFactory = $productCollectionFactory; @@ -73,8 +71,7 @@ public function __construct( $postDataHelper, $categoryFactory, $catalogLayer, - $data, - $priceBlockTypes + $data ); } diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php index 4dc7f58cd592d..8ef064d5a0d36 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php @@ -74,23 +74,20 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct implements * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Checkout\Model\Session $checkoutSession * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Checkout\Model\Resource\Cart $checkoutCart, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Checkout\Model\Session $checkoutSession, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->_checkoutCart = $checkoutCart; $this->_catalogProductVisibility = $catalogProductVisibility; $this->_checkoutSession = $checkoutSession; parent::__construct( $context, - $data, - $priceBlockTypes + $data ); } diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php index 842461a1ddffb..5b5fcf88e9aa3 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php @@ -89,23 +89,20 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements \ * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Checkout\Model\Session $checkoutSession * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Checkout\Model\Resource\Cart $checkoutCart, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Checkout\Model\Session $checkoutSession, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->_checkoutCart = $checkoutCart; $this->_catalogProductVisibility = $catalogProductVisibility; $this->_checkoutSession = $checkoutSession; parent::__construct( $context, - $data, - $priceBlockTypes + $data ); } diff --git a/app/code/Magento/Catalog/Block/Product/Send.php b/app/code/Magento/Catalog/Block/Product/Send.php index 6c7858e98aadf..0d5cd90478307 100644 --- a/app/code/Magento/Catalog/Block/Product/Send.php +++ b/app/code/Magento/Catalog/Block/Product/Send.php @@ -47,21 +47,18 @@ class Send extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Helper\View $customerView * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Helper\View $customerView, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->_customerSession = $customerSession; $this->_customerView = $customerView; parent::__construct( $context, - $data, - $priceBlockTypes + $data ); $this->_isScopePrivate = true; } diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php index fcd14d4429e25..f51dfd2f76b24 100644 --- a/app/code/Magento/Catalog/Block/Product/View.php +++ b/app/code/Magento/Catalog/Block/Product/View.php @@ -95,7 +95,6 @@ class View extends AbstractProduct implements \Magento\Framework\View\Block\Iden * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig * @param \Magento\Framework\Locale\FormatInterface $localeFormat * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, @@ -107,8 +106,7 @@ public function __construct( \Magento\Catalog\Helper\Product $productHelper, \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig, \Magento\Framework\Locale\FormatInterface $localeFormat, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->_productHelper = $productHelper; $this->_coreData = $coreData; @@ -120,8 +118,7 @@ public function __construct( $this->_localeFormat = $localeFormat; parent::__construct( $context, - $data, - $priceBlockTypes + $data ); } @@ -249,15 +246,12 @@ public function getJsonConfig() $_request->setProductClassId($product->getTaxClassId()); $currentTax = $this->_taxCalculation->getRate($_request); - $_tierPrices = array(); - $_tierPricesInclTax = array(); - foreach ($product->getTierPrice() as $tierPrice) { - $_tierPrices[] = $this->_coreData->currency($tierPrice['website_price'], false, false); - $_tierPricesInclTax[] = $this->_coreData->currency( - $this->_taxData->getPrice($product, (int)$tierPrice['website_price'], true), - false, - false - ); + $tierPrices = array(); + + $tierPricesList = $product->getPriceInfo()->getPrice('tier_price')->getTierPriceList(); + + foreach ($tierPricesList as $tierPrice) { + $tierPrices[] = $this->_coreData->currency($tierPrice['price']->getValue(), false, false); } $config = array( 'productId' => $product->getId(), @@ -271,7 +265,7 @@ public function getJsonConfig() false ), 'productOldPrice' => $this->_coreData->currency( - $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getBaseAmount(), + $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue(), false, false ), @@ -293,8 +287,7 @@ public function getJsonConfig() 'plusDispositionTax' => 0, 'oldMinusDisposition' => 0, 'minusDisposition' => 0, - 'tierPrices' => $_tierPrices, - 'tierPricesInclTax' => $_tierPricesInclTax + 'tierPrices' => $tierPrices ); $responseObject = new \Magento\Framework\Object(); diff --git a/app/code/Magento/Catalog/Block/Product/View/AbstractView.php b/app/code/Magento/Catalog/Block/Product/View/AbstractView.php index e2a7ac5995ff0..c3eb8063b61aa 100644 --- a/app/code/Magento/Catalog/Block/Product/View/AbstractView.php +++ b/app/code/Magento/Catalog/Block/Product/View/AbstractView.php @@ -44,19 +44,16 @@ abstract class AbstractView extends \Magento\Catalog\Block\Product\AbstractProdu * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Framework\Stdlib\ArrayUtils $arrayUtils, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->arrayUtils = $arrayUtils; parent::__construct( $context, - $data, - $priceBlockTypes + $data ); } diff --git a/app/code/Magento/Catalog/Block/Product/Widget/NewWidget.php b/app/code/Magento/Catalog/Block/Product/Widget/NewWidget.php index f1be592cd57d2..64d70288af15c 100644 --- a/app/code/Magento/Catalog/Block/Product/Widget/NewWidget.php +++ b/app/code/Magento/Catalog/Block/Product/Widget/NewWidget.php @@ -62,21 +62,6 @@ class NewWidget extends \Magento\Catalog\Block\Product\NewProduct implements \Ma */ protected $_pager; - /** - * Initialize block's cache and template settings - * - * @return void - */ - protected function _construct() - { - parent::_construct(); - $this->addPriceBlockType( - 'bundle', - 'Magento\Bundle\Block\Catalog\Product\Price', - 'bundle/catalog/product/price.phtml' - ); - } - /** * Product collection initialize process * @@ -249,7 +234,7 @@ public function getProductPriceHtml( $price = ''; if ($priceRender) { $price = $priceRender->render( - \Magento\Catalog\Pricing\Price\FinalPriceInterface::PRICE_TYPE_FINAL, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, $product, $arguments ); diff --git a/app/code/Magento/Catalog/Helper/Product/Configuration.php b/app/code/Magento/Catalog/Helper/Product/Configuration.php index 02f33832346e7..89f7204d47bbc 100644 --- a/app/code/Magento/Catalog/Helper/Product/Configuration.php +++ b/app/code/Magento/Catalog/Helper/Product/Configuration.php @@ -25,13 +25,15 @@ */ namespace Magento\Catalog\Helper\Product; +use Magento\Catalog\Helper\Product\Configuration\ConfigurationInterface; +use Magento\Framework\App\Helper\AbstractHelper; + /** * Helper for fetching properties by product configurational item * * @SuppressWarnings(PHPMD.LongVariable) */ -class Configuration extends \Magento\Framework\App\Helper\AbstractHelper implements - \Magento\Catalog\Helper\Product\Configuration\ConfigurationInterface +class Configuration extends AbstractHelper implements ConfigurationInterface { /** * Filter manager @@ -89,15 +91,11 @@ public function getCustomOptions(\Magento\Catalog\Model\Product\Configuration\It $option = $product->getOptionById($optionId); if ($option) { $itemOption = $item->getOptionByCode('option_' . $option->getId()); - $group = $option->groupFactory( - $option->getType() - )->setOption( - $option - )->setConfigurationItem( - $item - )->setConfigurationItemOption( - $itemOption - ); + /** @var $group \Magento\Catalog\Model\Product\Option\Type\DefaultType */ + $group = $option->groupFactory($option->getType()) + ->setOption($option) + ->setConfigurationItem($item) + ->setConfigurationItemOption($itemOption); if ('file' == $option->getType()) { $downloadParams = $item->getFileDownloadParams(); diff --git a/app/code/Magento/Catalog/Helper/Product/Configuration/ConfigurationInterface.php b/app/code/Magento/Catalog/Helper/Product/Configuration/ConfigurationInterface.php index b72ccb67b6352..2ac6d335ecc65 100644 --- a/app/code/Magento/Catalog/Helper/Product/Configuration/ConfigurationInterface.php +++ b/app/code/Magento/Catalog/Helper/Product/Configuration/ConfigurationInterface.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Helper\Product\Configuration; + /** * Interface for product configuration helpers - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team */ -namespace Magento\Catalog\Helper\Product\Configuration; - interface ConfigurationInterface { /** diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php index 70fe542c82827..298f793a5e99f 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php @@ -32,16 +32,6 @@ */ abstract class AbstractAction { - /** - * Path to maximum available amount of indexes for flat indexer - */ - const XML_NODE_MAX_INDEX_COUNT = 'catalog/product/flat/max_index_count'; - - /** - * Maximum size of attributes chunk - */ - const ATTRIBUTES_CHUNK_SIZE = 59; - /** * Suffix for value field on composite attributes * @@ -50,50 +40,22 @@ abstract class AbstractAction protected $_valueFieldSuffix = '_value'; /** - * Resource instance + * Suffix for drop table (uses on flat table rename) * - * @var \Magento\Framework\App\Resource + * @var string */ - protected $_resource; + protected $_tableDropSuffix = '_drop_indexer'; /** * @var \Magento\Store\Model\StoreManagerInterface */ protected $_storeManager; - /** - * Catalog resource helper - * - * @var \Magento\Catalog\Model\Resource\Helper - */ - protected $_resourceHelper; - - /** - * Core store config - * - * @var \Magento\Framework\App\Config\ScopeConfigInterface - */ - protected $_scopeConfig; - - /** - * Suffix for drop table (uses on flat table rename) - * - * @var string - */ - protected $_tableDropSuffix = '_drop_indexer'; - /** * @var \Magento\Catalog\Helper\Product\Flat\Indexer */ protected $_productIndexerHelper; - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData; - /** * @var \Magento\Framework\DB\Adapter\AdapterInterface */ @@ -118,11 +80,6 @@ abstract class AbstractAction */ protected $_productTypes = array(); - /** - * @var \Magento\Catalog\Model\Indexer\Product\Flat\Processor - */ - protected $_flatProductProcessor; - /** * @var TableBuilder */ @@ -136,33 +93,23 @@ abstract class AbstractAction /** * @param \Magento\Framework\App\Resource $resource * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Catalog\Model\Resource\Helper $resourceHelper - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper * @param \Magento\Catalog\Model\Product\Type $productType - * @param Processor $flatProductProcessor * @param TableBuilder $tableBuilder * @param FlatTableBuilder $flatTableBuilder */ public function __construct( \Magento\Framework\App\Resource $resource, \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Catalog\Model\Resource\Helper $resourceHelper, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper, \Magento\Catalog\Model\Product\Type $productType, - \Magento\Catalog\Model\Indexer\Product\Flat\Processor $flatProductProcessor, - \Magento\Catalog\Model\Indexer\Product\Flat\TableBuilder $tableBuilder, - \Magento\Catalog\Model\Indexer\Product\Flat\FlatTableBuilder $flatTableBuilder + TableBuilder $tableBuilder, + FlatTableBuilder $flatTableBuilder ) { - $this->_resource = $resource; $this->_storeManager = $storeManager; - $this->_resourceHelper = $resourceHelper; - $this->_scopeConfig = $scopeConfig; $this->_productIndexerHelper = $productHelper; $this->_productType = $productType; $this->_connection = $resource->getConnection('default'); - $this->_flatProductProcessor = $flatProductProcessor; $this->_tableBuilder = $tableBuilder; $this->_flatTableBuilder = $flatTableBuilder; } @@ -175,17 +122,6 @@ public function __construct( */ abstract public function execute($ids); - /** - * Retrieve Catalog Product Flat Table name - * - * @param int $storeId - * @return string - */ - public function getFlatTableName($storeId) - { - return sprintf('%s_%s', $this->_connection->getTableName('catalog_product_flat'), $storeId); - } - /** * Return temporary table name by regular table name * @@ -243,34 +179,6 @@ protected function _reindex($storeId, array $changedIds = array()) } } - /** - * Remove products from flat that are not exist - * - * @param array $ids - * @param int $storeId - * @return void - */ - protected function _removeDeletedProducts(array &$ids, $storeId) - { - $select = $this->_connection->select()->from( - $this->_productIndexerHelper->getTable('catalog_product_entity') - )->where( - 'entity_id IN(?)', - $ids - ); - $result = $this->_connection->query($select); - - $existentProducts = array(); - foreach ($result->fetchAll() as $product) { - $existentProducts[] = $product['entity_id']; - } - - $productsToDelete = array_diff($ids, $existentProducts); - $ids = $existentProducts; - - $this->deleteProductsFromStore($productsToDelete, $storeId); - } - /** * Retrieve Product Type Instances * as key - type code, value - instance model @@ -406,172 +314,6 @@ protected function _cleanRelationProducts($storeId) return $this; } - /** - * Reindex single product into flat product table - * - * @param int $storeId - * @param int $productId - * @return \Magento\Catalog\Model\Indexer\Product\Flat - */ - protected function _reindexSingleProduct($storeId, $productId) - { - $flatTable = $this->_productIndexerHelper->getFlatTableName($storeId); - - if (!$this->_connection->isTableExists($flatTable)) { - $this->_flatTableBuilder->build( - $storeId, - array($productId), - $this->_valueFieldSuffix, - $this->_tableDropSuffix, - false - ); - } - - $attributes = $this->_productIndexerHelper->getAttributes(); - $eavAttributes = $this->_productIndexerHelper->getTablesStructure($attributes); - $updateData = array(); - $describe = $this->_connection->describeTable($flatTable); - - foreach ($eavAttributes as $tableName => $tableColumns) { - $columnsChunks = array_chunk($tableColumns, self::ATTRIBUTES_CHUNK_SIZE, true); - - foreach ($columnsChunks as $columns) { - $select = $this->_connection->select(); - $selectValue = $this->_connection->select(); - $keyColumns = array( - 'entity_id' => 'e.entity_id', - 'attribute_id' => 't.attribute_id', - 'value' => $this->_connection->getIfNullSql('`t2`.`value`', '`t`.`value`') - ); - - if ($tableName != $this->_productIndexerHelper->getTable('catalog_product_entity')) { - $valueColumns = array(); - $ids = array(); - $select->from( - array('e' => $this->_productIndexerHelper->getTable('catalog_product_entity')), - $keyColumns - ); - - $selectValue->from( - array('e' => $this->_productIndexerHelper->getTable('catalog_product_entity')), - $keyColumns - ); - - /** @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */ - foreach ($columns as $columnName => $attribute) { - if (isset($describe[$columnName])) { - $ids[$attribute->getId()] = $columnName; - } - } - - $select->joinLeft( - array('t' => $tableName), - 'e.entity_id = t.entity_id ' . $this->_connection->quoteInto( - ' AND t.attribute_id IN (?)', - array_keys($ids) - ) . ' AND t.store_id = 0', - array() - )->joinLeft( - array('t2' => $tableName), - 't.entity_id = t2.entity_id ' . - ' AND t.attribute_id = t2.attribute_id ' . - $this->_connection->quoteInto( - ' AND t2.store_id = ?', - $storeId - ), - array() - )->where( - 'e.entity_id = ' . $productId - )->where( - 't.attribute_id IS NOT NULL' - ); - $cursor = $this->_connection->query($select); - while ($row = $cursor->fetch(\Zend_Db::FETCH_ASSOC)) { - $updateData[$ids[$row['attribute_id']]] = $row['value']; - $valueColumnName = $ids[$row['attribute_id']] . $this->_valueFieldSuffix; - if (isset($describe[$valueColumnName])) { - $valueColumns[$row['value']] = $valueColumnName; - } - } - - //Update not simple attributes (eg. dropdown) - if (!empty($valueColumns)) { - $valueIds = array_keys($valueColumns); - - $select = $this->_connection->select()->from( - array('t' => $this->_productIndexerHelper->getTable('eav_attribute_option_value')), - array('t.option_id', 't.value') - )->where( - $this->_connection->quoteInto('t.option_id IN (?)', $valueIds) - ); - $cursor = $this->_connection->query($select); - while ($row = $cursor->fetch(\Zend_Db::FETCH_ASSOC)) { - $valueColumnName = $valueColumns[$row['option_id']]; - if (isset($describe[$valueColumnName])) { - $updateData[$valueColumnName] = $row['value']; - } - } - } - } else { - $columnNames = array_keys($columns); - $columnNames[] = 'attribute_set_id'; - $columnNames[] = 'type_id'; - $select->from( - array('e' => $this->_productIndexerHelper->getTable('catalog_product_entity')), - $columnNames - )->where( - 'e.entity_id = ' . $productId - ); - $cursor = $this->_connection->query($select); - $row = $cursor->fetch(\Zend_Db::FETCH_ASSOC); - if (!empty($row)) { - foreach ($row as $columnName => $value) { - $updateData[$columnName] = $value; - } - } - } - } - } - - if (!empty($updateData)) { - $updateData += array('entity_id' => $productId); - $updateFields = array(); - foreach ($updateData as $key => $value) { - $updateFields[$key] = $key; - } - $this->_connection->insertOnDuplicate($flatTable, $updateData, $updateFields); - } - - return $this; - } - - /** - * Delete products from flat table(s) - * - * @param int|array $productId - * @param null|int $storeId - * @return void - */ - public function deleteProductsFromStore($productId, $storeId = null) - { - if (!is_array($productId)) { - $productId = array($productId); - } - if (null === $storeId) { - foreach ($this->_storeManager->getStores() as $store) { - $this->_connection->delete( - $this->_productIndexerHelper->getFlatTableName($store->getId()), - array('entity_id IN(?)' => $productId) - ); - } - } else { - $this->_connection->delete( - $this->_productIndexerHelper->getFlatTableName((int)$storeId), - array('entity_id IN(?)' => $productId) - ); - } - } - /** * Check is flat table for store exists * @@ -581,7 +323,7 @@ public function deleteProductsFromStore($productId, $storeId = null) protected function _isFlatTableExists($storeId) { if (!isset($this->_flatTablesExist[$storeId])) { - $tableName = $this->getFlatTableName($storeId); + $tableName = $this->_productIndexerHelper->getFlatTableName($storeId); $isTableExists = $this->_connection->isTableExists($tableName); $this->_flatTablesExist[$storeId] = $isTableExists ? true : false; diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php new file mode 100644 index 0000000000000..8829c244647cd --- /dev/null +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php @@ -0,0 +1,114 @@ +productIndexerHelper = $productHelper; + $this->connection = $resource->getConnection('default'); + $this->storeManager = $storeManager; + } + + /** + * Remove products from flat that are not exist + * + * @param array $ids + * @param int $storeId + * @return void + */ + public function removeDeletedProducts(array &$ids, $storeId) + { + $select = $this->connection->select()->from( + $this->productIndexerHelper->getTable('catalog_product_entity') + )->where( + 'entity_id IN(?)', + $ids + ); + $result = $this->connection->query($select); + + $existentProducts = array(); + foreach ($result->fetchAll() as $product) { + $existentProducts[] = $product['entity_id']; + } + + $productsToDelete = array_diff($ids, $existentProducts); + $ids = $existentProducts; + + $this->deleteProductsFromStore($productsToDelete, $storeId); + } + + /** + * Delete products from flat table(s) + * + * @param int|array $productId + * @param null|int $storeId + * @return void + */ + public function deleteProductsFromStore($productId, $storeId = null) + { + if (!is_array($productId)) { + $productId = array($productId); + } + if (null === $storeId) { + foreach ($this->storeManager->getStores() as $store) { + $this->connection->delete( + $this->productIndexerHelper->getFlatTableName($store->getId()), + array('entity_id IN(?)' => $productId) + ); + } + } else { + $this->connection->delete( + $this->productIndexerHelper->getFlatTableName((int)$storeId), + array('entity_id IN(?)' => $productId) + ); + } + } +} diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Indexer.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Indexer.php new file mode 100644 index 0000000000000..9ddc75f04dd77 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Indexer.php @@ -0,0 +1,184 @@ +_productIndexerHelper = $productHelper; + $this->_connection = $resource->getConnection('default'); + } + + /** + * Write single product into flat product table + * + * @param int $storeId + * @param int $productId + * @param string $valueFieldSuffix + * @return \Magento\Catalog\Model\Indexer\Product\Flat + */ + public function write($storeId, $productId, $valueFieldSuffix = '') + { + $flatTable = $this->_productIndexerHelper->getFlatTableName($storeId); + + $attributes = $this->_productIndexerHelper->getAttributes(); + $eavAttributes = $this->_productIndexerHelper->getTablesStructure($attributes); + $updateData = array(); + $describe = $this->_connection->describeTable($flatTable); + + foreach ($eavAttributes as $tableName => $tableColumns) { + $columnsChunks = array_chunk($tableColumns, self::ATTRIBUTES_CHUNK_SIZE, true); + + foreach ($columnsChunks as $columns) { + $select = $this->_connection->select(); + $selectValue = $this->_connection->select(); + $keyColumns = array( + 'entity_id' => 'e.entity_id', + 'attribute_id' => 't.attribute_id', + 'value' => $this->_connection->getIfNullSql('`t2`.`value`', '`t`.`value`') + ); + + if ($tableName != $this->_productIndexerHelper->getTable('catalog_product_entity')) { + $valueColumns = array(); + $ids = array(); + $select->from( + array('e' => $this->_productIndexerHelper->getTable('catalog_product_entity')), + $keyColumns + ); + + $selectValue->from( + array('e' => $this->_productIndexerHelper->getTable('catalog_product_entity')), + $keyColumns + ); + + /** @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */ + foreach ($columns as $columnName => $attribute) { + if (isset($describe[$columnName])) { + $ids[$attribute->getId()] = $columnName; + } + } + + $select->joinLeft( + array('t' => $tableName), + 'e.entity_id = t.entity_id ' . $this->_connection->quoteInto( + ' AND t.attribute_id IN (?)', + array_keys($ids) + ) . ' AND t.store_id = 0', + array() + )->joinLeft( + array('t2' => $tableName), + 't.entity_id = t2.entity_id ' . + ' AND t.attribute_id = t2.attribute_id ' . + $this->_connection->quoteInto( + ' AND t2.store_id = ?', + $storeId + ), + array() + )->where( + 'e.entity_id = ' . $productId + )->where( + 't.attribute_id IS NOT NULL' + ); + $cursor = $this->_connection->query($select); + while ($row = $cursor->fetch(\Zend_Db::FETCH_ASSOC)) { + $updateData[$ids[$row['attribute_id']]] = $row['value']; + $valueColumnName = $ids[$row['attribute_id']] . $valueFieldSuffix; + if (isset($describe[$valueColumnName])) { + $valueColumns[$row['value']] = $valueColumnName; + } + } + + //Update not simple attributes (eg. dropdown) + if (!empty($valueColumns)) { + $valueIds = array_keys($valueColumns); + + $select = $this->_connection->select()->from( + array('t' => $this->_productIndexerHelper->getTable('eav_attribute_option_value')), + array('t.option_id', 't.value') + )->where( + $this->_connection->quoteInto('t.option_id IN (?)', $valueIds) + ); + $cursor = $this->_connection->query($select); + while ($row = $cursor->fetch(\Zend_Db::FETCH_ASSOC)) { + $valueColumnName = $valueColumns[$row['option_id']]; + if (isset($describe[$valueColumnName])) { + $updateData[$valueColumnName] = $row['value']; + } + } + } + } else { + $columnNames = array_keys($columns); + $columnNames[] = 'attribute_set_id'; + $columnNames[] = 'type_id'; + $select->from( + array('e' => $this->_productIndexerHelper->getTable('catalog_product_entity')), + $columnNames + )->where( + 'e.entity_id = ' . $productId + ); + $cursor = $this->_connection->query($select); + $row = $cursor->fetch(\Zend_Db::FETCH_ASSOC); + if (!empty($row)) { + foreach ($row as $columnName => $value) { + $updateData[$columnName] = $value; + } + } + } + } + } + + if (!empty($updateData)) { + $updateData += array('entity_id' => $productId); + $updateFields = array(); + foreach ($updateData as $key => $value) { + $updateFields[$key] = $key; + } + $this->_connection->insertOnDuplicate($flatTable, $updateData, $updateFields); + } + + return $this; + } +} diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php index 0aea1d535fddf..c5c9491dd2930 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php @@ -25,12 +25,58 @@ */ namespace Magento\Catalog\Model\Indexer\Product\Flat\Action; +use Magento\Catalog\Model\Indexer\Product\Flat\Processor; +use Magento\Catalog\Model\Indexer\Product\Flat\TableBuilder; +use Magento\Catalog\Model\Indexer\Product\Flat\FlatTableBuilder; + /** * Class Row reindex action * @package Magento\Catalog\Model\Indexer\Product\Flat\Action */ class Row extends \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction { + /** + * @var \Magento\Catalog\Model\Indexer\Product\Flat\Action\Indexer + */ + protected $flatItemWriter; + + /** + * @var Eraser + */ + protected $flatItemEraser; + + /** + * @param \Magento\Framework\App\Resource $resource + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper + * @param \Magento\Catalog\Model\Product\Type $productType + * @param TableBuilder $tableBuilder + * @param FlatTableBuilder $flatTableBuilder + * @param Indexer $flatItemWriter + * @param Eraser $flatItemEraser + */ + public function __construct( + \Magento\Framework\App\Resource $resource, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper, + \Magento\Catalog\Model\Product\Type $productType, + TableBuilder $tableBuilder, + FlatTableBuilder $flatTableBuilder, + Indexer $flatItemWriter, + Eraser $flatItemEraser + ) { + parent::__construct( + $resource, + $storeManager, + $productHelper, + $productType, + $tableBuilder, + $flatTableBuilder + ); + $this->flatItemWriter = $flatItemWriter; + $this->flatItemEraser = $flatItemEraser; + } + /** * Execute row reindex action * @@ -45,9 +91,21 @@ public function execute($id = null) } $ids = array($id); foreach ($this->_storeManager->getStores() as $store) { - $this->_removeDeletedProducts($ids, $store->getId()); + $tableExists = $this->_isFlatTableExists($store->getId()); + if ($tableExists) { + $this->flatItemEraser->removeDeletedProducts($ids, $store->getId()); + } if (isset($ids[0])) { - $this->_reindexSingleProduct($store->getId(), $ids[0]); + if (!$tableExists) { + $this->_flatTableBuilder->build( + $store->getId(), + array($ids[0]), + $this->_valueFieldSuffix, + $this->_tableDropSuffix, + false + ); + } + $this->flatItemWriter->write($store->getId(), $ids[0], $this->_valueFieldSuffix); } } return $this; diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php index cceba57cf0b52..2fb5aaf399144 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php @@ -25,6 +25,9 @@ */ namespace Magento\Catalog\Model\Indexer\Product\Flat\Action; +use Magento\Catalog\Model\Indexer\Product\Flat\TableBuilder; +use Magento\Catalog\Model\Indexer\Product\Flat\FlatTableBuilder; + /** * Class Rows reindex action for mass actions * @@ -32,6 +35,40 @@ */ class Rows extends \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction { + /** + * @var Eraser + */ + protected $flatItemEraser; + + /** + * @param \Magento\Framework\App\Resource $resource + * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper + * @param \Magento\Catalog\Model\Product\Type $productType + * @param TableBuilder $tableBuilder + * @param FlatTableBuilder $flatTableBuilder + * @param Eraser $flatItemEraser + */ + public function __construct( + \Magento\Framework\App\Resource $resource, + \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper, + \Magento\Catalog\Model\Product\Type $productType, + TableBuilder $tableBuilder, + FlatTableBuilder $flatTableBuilder, + Eraser $flatItemEraser + ) { + parent::__construct( + $resource, + $storeManager, + $productHelper, + $productType, + $tableBuilder, + $flatTableBuilder + ); + $this->flatItemEraser = $flatItemEraser; + } + /** * Execute multiple rows reindex action * @@ -48,7 +85,7 @@ public function execute($ids) foreach ($this->_storeManager->getStores() as $store) { $idsBatches = array_chunk($ids, \Magento\Catalog\Helper\Product\Flat\Indexer::BATCH_SIZE); foreach ($idsBatches as $changedIds) { - $this->_removeDeletedProducts($changedIds, $store->getId()); + $this->flatItemEraser->removeDeletedProducts($changedIds, $store->getId()); if (!empty($changedIds)) { $this->_reindex($store->getId(), $changedIds); } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php index f7f6a998e9bc1..e937a06a874cd 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php @@ -31,6 +31,11 @@ */ class FlatTableBuilder { + /** + * Path to maximum available amount of indexes for flat indexer + */ + const XML_NODE_MAX_INDEX_COUNT = 'catalog/product/flat/max_index_count'; + /** * @var \Magento\Catalog\Helper\Product\Flat\Indexer */ @@ -123,7 +128,7 @@ protected function _createTemporaryFlatTable($storeId) $indexesNeed = $this->_productIndexerHelper->getFlatIndexes(); $maxIndex = $this->_config->getValue( - \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction::XML_NODE_MAX_INDEX_COUNT + self::XML_NODE_MAX_INDEX_COUNT ); if ($maxIndex && count($indexesNeed) > $maxIndex) { throw new \Magento\Framework\Model\Exception( diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php index 5d6481cc24b9d..c7b5a3d376323 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/TableBuilder.php @@ -258,7 +258,7 @@ protected function _fillTemporaryTable( $columnsChunks = array_chunk( $tableColumns, - \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction::ATTRIBUTES_CHUNK_SIZE, + Action\Indexer::ATTRIBUTES_CHUNK_SIZE, true ); foreach ($columnsChunks as $columnsList) { diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 15446a4038dc7..aa42badd5cae0 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -757,6 +757,16 @@ public function setQty($qty) return $this; } + /** + * Get quantity for product + * + * @return float + */ + public function getQty() + { + return $this->getData('qty'); + } + /** * Callback for entity reindex * diff --git a/app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemInterface.php b/app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemInterface.php index 4e85966cc05d1..540007beb7cd1 100644 --- a/app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemInterface.php +++ b/app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemInterface.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Model\Product\Configuration\Item; + /** * Product configurational item interface - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team */ -namespace Magento\Catalog\Model\Product\Configuration\Item; - interface ItemInterface { /** diff --git a/app/code/Magento/Catalog/Model/Product/Option.php b/app/code/Magento/Catalog/Model/Product/Option.php index 2de6843d454b9..7745e8a332be8 100644 --- a/app/code/Magento/Catalog/Model/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Product/Option.php @@ -431,7 +431,7 @@ protected function _afterSave() public function getPrice($flag = false) { if ($flag && $this->getPriceType() == 'percent') { - $basePrice = $this->getProduct()->getPriceInfo()->getPrice(BasePrice::PRICE_TYPE_BASE_PRICE)->getValue(); + $basePrice = $this->getProduct()->getPriceInfo()->getPrice(BasePrice::PRICE_CODE)->getValue(); $price = $basePrice * ($this->_getData('price') / 100); return $price; } diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php index b3d6f229b5f91..9dae9ada9b227 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php @@ -782,7 +782,6 @@ public function copyQuoteToOrder() $this->_rootDirectory->getAbsolutePath($quotePath), $this->_rootDirectory->getAbsolutePath($orderPath) ); - $this->_rootDirectory->copyFile($quotePath, $orderPath); } catch (\Exception $e) { return $this; } diff --git a/app/code/Magento/Catalog/Model/Product/Type.php b/app/code/Magento/Catalog/Model/Product/Type.php index d1e9bf94d1c88..bdfe35666f77f 100644 --- a/app/code/Magento/Catalog/Model/Product/Type.php +++ b/app/code/Magento/Catalog/Model/Product/Type.php @@ -30,7 +30,6 @@ namespace Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product; -use Magento\Framework\Pricing\Object\SaleableInterface; class Type { @@ -181,12 +180,12 @@ public function priceFactory($productType) /** * Get Product Price Info object * - * @param SaleableInterface $product + * @param Product $saleableItem * @return \Magento\Framework\Pricing\PriceInfoInterface */ - public function getPriceInfo(SaleableInterface $product) + public function getPriceInfo(Product $saleableItem) { - return $this->_priceInfoFactory->create($product); + return $this->_priceInfoFactory->create($saleableItem); } /** diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php index e90bf636c492d..17404be9d8773 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php @@ -231,9 +231,10 @@ public function getInactiveCategoryIds() * @param \Magento\Catalog\Model\Category|int $parentNode * @param integer $recursionLevel * @param integer $storeId + * @param bool $skipMenuFilter * @return array */ - protected function _loadNodes($parentNode = null, $recursionLevel = 0, $storeId = 0) + protected function _loadNodes($parentNode = null, $recursionLevel = 0, $storeId = 0, $skipMenuFilter = false) { $_conn = $this->_getReadAdapter(); $startLevel = 1; @@ -279,13 +280,14 @@ protected function _loadNodes($parentNode = null, $recursionLevel = 0, $storeId )->where( 'main_table.is_active = ?', '1' - )->where( - 'main_table.include_in_menu = ?', - '1' - )->order( - 'main_table.position' ); + if (false == $skipMenuFilter) { + $select->where('main_table.include_in_menu = ?', '1'); + } + + $select->order('main_table.position'); + if ($parentPath) { $select->where($_conn->quoteInto("main_table.path like ?", "{$parentPath}/%")); } @@ -587,7 +589,7 @@ public function getParentDesignCategory($category) */ public function getChildrenCategories($category) { - $categories = $this->_loadNodes($category, 1, $category->getStoreId()); + $categories = $this->_loadNodes($category, 1, $category->getStoreId(), true); return $categories; } diff --git a/app/code/Magento/Catalog/Pricing/Price/BasePrice.php b/app/code/Magento/Catalog/Pricing/Price/BasePrice.php index 51030def6a11d..b98be1aa65a79 100644 --- a/app/code/Magento/Catalog/Pricing/Price/BasePrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/BasePrice.php @@ -26,25 +26,17 @@ namespace Magento\Catalog\Pricing\Price; +use Magento\Framework\Pricing\Price\AbstractPrice; + /** * Class BasePrice */ -class BasePrice extends RegularPrice +class BasePrice extends AbstractPrice { /** * Price type identifier string */ - const PRICE_TYPE_BASE_PRICE = 'base_price'; - - /** - * @var string - */ - protected $priceType = self::PRICE_TYPE_BASE_PRICE; - - /** - * @var bool|float|null - */ - protected $maxValue; + const PRICE_CODE = 'base_price'; /** * Get Base Price Value @@ -55,8 +47,11 @@ public function getValue() { if ($this->value === null) { $this->value = false; - foreach ($this->priceInfo->getPricesIncludedInBase() as $price) { - $this->value = min($price->getValue(), $this->value ?: $price->getValue()); + foreach ($this->priceInfo->getPrices() as $code => $price) { + if ($price instanceof \Magento\Framework\Pricing\Price\BasePriceProviderInterface && $price->getValue() + ) { + $this->value = min($price->getValue(), $this->value ? : $price->getValue()); + } } } return $this->value; diff --git a/app/code/Magento/Catalog/Pricing/Price/ConfiguredPrice.php b/app/code/Magento/Catalog/Pricing/Price/ConfiguredPrice.php new file mode 100644 index 0000000000000..3977fda3e48ff --- /dev/null +++ b/app/code/Magento/Catalog/Pricing/Price/ConfiguredPrice.php @@ -0,0 +1,111 @@ +item = $item; + parent::__construct($saleableItem, $quantity, $calculator); + } + + /** + * @param ItemInterface $item + * @return $this + */ + public function setItem(ItemInterface $item) + { + $this->item = $item; + return $this; + } + + /** + * Get value of configured options + * + * @return array + */ + protected function getOptionsValue() + { + $product = $this->item->getProduct(); + $value = 0.; + $optionIds = $this->item->getOptionByCode('option_ids'); + if ($optionIds) { + foreach (explode(',', $optionIds->getValue()) as $optionId) { + $option = $product->getOptionById($optionId); + if ($option) { + /** @var \Magento\Wishlist\Model\Item\Option $itemOption */ + $itemOption = $this->item->getOptionByCode('option_' . $option->getId()); + /** @var $group \Magento\Catalog\Model\Product\Option\Type\DefaultType */ + $group = $option->groupFactory($option->getType()) + ->setOption($option) + ->setConfigurationItem($this->item) + ->setConfigurationItemOption($itemOption); + $value += $group->getOptionPrice($itemOption->getValue(), $this->value); + } + } + } + return $value; + } + + /** + * Price value of product with configured options + * + * @return bool|float + */ + public function getValue() + { + return $this->item ? parent::getValue() + $this->getOptionsValue() : parent::getValue(); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Stub/Order.php b/app/code/Magento/Catalog/Pricing/Price/ConfiguredPriceInterface.php similarity index 67% rename from dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Stub/Order.php rename to app/code/Magento/Catalog/Pricing/Price/ConfiguredPriceInterface.php index f050a80c4ccca..affec1ddb5947 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Stub/Order.php +++ b/app/code/Magento/Catalog/Pricing/Price/ConfiguredPriceInterface.php @@ -18,31 +18,29 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Catalog * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Sales\Controller\Adminhtml\Stub; -use Magento\Backend\App\Action; -use Magento\Sales\Controller\Adminhtml\Order as OrderController; +namespace Magento\Catalog\Pricing\Price; + +use Magento\Catalog\Model\Product\Configuration\Item\ItemInterface; /** - * Magento Adminhtml Order Controller Test + * Configured price interface */ -class Order extends OrderController +interface ConfiguredPriceInterface { /** - * @var \Magento\Framework\App\Action\Title - */ - public $_title; - - /** - * @var \Magento\Framework\App\Action\Title + * Price type configured */ - public $_view; + const CONFIGURED_PRICE_CODE = 'configured_price'; /** - * @var \Magento\Framework\Message\ManagerInterface + * @param ItemInterface $item + * @return $this */ - public $messageManager; + public function setItem(ItemInterface $item); } diff --git a/app/code/Magento/Catalog/Pricing/Price/CustomOptionPrice.php b/app/code/Magento/Catalog/Pricing/Price/CustomOptionPrice.php index f81e2e3aa8c10..9da910f99f553 100644 --- a/app/code/Magento/Catalog/Pricing/Price/CustomOptionPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/CustomOptionPrice.php @@ -27,18 +27,19 @@ use Magento\Catalog\Pricing\Price; use Magento\Catalog\Model\Product\Option\Value; +use Magento\Framework\Pricing\Price\AbstractPrice; /** * Class OptionPrice * * @package Magento\Catalog\Pricing\Price */ -class CustomOptionPrice extends RegularPrice implements CustomOptionPriceInterface +class CustomOptionPrice extends AbstractPrice implements CustomOptionPriceInterface { /** - * @var string + * Price model code */ - protected $priceType = self::PRICE_TYPE_CUSTOM_OPTION; + const PRICE_CODE = 'custom_option_price'; /** * @var array @@ -46,17 +47,53 @@ class CustomOptionPrice extends RegularPrice implements CustomOptionPriceInterfa protected $priceOptions; /** - * Get Value + * Get minimal optoin item values * * @return bool|float */ public function getValue() + { + $requiredMinimalOptions = []; + $options = $this->product->getOptions(); + if ($options) { + /** @var $optionItem \Magento\Catalog\Model\Product\Option */ + foreach ($options as $optionItem) { + if (!$optionItem->getIsRequire()) { + continue; + } + $min = 0.; + /** @var $optionValue \Magento\Catalog\Model\Product\Option\Value */ + foreach ($optionItem->getValues() as $optionValue) { + $price = $optionValue->getPrice($optionValue->getPriceType() == Value::TYPE_PERCENT); + if (!$min) { + $min = $price; + } + if ($price < $min) { + $min = $price; + } + } + $requiredMinimalOptions[] = [ + 'option_id' => $optionItem->getId(), + 'type' => $optionItem->getType(), + 'min' => $min + ]; + } + } + return $requiredMinimalOptions; + } + + /** + * Return price for select custom options + * + * @return float + */ + public function getSelectedOptions() { if (null !== $this->value) { return $this->value; } $this->value = false; - $optionIds = $this->salableItem->getCustomOption('option_ids'); + $optionIds = $this->product->getCustomOption('option_ids'); if (!$optionIds) { return $this->value; } @@ -82,11 +119,11 @@ protected function processOptions(array $values) { $value = 0.; foreach ($values as $optionId) { - $option = $this->salableItem->getOptionById($optionId); + $option = $this->product->getOptionById($optionId); if (!$option) { continue; } - $confItemOption = $this->salableItem->getCustomOption('option_' . $option->getId()); + $confItemOption = $this->product->getCustomOption('option_' . $option->getId()); $group = $option->groupFactory($option->getType()) ->setOption($option) @@ -107,7 +144,7 @@ public function getOptions() return $this->priceOptions; } $this->priceOptions = []; - $options = $this->salableItem->getOptions(); + $options = $this->product->getOptions(); if ($options) { /** @var $optionItem \Magento\Catalog\Model\Product\Option */ foreach ($options as $optionItem) { @@ -116,7 +153,7 @@ public function getOptions() $price = $optionValue->getPrice($optionValue->getPriceType() == Value::TYPE_PERCENT); $this->priceOptions[$optionValue->getId()][$price] = [ 'base_amount' => $price, - 'adjustment' => $this->getAmount()->getValue() + 'adjustment' => $this->getCustomAmount($price)->getValue() ]; } } diff --git a/app/code/Magento/Catalog/Pricing/Price/CustomOptionPriceInterface.php b/app/code/Magento/Catalog/Pricing/Price/CustomOptionPriceInterface.php index 5e897e8c0a9b6..1619e8a2af9d8 100644 --- a/app/code/Magento/Catalog/Pricing/Price/CustomOptionPriceInterface.php +++ b/app/code/Magento/Catalog/Pricing/Price/CustomOptionPriceInterface.php @@ -28,11 +28,6 @@ */ interface CustomOptionPriceInterface { - /** - * Price model code - */ - const PRICE_TYPE_CUSTOM_OPTION = 'custom_option_price'; - /** * Return calculated options * diff --git a/app/code/Magento/Catalog/Pricing/Price/FinalPrice.php b/app/code/Magento/Catalog/Pricing/Price/FinalPrice.php index 20fd00fbb55d0..0bb6144808d2d 100644 --- a/app/code/Magento/Catalog/Pricing/Price/FinalPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/FinalPrice.php @@ -27,17 +27,18 @@ namespace Magento\Catalog\Pricing\Price; use Magento\Framework\Pricing\Adjustment\CalculatorInterface; -use Magento\Framework\Pricing\Object\SaleableInterface; +use Magento\Catalog\Model\Product; +use Magento\Framework\Pricing\Price\AbstractPrice; /** * Final price model */ -class FinalPrice extends RegularPrice implements FinalPriceInterface +class FinalPrice extends AbstractPrice implements FinalPriceInterface { /** - * @var string + * Price type final */ - protected $priceType = self::PRICE_TYPE_FINAL; + const PRICE_CODE = 'final_price'; /** * @var BasePrice @@ -45,18 +46,17 @@ class FinalPrice extends RegularPrice implements FinalPriceInterface protected $basePrice; /** - * @param SaleableInterface $salableItem + * @param Product $saleableItem * @param float $quantity * @param CalculatorInterface $calculator */ public function __construct( - SaleableInterface $salableItem, + Product $saleableItem, $quantity, CalculatorInterface $calculator ) { - parent::__construct($salableItem, $quantity, $calculator); - $this->basePrice = $this->priceInfo->getPrice(BasePrice::PRICE_TYPE_BASE_PRICE); - $this->baseAmount = $this->getValue(); + parent::__construct($saleableItem, $quantity, $calculator); + $this->basePrice = $this->priceInfo->getPrice(BasePrice::PRICE_CODE); } /** @@ -66,7 +66,7 @@ public function __construct( */ public function getValue() { - return max(0, $this->basePrice->getValue()); // + custom options price + return max(0, $this->basePrice->getValue()); } /** @@ -76,11 +76,11 @@ public function getValue() */ public function getMinimalPrice() { - $minimalPrice = $this->salableItem->getMinimalPrice(); + $minimalPrice = $this->product->getMinimalPrice(); if ($minimalPrice === null) { $minimalPrice = $this->getValue(); } - return $this->calculator->getAmount($minimalPrice, $this->salableItem); + return $this->calculator->getAmount($minimalPrice, $this->product); } /** @@ -90,6 +90,6 @@ public function getMinimalPrice() */ public function getMaximalPrice() { - return $this->calculator->getAmount($this->getValue(), $this->salableItem); + return $this->calculator->getAmount($this->getValue(), $this->product); } } diff --git a/app/code/Magento/Catalog/Pricing/Price/FinalPriceInterface.php b/app/code/Magento/Catalog/Pricing/Price/FinalPriceInterface.php index 03f21043f1ad7..a8ddaa62cf420 100644 --- a/app/code/Magento/Catalog/Pricing/Price/FinalPriceInterface.php +++ b/app/code/Magento/Catalog/Pricing/Price/FinalPriceInterface.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Catalog * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -25,12 +27,21 @@ namespace Magento\Catalog\Pricing\Price; /** - * Final price interface + * Special price interface */ interface FinalPriceInterface { /** - * Price type final + * Get Minimal Price Amount + * + * @return \Magento\Framework\Pricing\Amount\AmountInterface */ - const PRICE_TYPE_FINAL = 'final_price'; + public function getMinimalPrice(); + + /** + * Get Maximal Price Amount + * + * @return \Magento\Framework\Pricing\Amount\AmountInterface + */ + public function getMaximalPrice(); } diff --git a/app/code/Magento/Catalog/Pricing/Price/GroupPrice.php b/app/code/Magento/Catalog/Pricing/Price/GroupPrice.php index c2ccaf17b97ed..80d79213e7198 100644 --- a/app/code/Magento/Catalog/Pricing/Price/GroupPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/GroupPrice.php @@ -27,18 +27,20 @@ namespace Magento\Catalog\Pricing\Price; use Magento\Framework\Pricing\Adjustment\CalculatorInterface; -use Magento\Framework\Pricing\Object\SaleableInterface; +use \Magento\Catalog\Model\Product; use Magento\Customer\Model\Session; +use Magento\Framework\Pricing\Price\AbstractPrice; +use Magento\Framework\Pricing\Price\BasePriceProviderInterface; /** * Group price model */ -class GroupPrice extends RegularPrice implements GroupPriceInterface +class GroupPrice extends AbstractPrice implements GroupPriceInterface, BasePriceProviderInterface { /** - * @var string + * Price type group */ - protected $priceType = self::PRICE_TYPE_GROUP; + const PRICE_CODE = 'group_price'; /** * @var Session @@ -51,18 +53,18 @@ class GroupPrice extends RegularPrice implements GroupPriceInterface protected $storedGroupPrice; /** - * @param SaleableInterface $salableItem + * @param Product $saleableItem * @param float $quantity * @param CalculatorInterface $calculator * @param Session $customerSession */ public function __construct( - SaleableInterface $salableItem, + Product $saleableItem, $quantity, CalculatorInterface $calculator, Session $customerSession ) { - parent::__construct($salableItem, $quantity, $calculator); + parent::__construct($saleableItem, $quantity, $calculator); $this->customerSession = $customerSession; } @@ -89,8 +91,8 @@ public function getValue() */ protected function getCustomerGroupId() { - if ($this->salableItem->getCustomerGroupId()) { - return (int) $this->salableItem->getCustomerGroupId(); + if ($this->product->getCustomerGroupId()) { + return (int) $this->product->getCustomerGroupId(); } return (int) $this->customerSession->getCustomerGroupId(); } @@ -104,13 +106,13 @@ public function getStoredGroupPrice() return $this->storedGroupPrice; } - $this->storedGroupPrice = $this->salableItem->getData('group_price'); + $this->storedGroupPrice = $this->product->getData('group_price'); if (null === $this->storedGroupPrice) { - $attribute = $this->salableItem->getResource()->getAttribute('group_price'); + $attribute = $this->product->getResource()->getAttribute('group_price'); if ($attribute) { - $attribute->getBackend()->afterLoad($this->salableItem); - $this->storedGroupPrice = $this->salableItem->getData('group_price'); + $attribute->getBackend()->afterLoad($this->product); + $this->storedGroupPrice = $this->product->getData('group_price'); } } if (null === $this->storedGroupPrice || !is_array($this->storedGroupPrice)) { diff --git a/app/code/Magento/Catalog/Pricing/Price/GroupPriceInterface.php b/app/code/Magento/Catalog/Pricing/Price/GroupPriceInterface.php index cd20d1637636e..b65d86fa78896 100644 --- a/app/code/Magento/Catalog/Pricing/Price/GroupPriceInterface.php +++ b/app/code/Magento/Catalog/Pricing/Price/GroupPriceInterface.php @@ -31,11 +31,6 @@ */ interface GroupPriceInterface { - /** - * Price type group - */ - const PRICE_TYPE_GROUP = 'group_price'; - /** * @return array */ diff --git a/app/code/Magento/Catalog/Pricing/Price/MsrpPrice.php b/app/code/Magento/Catalog/Pricing/Price/MsrpPrice.php index 6320f472e2ce9..1df96a4b8ff39 100644 --- a/app/code/Magento/Catalog/Pricing/Price/MsrpPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/MsrpPrice.php @@ -28,7 +28,7 @@ use Magento\Catalog\Helper\Data; use Magento\Framework\Pricing\Adjustment\CalculatorInterface; -use Magento\Framework\Pricing\Object\SaleableInterface; +use Magento\Catalog\Model\Product; /** * MSRP price model @@ -36,9 +36,9 @@ class MsrpPrice extends FinalPrice implements MsrpPriceInterface { /** - * @var string + * Price type MSRP */ - protected $priceType = self::PRICE_TYPE_MSRP; + const PRICE_CODE = 'msrp_price'; /** * @var \Magento\Catalog\Helper\Data @@ -46,18 +46,18 @@ class MsrpPrice extends FinalPrice implements MsrpPriceInterface protected $catalogDataHelper; /** - * @param SaleableInterface $salableItem + * @param Product $saleableItem * @param float $quantity * @param CalculatorInterface $calculator * @param Data $catalogDataHelper */ public function __construct( - SaleableInterface $salableItem, + Product $saleableItem, $quantity, CalculatorInterface $calculator, Data $catalogDataHelper ) { - parent::__construct($salableItem, $quantity, $calculator); + parent::__construct($saleableItem, $quantity, $calculator); $this->catalogDataHelper = $catalogDataHelper; } @@ -68,7 +68,7 @@ public function __construct( */ public function isShowPriceOnGesture() { - return $this->catalogDataHelper->isShowPriceOnGesture($this->salableItem); + return $this->catalogDataHelper->isShowPriceOnGesture($this->product); } /** @@ -78,7 +78,7 @@ public function isShowPriceOnGesture() */ public function getMsrpPriceMessage() { - return $this->catalogDataHelper->getMsrpPriceMessage($this->salableItem); + return $this->catalogDataHelper->getMsrpPriceMessage($this->product); } /** @@ -94,11 +94,11 @@ public function isMsrpEnabled() /** * Check if can apply Minimum Advertise price to product * - * @param SaleableInterface $saleableItem + * @param Product $product * @return bool */ - public function canApplyMsrp(SaleableInterface $saleableItem) + public function canApplyMsrp(Product $product) { - return $this->catalogDataHelper->canApplyMsrp($saleableItem); + return $this->catalogDataHelper->canApplyMsrp($product); } } diff --git a/app/code/Magento/Catalog/Pricing/Price/MsrpPriceInterface.php b/app/code/Magento/Catalog/Pricing/Price/MsrpPriceInterface.php index 2dd7e123b9152..145ea09a505c9 100644 --- a/app/code/Magento/Catalog/Pricing/Price/MsrpPriceInterface.php +++ b/app/code/Magento/Catalog/Pricing/Price/MsrpPriceInterface.php @@ -26,18 +26,13 @@ namespace Magento\Catalog\Pricing\Price; -use Magento\Framework\Pricing\Object\SaleableInterface; +use Magento\Catalog\Model\Product; /** * MSRP price interface */ interface MsrpPriceInterface { - /** - * Price type MSRP - */ - const PRICE_TYPE_MSRP = 'msrp_price'; - /** * Check is product need gesture to show price * @@ -62,8 +57,8 @@ public function isMsrpEnabled(); /** * Check if can apply Minimum Advertise price to product in specific visibility * - * @param SaleableInterface $product + * @param Product $saleableItem * @return bool */ - public function canApplyMsrp(SaleableInterface $product); + public function canApplyMsrp(Product $saleableItem); } diff --git a/app/code/Magento/Catalog/Pricing/Price/RegularPrice.php b/app/code/Magento/Catalog/Pricing/Price/RegularPrice.php index 53e702c71fb00..e067dc4fa03a7 100644 --- a/app/code/Magento/Catalog/Pricing/Price/RegularPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/RegularPrice.php @@ -24,72 +24,18 @@ namespace Magento\Catalog\Pricing\Price; -use Magento\Framework\Pricing\Adjustment\CalculatorInterface; -use Magento\Framework\Pricing\Amount\AmountInterface; -use Magento\Framework\Pricing\Price\PriceInterface; -use Magento\Framework\Pricing\PriceInfoInterface; -use Magento\Framework\Pricing\Object\SaleableInterface; +use Magento\Framework\Pricing\Price\AbstractPrice; +use Magento\Framework\Pricing\Price\BasePriceProviderInterface; /** * Class RegularPrice */ -class RegularPrice implements PriceInterface +class RegularPrice extends AbstractPrice implements BasePriceProviderInterface { /** - * Default price type + * Price type */ - const PRICE_TYPE_PRICE_DEFAULT = 'regular_price'; - - /** - * @var string - */ - protected $priceType = self::PRICE_TYPE_PRICE_DEFAULT; - - /** - * @var SaleableInterface|\Magento\Catalog\Model\Product - */ - protected $salableItem; - - /** - * @var PriceInfoInterface - */ - protected $priceInfo; - - /** - * @var float - */ - protected $quantity; - - /** - * @var \Magento\Framework\Pricing\Adjustment\Calculator - */ - protected $calculator; - - /** - * @var bool|float - */ - protected $value; - - /** - * @var AmountInterface - */ - protected $amount; - - /** - * @param SaleableInterface $salableItem - * @param float $quantity - * @param CalculatorInterface $calculator - */ - public function __construct( - SaleableInterface $salableItem, - $quantity, - CalculatorInterface $calculator - ) { - $this->salableItem = $salableItem; - $this->quantity = $quantity; - $this->calculator = $calculator; - $this->priceInfo = $salableItem->getPriceInfo(); - } + const PRICE_CODE = 'regular_price'; /** * Get price value @@ -99,45 +45,9 @@ public function __construct( public function getValue() { if ($this->value === null) { - $price = $this->salableItem->getPrice(); + $price = $this->product->getPrice(); $this->value = $price ? floatval($price) : false; } return $this->value; } - - /** - * Get Price Amount object - * - * @return AmountInterface - */ - public function getAmount() - { - if (null === $this->amount) { - $this->amount = $this->calculator->getAmount($this->getValue(), $this->salableItem); - } - return $this->amount; - } - - /** - * @param float $amount - * @param null|bool|string $exclude - * @return AmountInterface - */ - public function getCustomAmount($amount = null, $exclude = null) - { - if ($amount === null) { - $amount = $this->getValue(); - } - return $this->calculator->getAmount($amount, $this->salableItem, $exclude); - } - - /** - * Get price type code - * - * @return string - */ - public function getPriceType() - { - return $this->priceType; - } } diff --git a/app/code/Magento/Catalog/Pricing/Price/SpecialPrice.php b/app/code/Magento/Catalog/Pricing/Price/SpecialPrice.php index 78070d8fb5166..90434c19ed316 100644 --- a/app/code/Magento/Catalog/Pricing/Price/SpecialPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/SpecialPrice.php @@ -27,18 +27,20 @@ namespace Magento\Catalog\Pricing\Price; use Magento\Framework\Pricing\Adjustment\CalculatorInterface; -use Magento\Framework\Pricing\Object\SaleableInterface; +use Magento\Catalog\Model\Product; +use Magento\Framework\Pricing\Price\AbstractPrice; use Magento\Framework\Stdlib\DateTime\TimezoneInterface; +use Magento\Framework\Pricing\Price\BasePriceProviderInterface; /** * Special price model */ -class SpecialPrice extends RegularPrice implements SpecialPriceInterface +class SpecialPrice extends AbstractPrice implements SpecialPriceInterface, BasePriceProviderInterface { /** - * @var string + * Price type special */ - protected $priceType = self::PRICE_TYPE_SPECIAL; + const PRICE_CODE = 'special_price'; /** * @var TimezoneInterface @@ -46,18 +48,18 @@ class SpecialPrice extends RegularPrice implements SpecialPriceInterface protected $localeDate; /** - * @param SaleableInterface $salableItem + * @param Product $saleableItem * @param float $quantity * @param CalculatorInterface $calculator * @param TimezoneInterface $localeDate */ public function __construct( - SaleableInterface $salableItem, + Product $saleableItem, $quantity, CalculatorInterface $calculator, TimezoneInterface $localeDate ) { - parent::__construct($salableItem, $quantity, $calculator); + parent::__construct($saleableItem, $quantity, $calculator); $this->localeDate = $localeDate; } @@ -84,7 +86,7 @@ public function getValue() */ public function getSpecialPrice() { - return $this->salableItem->getSpecialPrice(); + return $this->product->getSpecialPrice(); } /** @@ -94,7 +96,7 @@ public function getSpecialPrice() */ public function getSpecialFromDate() { - return $this->salableItem->getSpecialFromDate(); + return $this->product->getSpecialFromDate(); } /** @@ -104,7 +106,7 @@ public function getSpecialFromDate() */ public function getSpecialToDate() { - return $this->salableItem->getSpecialToDate(); + return $this->product->getSpecialToDate(); } /** @@ -113,7 +115,7 @@ public function getSpecialToDate() public function isScopeDateInInterval() { return $this->localeDate->isScopeDateInInterval( - $this->salableItem->getStore(), + $this->product->getStore(), $this->getSpecialFromDate(), $this->getSpecialToDate() ); diff --git a/app/code/Magento/Catalog/Pricing/Price/SpecialPriceInterface.php b/app/code/Magento/Catalog/Pricing/Price/SpecialPriceInterface.php index 60a14e73ccd31..fb591fd3e16f3 100644 --- a/app/code/Magento/Catalog/Pricing/Price/SpecialPriceInterface.php +++ b/app/code/Magento/Catalog/Pricing/Price/SpecialPriceInterface.php @@ -31,11 +31,6 @@ */ interface SpecialPriceInterface { - /** - * Price type special - */ - const PRICE_TYPE_SPECIAL = 'special_price'; - /** * Returns special price * diff --git a/app/code/Magento/Catalog/Pricing/Price/TierPrice.php b/app/code/Magento/Catalog/Pricing/Price/TierPrice.php index 597dd4b411097..8a34bf7b83453 100644 --- a/app/code/Magento/Catalog/Pricing/Price/TierPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/TierPrice.php @@ -25,21 +25,23 @@ namespace Magento\Catalog\Pricing\Price; use Magento\Framework\Pricing\Adjustment\CalculatorInterface; -use Magento\Framework\Pricing\Object\SaleableInterface; -use Magento\Customer\Service\V1\CustomerGroupServiceInterface; +use Magento\Catalog\Model\Product; +use Magento\Customer\Model\Group; use Magento\Customer\Model\Session; +use Magento\Framework\Pricing\Price\AbstractPrice; use Magento\Framework\Pricing\PriceInfoInterface; use Magento\Framework\Pricing\Amount\AmountInterface; +use Magento\Framework\Pricing\Price\BasePriceProviderInterface; /** * Tire prices model */ -class TierPrice extends RegularPrice implements TierPriceInterface +class TierPrice extends AbstractPrice implements TierPriceInterface, BasePriceProviderInterface { /** - * @var string + * Price type tier */ - protected $priceType = self::PRICE_TYPE_TIER; + const PRICE_CODE = 'tier_price'; /** * @var Session @@ -73,23 +75,23 @@ class TierPrice extends RegularPrice implements TierPriceInterface protected $filterByBasePrice = true; /** - * @param SaleableInterface $salableItem + * @param Product $saleableItem * @param float $quantity * @param CalculatorInterface $calculator * @param Session $customerSession */ public function __construct( - SaleableInterface $salableItem, + Product $saleableItem, $quantity, CalculatorInterface $calculator, Session $customerSession ) { - parent::__construct($salableItem, $quantity, $calculator); + parent::__construct($saleableItem, $quantity, $calculator); $this->customerSession = $customerSession; - if ($salableItem->hasCustomerGroupId()) { - $this->customerGroup = (int)$salableItem->getCustomerGroupId(); + if ($saleableItem->hasCustomerGroupId()) { + $this->customerGroup = (int) $saleableItem->getCustomerGroupId(); } else { - $this->customerGroup = (int)$this->customerSession->getCustomerGroupId(); + $this->customerGroup = (int) $this->customerSession->getCustomerGroupId(); } } @@ -104,7 +106,7 @@ public function getValue() $prices = $this->getStoredTierPrices(); $prevQty = PriceInfoInterface::PRODUCT_QUANTITY_DEFAULT; $this->value = $prevPrice = $tierPrice = false; - $priceGroup = CustomerGroupServiceInterface::CUST_GROUP_ALL; + $priceGroup = Group::CUST_GROUP_ALL; foreach ($prices as $price) { if (!$this->canApplyTierPrice($price, $priceGroup, $prevQty)) { @@ -172,9 +174,7 @@ protected function filterTierPrices(array $priceList) $qtyCache = []; foreach ($priceList as $priceKey => $price) { /* filter price by customer group */ - if ($price['cust_group'] !== $this->customerGroup - && $price['cust_group'] !== CustomerGroupServiceInterface::CUST_GROUP_ALL - ) { + if ($price['cust_group'] !== $this->customerGroup && $price['cust_group'] !== Group::CUST_GROUP_ALL) { unset($priceList[$priceKey]); continue; } @@ -205,7 +205,7 @@ protected function filterTierPrices(array $priceList) protected function getBasePrice() { /** @var float $productPrice is a minimal available price */ - return $this->priceInfo->getPrice(BasePrice::PRICE_TYPE_BASE_PRICE)->getValue(); + return $this->priceInfo->getPrice(BasePrice::PRICE_CODE)->getValue(); } /** @@ -214,7 +214,10 @@ protected function getBasePrice() */ public function getSavePercent(AmountInterface $amount) { - return ceil(100 - ((100 / $this->getBasePrice()) * $amount->getBaseAmount())); + return ceil( + 100 - ((100 / $this->priceInfo->getPrice(BasePrice::PRICE_CODE)->getAmount()->getBaseAmount()) + * $amount->getBaseAmount()) + ); } /** @@ -223,7 +226,7 @@ public function getSavePercent(AmountInterface $amount) */ protected function applyAdjustment($price) { - return $this->calculator->getAmount($price, $this->salableItem); + return $this->calculator->getAmount($price, $this->product); } /** @@ -239,7 +242,7 @@ protected function canApplyTierPrice(array $currentTierPrice, $prevPriceGroup, $ // Tier price can be applied, if: // tier price is for current customer group or is for all groups if ($currentTierPrice['cust_group'] !== $this->customerGroup - && $currentTierPrice['cust_group'] !== CustomerGroupServiceInterface::CUST_GROUP_ALL + && $currentTierPrice['cust_group'] !== Group::CUST_GROUP_ALL ) { return false; } @@ -253,8 +256,8 @@ protected function canApplyTierPrice(array $currentTierPrice, $prevPriceGroup, $ } // and found tier qty is same as previous tier qty, but current tier group isn't ALL_GROUPS if ($currentTierPrice['price_qty'] == $prevQty - && $prevPriceGroup !== CustomerGroupServiceInterface::CUST_GROUP_ALL - && $currentTierPrice['cust_group'] === CustomerGroupServiceInterface::CUST_GROUP_ALL + && $prevPriceGroup !== Group::CUST_GROUP_ALL + && $currentTierPrice['cust_group'] === Group::CUST_GROUP_ALL ) { return false; } @@ -269,13 +272,13 @@ protected function canApplyTierPrice(array $currentTierPrice, $prevPriceGroup, $ protected function getStoredTierPrices() { if (null === $this->rawPriceList) { - $this->rawPriceList = $this->salableItem->getData(self::PRICE_TYPE_TIER); + $this->rawPriceList = $this->product->getData(self::PRICE_CODE); if (null === $this->rawPriceList || !is_array($this->rawPriceList)) { /** @var \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute */ - $attribute = $this->salableItem->getResource()->getAttribute(self::PRICE_TYPE_TIER); + $attribute = $this->product->getResource()->getAttribute(self::PRICE_CODE); if ($attribute) { - $attribute->getBackend()->afterLoad($this->salableItem); - $this->rawPriceList = $this->salableItem->getData(self::PRICE_TYPE_TIER); + $attribute->getBackend()->afterLoad($this->product); + $this->rawPriceList = $this->product->getData(self::PRICE_CODE); } } if (null === $this->rawPriceList || !is_array($this->rawPriceList)) { diff --git a/app/code/Magento/Catalog/Pricing/Price/TierPriceInterface.php b/app/code/Magento/Catalog/Pricing/Price/TierPriceInterface.php index 5d5bd30c0cecd..184628b9c6b6e 100644 --- a/app/code/Magento/Catalog/Pricing/Price/TierPriceInterface.php +++ b/app/code/Magento/Catalog/Pricing/Price/TierPriceInterface.php @@ -29,11 +29,6 @@ */ interface TierPriceInterface { - /** - * Price type tier - */ - const PRICE_TYPE_TIER = 'tier_price'; - /** * @return array */ diff --git a/app/code/Magento/Catalog/Pricing/Render.php b/app/code/Magento/Catalog/Pricing/Render.php index 47e7fa9c7f51a..65bcef7dcbd8c 100644 --- a/app/code/Magento/Catalog/Pricing/Render.php +++ b/app/code/Magento/Catalog/Pricing/Render.php @@ -26,6 +26,7 @@ namespace Magento\Catalog\Pricing; +use Magento\Catalog\Model\Product; use Magento\Framework\Pricing\Object\SaleableInterface; use Magento\Framework\View\Element\Template; use Magento\Framework\Registry; @@ -73,7 +74,9 @@ protected function _toHtml() if ($priceRender instanceof PricingRender) { $product = $this->getProduct(); if ($product instanceof SaleableInterface) { - return $priceRender->render($this->getPriceTypeCode(), $product, $this->getData()); + $arguments = $this->getData(); + $arguments['render_block'] = $this; + return $priceRender->render($this->getPriceTypeCode(), $product, $arguments); } } return parent::_toHtml(); @@ -82,7 +85,7 @@ protected function _toHtml() /** * Returns saleable item instance * - * @return SaleableInterface + * @return Product */ protected function getProduct() { diff --git a/app/code/Magento/Catalog/Pricing/Render/ConfiguredPriceBox.php b/app/code/Magento/Catalog/Pricing/Render/ConfiguredPriceBox.php new file mode 100644 index 0000000000000..f311d0eb321f5 --- /dev/null +++ b/app/code/Magento/Catalog/Pricing/Render/ConfiguredPriceBox.php @@ -0,0 +1,56 @@ +getPrice(); + /** @var $renderBlock \Magento\Catalog\Pricing\Render */ + $renderBlock = $this->getRenderBlock(); + if ($renderBlock && $renderBlock->getItem() instanceof ItemInterface) { + $price->setItem($renderBlock->getItem()); + } elseif ($renderBlock + && $renderBlock->getParentBlock() + && $renderBlock->getParentBlock()->getItem() instanceof ItemInterface + ) { + $price->setItem($renderBlock->getParentBlock()->getItem()); + } + return parent::_prepareLayout(); + } +} diff --git a/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php b/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php index 4851766e9721c..06d8222b810d9 100644 --- a/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php +++ b/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php @@ -30,7 +30,6 @@ use Magento\Catalog\Pricing\Price\MsrpPrice; use Magento\Framework\Pricing\Render; use Magento\Catalog\Pricing\Price; -use Magento\Catalog\Pricing\Price\MsrpPriceInterface; /** * Class for final_price rendering @@ -59,7 +58,7 @@ protected function _toHtml() if ($msrpPriceType->canApplyMsrp($this->getSaleableItem())) { /** @var BasePriceBox $msrpBlock */ $msrpBlock = $this->rendererPool->createPriceRender( - MsrpPriceInterface::PRICE_TYPE_MSRP, + MsrpPrice::PRICE_CODE, $this->getSaleableItem(), [ 'real_price_html' => $result @@ -89,9 +88,8 @@ protected function wrapResult($html) */ public function renderAmountMinimal() { - //@TODO Implement 'minimal_price' final price is a minimum price - - $price = $this->getPriceType(\Magento\Catalog\Pricing\Price\FinalPriceInterface::PRICE_TYPE_FINAL); + /** @var \Magento\Catalog\Pricing\Price\FinalPrice $price */ + $price = $this->getPriceType(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE); $id = $this->getPriceId() ? $this->getPriceId() : 'product-minimal-price-' . $this->getSaleableItem()->getId(); return $this->renderAmount( $price->getMinimalPrice(), @@ -111,8 +109,8 @@ public function renderAmountMinimal() */ public function hasSpecialPrice() { - $displayRegularPrice = $this->getPriceType(Price\RegularPrice::PRICE_TYPE_PRICE_DEFAULT)->getAmount(); - $displayFinalPrice = $this->getPriceType(Price\FinalPriceInterface::PRICE_TYPE_FINAL)->getAmount(); + $displayRegularPrice = $this->getPriceType(Price\RegularPrice::PRICE_CODE)->getAmount()->getValue(); + $displayFinalPrice = $this->getPriceType(Price\FinalPrice::PRICE_CODE)->getAmount()->getValue(); return $displayFinalPrice < $displayRegularPrice; } @@ -124,7 +122,7 @@ public function hasSpecialPrice() public function showMinimalPrice() { /** @var Price\FinalPrice $finalPrice */ - $finalPrice = $this->getPriceType(Price\FinalPriceInterface::PRICE_TYPE_FINAL); + $finalPrice = $this->getPriceType(Price\FinalPrice::PRICE_CODE); $finalPriceValue = $finalPrice->getAmount()->getValue(); $minimalPriceAValue = $finalPrice->getMinimalPrice()->getValue(); return $this->getDisplayMinimalPrice() diff --git a/app/code/Magento/Catalog/Pricing/Render/PriceBox.php b/app/code/Magento/Catalog/Pricing/Render/PriceBox.php index 113586b5915f9..0a5d2bbedc168 100644 --- a/app/code/Magento/Catalog/Pricing/Render/PriceBox.php +++ b/app/code/Magento/Catalog/Pricing/Render/PriceBox.php @@ -25,7 +25,7 @@ */ namespace Magento\Catalog\Pricing\Render; -use Magento\Framework\Pricing\Object\SaleableInterface; +use Magento\Catalog\Model\Product; use Magento\Framework\Pricing\Price\PriceInterface; use Magento\Framework\Pricing\Render\PriceBox as PriceBoxRender; use Magento\Framework\View\Element\Template\Context; @@ -54,7 +54,7 @@ class PriceBox extends PriceBoxRender /** * @param Context $context - * @param SaleableInterface $saleableItem + * @param Product $saleableItem * @param PriceInterface $price * @param RendererPool $rendererPool * @param Data $coreDataHelper @@ -63,7 +63,7 @@ class PriceBox extends PriceBoxRender */ public function __construct( Context $context, - SaleableInterface $saleableItem, + Product $saleableItem, PriceInterface $price, RendererPool $rendererPool, Data $coreDataHelper, @@ -103,10 +103,10 @@ public function getRandomString($length, $chars = null) /** * Check if quantity can be displayed for tier price with msrp * - * @param SaleableInterface $product + * @param Product $product * @return bool */ - public function getCanDisplayQty(SaleableInterface $product) + public function getCanDisplayQty(Product $product) { //TODO Refactor - change to const similar to Model\Product\Type\Grouped::TYPE_CODE if ($product->getTypeId() == 'grouped') { diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index e56521f410c38..94c82da0d5591 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -320,56 +320,11 @@ - - - - Magento\Framework\Pricing\PriceInfo\Base - - - - - - - - Magento\Catalog\Pricing\Price\RegularPrice - true - - - Magento\Catalog\Pricing\Price\FinalPrice - false - - - Magento\Catalog\Pricing\Price\TierPrice - true - - - Magento\Catalog\Pricing\Price\GroupPrice - true - - - Magento\Catalog\Pricing\Price\SpecialPrice - true - - - Magento\Catalog\Pricing\Price\MsrpPrice - false - - - Magento\Catalog\Pricing\Price\BasePrice - false - - - Magento\Catalog\Pricing\Price\CustomOptionPrice - false - - - - - Magento\Tax\Pricing\Adjustment::CODE - Magento\Weee\Pricing\Adjustment::CODE + Magento\Tax\Pricing\Adjustment::ADJUSTMENT_CODE + Magento\Weee\Pricing\Adjustment::ADJUSTMENT_CODE @@ -386,4 +341,34 @@ + + + + Magento\Catalog\Pricing\Price\RegularPrice + Magento\Catalog\Pricing\Price\FinalPrice + Magento\Catalog\Pricing\Price\TierPrice + Magento\Catalog\Pricing\Price\GroupPrice + Magento\Catalog\Pricing\Price\SpecialPrice + Magento\Catalog\Pricing\Price\MsrpPrice + Magento\Catalog\Pricing\Price\BasePrice + Magento\Catalog\Pricing\Price\CustomOptionPrice + Magento\Catalog\Pricing\Price\ConfiguredPrice + + + + + + Magento\Catalog\Pricing\Price\Pool + + + + + + + Magento\Framework\Pricing\PriceInfo\Base + Magento\Catalog\Pricing\Price\Collection + + + + diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/base-image-uploader.js b/app/code/Magento/Catalog/view/adminhtml/catalog/base-image-uploader.js index d88d163e88118..876da3951dbbf 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/base-image-uploader.js +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/base-image-uploader.js @@ -110,7 +110,7 @@ this.element.find('input[type="file"]').fileupload({ dataType: 'json', - dropZone: $dropPlaceholder, + dropZone: $dropPlaceholder.closest('[data-attribute-code]'), acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, maxFileSize: this.element.data('maxFileSize'), done: function(event, data) { diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/form/renderer/fieldset/element.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/form/renderer/fieldset/element.phtml index 7c3824988d435..2bf89e78c6e72 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/form/renderer/fieldset/element.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/form/renderer/fieldset/element.phtml @@ -57,7 +57,7 @@ $fieldAttributes = $fieldId . ' class="' . $fieldClass . '" ' getType() == 'hidden'): ?> getElementHtml() ?> - data-element-id="getHtmlId() ?>" + data-attribute-code="getHtmlId() ?>" data-apply-to="escapeHtml($this->helper('Magento\Core\Helper\Data')->jsonEncode( $element->hasEntityAttribute() ? $element->getEntityAttribute()->getApplyTo() : array() ))?>" diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit.phtml index 8c5362b9c0ab2..383b85b2ed495 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit.phtml @@ -321,7 +321,7 @@ jQuery(function($) { if (nameDataMapper.apply($elements.get(index)) == elementId) { return true; } - var $elementToMove = $('.fieldset>.field[data-element-id="' + elementId + '"]'); + var $elementToMove = $('.fieldset>.field[data-attribute-code="' + elementId + '"]'); if ($elementToMove.length === 0) { $elementToMove = $element; } diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/action/inventory.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/action/inventory.phtml index aa0568b6f665f..21fa82aab5c6c 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/action/inventory.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/action/inventory.phtml @@ -63,7 +63,7 @@
- + @@ -95,7 +95,7 @@
- + @@ -112,7 +112,7 @@
- + @@ -129,7 +129,7 @@
- + @@ -169,7 +169,7 @@
- + @@ -186,7 +186,7 @@
- + @@ -206,7 +206,7 @@
- + @@ -223,7 +223,7 @@
- + diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/price/group.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/price/group.phtml index 0cf86cd08b695..02fba5cbd59c5 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/price/group.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/price/group.phtml @@ -35,7 +35,7 @@ $_priceValueValidation = $this->getPriceValidation('validate-zero-or-greater'); $_showWebsite= $this->isMultiWebsites(); ?> -
+ + + catalog_product_prices + true + + + diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE_ERROR.xml b/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE_ERROR.xml index dca7f34bc954d..8696cb9923eda 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE_ERROR.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE_ERROR.xml @@ -25,4 +25,11 @@ --> + + + catalog_product_prices + true + + + diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_UPDATE_RESULT.xml b/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_UPDATE_RESULT.xml index 39952aea54f7a..ebc33502e83ea 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_UPDATE_RESULT.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_UPDATE_RESULT.xml @@ -25,4 +25,11 @@ --> + + + catalog_product_prices + true + + + diff --git a/app/code/Magento/Catalog/view/adminhtml/product/edit/tabs.phtml b/app/code/Magento/Catalog/view/adminhtml/product/edit/tabs.phtml index 012fb48cc1047..cd996e043d314 100644 --- a/app/code/Magento/Catalog/view/adminhtml/product/edit/tabs.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/product/edit/tabs.phtml @@ -72,6 +72,7 @@
getUiId('tab', 'content', $_tab->getId()) ?>> getTabContent($_tab); ?> diff --git a/app/code/Magento/Catalog/view/frontend/js/msrp.js b/app/code/Magento/Catalog/view/base/js/msrp.js similarity index 100% rename from app/code/Magento/Catalog/view/frontend/js/msrp.js rename to app/code/Magento/Catalog/view/base/js/msrp.js diff --git a/app/code/Magento/Catalog/view/frontend/js/tier-price.js b/app/code/Magento/Catalog/view/base/js/tier-price.js similarity index 100% rename from app/code/Magento/Catalog/view/frontend/js/tier-price.js rename to app/code/Magento/Catalog/view/base/js/tier-price.js diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_prices.xml b/app/code/Magento/Catalog/view/base/layout/catalog_product_prices.xml similarity index 90% rename from app/code/Magento/Catalog/view/frontend/layout/catalog_product_prices.xml rename to app/code/Magento/Catalog/view/base/layout/catalog_product_prices.xml index e8abbb7082c12..8dda37e87c9ed 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_prices.xml +++ b/app/code/Magento/Catalog/view/base/layout/catalog_product_prices.xml @@ -52,6 +52,10 @@ Magento_Catalog::product/price/amount/option.phtml + + Magento\Catalog\Pricing\Render\ConfiguredPriceBox + Magento_Catalog::product/price/configured_price.phtml + diff --git a/app/design/frontend/Magento/plushe/Magento_Catalog/layout/catalog_category_view.xml b/app/code/Magento/Catalog/view/base/layout/default.xml similarity index 65% rename from app/design/frontend/Magento/plushe/Magento_Catalog/layout/catalog_category_view.xml rename to app/code/Magento/Catalog/view/base/layout/default.xml index ed2bf54c46851..7b8420a104c3d 100644 --- a/app/design/frontend/Magento/plushe/Magento_Catalog/layout/catalog_category_view.xml +++ b/app/code/Magento/Catalog/view/base/layout/default.xml @@ -23,13 +23,13 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - - + + - - positions:list-secondary + catalog_product_prices + true + - + diff --git a/app/code/Magento/Bundle/view/frontend/layout/catalogsearch_result_index.xml b/app/code/Magento/Catalog/view/base/layout/empty.xml similarity index 64% rename from app/code/Magento/Bundle/view/frontend/layout/catalogsearch_result_index.xml rename to app/code/Magento/Catalog/view/base/layout/empty.xml index 403b2e3b52a6c..7b8420a104c3d 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/catalogsearch_result_index.xml +++ b/app/code/Magento/Catalog/view/base/layout/empty.xml @@ -23,12 +23,13 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> - - - - bundle - Magento\Bundle\Block\Catalog\Product\Price - catalog/product/price.phtml - - + + + + catalog_product_prices + true + + + diff --git a/app/code/Magento/Catalog/view/frontend/product/price/amount/default.phtml b/app/code/Magento/Catalog/view/base/product/price/amount/default.phtml similarity index 56% rename from app/code/Magento/Catalog/view/frontend/product/price/amount/default.phtml rename to app/code/Magento/Catalog/view/base/product/price/amount/default.phtml index 78228659433e1..13b3d89bf9edd 100644 --- a/app/code/Magento/Catalog/view/frontend/product/price/amount/default.phtml +++ b/app/code/Magento/Catalog/view/base/product/price/amount/default.phtml @@ -25,23 +25,20 @@ -getDisplayLabel()): ?> - getDisplayLabel(); ?> - - - getPriceDisplayLabel()): ?> - getPriceDisplayLabel(); ?> + + getDisplayLabel()): ?> + getDisplayLabel(); ?> - - convertAndFormatCurrency($this->getDisplayValue(), (bool) $this->getIncludeContainer()) ?> + getPriceDisplayLabel()) ? 'data-label="' . $this->getPriceDisplayLabel() . '"' : '' ?> + class="price-wrapper getPriceWrapperCss();?>"> + + convertAndFormatCurrency($this->getDisplayValue(), (bool) $this->getIncludeContainer()) ?> + + hasAdjustmentsHtml()): ?> + + getAdjustmentsHtml() ?> + + -hasAdjustmentsHtml()): ?> -getZone() == \Magento\Framework\Pricing\Render::ZONE_ITEM_OPTION): ?> - ( - getAdjustmentsHtml() ?> - ) - - getAdjustmentsHtml() ?> - - diff --git a/app/code/Magento/Catalog/view/frontend/product/price/amount/option.phtml b/app/code/Magento/Catalog/view/base/product/price/amount/option.phtml similarity index 100% rename from app/code/Magento/Catalog/view/frontend/product/price/amount/option.phtml rename to app/code/Magento/Catalog/view/base/product/price/amount/option.phtml diff --git a/app/code/Magento/Bundle/view/frontend/catalog/product/view/tierprices.phtml b/app/code/Magento/Catalog/view/base/product/price/configured_price.phtml similarity index 67% rename from app/code/Magento/Bundle/view/frontend/catalog/product/view/tierprices.phtml rename to app/code/Magento/Catalog/view/base/product/price/configured_price.phtml index 04cf6a41f9ca2..78022950022aa 100644 --- a/app/code/Magento/Bundle/view/frontend/catalog/product/view/tierprices.phtml +++ b/app/code/Magento/Catalog/view/base/product/price/configured_price.phtml @@ -18,22 +18,20 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category design + * @package base_default * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> - getProduct(); -$_tierPrices = $this->getTierPrices(); +/** @var \Magento\Catalog\Pricing\Render\FinalPriceBox $this */ +/** @var \Magento\Catalog\Pricing\Price\ConfiguredPrice $configuredPrice */ +$configuredPrice = $this->getPrice(); ?> - 0): ?> -
    - -
  • '.($_price['price']*1).'%') ?>
  • - -
- +

+ renderAmount($configuredPrice->getAmount(), [ + 'display_label' => __('Price as configured:'), + 'include_container' => false + ]); ?> +

diff --git a/app/code/Magento/Catalog/view/frontend/product/price/final_price.phtml b/app/code/Magento/Catalog/view/base/product/price/final_price.phtml similarity index 76% rename from app/code/Magento/Catalog/view/frontend/product/price/final_price.phtml rename to app/code/Magento/Catalog/view/base/product/price/final_price.phtml index 9c99b8f95c462..6658439ac2ab2 100644 --- a/app/code/Magento/Catalog/view/frontend/product/price/final_price.phtml +++ b/app/code/Magento/Catalog/view/base/product/price/final_price.phtml @@ -36,21 +36,9 @@ $priceModel = $this->getPriceType('regular_price'); /** @var \Magento\Catalog\Pricing\Price\FinalPrice $finalPriceModel */ $finalPriceModel = $this->getPriceType('final_price'); ?> -getPriceType('regular_price')->getValue() . "
"; - echo 'Special Price :' . $this->getPriceType('special_price')->getValue(). "
"; - echo 'Group Price :' . $this->getPriceType('group_price')->getValue(). "
"; - echo 'Catalog Rule Price :' . $this->getPriceType('catalog_rule_price')->getValue(). "
"; - echo 'Tier Price :' . $this->getPriceType('tier_price')->getValue(). "
"; - echo 'Base Price :' . $this->getPriceType('base_price')->getValue(). "
"; - echo 'Final Price :' . $this->getPriceType('final_price')->getValue(). "
"; - echo "
"; -} -?> hasSpecialPrice()): ?>

- renderAmount($priceModel->getCustomAmount($priceModel->getValue(), true), [ + renderAmount($priceModel->getAmount(), [ 'display_label' => __('Regular Price:'), 'price_id' => $this->getPriceId('old-price-'), 'include_container' => true, diff --git a/app/code/Magento/Catalog/view/frontend/product/price/msrp_price.phtml b/app/code/Magento/Catalog/view/base/product/price/msrp_price.phtml similarity index 60% rename from app/code/Magento/Catalog/view/frontend/product/price/msrp_price.phtml rename to app/code/Magento/Catalog/view/base/product/price/msrp_price.phtml index 451e896bb4517..b1b449e3f7b27 100644 --- a/app/code/Magento/Catalog/view/frontend/product/price/msrp_price.phtml +++ b/app/code/Magento/Catalog/view/base/product/price/msrp_price.phtml @@ -33,7 +33,7 @@ /** @var Magento\Catalog\Pricing\Price\MsrpPriceInterface $priceType */ $priceType = $this->getPrice(); -/** @var $product \Magento\Catalog\Model\Product|\Magento\Framework\Pricing\Object\SaleableInterface */ +/** @var $product \Magento\Catalog\Model\Product */ $product = $this->getSaleableItem(); $productId = $product->getId(); // @todo: msrp works totally wrong, any excuses not accepted. will be refactored ASAP @@ -60,7 +60,18 @@ if ($product->isSaleable()) { getIdSuffix(); ?> getRandomString(20); ?> - + + getMsrpPriceMessage() ?> @@ -69,37 +80,11 @@ if ($product->isSaleable()) { getZone() == \Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW): ?> getRandomString(20); ?> - - + - - diff --git a/app/code/Magento/Catalog/view/frontend/product/price/tier_prices.phtml b/app/code/Magento/Catalog/view/base/product/price/tier_prices.phtml similarity index 94% rename from app/code/Magento/Catalog/view/frontend/product/price/tier_prices.phtml rename to app/code/Magento/Catalog/view/base/product/price/tier_prices.phtml index 006e993c27c59..a723dbbb185d6 100644 --- a/app/code/Magento/Catalog/view/frontend/product/price/tier_prices.phtml +++ b/app/code/Magento/Catalog/view/base/product/price/tier_prices.phtml @@ -100,11 +100,9 @@ $product = $this->getSaleableItem(); diff --git a/app/code/Magento/Catalog/view/frontend/js/components.phtml b/app/code/Magento/Catalog/view/frontend/js/components.phtml new file mode 100644 index 0000000000000..ecd591e9e5c9a --- /dev/null +++ b/app/code/Magento/Catalog/view/frontend/js/components.phtml @@ -0,0 +1,99 @@ + + +getChildHtml() ?> diff --git a/app/code/Magento/Catalog/view/frontend/js/date-option.js b/app/code/Magento/Catalog/view/frontend/js/date-option.js index c3fb458e52264..9d277ecc7df37 100644 --- a/app/code/Magento/Catalog/view/frontend/js/date-option.js +++ b/app/code/Magento/Catalog/view/frontend/js/date-option.js @@ -25,6 +25,9 @@ /*jshint browser:true jquery:true*/ (function($) { $.widget('mage.dateOption', { + options: { + }, + _create: function() { $(this.options.datepickerFieldSelector) .on('change', $.proxy(function() {this.element.trigger('reloadPrice');}, this)); diff --git a/app/code/Magento/Catalog/view/frontend/js/price-option.js b/app/code/Magento/Catalog/view/frontend/js/price-option.js index edb3cdff4df47..e4b4f65c6d345 100644 --- a/app/code/Magento/Catalog/view/frontend/js/price-option.js +++ b/app/code/Magento/Catalog/view/frontend/js/price-option.js @@ -35,7 +35,6 @@ controlContainer: 'dd' }, _create: function() { - this.element.on('changePrice', $.proxy(function(e, data) { this.changePrice(data.config, data.price); }, this)).on('reloadPrice', $.proxy(function() { @@ -224,8 +223,10 @@ price = price + getOptionPrices[0]; } - - var priceHtml = $.tmpl(this.options.priceTemplate, {'formattedPrice': this._formatCurrency(price, this.options.priceConfig.priceFormat)}); + var priceHtml = $.tmpl( + this.options.priceTemplate, + {'formattedPrice': this._formatCurrency(price, this.options.priceConfig.priceFormat)} + ); priceElement.html(priceHtml[0].outerHTML); // If clone exists, update clone price as well if (!isClone && clone.length === 1) { diff --git a/app/code/Magento/Catalog/view/frontend/layout/MAP_price_msrp_item.xml b/app/code/Magento/Catalog/view/frontend/layout/MAP_price_msrp_item.xml deleted file mode 100644 index e09d8f92c57f4..0000000000000 --- a/app/code/Magento/Catalog/view/frontend/layout/MAP_price_msrp_item.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - msrp - Magento\Catalog\Block\Product\Price - product/price_msrp_item.phtml - - - - - msrp - Magento\Catalog\Block\Product\Price - product/price_msrp_item.phtml - - - diff --git a/app/code/Magento/Catalog/view/frontend/layout/MAP_price_msrp_wishlist_item.xml b/app/code/Magento/Catalog/view/frontend/layout/MAP_price_msrp_wishlist_item.xml deleted file mode 100644 index 5421481925349..0000000000000 --- a/app/code/Magento/Catalog/view/frontend/layout/MAP_price_msrp_wishlist_item.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - msrp - Magento\Catalog\Block\Product\Price - Magento_Wishlist::render/item/price_msrp_item.phtml - - - diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml index 49792c14a2b51..af981d307000f 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml @@ -37,11 +37,6 @@ - - - mage/zoom.js - - mage/gallery.css diff --git a/app/code/Magento/Catalog/view/frontend/layout/default.xml b/app/code/Magento/Catalog/view/frontend/layout/default.xml index a305f92da201c..4cef193beb150 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/default.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/default.xml @@ -30,36 +30,12 @@ - - - - msrp - Magento\Catalog\Block\Product\Price - product/price_msrp.phtml - - - msrp_item - Magento\Catalog\Block\Product\Price - product/price_msrp_item.phtml - - - msrp_noform - Magento\Catalog\Block\Product\Price - product/price_msrp_noform.phtml - - Magento_Catalog::js/product/list/toolbar.js + - - - catalog_product_prices - true - - - diff --git a/app/code/Magento/Catalog/view/frontend/product/compare/list.phtml b/app/code/Magento/Catalog/view/frontend/product/compare/list.phtml index 307c63787cb4f..6809b5f610806 100644 --- a/app/code/Magento/Catalog/view/frontend/product/compare/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/compare/list.phtml @@ -31,7 +31,13 @@ getLayout()->createBlock('Magento\Catalog\Block\Product\Image'); ?>

- +
@@ -143,18 +149,3 @@

- diff --git a/app/code/Magento/Catalog/view/frontend/product/compare/sidebar.phtml b/app/code/Magento/Catalog/view/frontend/product/compare/sidebar.phtml index cd7c44ba16b3f..d1288f0ef9e6f 100644 --- a/app/code/Magento/Catalog/view/frontend/product/compare/sidebar.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/compare/sidebar.phtml @@ -37,7 +37,13 @@ $count = $_helper->getItemCount();
getItemCount() > 0): ?> -
    +
      $_item): ?>
    1. @@ -64,18 +70,6 @@ $count = $_helper->getItemCount();
-

diff --git a/app/code/Magento/Catalog/view/frontend/product/gallery.phtml b/app/code/Magento/Catalog/view/frontend/product/gallery.phtml index 1a0794166ef60..cbbb40e91b4c2 100644 --- a/app/code/Magento/Catalog/view/frontend/product/gallery.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/gallery.phtml @@ -40,7 +40,7 @@ escapeHtml($this->getCurrentImage()->getLabel())): ?>

- width="" alt="escapeHtml($this->getCurrentImage()->getLabel()) ?>" title="escapeHtml($this->getCurrentImage()->getLabel()) ?>" id="product-gallery-image" class="image" /> + width="" alt="escapeHtml($this->getCurrentImage()->getLabel()) ?>" title="escapeHtml($this->getCurrentImage()->getLabel()) ?>" id="product-gallery-image" class="image" data-mage-init='{"catalogGallery":{}}'/>
getPreviousImageUrl() || $this->getNextImageUrl()): ?> - diff --git a/app/code/Magento/Catalog/view/frontend/product/list/items.phtml b/app/code/Magento/Catalog/view/frontend/product/list/items.phtml index 893741ed4f561..f57359ccd9e7a 100644 --- a/app/code/Magento/Catalog/view/frontend/product/list/items.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/list/items.phtml @@ -175,7 +175,11 @@ switch($type = $this->getType()) { -
+ +
+ +
+
@@ -282,21 +286,5 @@ switch($type = $this->getType()) {
- - - - - -
diff --git a/app/code/Magento/Catalog/view/frontend/product/price.phtml b/app/code/Magento/Catalog/view/frontend/product/price.phtml deleted file mode 100644 index bc560c05fbfe3..0000000000000 --- a/app/code/Magento/Catalog/view/frontend/product/price.phtml +++ /dev/null @@ -1,387 +0,0 @@ - - - -helper('Magento\Core\Helper\Data'); - $weeeHelper = $this->helper('Magento\Weee\Helper\Data'); - $priceHelper = $this->helper('Magento\Catalog\Helper\Product\Price'); - /* @var $_coreHelper \Magento\Core\Helper\Data */ - /* @var $weeeHelper \Magento\Weee\Helper\Data */ - /* @var $priceHelper Magento\Catalog\Helper\Product\Price */ - - $_product = $this->getProduct(); - $_storeId = $_product->getStoreId(); - $_id = $_product->getId(); - $_weeeSeparator = ''; - $_simplePricesTax = ($priceHelper->displayPriceIncludingTax() || $priceHelper->displayBothPrices()); - $_minimalPriceValue = $_product->getMinimalPrice(); - $_minimalPrice = $priceHelper->getPrice($_product, $_minimalPriceValue, $_simplePricesTax); -?> -getAmountForDisplay($_product); ?> -typeOfDisplay(array(\Magento\Weee\Model\Tax::DISPLAY_INCL_DESCR, \Magento\Weee\Model\Tax::DISPLAY_EXCL_DESCR_INCL, 4))): ?> - getAmount($_product); ?> - getProductWeeeAttributesForDisplay($_product); ?> - - -isTaxable() && !$priceHelper->priceIncludesTax($_storeId)): ?> - getProductWeeeAttributesForRenderer($_product, null, null, null, true); ?> - getAmountInclTaxes($_attributes); ?> - - -
-getPrice($_product, $_product->getPrice()) ?> -getPrice($_product, $_product->getPrice(), $_simplePricesTax) ?> -getPrice($_product, $_product->getFinalPrice()) ?> -getPrice($_product, $_product->getFinalPrice(), true) ?> -getPriceDisplayType(); ?> -= $_price): ?> - displayBothPrices()): ?> - typeOfDisplay(0)): // including ?> - - - - currency($_price + $_weeeTaxAmount, true, false) ?> - - - - - - currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> - - - typeOfDisplay(1)): // incl. + weee ?> - - - - currency($_price + $_weeeTaxAmount, true, false) ?> - - - - - - currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> - - ( - - - getName(); ?>: currency($_weeeTaxAttribute->getAmount(), true, true); ?> - - - ) - - typeOfDisplay(4)): // incl. + weee ?> - - - - currency($_price + $_weeeTaxAmount, true, false) ?> - - - - - - currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> - - ( - - - getName(); ?>: currency($_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, true); ?> - - - ) - - typeOfDisplay(2)): // excl. + weee + final ?> - - - - currency($_price, true, false) ?> - - - - - getName(); ?>: currency($_weeeTaxAttribute->getAmount(), true, true); ?> - - - - - - currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> - - - - - - - - currency($_price, true, false) ?> - - currency($_finalPrice, true, false) ?> - - - - - - - currency($_finalPriceInclTax, true, false) ?> - - - - - typeOfDisplay(0)): // including ?> - - currency($_price + $_weeeTaxAmount, true, true) ?> - - typeOfDisplay(1)): // incl. + weee ?> - - currency($_price + $_weeeTaxAmount, true, true) ?> - - ( - - - getName(); ?>: currency($_weeeTaxAttribute->getAmount(), true, true); ?> - - - ) - typeOfDisplay(4)): // incl. + weee ?> - - currency($_price + $_weeeTaxAmount, true, true) ?> - - ( - - - getName(); ?>: currency($_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, true); ?> - - - ) - typeOfDisplay(2)): // excl. + weee + final ?> - currency($_price,true,true) ?>
- - - getName(); ?>: currency($_weeeTaxAttribute->getAmount(), true, true); ?> - - - - currency($_price + $_weeeTaxAmount, true, true) ?> - - - - - currency($_price, true, true) ?> - - currency($_finalPrice, true, true) ?> - - - - - - getOriginalAmount($_product); ?> - - typeOfDisplay(0)): // including ?> -

- - - currency($_regularPrice + $_originalWeeeTaxAmount, true, false) ?> - -

- - displayBothPrices()): ?> -

- - - - - currency($_finalPrice + $_weeeTaxAmount, true, false) ?> - - - - - - currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> - - -

- -

- - - currency($_finalPrice + $_weeeTaxAmountInclTaxes, true, false) ?> - -

- - - typeOfDisplay(1)): // incl. + weee ?> -

- - - currency($_regularPrice + $_originalWeeeTaxAmount, true, false) ?> - -

- -

- - - - - currency($_finalPrice + $_weeeTaxAmount, true, false) ?> - - - ( - - - getName(); ?>: currency($_weeeTaxAttribute->getAmount(), true, true); ?> - - - ) - - - - currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> - - -

- typeOfDisplay(4)): // incl. + weee ?> -

- - - currency($_regularPrice + $_originalWeeeTaxAmount, true, false) ?> - -

- -

- - - - - currency($_finalPrice + $_weeeTaxAmount, true, false) ?> - - - ( - - - getName(); ?>: currency($_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, true); ?> - - - ) - - - - currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> - - -

- typeOfDisplay(2)): // excl. + weee + final ?> -

- - - currency($_regularPrice, true, false) ?> - -

- -

- - - - - currency($_finalPrice, true, false) ?> - - - - - getName(); ?>: currency($_weeeTaxAttribute->getAmount(), true, true); ?> - - - - - - currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> - - -

- -

- - - currency($_regularPrice, true, false) ?> - -

- - displayBothPrices()): ?> -

- - - - - currency($_finalPrice, true, false) ?> - - - - - - currency($_finalPriceInclTax, true, false) ?> - - -

- -

- - - currency($_finalPrice, true, false) ?> - -

- - - - -getDisplayMinimalPrice() && $_minimalPriceValue && $_minimalPriceValue < $_product->getFinalPrice()): ?> - - - typeOfDisplay(array(0, 1, 4))): ?> - - - - getUseLinkForAsLowAs()):?> - - - - - - - currency($_minimalPriceDisplayValue, true, false) ?> - - getUseLinkForAsLowAs()):?> - - - - -getDisplayMinimalPrice() && $_minimalPrice && $_minimalPrice < $_finalPrice): */ ?> -
diff --git a/app/code/Magento/Catalog/view/frontend/product/price_msrp.phtml b/app/code/Magento/Catalog/view/frontend/product/price_msrp.phtml index e193d2d65b610..3fa751ee84935 100644 --- a/app/code/Magento/Catalog/view/frontend/product/price_msrp.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/price_msrp.phtml @@ -44,31 +44,18 @@ getId() . $this->getRandomString(20); ?> - + helper('Magento\Catalog\Helper\Data')->isShowPriceOnGesture($_product)): ?> + + + + +
- - diff --git a/app/code/Magento/Catalog/view/frontend/product/price_msrp_item.phtml b/app/code/Magento/Catalog/view/frontend/product/price_msrp_item.phtml index 81201c6eb1268..7772285a4e95d 100644 --- a/app/code/Magento/Catalog/view/frontend/product/price_msrp_item.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/price_msrp_item.phtml @@ -46,51 +46,30 @@ $priceElementIdPrefix = $this->getPriceElementIdPrefix() ? $this->getPriceElemen
helper('Magento\Tax\Helper\Data')->getPrice($_product, $_product->getMsrp()) ?> getMsrp()): ?> - currency($_product->getMsrp(), true, true) ?> - + currency($_product->getMsrp(), true, true) ?> + isShowPriceOnGesture($_product)): ?> - getIdSuffix(); ?> - - getRandomString(20); ?> - - + getIdSuffix(); ?> + + getRandomString(20); ?> + + - + getMsrpPriceMessage($_product) ?> getRandomString(20); ?> - +
- - - - diff --git a/app/code/Magento/Catalog/view/frontend/product/price_msrp_noform.phtml b/app/code/Magento/Catalog/view/frontend/product/price_msrp_noform.phtml index 634d3e2b1191d..75c1a8be6e45e 100644 --- a/app/code/Magento/Catalog/view/frontend/product/price_msrp_noform.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/price_msrp_noform.phtml @@ -45,31 +45,18 @@ getId() . $this->getRandomString(20); ?> - + helper('Magento\Catalog\Helper\Data')->isShowPriceOnGesture($_product)): ?> + + + + + - - diff --git a/app/code/Magento/Catalog/view/frontend/product/view/addto.phtml b/app/code/Magento/Catalog/view/frontend/product/view/addto.phtml index 110b40ffa4208..e761cd0b6f7f6 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/addto.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/addto.phtml @@ -43,9 +43,7 @@ $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); class="action tocompare"> diff --git a/app/code/Magento/Catalog/view/frontend/product/view/addtocart.phtml b/app/code/Magento/Catalog/view/frontend/product/view/addtocart.phtml index 6779f656226c5..562c3ac406f96 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/addtocart.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/addtocart.phtml @@ -60,13 +60,8 @@ diff --git a/app/code/Magento/Catalog/view/frontend/product/view/base-image.phtml b/app/code/Magento/Catalog/view/frontend/product/view/base-image.phtml index e475f2a462f7d..034bee63e17a7 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/base-image.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/base-image.phtml @@ -145,41 +145,33 @@ $thumbHeight = $this->getVar("product_page_more_views:height") ? : $thumbWidth; diff --git a/app/code/Magento/Catalog/view/frontend/product/view/form.phtml b/app/code/Magento/Catalog/view/frontend/product/view/form.phtml index 8dd0b4574eeec..d896dee7059c4 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/form.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/form.phtml @@ -33,8 +33,8 @@ diff --git a/app/code/Magento/Catalog/view/frontend/product/view/options.phtml b/app/code/Magento/Catalog/view/frontend/product/view/options.phtml index 44aae92547119..97dc955cf46e8 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/options.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/options.phtml @@ -28,8 +28,8 @@ -
-
> +
> getProduct() ?> getProductPriceHtml( $_product, - \Magento\Catalog\Pricing\Price\FinalPriceInterface::PRICE_TYPE_FINAL, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, \Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW, [ 'price_id_suffix' => '_clone' diff --git a/app/code/Magento/Catalog/view/frontend/product/view/tierprices.phtml b/app/code/Magento/Catalog/view/frontend/product/view/tierprices.phtml deleted file mode 100644 index b77c6e618f4c9..0000000000000 --- a/app/code/Magento/Catalog/view/frontend/product/view/tierprices.phtml +++ /dev/null @@ -1,228 +0,0 @@ - - -getProduct(); -$_tierPrices = $this->getTierPrices(); -$_finalPriceInclTax = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_product->getFinalPrice(), true); - -/** @var $_catalogHelper \Magento\Catalog\Helper\Data */ -$_catalogHelper = $this->helper('Magento\Catalog\Helper\Data'); - -$_weeeTaxAmount = $this->helper('Magento\Weee\Helper\Data')->getAmountForDisplay($_product); -if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay(array(1, 2, 4))) { - $_weeeTaxAttributes = $this->helper('Magento\Weee\Helper\Data')->getProductWeeeAttributesForDisplay($_product); -} - -?> - 0): ?> -
    - helper('Magento\Weee\Helper\Data')->processTierPrices($_product, $_tierPrices); ?> - $_price): ?> -
  • - canApplyMsrp($_product)): ?> - getShowDetailedPrice() === false): ?> - : - - - - - - helper('Magento\Tax\Helper\Data')->displayBothPrices()): ?> - helper('Magento\Weee\Helper\Data')->typeOfDisplay(0)): ?> - - helper('Magento\Weee\Helper\Data')->typeOfDisplay(1)): ?> - - - ( - - - - getName(); ?>: helper('Magento\Core\Helper\Data')->currency($_attribute->getAmount()); ?> - - ) - - - helper('Magento\Weee\Helper\Data')->typeOfDisplay(4)): ?> - - - ( - - - - getName(); ?>: helper('Magento\Core\Helper\Data')->currency($_attribute->getAmount()+$_attribute->getTaxAmount()); ?> - - ) - - - helper('Magento\Weee\Helper\Data')->typeOfDisplay(2)): ?> - - - ( - - getName(); ?>: helper('Magento\Core\Helper\Data')->currency($_attribute->getAmount()); ?> - - - ) - - - - - - - helper('Magento\Tax\Helper\Data')->displayPriceIncludingTax()): ?> - helper('Magento\Weee\Helper\Data')->typeOfDisplay(0)): ?> - - helper('Magento\Weee\Helper\Data')->typeOfDisplay(1)): ?> - - - ( - - - getName(); ?>: helper('Magento\Core\Helper\Data')->currency($_attribute->getAmount()); ?> - - ) - - - helper('Magento\Weee\Helper\Data')->typeOfDisplay(4)): ?> - - - ( - - - getName(); ?>: helper('Magento\Core\Helper\Data')->currency($_attribute->getAmount()+$_attribute->getTaxAmount()); ?> - - ) - - - helper('Magento\Weee\Helper\Data')->typeOfDisplay(2)): ?> - - - ( - - getName(); ?>: helper('Magento\Core\Helper\Data')->currency($_attribute->getAmount()); ?> - - - ) - - - - - - - helper('Magento\Weee\Helper\Data')->typeOfDisplay(0)): ?> - - helper('Magento\Weee\Helper\Data')->typeOfDisplay(1)): ?> - - - ( - - - getName(); ?>: helper('Magento\Core\Helper\Data')->currency($_attribute->getAmount()); ?> - - ) - - - helper('Magento\Weee\Helper\Data')->typeOfDisplay(4)): ?> - - - ( - - - getName(); ?>: helper('Magento\Core\Helper\Data')->currency($_attribute->getAmount()+$_attribute->getTaxAmount()); ?> - - ) - - - helper('Magento\Weee\Helper\Data')->typeOfDisplay(2)): ?> - - - ( - - getName(); ?>: helper('Magento\Core\Helper\Data')->currency($_attribute->getAmount()); ?> - - - ) - - - - - - - - - - - getShowDetailedPrice() !== false): ?> - getPrice() == $_product->getFinalPrice() && $_product->getPrice() > $_price['price']) - || ($_product->getPrice() != $_product->getFinalPrice() && $_product->getFinalPrice() > $_price['price'])): ?> -   % - - - - isShowPriceOnGesture($_product)):?> - getId() . $this->getRandomString(20); ?> - $this->getProduct()->isSalable() - ? $this->getAddToCartUrl($_product, array('qty' => $_price['price_qty'])) - : '', - 'name' => $_product->getName(), - 'price' => $_price['real_price_html'], - 'msrp' => $this->helper('Magento\Core\Helper\Data')->currency($_product->getMsrp(), true, false), - ]; - if ($this->getCanDisplayQty() !== false) { - $tierPriceData['qty'] = $_price['price_qty']; - } - ?> - - - - getMsrpPriceMessage($_product) ?> - - -
  • - -
- isShowPriceOnGesture($_product)):?> - - - diff --git a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php index c37c0e859afbc..d0a0d1f313ef5 100644 --- a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php +++ b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php @@ -185,7 +185,7 @@ protected function _disableFields() protected function _getJs($quantityFieldId, $inStockFieldId) { // @codingStandardsIgnoreStart - return "\n \n "; + return "\n \n "; // @codingStandardsIgnoreEnd } } diff --git a/app/code/Magento/CatalogRule/Pricing/Price/CatalogRulePrice.php b/app/code/Magento/CatalogRule/Pricing/Price/CatalogRulePrice.php index 5402467cb76b5..c596222347666 100644 --- a/app/code/Magento/CatalogRule/Pricing/Price/CatalogRulePrice.php +++ b/app/code/Magento/CatalogRule/Pricing/Price/CatalogRulePrice.php @@ -26,9 +26,9 @@ namespace Magento\CatalogRule\Pricing\Price; -use Magento\Catalog\Pricing\Price\RegularPrice; +use Magento\Framework\Pricing\Price\AbstractPrice; use Magento\Framework\Pricing\Adjustment\Calculator; -use Magento\Framework\Pricing\Object\SaleableInterface; +use Magento\Catalog\Model\Product; use Magento\Framework\Stdlib\DateTime\TimezoneInterface; use Magento\Store\Model\StoreManager; use Magento\Customer\Model\Session; @@ -37,17 +37,12 @@ /** * Class CatalogRulePrice */ -class CatalogRulePrice extends RegularPrice +class CatalogRulePrice extends AbstractPrice { /** * Price type identifier string */ - const PRICE_TYPE = 'catalog_rule_price'; - - /** - * @var string - */ - protected $priceType = self::PRICE_TYPE; + const PRICE_CODE = 'catalog_rule_price'; /** * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface @@ -70,7 +65,7 @@ class CatalogRulePrice extends RegularPrice protected $resourceRuleFactory; /** - * @param SaleableInterface $salableItem + * @param Product $saleableItem * @param float $quantity * @param Calculator $calculator * @param TimezoneInterface $dateTime @@ -79,7 +74,7 @@ class CatalogRulePrice extends RegularPrice * @param RuleFactory $catalogRuleResourceFactory */ public function __construct( - SaleableInterface $salableItem, + Product $saleableItem, $quantity, Calculator $calculator, TimezoneInterface $dateTime, @@ -87,7 +82,7 @@ public function __construct( Session $customerSession, RuleFactory $catalogRuleResourceFactory ) { - parent::__construct($salableItem, $quantity, $calculator); + parent::__construct($saleableItem, $quantity, $calculator); $this->dateTime = $dateTime; $this->storeManager = $storeManager; $this->customerSession = $customerSession; @@ -107,7 +102,7 @@ public function getValue() $this->dateTime->scopeTimeStamp($this->storeManager->getStore()->getId()), $this->storeManager->getStore()->getWebsiteId(), $this->customerSession->getCustomerGroupId(), - $this->salableItem->getId() + $this->product->getId() ); $this->value = $this->value ? floatval($this->value) : false; } diff --git a/app/code/Magento/CatalogRule/etc/di.xml b/app/code/Magento/CatalogRule/etc/di.xml index 3f2ccf312d11f..8f8e328c3f44a 100644 --- a/app/code/Magento/CatalogRule/etc/di.xml +++ b/app/code/Magento/CatalogRule/etc/di.xml @@ -51,14 +51,13 @@ - + + - - - Magento\CatalogRule\Pricing\Price\CatalogRulePrice - true - + + Magento\CatalogRule\Pricing\Price\CatalogRulePrice - + + diff --git a/app/code/Magento/CatalogSearch/view/frontend/advanced/form.phtml b/app/code/Magento/CatalogSearch/view/frontend/advanced/form.phtml index 723d68d43d725..7e9961976ea84 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/advanced/form.phtml +++ b/app/code/Magento/CatalogSearch/view/frontend/advanced/form.phtml @@ -149,27 +149,20 @@ diff --git a/app/code/Magento/CatalogSearch/view/frontend/form.mini.phtml b/app/code/Magento/CatalogSearch/view/frontend/form.mini.phtml index 105c679460b5e..9079ef2bcdbca 100644 --- a/app/code/Magento/CatalogSearch/view/frontend/form.mini.phtml +++ b/app/code/Magento/CatalogSearch/view/frontend/form.mini.phtml @@ -35,6 +35,11 @@ $helper = $this->helper('Magento\CatalogSearch\Helper\Data');
helper('Magento\CatalogSearch\Helper\Data');
-
diff --git a/app/code/Magento/Checkout/Block/Cart/Crosssell.php b/app/code/Magento/Checkout/Block/Cart/Crosssell.php index 83d47f857f399..e5331dd89e12a 100644 --- a/app/code/Magento/Checkout/Block/Cart/Crosssell.php +++ b/app/code/Magento/Checkout/Block/Cart/Crosssell.php @@ -74,7 +74,8 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Catalog\Model\Product\LinkFactory $productLinkFactory * @param \Magento\Sales\Model\Quote\Item\RelatedProducts $itemRelationsList * @param array $data - * @param array $priceBlockTypes + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Catalog\Block\Product\Context $context, @@ -83,8 +84,7 @@ public function __construct( \Magento\CatalogInventory\Model\Stock $stock, \Magento\Catalog\Model\Product\LinkFactory $productLinkFactory, \Magento\Sales\Model\Quote\Item\RelatedProducts $itemRelationsList, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->_checkoutSession = $checkoutSession; $this->_productVisibility = $productVisibility; @@ -93,8 +93,7 @@ public function __construct( $this->_itemRelationsList = $itemRelationsList; parent::__construct( $context, - $data, - $priceBlockTypes + $data ); $this->_isScopePrivate = true; } diff --git a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php index 176af19625fce..b879de34b9ee3 100644 --- a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php +++ b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php @@ -26,6 +26,7 @@ namespace Magento\Checkout\Block\Cart\Item; use Magento\Sales\Model\Quote\Item; +use Magento\Catalog\Pricing\Price\ConfiguredPriceInterface; /** * Shopping cart item render block @@ -454,23 +455,6 @@ public function getProductAdditionalInformationBlock() return $this->getLayout()->getBlock('additional.product.info'); } - /** - * Get html for MAP product enabled - * - * @param Item $item - * @return string - */ - public function getMsrpHtml($item) - { - return $this->getLayout()->createBlock( - 'Magento\Catalog\Block\Product\Price' - )->setTemplate( - 'product/price_msrp_item.phtml' - )->setProduct( - $item->getProduct() - )->toHtml(); - } - /** * Set qty mode to be strict or not * @@ -507,4 +491,39 @@ public function getIdentities() } return array(); } + + /** + * Get product price formatted with html (final price, special price, mrp price) + * + * @param \Magento\Catalog\Model\Product $product + * @return string + */ + public function getProductPriceHtml(\Magento\Catalog\Model\Product $product) + { + $priceRender = $this->getPriceRender(); + $priceRender->setItem($this->getItem()); + + $price = ''; + if ($priceRender) { + $price = $priceRender->render( + ConfiguredPriceInterface::CONFIGURED_PRICE_CODE, + $product, + [ + 'include_container' => true, + 'display_minimal_price' => true, + 'zone' => \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST + ] + ); + } + + return $price; + } + + /** + * @return \Magento\Framework\Pricing\Render + */ + protected function getPriceRender() + { + return $this->getLayout()->getBlock('product.price.render.default'); + } } diff --git a/app/code/Magento/Checkout/view/frontend/cart/coupon.phtml b/app/code/Magento/Checkout/view/frontend/cart/coupon.phtml index 624011ec06b0c..9142a9bd9328f 100644 --- a/app/code/Magento/Checkout/view/frontend/cart/coupon.phtml +++ b/app/code/Magento/Checkout/view/frontend/cart/coupon.phtml @@ -26,7 +26,13 @@
-
+
@@ -50,21 +56,5 @@
-
diff --git a/app/code/Magento/Checkout/view/frontend/cart/form.phtml b/app/code/Magento/Checkout/view/frontend/cart/form.phtml index 354ce6342594a..20615ea4ab8ca 100644 --- a/app/code/Magento/Checkout/view/frontend/cart/form.phtml +++ b/app/code/Magento/Checkout/view/frontend/cart/form.phtml @@ -27,9 +27,15 @@ helper('Magento\Tax\Helper\Data')->displayCartBothPrices() ? 2 : 1); ?>
getChildHtml('form_before') ?> -
+ getBlockHtml('formkey'); ?> -
+
@@ -66,37 +72,14 @@ - getChildHtml('shopping.cart.table.after'); ?> diff --git a/app/code/Magento/Checkout/view/frontend/cart/item/configure/updatecart.phtml b/app/code/Magento/Checkout/view/frontend/cart/item/configure/updatecart.phtml index 04d39084cbbf1..d52b6765340de 100644 --- a/app/code/Magento/Checkout/view/frontend/cart/item/configure/updatecart.phtml +++ b/app/code/Magento/Checkout/view/frontend/cart/item/configure/updatecart.phtml @@ -45,16 +45,12 @@ diff --git a/app/code/Magento/Checkout/view/frontend/cart/item/default.phtml b/app/code/Magento/Checkout/view/frontend/cart/item/default.phtml index 1139cd4e95307..195c892d7a228 100644 --- a/app/code/Magento/Checkout/view/frontend/cart/item/default.phtml +++ b/app/code/Magento/Checkout/view/frontend/cart/item/default.phtml @@ -82,22 +82,16 @@ $canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_ite getId(); ?> - getProduct(); ?> - + formatPrice($_item->getCalculationPrice()) ?>", + "msrpPrice": "helper('Magento\Core\Helper\Data')->currency($_product->getMsrp(),true,true) ?>", + "showAddToCart": false}}'> + diff --git a/app/code/Magento/Checkout/view/frontend/cart/minicart.phtml b/app/code/Magento/Checkout/view/frontend/cart/minicart.phtml index 52c0f599e4774..de73c20e6d445 100644 --- a/app/code/Magento/Checkout/view/frontend/cart/minicart.phtml +++ b/app/code/Magento/Checkout/view/frontend/cart/minicart.phtml @@ -113,14 +113,12 @@ getInList()): ?> diff --git a/app/code/Magento/Checkout/view/frontend/cart/shipping.phtml b/app/code/Magento/Checkout/view/frontend/cart/shipping.phtml index c55aab2cde491..41d28883d1fc7 100644 --- a/app/code/Magento/Checkout/view/frontend/cart/shipping.phtml +++ b/app/code/Magento/Checkout/view/frontend/cart/shipping.phtml @@ -70,24 +70,18 @@ getEstimateRates())): ?> diff --git a/app/code/Magento/Checkout/view/frontend/js/components.phtml b/app/code/Magento/Checkout/view/frontend/js/components.phtml index 107b5ea704200..9ab2c068b32a2 100644 --- a/app/code/Magento/Checkout/view/frontend/js/components.phtml +++ b/app/code/Magento/Checkout/view/frontend/js/components.phtml @@ -36,8 +36,39 @@ ], dropdownDialog: [ 'getViewFileUrl('mage/dropdown.js') ?>' + ], + addToCart: [ + 'getViewFileUrl('Magento_Catalog::js/msrp.js') ?>' + ], + checkoutBalance: [ + 'getViewFileUrl('Magento_Customer::js/checkout-balance.js')?>' + ], + shoppingCart: [ + 'getViewFileUrl('Magento_Checkout::js/shopping-cart.js') ?>' + ], + regionUpdater: [ + 'getViewFileUrl('Magento_Checkout::js/region-updater.js') ?>' + ], + creditCardType: [ + 'getViewFileUrl('Magento_Payment::cc-type.js') ?>' + ], + opcheckout: [ + 'getViewFileUrl('jquery/jquery.validate.js')?>', + 'getViewFileUrl('jquery/jquery.metadata.js')?>', + 'getViewFileUrl('mage/validation.js')?>', + 'getViewFileUrl('mage/validation/validation.js')?>', + 'getViewFileUrl('Magento_Checkout::js/opcheckout.js') ?>' + ], + accordion: [ + 'getViewFileUrl('Magento_Checkout::js/accordion.js') ?>' + ], + sidebar: [ + 'getViewFileUrl('Magento_Checkout::js/sidebar.js') ?>' + ], + payment: [ + 'getViewFileUrl('Magento_Checkout::js/payment.js') ?>' ] }); })(jQuery); -getChildHtml() ?> \ No newline at end of file +getChildHtml() ?> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml index ad6af5571d9ad..c8c43a8b1222c 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_configure.xml @@ -25,6 +25,9 @@ --> + + + diff --git a/app/code/Magento/Checkout/view/frontend/onepage.phtml b/app/code/Magento/Checkout/view/frontend/onepage.phtml index de7cbe0c5d8c7..65218676f368c 100644 --- a/app/code/Magento/Checkout/view/frontend/onepage.phtml +++ b/app/code/Magento/Checkout/view/frontend/onepage.phtml @@ -43,26 +43,15 @@ $_paymentBlock = $this->getLayout()->getBlock('checkout.onepage.payment'); diff --git a/app/code/Magento/Checkout/view/frontend/onepage/billing.phtml b/app/code/Magento/Checkout/view/frontend/onepage/billing.phtml index d50869f77e0df..e644c024ac2e7 100644 --- a/app/code/Magento/Checkout/view/frontend/onepage/billing.phtml +++ b/app/code/Magento/Checkout/view/frontend/onepage/billing.phtml @@ -207,18 +207,14 @@ diff --git a/app/code/Magento/Checkout/view/frontend/onepage/login.phtml b/app/code/Magento/Checkout/view/frontend/onepage/login.phtml index a1ff77c178d19..5bc276ca4f445 100644 --- a/app/code/Magento/Checkout/view/frontend/onepage/login.phtml +++ b/app/code/Magento/Checkout/view/frontend/onepage/login.phtml @@ -35,7 +35,11 @@ isAllowedGuestCheckout() || $this->helper('Magento\Customer\Helper\Data')->isRegistrationAllowed() ): ?>
@@ -139,16 +131,3 @@
- diff --git a/app/code/Magento/Checkout/view/frontend/onepage/shipping.phtml b/app/code/Magento/Checkout/view/frontend/onepage/shipping.phtml index 9c0fa6fd2be19..a078a53ab9bcc 100644 --- a/app/code/Magento/Checkout/view/frontend/onepage/shipping.phtml +++ b/app/code/Magento/Checkout/view/frontend/onepage/shipping.phtml @@ -129,18 +129,14 @@ diff --git a/app/code/Magento/Cms/data/cms_setup/data-install-1.6.0.0.php b/app/code/Magento/Cms/data/cms_setup/data-install-1.6.0.0.php index 82b65aef5137d..539a5adc9d92b 100644 --- a/app/code/Magento/Cms/data/cms_setup/data-install-1.6.0.0.php +++ b/app/code/Magento/Cms/data/cms_setup/data-install-1.6.0.0.php @@ -63,7 +63,7 @@ 'root_template' => 'two_columns_right', 'identifier' => 'about-magento-demo-store', 'content_heading' => 'About Magento Store', - 'content' => "
\r\n

\"Varien\"

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede.

\r\n

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede. Cras vel libero id lectus rhoncus porta.

\r\n
\r\n

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit.

\r\n

Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui. Nunc risus. Proin scelerisque augue. Nam ullamcorper. Phasellus id massa. Pellentesque nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nunc augue. Aenean sed justo non leo vehicula laoreet. Praesent ipsum libero, auctor ac, tempus nec, tempor nec, justo.

\r\n

Maecenas ullamcorper, odio vel tempus egestas, dui orci faucibus orci, sit amet aliquet lectus dolor et quam. Pellentesque consequat luctus purus. Nunc et risus. Etiam a nibh. Phasellus dignissim metus eget nisi. Vestibulum sapien dolor, aliquet nec, porta ac, malesuada a, libero. Praesent feugiat purus eget est. Nulla facilisi. Vestibulum tincidunt sapien eu velit. Mauris purus. Maecenas eget mauris eu orci accumsan feugiat. Pellentesque eget velit. Nunc tincidunt.

\r\n
\r\n

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede. Cras vel libero id lectus rhoncus porta. Suspendisse convallis felis ac enim. Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui. Nunc risus. Proin scelerisque augue. Nam ullamcorper

\r\n

Maecenas ullamcorper, odio vel tempus egestas, dui orci faucibus orci, sit amet aliquet lectus dolor et quam. Pellentesque consequat luctus purus.

\r\n

Nunc et risus. Etiam a nibh. Phasellus dignissim metus eget nisi.

\r\n
\r\n

To all of you, from all of us at Magento Store - Thank you and Happy eCommerce!

\r\n

John Doe
Some important guy

\r\n
", + 'content' => "
\r\n

\"Varien\"

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede.

\r\n

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede. Cras vel libero id lectus rhoncus porta.

\r\n
\r\n

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit.

\r\n

Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui. Nunc risus. Proin scelerisque augue. Nam ullamcorper. Phasellus id massa. Pellentesque nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nunc augue. Aenean sed justo non leo vehicula laoreet. Praesent ipsum libero, auctor ac, tempus nec, tempor nec, justo.

\r\n

Maecenas ullamcorper, odio vel tempus egestas, dui orci faucibus orci, sit amet aliquet lectus dolor et quam. Pellentesque consequat luctus purus. Nunc et risus. Etiam a nibh. Phasellus dignissim metus eget nisi. Vestibulum sapien dolor, aliquet nec, porta ac, malesuada a, libero. Praesent feugiat purus eget est. Nulla facilisi. Vestibulum tincidunt sapien eu velit. Mauris purus. Maecenas eget mauris eu orci accumsan feugiat. Pellentesque eget velit. Nunc tincidunt.

\r\n
\r\n

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede. Cras vel libero id lectus rhoncus porta. Suspendisse convallis felis ac enim. Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui. Nunc risus. Proin scelerisque augue. Nam ullamcorper

\r\n

Maecenas ullamcorper, odio vel tempus egestas, dui orci faucibus orci, sit amet aliquet lectus dolor et quam. Pellentesque consequat luctus purus.

\r\n

Nunc et risus. Etiam a nibh. Phasellus dignissim metus eget nisi.

\r\n
\r\n

To all of you, from all of us at Magento Store - Thank you and Happy eCommerce!

\r\n

John Doe
Some important guy

\r\n
", 'is_active' => 1, 'stores' => array(0), 'sort_order' => 0 @@ -83,7 +83,7 @@ 'root_template' => 'one_column', 'identifier' => 'enable-cookies', 'content_heading' => 'What are Cookies?', - 'content' => "
\r\n
Please enable cookies in your web browser to continue.
\r\n
\r\n

Cookies are short pieces of data that are sent to your computer when you visit a website. On later visits, this data is then returned to that website. Cookies allow us to recognize you automatically whenever you visit our site so that we can personalize your experience and provide you with better service. We also use cookies (and similar browser data, such as Flash cookies) for fraud prevention and other purposes. If your web browser is set to refuse cookies from our website, you will not be able to complete a purchase or take advantage of certain features of our website, such as storing items in your Shopping Cart or receiving personalized recommendations. As a result, we strongly encourage you to configure your web browser to accept cookies from our website.

\r\n

Enabling Cookies

\r\n \r\n

Internet Explorer 7.x

\r\n
    \r\n
  1. \r\n

    Start Internet Explorer

    \r\n
  2. \r\n
  3. \r\n

    Under the Tools menu, click Internet Options

    \r\n

    \"\"

    \r\n
  4. \r\n
  5. \r\n

    Click the Privacy tab

    \r\n

    \"\"

    \r\n
  6. \r\n
  7. \r\n

    Click the Advanced button

    \r\n

    \"\"

    \r\n
  8. \r\n
  9. \r\n

    Put a check mark in the box for Override Automatic Cookie Handling, put another check mark in the Always accept session cookies box

    \r\n

    \"\"

    \r\n
  10. \r\n
  11. \r\n

    Click OK

    \r\n

    \"\"

    \r\n
  12. \r\n
  13. \r\n

    Click OK

    \r\n

    \"\"

    \r\n
  14. \r\n
  15. \r\n

    Restart Internet Explore

    \r\n
  16. \r\n
\r\n

Back to Top

\r\n

Internet Explorer 6.x

\r\n
    \r\n
  1. \r\n

    Select Internet Options from the Tools menu

    \r\n

    \"\"

    \r\n
  2. \r\n
  3. \r\n

    Click on the Privacy tab

    \r\n
  4. \r\n
  5. \r\n

    Click the Default button (or manually slide the bar down to Medium) under Settings. Click OK

    \r\n

    \"\"

    \r\n
  6. \r\n
\r\n

Back to Top

\r\n

Mozilla/Firefox

\r\n
    \r\n
  1. \r\n

    Click on the Tools-menu in Mozilla

    \r\n
  2. \r\n
  3. \r\n

    Click on the Options... item in the menu - a new window open

    \r\n
  4. \r\n
  5. \r\n

    Click on the Privacy selection in the left part of the window. (See image below)

    \r\n

    \"\"

    \r\n
  6. \r\n
  7. \r\n

    Expand the Cookies section

    \r\n
  8. \r\n
  9. \r\n

    Check the Enable cookies and Accept cookies normally checkboxes

    \r\n
  10. \r\n
  11. \r\n

    Save changes by clicking Ok.

    \r\n
  12. \r\n
\r\n

Back to Top

\r\n

Opera 7.x

\r\n
    \r\n
  1. \r\n

    Click on the Tools menu in Opera

    \r\n
  2. \r\n
  3. \r\n

    Click on the Preferences... item in the menu - a new window open

    \r\n
  4. \r\n
  5. \r\n

    Click on the Privacy selection near the bottom left of the window. (See image below)

    \r\n

    \"\"

    \r\n
  6. \r\n
  7. \r\n

    The Enable cookies checkbox must be checked, and Accept all cookies should be selected in the "Normal cookies" drop-down

    \r\n
  8. \r\n
  9. \r\n

    Save changes by clicking Ok

    \r\n
  10. \r\n
\r\n

Back to Top

\r\n", + 'content' => "
\r\n
Please enable cookies in your web browser to continue.
\r\n
\r\n

Cookies are short pieces of data that are sent to your computer when you visit a website. On later visits, this data is then returned to that website. Cookies allow us to recognize you automatically whenever you visit our site so that we can personalize your experience and provide you with better service. We also use cookies (and similar browser data, such as Flash cookies) for fraud prevention and other purposes. If your web browser is set to refuse cookies from our website, you will not be able to complete a purchase or take advantage of certain features of our website, such as storing items in your Shopping Cart or receiving personalized recommendations. As a result, we strongly encourage you to configure your web browser to accept cookies from our website.

\r\n

Enabling Cookies

\r\n \r\n

Internet Explorer 7.x

\r\n
    \r\n
  1. \r\n

    Start Internet Explorer

    \r\n
  2. \r\n
  3. \r\n

    Under the Tools menu, click Internet Options

    \r\n

    \"\"

    \r\n
  4. \r\n
  5. \r\n

    Click the Privacy tab

    \r\n

    \"\"

    \r\n
  6. \r\n
  7. \r\n

    Click the Advanced button

    \r\n

    \"\"

    \r\n
  8. \r\n
  9. \r\n

    Put a check mark in the box for Override Automatic Cookie Handling, put another check mark in the Always accept session cookies box

    \r\n

    \"\"

    \r\n
  10. \r\n
  11. \r\n

    Click OK

    \r\n

    \"\"

    \r\n
  12. \r\n
  13. \r\n

    Click OK

    \r\n

    \"\"

    \r\n
  14. \r\n
  15. \r\n

    Restart Internet Explore

    \r\n
  16. \r\n
\r\n

Back to Top

\r\n

Internet Explorer 6.x

\r\n
    \r\n
  1. \r\n

    Select Internet Options from the Tools menu

    \r\n

    \"\"

    \r\n
  2. \r\n
  3. \r\n

    Click on the Privacy tab

    \r\n
  4. \r\n
  5. \r\n

    Click the Default button (or manually slide the bar down to Medium) under Settings. Click OK

    \r\n

    \"\"

    \r\n
  6. \r\n
\r\n

Back to Top

\r\n

Mozilla/Firefox

\r\n
    \r\n
  1. \r\n

    Click on the Tools-menu in Mozilla

    \r\n
  2. \r\n
  3. \r\n

    Click on the Options... item in the menu - a new window open

    \r\n
  4. \r\n
  5. \r\n

    Click on the Privacy selection in the left part of the window. (See image below)

    \r\n

    \"\"

    \r\n
  6. \r\n
  7. \r\n

    Expand the Cookies section

    \r\n
  8. \r\n
  9. \r\n

    Check the Enable cookies and Accept cookies normally checkboxes

    \r\n
  10. \r\n
  11. \r\n

    Save changes by clicking Ok.

    \r\n
  12. \r\n
\r\n

Back to Top

\r\n

Opera 7.x

\r\n
    \r\n
  1. \r\n

    Click on the Tools menu in Opera

    \r\n
  2. \r\n
  3. \r\n

    Click on the Preferences... item in the menu - a new window open

    \r\n
  4. \r\n
  5. \r\n

    Click on the Privacy selection near the bottom left of the window. (See image below)

    \r\n

    \"\"

    \r\n
  6. \r\n
  7. \r\n

    The Enable cookies checkbox must be checked, and Accept all cookies should be selected in the "Normal cookies" drop-down

    \r\n
  8. \r\n
  9. \r\n

    Save changes by clicking Ok

    \r\n
  10. \r\n
\r\n

Back to Top

\r\n", 'is_active' => 1, 'stores' => array(0) ) diff --git a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php index 812d9aaf2fbd6..52e90949ac75a 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php @@ -25,90 +25,58 @@ */ namespace Magento\ConfigurableProduct\Block\Product\View\Type; -use Magento\Catalog\Model\Product\PriceModifierInterface; -use Magento\Customer\Controller\RegistryConstants; -use Magento\Customer\Service\V1\CustomerAccountServiceInterface as CustomerAccountService; - /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView { /** - * Prices + * Catalog product * - * @var array + * @var \Magento\Catalog\Helper\Product */ - protected $_prices = array(); + protected $catalogProduct = null; /** - * Prepared prices + * Prices * * @var array */ - protected $_resPrices = array(); - - /** - * Catalog product - * - * @var \Magento\Catalog\Helper\Product - */ - protected $_catalogProduct = null; + protected $_prices = array(); /** * @var \Magento\Framework\Json\EncoderInterface */ - protected $_jsonEncoder; - - /** - * @var \Magento\Catalog\Helper\Product\Price - */ - protected $priceHelper; + protected $jsonEncoder; /** - * @var CustomerAccountService + * @var \Magento\ConfigurableProduct\Helper\Data $imageHelper */ - protected $_customerAccountService; - - /** - * @var \Magento\Catalog\Model\Product\PriceModifierInterface - */ - protected $priceModifier; + protected $helper; /** * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder + * @param \Magento\ConfigurableProduct\Helper\Data $helper * @param \Magento\Catalog\Helper\Product $catalogProduct - * @param \Magento\Catalog\Helper\Product\Price $priceHelper - * @param CustomerAccountService $customerAccountService - * @param \Magento\Catalog\Model\Product\PriceModifierInterface $priceModifier * @param array $data - * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Framework\Stdlib\ArrayUtils $arrayUtils, \Magento\Framework\Json\EncoderInterface $jsonEncoder, + \Magento\ConfigurableProduct\Helper\Data $helper, \Magento\Catalog\Helper\Product $catalogProduct, - \Magento\Catalog\Helper\Product\Price $priceHelper, - CustomerAccountService $customerAccountService, - PriceModifierInterface $priceModifier, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { - $this->_catalogProduct = $catalogProduct; - $this->_jsonEncoder = $jsonEncoder; - $this->priceHelper = $priceHelper; - $this->priceModifier = $priceModifier; - $this->_customerAccountService = $customerAccountService; + $this->helper = $helper; + $this->jsonEncoder = $jsonEncoder; + $this->catalogProduct = $catalogProduct; parent::__construct( $context, $arrayUtils, - $data, - $priceBlockTypes + $data ); } @@ -150,7 +118,7 @@ public function getAllowProducts() { if (!$this->hasAllowProducts()) { $products = array(); - $skipSaleableCheck = $this->_catalogProduct->getSkipSaleableCheck(); + $skipSaleableCheck = $this->catalogProduct->getSkipSaleableCheck(); $allProducts = $this->getProduct()->getTypeInstance()->getUsedProducts($this->getProduct(), null); foreach ($allProducts as $product) { if ($product->isSaleable() || $skipSaleableCheck) { @@ -186,230 +154,39 @@ protected function _getAdditionalConfig() * Composes configuration for js * * @return string - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function getJsonConfig() { - $attributes = array(); - $options = array(); $store = $this->getCurrentStore(); - $taxHelper = $this->_taxData; $currentProduct = $this->getProduct(); - $baseImageUrl = (string)$this->_imageHelper->init($currentProduct, 'image'); - $preConfiguredValues = null; - - $preConfiguredFlag = $currentProduct->hasPreconfiguredValues(); - if ($preConfiguredFlag) { - $preConfiguredValues = $currentProduct->getPreconfiguredValues(); - $defaultValues = array(); - } - - foreach ($this->getAllowProducts() as $product) { - $productId = $product->getId(); - $this->_imageHelper->init($product, 'image'); - - foreach ($this->getAllowAttributes() as $attribute) { - $productAttribute = $attribute->getProductAttribute(); - $productAttributeId = $productAttribute->getId(); - $attributeValue = $product->getData($productAttribute->getAttributeCode()); - if (!isset($options[$productAttributeId])) { - $options[$productAttributeId] = array(); - } - - if (!isset($options[$productAttributeId][$attributeValue])) { - $options[$productAttributeId][$attributeValue] = array(); - } - $options[$productAttributeId][$attributeValue][] = $productId; - - if (!$product->getImage() || $product->getImage() === 'no_selection') { - $options['images'][$productAttributeId][$attributeValue][$productId] = $baseImageUrl; - } else { - $options['images'][$productAttributeId][$attributeValue][$productId] = (string)$this->_imageHelper; - } - } - } - - $this->_resPrices = array($this->_preparePrice($currentProduct->getFinalPrice())); - - foreach ($this->getAllowAttributes() as $attribute) { - $productAttribute = $attribute->getProductAttribute(); - $attributeId = $productAttribute->getId(); - $info = array( - 'id' => $productAttribute->getId(), - 'code' => $productAttribute->getAttributeCode(), - 'label' => $attribute->getLabel(), - 'options' => array() - ); - - $optionPrices = array(); - $prices = $attribute->getPrices(); - if (is_array($prices)) { - foreach ($prices as $value) { - if (!$this->_validateAttributeValue($attributeId, $value, $options)) { - continue; - } - $currentProduct->setConfigurablePrice( - $this->_preparePrice($value['pricing_value'], $value['is_percent']) - ); - $currentProduct->setParentId(true); - $currentProduct->setConfigurablePrice( - $this->priceModifier->modifyPrice($currentProduct->getConfigurablePrice(), $currentProduct) - ); - $configurablePrice = $currentProduct->getConfigurablePrice(); - - if (isset($options[$attributeId][$value['value_index']])) { - $productsIndex = $options[$attributeId][$value['value_index']]; - } else { - $productsIndex = array(); - } - - // @todo resolve issue with weee specifics - $info['options'][] = array( - 'id' => $value['value_index'], - 'label' => $value['label'], - 'price' => $configurablePrice, - 'oldPrice' => $this->_prepareOldPrice($value['pricing_value'], $value['is_percent']), - 'inclTaxPrice' => $currentProduct - ->getPriceInfo() - ->getPrice('final_price') - ->getCustomAmount($configurablePrice, 'weee') - ->getValue(), - 'exclTaxPrice' => $configurablePrice, - 'products' => $productsIndex - ); - $optionPrices[] = $configurablePrice; - } - } - - /** - * Prepare formatted values for options choose - */ - foreach ($optionPrices as $optionPrice) { - foreach ($optionPrices as $additional) { - $this->_preparePrice(abs($additional - $optionPrice)); - } - } - if ($this->_validateAttributeInfo($info)) { - $attributes[$attributeId] = $info; - } - - // Add attribute default value (if set) - if ($preConfiguredFlag) { - $configValue = $preConfiguredValues->getData('super_attribute/' . $attributeId); - if ($configValue) { - $defaultValues[$attributeId] = $configValue; - } - } - } - - - if (is_null($this->priceHelper->getCustomer()->getId()) - && $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID) - ) { - $customerId = $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); - $this->priceHelper->setCustomer($this->_customerAccountService->getCustomer($customerId)); - } - - $_request = $this->priceHelper->getRateRequest(false, false, false); - $_request->setProductClassId($currentProduct->getTaxClassId()); - $defaultTax = $this->priceHelper->getRate($_request); - - $_request = $this->priceHelper->getRateRequest(); - $_request->setProductClassId($currentProduct->getTaxClassId()); - $currentTax = $this->priceHelper->getRate($_request); - $taxConfig = array( - 'includeTax' => $taxHelper->priceIncludesTax(), - 'showIncludeTax' => $taxHelper->displayPriceIncludingTax(), - 'showBothPrices' => $taxHelper->displayBothPrices(), - 'defaultTax' => $defaultTax, - 'currentTax' => $currentTax, - 'inclTaxTitle' => __('Incl. Tax') - ); + /** + * @var \Magento\ConfigurableProduct\Pricing\Price\AttributePrice $attributePrice + */ + $attributePrice = $currentProduct + ->getPriceInfo() + ->getPrice('attribute_price'); + $options = $this->helper->getOptions($currentProduct, $this->getAllowProducts()); + $attributes = $attributePrice->prepareAttributes($options); $config = array( - 'attributes' => $attributes, + 'attributes' => $attributes['priceOptions'], 'template' => str_replace('%s', '#{price}', $store->getCurrentCurrency()->getOutputFormat()), 'basePrice' => $this->_registerJsPrice($this->_convertPrice($currentProduct->getFinalPrice())), 'oldPrice' => $this->_registerJsPrice($this->_convertPrice($currentProduct->getPrice())), 'productId' => $currentProduct->getId(), 'chooseText' => __('Choose an Option...'), - 'taxConfig' => $taxConfig, + 'taxConfig' => $attributePrice->getTaxConfig(), 'images' => $options['images'] ); - if ($preConfiguredFlag && !empty($defaultValues)) { - $config['defaultValues'] = $defaultValues; + if ($currentProduct->hasPreconfiguredValues() && !empty($attributes['defaultValues'])) { + $config['defaultValues'] = $attributes['defaultValues']; } $config = array_merge($config, $this->_getAdditionalConfig()); - return $this->_jsonEncoder->encode($config); - } - - /** - * Validating of super product option value - * - * @param int $attributeId - * @param array $value - * @param array $options - * @return bool - */ - protected function _validateAttributeValue($attributeId, &$value, &$options) - { - if (isset($options[$attributeId][$value['value_index']])) { - return true; - } - - return false; - } - - /** - * Validation of super product option - * - * @param array $info - * @return bool - */ - protected function _validateAttributeInfo(&$info) - { - if (count($info['options']) > 0) { - return true; - } - return false; - } - - /** - * Calculation real price - * - * @param float $price - * @param bool $isPercent - * @return string - */ - protected function _preparePrice($price, $isPercent = false) - { - if ($isPercent && !empty($price)) { - $price = $this->getProduct()->getFinalPrice() * $price / 100; - } - - return $this->_registerJsPrice($this->_convertPrice($price, true)); - } - - /** - * Calculation price before special price - * - * @param float $price - * @param bool $isPercent - * @return string - */ - protected function _prepareOldPrice($price, $isPercent = false) - { - if ($isPercent && !empty($price)) { - $price = $this->getProduct()->getPrice() * $price / 100; - } - - return $this->_registerJsPrice($this->_convertPrice($price, true)); + return $this->jsonEncoder->encode($config); } /** diff --git a/app/code/Magento/ConfigurableProduct/Helper/Data.php b/app/code/Magento/ConfigurableProduct/Helper/Data.php new file mode 100644 index 0000000000000..27c228e07528b --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Helper/Data.php @@ -0,0 +1,91 @@ +imageHelper = $imageHelper; + } + + /** + * Get Options for Configurable Product Options + * + * @param \Magento\Catalog\Model\Product $currentProduct + * @param array $allowedProducts + * @return array + */ + public function getOptions($currentProduct, $allowedProducts) + { + $options = array(); + $baseImageUrl = (string)$this->imageHelper->init($currentProduct, 'image'); + + foreach ($allowedProducts as $product) { + $productId = $product->getId(); + $image = (string)$this->imageHelper->init($product, 'image'); + + foreach ($this->getAllowAttributes($currentProduct) as $attribute) { + $productAttribute = $attribute->getProductAttribute(); + $productAttributeId = $productAttribute->getId(); + $attributeValue = $product->getData($productAttribute->getAttributeCode()); + + $options[$productAttributeId][$attributeValue][] = $productId; + $options['images'][$productAttributeId][$attributeValue][$productId] = $image ? $image : $baseImageUrl; + } + } + + return $options; + } + + /** + * Get allowed attributes + * + * @param \Magento\Catalog\Model\Product $product + * @return array + */ + public function getAllowAttributes($product) + { + return $product->getTypeInstance()->getConfigurableAttributes($product); + } +} diff --git a/app/code/Magento/ConfigurableProduct/Pricing/Price/AttributePrice.php b/app/code/Magento/ConfigurableProduct/Pricing/Price/AttributePrice.php new file mode 100644 index 0000000000000..aaae58d768433 --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Pricing/Price/AttributePrice.php @@ -0,0 +1,316 @@ +priceModifier = $modifier; + $this->storeManager = $storeManager; + parent::__construct($saleableItem, $quantity, $calculator); + } + + /** + * Prepare JsonAttributes with Options Prices + * + * @param array $options + * @return array + */ + public function prepareAttributes(array $options = []) + { + $defaultValues = []; + $attributes = []; + $configurableAttributes = $this->product->getTypeInstance()->getConfigurableAttributes($this->product); + foreach ($configurableAttributes as $attribute) { + $productAttribute = $attribute->getProductAttribute(); + $attributeId = $productAttribute->getId(); + $info = [ + 'id' => $attributeId, + 'code' => $productAttribute->getAttributeCode(), + 'label' => $attribute->getLabel(), + 'options' => $this->getPriceOptions($attributeId, $attribute, $options) + ]; + $defaultValues[$attributeId] = $this->getAttributeConfigValue($attributeId); + if ($this->validateAttributeInfo($info)) { + $attributes[$attributeId] = $info; + } + } + return [ + 'priceOptions' => $attributes, + 'defaultValues' => $defaultValues + ]; + } + + /** + * Returns prices for configurable product options + * + * @param int $attributeId + * @param Attribute $attribute + * @param array $options + * @return array + */ + public function getPriceOptions($attributeId, $attribute, array $options = []) + { + $prices = $attribute->getPrices(); + $optionPrices = []; + if (!is_array($prices)) { + return $optionPrices; + } + + foreach ($prices as $value) { + $optionValueModified = $this->getOptionValueModified($value); + $optionValueAmount = $this->getOptionValueAmount($value); + + $price = $this->convertPrice($optionValueAmount->getValue()); + $optionPrices[] = [ + 'id' => $value['value_index'], + 'label' => $value['label'], + 'price' => $this->convertDot($optionValueModified->getValue()), + 'oldPrice' => $this->convertDot($price), + 'inclTaxPrice' => $this->convertDot($optionValueModified->getValue()), + 'exclTaxPrice' => $this->convertDot($optionValueModified->getBaseAmount()), + 'products' => $this->getProductsIndex($attributeId, $options, $value) + ]; + } + + return $optionPrices; + } + + /** + * Get Option Value including price rule + * + * @param array $value + * @param string $exclude + * @return AmountInterface + */ + public function getOptionValueModified( + array $value = [], + $exclude = \Magento\Weee\Pricing\Adjustment::ADJUSTMENT_CODE + ) { + $pricingValue = $this->getPricingValue($value); + $this->product->setParentId(true); + $amount = $this->priceModifier->modifyPrice($pricingValue, $this->product); + + return $this->calculator->getAmount(floatval($amount), $this->product, $exclude); + } + + /** + * Get Option Value Amount with no Catalog Rules + * + * @param array $value + * @param string $exclude + * @return AmountInterface + */ + public function getOptionValueAmount( + array $value = [], + $exclude = \Magento\Weee\Pricing\Adjustment::ADJUSTMENT_CODE + ) { + $amount = $this->getPricingValue($value); + + return $this->calculator->getAmount(floatval($amount), $this->product, $exclude); + } + + /** + * Prepare percent price value + * + * @param array $value + * @return float + */ + protected function preparePrice(array $value = []) + { + return $this->product + ->getPriceInfo() + ->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE) + ->getValue() * $value['pricing_value'] / 100; + } + + /** + * Get value from array + * + * @param array $value + * @return float + */ + protected function getPricingValue(array $value = []) + { + if ($value['is_percent'] && !empty($value['pricing_value'])) { + return $this->preparePrice($value); + } else { + return $value['pricing_value']; + } + } + + /** + * Get Products Index + * + * @param int $attributeId + * @param array $options + * @param array $value + * @return array + */ + protected function getProductsIndex($attributeId, array $options = [], array $value = []) + { + if (isset($options[$attributeId][$value['value_index']])) { + return $options[$attributeId][$value['value_index']]; + } else { + return []; + } + } + + /** + * @param int $attributeId + * @return mixed|null + */ + protected function getAttributeConfigValue($attributeId) + { + if ($this->product->hasPreconfiguredValues()) { + return $this->product->getPreconfiguredValues()->getData('super_attribute/' . $attributeId); + } + } + + /** + * Validation of super product option + * + * @param array $info + * @return bool + */ + protected function validateAttributeInfo($info) + { + if (count($info['options']) > 0) { + return true; + } + return false; + } + + /** + * Replace ',' on '.' for js + * + * @param float $price + * @return string + */ + protected function convertDot($price) + { + return str_replace(',', '.', $price); + } + + + /** + * Convert price from default currency to current currency + * + * @param float $price + * @param bool $round + * @return float + */ + protected function convertPrice($price, $round = false) + { + if (empty($price)) { + return 0; + } + + $price = $this->storeManager->getStore()->convertPrice($price); + if ($round) { + $price = $this->storeManager->getStore()->roundPrice($price); + } + + return $price; + } + + /** + * Returns tax config for Configurable options + * + * @return array + */ + public function getTaxConfig() + { + $config = $this->prepareAdjustmentConfig(); + unset($config['product']); + return $config; + } + + /** + * Default values for configurable options + * + * @return array + */ + public function prepareAdjustmentConfig() + { + return [ + 'includeTax' => false, + 'showIncludeTax' => false, + 'showBothPrices' => false, + 'defaultTax' => 0, + 'currentTax' => 0, + 'inclTaxTitle' => __('Incl. Tax'), + 'product' => $this->product + ]; + } + + /** + * Get price value + * + * @return float|bool + */ + public function getValue() + { + // TODO: Implement getValue() method. + } +} diff --git a/app/code/Magento/ConfigurableProduct/Pricing/Price/AttributePriceInterface.php b/app/code/Magento/ConfigurableProduct/Pricing/Price/AttributePriceInterface.php new file mode 100644 index 0000000000000..8834cfe05d0ec --- /dev/null +++ b/app/code/Magento/ConfigurableProduct/Pricing/Price/AttributePriceInterface.php @@ -0,0 +1,47 @@ + + + + + Magento\ConfigurableProduct\Pricing\Price\AttributePrice + + Magento\Catalog\Pricing\Price\Pool + + + + + Magento\ConfigurableProduct\Pricing\Price\Pool + + + + + + + Magento\Framework\Pricing\PriceInfo\Base + Magento\ConfigurableProduct\Pricing\Price\Collection + + + + diff --git a/app/code/Magento/ConfigurableProduct/etc/module.xml b/app/code/Magento/ConfigurableProduct/etc/module.xml index 51b4413c3aa1b..ae53a99001587 100644 --- a/app/code/Magento/ConfigurableProduct/etc/module.xml +++ b/app/code/Magento/ConfigurableProduct/etc/module.xml @@ -47,6 +47,7 @@ + diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/matrix.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/matrix.phtml index 08cf74a8938fa..c387a5bbf575b 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/matrix.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/catalog/product/edit/super/matrix.phtml @@ -270,7 +270,7 @@ jQuery(function ($) { matrix.find('[data-action=upload-image] [name=image]').each(function() { $(this).fileupload({ dataType: 'json', - dropZone: $(this), + dropZone: $(this).closest('[data-role=row]'), acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, done: function (event, data) { if (!data.result) { diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/js/configurable.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/js/configurable.js index 2c076cbf9b6e8..9ddd2af22cc29 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/js/configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/js/configurable.js @@ -204,26 +204,19 @@ Product.Config.prototype = { getOptionLabel: function(option, price){ var price = parseFloat(price); - if (this.taxConfig.includeTax) { - var tax = price / (100 + this.taxConfig.defaultTax) * this.taxConfig.defaultTax; - var excl = price - tax; - var incl = excl*(1+(this.taxConfig.currentTax/100)); - } else { - var tax = price * (this.taxConfig.currentTax / 100); - var excl = price; - var incl = excl + tax; - } + var includeTax = parseFloat(option.inclTaxPrice); + var excludeTax = parseFloat(option.exclTaxPrice); if (this.taxConfig.showIncludeTax || this.taxConfig.showBothPrices) { - price = incl; + price = includeTax; } else { - price = excl; + price = excludeTax; } var str = option.label; if(price){ if (this.taxConfig.showBothPrices) { - str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')'; + str+= ' ' + this.formatPrice(excludeTax, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')'; } else { str+= ' ' + this.formatPrice(price, true); } @@ -273,15 +266,26 @@ Product.Config.prototype = { } var price = 0; var oldPrice = 0; + var inclTaxPrice = 0; + var exclTaxPrice = 0; for(var i=this.settings.length-1;i>=0;i--){ var selected = this.settings[i].options[this.settings[i].selectedIndex]; if(selected.config){ - price += parseFloat(selected.config.price); + price += parseFloat(selected.config.price); oldPrice += parseFloat(selected.config.oldPrice); + inclTaxPrice += parseFloat(selected.config.inclTaxPrice); + exclTaxPrice += parseFloat(selected.config.exclTaxPrice); } } - optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice}); + optionsPrice.changePrice( + 'config', { + 'price': price, + 'oldPrice': oldPrice, + 'inclTaxPrice': inclTaxPrice, + 'exclTaxPrice': exclTaxPrice + } + ); optionsPrice.reload(); return price; diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/product/configurable/stock/disabler.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/product/configurable/stock/disabler.phtml index 57738a3cb0632..e822663a39d34 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/product/configurable/stock/disabler.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/product/configurable/stock/disabler.phtml @@ -24,7 +24,7 @@ ?> +getChildHtml() ?> diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.js b/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.js index 04bec6b59b1ee..9373c759a5a9d 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/frontend/js/configurable.js @@ -238,7 +238,7 @@ }); }); - if (galleryElement.length && galleryElement.data('gallery')) { + if (galleryElement.length) { if (result.length === 1) { this.initialGalleryImages = this.initialGalleryImages || galleryElement.gallery('option', 'images'); galleryElement.gallery('option', 'images', result); @@ -345,21 +345,25 @@ */ _getOptionLabel: function(option, price) { price = parseFloat(price); - var tax, incl, excl; + //todo: use taxes from php config + /* if (this.options.taxConfig.includeTax) { tax = price / (100 + this.options.taxConfig.defaultTax) * this.options.taxConfig.defaultTax; - excl = price - tax; - incl = excl * (1 + (this.options.taxConfig.currentTax / 100)); + excludeTax = price - tax; + includeTax = excl * (1 + (this.options.taxConfig.currentTax / 100)); } else { tax = price * (this.options.taxConfig.currentTax / 100); - excl = price; - incl = excl + tax; + excludeTax = price; + includeTax = excl + tax; } - price = (this.options.taxConfig.showIncludeTax || this.options.taxConfig.showBothPrices) ? incl : excl; + */ + var includeTax = option.inclTaxPrice; + var excludeTax = option.exclTaxPrice; + price = (this.options.taxConfig.showIncludeTax || this.options.taxConfig.showBothPrices) ? includeTax : excludeTax; var str = option.label; if (price) { str = (this.options.taxConfig.showBothPrices) ? - str += ' ' + this._formatPrice(excl, true) + ' (' + this._formatPrice(price, true) + ' ' + this.options.taxConfig.inclTaxTitle + ')' : + str += ' ' + this._formatPrice(excludeTax, true) + ' (' + this._formatPrice(price, true) + ' ' + this.options.taxConfig.inclTaxTitle + ')' : str += ' ' + this._formatPrice(price, true); } return str; diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/layout/catalog_product_view_type_configurable.xml b/app/code/Magento/ConfigurableProduct/view/frontend/layout/catalog_product_view_type_configurable.xml index 992f181eef5c2..1e51e658aae43 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/layout/catalog_product_view_type_configurable.xml +++ b/app/code/Magento/ConfigurableProduct/view/frontend/layout/catalog_product_view_type_configurable.xml @@ -24,6 +24,9 @@ */ --> + + + type-configurable diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/product/view/type/options/configurable.phtml b/app/code/Magento/ConfigurableProduct/view/frontend/product/view/type/options/configurable.phtml index 4ac6e31202c0f..aef2e4f74c370 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/product/view/type/options/configurable.phtml +++ b/app/code/Magento/ConfigurableProduct/view/frontend/product/view/type/options/configurable.phtml @@ -46,10 +46,9 @@ $_attributes = $this->decorateArray($this->getAllowAttributes()); diff --git a/app/code/Magento/Contact/view/frontend/form.phtml b/app/code/Magento/Contact/view/frontend/form.phtml index e9a8e7369a977..3e9dce45fd048 100644 --- a/app/code/Magento/Contact/view/frontend/form.phtml +++ b/app/code/Magento/Contact/view/frontend/form.phtml @@ -23,7 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -
+

@@ -61,13 +66,3 @@
- diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml index c733bf6781dad..fe465164a60a3 100644 --- a/app/code/Magento/Core/etc/di.xml +++ b/app/code/Magento/Core/etc/di.xml @@ -61,7 +61,7 @@ - + diff --git a/app/code/Magento/Core/view/frontend/require_cookie.phtml b/app/code/Magento/Core/view/frontend/require_cookie.phtml index 13c1fec3d8a5f..f6054ddb1bf2d 100644 --- a/app/code/Magento/Core/view/frontend/require_cookie.phtml +++ b/app/code/Magento/Core/view/frontend/require_cookie.phtml @@ -26,9 +26,7 @@ \ No newline at end of file diff --git a/app/code/Magento/Cron/Model/Config/Converter/Db.php b/app/code/Magento/Cron/Model/Config/Converter/Db.php index e754e5b138182..744c5dfb5d336 100644 --- a/app/code/Magento/Cron/Model/Config/Converter/Db.php +++ b/app/code/Magento/Cron/Model/Config/Converter/Db.php @@ -38,7 +38,7 @@ class Db implements \Magento\Framework\Config\ConverterInterface */ public function convert($source) { - $jobs = isset($source['crontab']['jobs']) ? $source['crontab']['jobs'] : array(); + $jobs = isset($source['crontab']['default']['jobs']) ? $source['crontab']['default']['jobs'] : array(); if (empty($jobs)) { return $jobs; diff --git a/app/code/Magento/Cron/Model/Config/Converter/Xml.php b/app/code/Magento/Cron/Model/Config/Converter/Xml.php index b6e17982f7015..d5f3431935cc5 100644 --- a/app/code/Magento/Cron/Model/Config/Converter/Xml.php +++ b/app/code/Magento/Cron/Model/Config/Converter/Xml.php @@ -65,6 +65,7 @@ public function convert($source) $config['name'] = $jobName; $config += $this->convertCronConfig($jobConfig); $config += $this->convertCronSchedule($jobConfig); + $config += $this->convertCronConfigPath($jobConfig); $output[$group->getAttribute('id')][$jobName] = $config; } @@ -116,4 +117,27 @@ protected function convertCronSchedule(\DOMElement $jobConfig) return $result; } + + /** + * Convert schedule cron configurations + * + * @param \DOMElement $jobConfig + * @return array + */ + protected function convertCronConfigPath(\DOMElement $jobConfig) + { + $result = array(); + /** @var \DOMText $schedules */ + foreach ($jobConfig->childNodes as $schedules) { + if ($schedules->nodeName == 'config_path') { + if (!empty($schedules->nodeValue)) { + $result['config_path'] = $schedules->nodeValue; + break; + } + } + continue; + } + + return $result; + } } diff --git a/app/code/Magento/Cron/Model/Observer.php b/app/code/Magento/Cron/Model/Observer.php index 8cf2f860fcd64..dde3e3164a38e 100644 --- a/app/code/Magento/Cron/Model/Observer.php +++ b/app/code/Magento/Cron/Model/Observer.php @@ -321,11 +321,9 @@ protected function _generateJobs($jobs, $exists, $groupId) $jobConfig['config_path'], \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); - } elseif (empty($cronExpr) && isset($jobConfig['schedule'])) { + } elseif (isset($jobConfig['schedule'])) { $cronExpr = $jobConfig['schedule']; - } - - if (!$cronExpr) { + } else { continue; } diff --git a/app/code/Magento/Cron/Model/Schedule.php b/app/code/Magento/Cron/Model/Schedule.php index f2f5068fad4c2..c0cc44aa7dc16 100644 --- a/app/code/Magento/Cron/Model/Schedule.php +++ b/app/code/Magento/Cron/Model/Schedule.php @@ -133,22 +133,11 @@ public function trySchedule($time) $d = getdate($this->_date->timestamp($time)); - $match = $this->matchCronExpression( - $e[0], - $d['minutes'] - ) && $this->matchCronExpression( - $e[1], - $d['hours'] - ) && $this->matchCronExpression( - $e[2], - $d['mday'] - ) && $this->matchCronExpression( - $e[3], - $d['mon'] - ) && $this->matchCronExpression( - $e[4], - $d['wday'] - ); + $match = $this->matchCronExpression($e[0], $d['minutes']) + && $this->matchCronExpression($e[1], $d['hours']) + && $this->matchCronExpression($e[2], $d['mday']) + && $this->matchCronExpression($e[3], $d['mon']) + && $this->matchCronExpression($e[4], $d['wday']); if ($match) { $this->setCreatedAt(strftime('%Y-%m-%d %H:%M:%S', time())); diff --git a/app/code/Magento/Cron/etc/crontab.xsd b/app/code/Magento/Cron/etc/crontab.xsd index b940e9df8090e..3a5aad9f97db2 100644 --- a/app/code/Magento/Cron/etc/crontab.xsd +++ b/app/code/Magento/Cron/etc/crontab.xsd @@ -66,6 +66,7 @@ + diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index.php b/app/code/Magento/Customer/Controller/Adminhtml/Index.php index e3915e946fd69..bb26232ad64fc 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index.php @@ -175,11 +175,11 @@ protected function _initCustomer($idFieldName = 'id') $customer = $this->_objectManager->create('Magento\Customer\Model\Customer'); if ($customerId) { $customer->load($customerId); + $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER_ID, $customerId); } // TODO: Investigate if any piece of code still relies on this; remove if not. $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER, $customer); - $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER_ID, $customerId); return $customerId; } diff --git a/app/code/Magento/Customer/Model/Resource/Group.php b/app/code/Magento/Customer/Model/Resource/Group.php index fa7c1c5085de2..4a7ee20826605 100644 --- a/app/code/Magento/Customer/Model/Resource/Group.php +++ b/app/code/Magento/Customer/Model/Resource/Group.php @@ -111,7 +111,8 @@ protected function _afterDelete(\Magento\Framework\Model\AbstractModel $group) $group->getId() )->load(); foreach ($customerCollection as $customer) { - $customer->load(); + /** @var $customer \Magento\Customer\Model\Customer */ + $customer->load($customer->getId()); $defaultGroupId = $this->_customerData->getDefaultCustomerGroupId($customer->getStoreId()); $customer->setGroupId($defaultGroupId); $customer->save(); diff --git a/app/code/Magento/Customer/view/frontend/address/book.phtml b/app/code/Magento/Customer/view/frontend/address/book.phtml index ef4cf8335b60e..c1b2c3f06a81b 100644 --- a/app/code/Magento/Customer/view/frontend/address/book.phtml +++ b/app/code/Magento/Customer/view/frontend/address/book.phtml @@ -101,12 +101,10 @@ diff --git a/app/code/Magento/Customer/view/frontend/address/edit.phtml b/app/code/Magento/Customer/view/frontend/address/edit.phtml index 04fb8940ef18c..8668046403204 100644 --- a/app/code/Magento/Customer/view/frontend/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/address/edit.phtml @@ -147,23 +147,17 @@ diff --git a/app/code/Magento/Customer/view/frontend/form/confirmation.phtml b/app/code/Magento/Customer/view/frontend/form/confirmation.phtml index 4e7668dc6b04b..e384587d6114d 100644 --- a/app/code/Magento/Customer/view/frontend/form/confirmation.phtml +++ b/app/code/Magento/Customer/view/frontend/form/confirmation.phtml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -
+

- diff --git a/app/code/Magento/Customer/view/frontend/form/edit.phtml b/app/code/Magento/Customer/view/frontend/form/edit.phtml index fcb8d125af6f6..3340b7b59ca16 100755 --- a/app/code/Magento/Customer/view/frontend/form/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/form/edit.phtml @@ -86,46 +86,36 @@ diff --git a/app/code/Magento/Customer/view/frontend/form/forgotpassword.phtml b/app/code/Magento/Customer/view/frontend/form/forgotpassword.phtml index 81c847ef9d7da..6f7af7d6694df 100644 --- a/app/code/Magento/Customer/view/frontend/form/forgotpassword.phtml +++ b/app/code/Magento/Customer/view/frontend/form/forgotpassword.phtml @@ -23,7 +23,11 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -
+

- diff --git a/app/code/Magento/Customer/view/frontend/form/login.phtml b/app/code/Magento/Customer/view/frontend/form/login.phtml index 3034b236060bc..6b366317814f0 100644 --- a/app/code/Magento/Customer/view/frontend/form/login.phtml +++ b/app/code/Magento/Customer/view/frontend/form/login.phtml @@ -36,7 +36,11 @@ diff --git a/app/code/Magento/Customer/view/frontend/form/register.phtml b/app/code/Magento/Customer/view/frontend/form/register.phtml index 1a3510f3447d2..baff908e24bbf 100644 --- a/app/code/Magento/Customer/view/frontend/form/register.phtml +++ b/app/code/Magento/Customer/view/frontend/form/register.phtml @@ -175,53 +175,40 @@ diff --git a/app/code/Magento/Customer/view/frontend/form/resetforgottenpassword.phtml b/app/code/Magento/Customer/view/frontend/form/resetforgottenpassword.phtml index 362f9b39be308..bfb1f4d97083a 100644 --- a/app/code/Magento/Customer/view/frontend/form/resetforgottenpassword.phtml +++ b/app/code/Magento/Customer/view/frontend/form/resetforgottenpassword.phtml @@ -25,7 +25,11 @@ /** @var \Magento\Customer\Block\Account\Resetpassword $this */ ?> -
+
@@ -46,15 +50,3 @@
- diff --git a/app/code/Magento/Customer/view/frontend/js/components.phtml b/app/code/Magento/Customer/view/frontend/js/components.phtml new file mode 100644 index 0000000000000..8e541cf9582f2 --- /dev/null +++ b/app/code/Magento/Customer/view/frontend/js/components.phtml @@ -0,0 +1,56 @@ + + +getChildHtml() ?> diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_create.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_create.xml index 4fc1e65305592..ab02ec14615f2 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_create.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_create.xml @@ -24,6 +24,9 @@ */ --> + + + 1column.phtml diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_edit.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_edit.xml index 03d42c7ed9704..2b438cacc139b 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_edit.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_edit.xml @@ -25,6 +25,9 @@ --> + + + Edit Account Information diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml b/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml index 2bf65f6a45707..376bf9e19baa9 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml @@ -25,6 +25,9 @@ --> + + + true diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_address_index.xml b/app/code/Magento/Customer/view/frontend/layout/customer_address_index.xml index e64f69c8d1352..8630b72b23f70 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_address_index.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_address_index.xml @@ -25,6 +25,9 @@ --> + + + diff --git a/app/code/Magento/Customer/view/frontend/set-password.js b/app/code/Magento/Customer/view/frontend/set-password.js index aebc51c5140be..0605a0fd3084a 100644 --- a/app/code/Magento/Customer/view/frontend/set-password.js +++ b/app/code/Magento/Customer/view/frontend/set-password.js @@ -25,6 +25,9 @@ /*jshint browser:true jquery:true expr:true*/ (function ($) { $.widget('mage.setPassword', { + options: { + }, + _create: function() { this.element.on('change', $.proxy(function(event) { $(event.target).is(':checked') ? this._showPassword() : this._hidePassword(); diff --git a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php index bc059bafa5d91..0a970bef5e506 100644 --- a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php +++ b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php @@ -25,8 +25,10 @@ */ namespace Magento\Downloadable\Block\Catalog\Product; +use Magento\Catalog\Pricing\Price\FinalPrice; +use Magento\Catalog\Pricing\Price\RegularPrice; use Magento\Downloadable\Model\Link; -use Magento\Customer\Controller\RegistryConstants; +use Magento\Downloadable\Pricing\Price\LinkPrice; /** * Downloadable Product Links part block @@ -34,11 +36,6 @@ */ class Links extends \Magento\Catalog\Block\Product\AbstractProduct { - /** - * @var \Magento\Tax\Model\Calculation - */ - protected $calculationModel; - /** * @var \Magento\Framework\Json\EncoderInterface */ @@ -56,30 +53,21 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct /** * @param \Magento\Catalog\Block\Product\Context $context - * @param \Magento\Tax\Model\Calculation $calculationModel - * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $accountService * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, - \Magento\Tax\Model\Calculation $calculationModel, - \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Core\Helper\Data $coreData, \Magento\Customer\Service\V1\CustomerAccountServiceInterface $accountService, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { - $this->calculationModel = $calculationModel; - $this->jsonEncoder = $jsonEncoder; $this->coreData = $coreData; $this->accountService = $accountService; parent::__construct( $context, - $data, - $priceBlockTypes + $data ); $this->_isScopePrivate = true; } @@ -118,48 +106,6 @@ public function getLinks() return $this->getProduct()->getTypeInstance()->getLinks($this->getProduct()); } - /** - * @param Link $link - * @return string - */ - public function getFormattedLinkPrice($link) - { - $price = $link->getPrice(); - $store = $this->getProduct()->getStore(); - - if (0 == $price) { - return ''; - } - - if (!$this->calculationModel->getCustomerData()->getId() - && $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID) - ) { - $customer = $this->accountService - ->getCustomer($this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID)); - $this->calculationModel->setCustomerData($customer); - } - - $taxHelper = $this->_taxData; - $coreHelper = $this->coreData; - $_priceInclTax = $taxHelper->getPrice($link->getProduct(), $price, true); - $_priceExclTax = $taxHelper->getPrice($link->getProduct(), $price); - - $priceStr = '+'; - if ($taxHelper->displayPriceIncludingTax()) { - $priceStr .= $coreHelper->currencyByStore($_priceInclTax, $store); - } elseif ($taxHelper->displayPriceExcludingTax()) { - $priceStr .= $coreHelper->currencyByStore($_priceExclTax, $store); - } elseif ($taxHelper->displayBothPrices()) { - $priceStr .= $coreHelper->currencyByStore($_priceExclTax, $store); - if ($_priceInclTax != $_priceExclTax) { - $priceStr .= ' (+' . $coreHelper->currencyByStore($_priceInclTax, $store) . ' ' . __('Incl. Tax') . ')'; - } - } - $priceStr .= ''; - - return $priceStr; - } - /** * Returns price converted to current currency rate * @@ -177,14 +123,41 @@ public function getCurrencyPrice($price) */ public function getJsonConfig() { - $config = array(); + $priceInfo = $this->getProduct()->getPriceInfo(); + $finalPrice = $priceInfo->getPrice(FinalPrice::PRICE_CODE); + $regularPrice = $priceInfo->getPrice(RegularPrice::PRICE_CODE); + $config = [ + 'price' => $this->coreData->currency( + $finalPrice->getAmount()->getValue(), + false, + false + ), + 'oldPrice' => $this->coreData->currency( + $regularPrice->getValue(), + false, + false + ) + ]; + $config['links'] = $this->getLinksConfig(); - $priceModel = $this->getProduct()->getPriceInfo()->getPrice('final_price'); + return json_encode($config); + } + /** + * Get links price config + * + * @return array + */ + protected function getLinksConfig() + { + $finalPrice = $this->getProduct()->getPriceInfo()->getPrice(FinalPrice::PRICE_CODE); + $linksConfig = []; foreach ($this->getLinks() as $link) { - $amount = $priceModel->getCustomAmount($link->getPrice()); - $config[$link->getId()] = [ - 'price' => $this->coreData->currency($link->getPrice(), false, false), + $amount = $finalPrice->getCustomAmount($link->getPrice()); + $price = $this->coreData->currency($link->getPrice(), false, false); + $linksConfig[$link->getId()] = [ + 'price' => $price, + 'oldPrice' => $price, 'inclTaxPrice' => $this->coreData->currency( $amount->getValue(), false, @@ -197,15 +170,14 @@ public function getJsonConfig() ) ]; } - - return $this->jsonEncoder->encode($config); + return $linksConfig; } /** * @param Link $link * @return string */ - public function getLinkSamlpeUrl($link) + public function getLinkSampleUrl($link) { $store = $this->getProduct()->getStore(); return $store->getUrl('downloadable/download/linkSample', array('link_id' => $link->getId())); @@ -290,6 +262,6 @@ public function getLinkPrice(Link $link) */ protected function getPriceType() { - return $this->getProduct()->getPriceInfo()->getPrice('link_price'); + return $this->getProduct()->getPriceInfo()->getPrice(LinkPrice::PRICE_CODE); } } diff --git a/app/code/Magento/Downloadable/Pricing/Price/LinkPrice.php b/app/code/Magento/Downloadable/Pricing/Price/LinkPrice.php index bc16691f5cf05..1088146f415b9 100644 --- a/app/code/Magento/Downloadable/Pricing/Price/LinkPrice.php +++ b/app/code/Magento/Downloadable/Pricing/Price/LinkPrice.php @@ -35,9 +35,9 @@ class LinkPrice extends RegularPrice implements LinkPriceInterface { /** - * @var string + * Default price type */ - protected $priceType = self::PRICE_TYPE; + const PRICE_CODE = 'link_price'; /** * @param Link $link diff --git a/app/code/Magento/Downloadable/Pricing/Price/LinkPriceInterface.php b/app/code/Magento/Downloadable/Pricing/Price/LinkPriceInterface.php index b86b4b84f39f6..64bed2d36d99d 100644 --- a/app/code/Magento/Downloadable/Pricing/Price/LinkPriceInterface.php +++ b/app/code/Magento/Downloadable/Pricing/Price/LinkPriceInterface.php @@ -24,9 +24,7 @@ namespace Magento\Downloadable\Pricing\Price; -use Magento\Catalog\Pricing\Price\RegularPrice; use Magento\Downloadable\Model\Link; -use Magento\Framework\Pricing\Adjustment\Calculator; /** * Class LinkPrice Model @@ -34,11 +32,6 @@ */ interface LinkPriceInterface { - /** - * Default price type - */ - const PRICE_TYPE = 'link_price'; - /** * @param Link $link * @return \Magento\Framework\Pricing\Amount\AmountInterface diff --git a/app/code/Magento/Downloadable/etc/di.xml b/app/code/Magento/Downloadable/etc/di.xml index dd90b38bdf404..f2a15bf24b2f5 100644 --- a/app/code/Magento/Downloadable/etc/di.xml +++ b/app/code/Magento/Downloadable/etc/di.xml @@ -52,12 +52,25 @@ - + - - - Magento\Downloadable\Pricing\Price\LinkPrice - false + + Magento\Downloadable\Pricing\Price\LinkPrice + + Magento\Catalog\Pricing\Price\Pool + + + + + Magento\Downloadable\Pricing\Price\Pool + + + + + + + Magento\Framework\Pricing\PriceInfo\Base + Magento\Downloadable\Pricing\Price\Collection diff --git a/app/code/Magento/Downloadable/view/adminhtml/product/composite/fieldset/downloadable.phtml b/app/code/Magento/Downloadable/view/adminhtml/product/composite/fieldset/downloadable.phtml index f7a0ebedf56c5..042792f40fdfd 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/product/composite/fieldset/downloadable.phtml +++ b/app/code/Magento/Downloadable/view/adminhtml/product/composite/fieldset/downloadable.phtml @@ -44,7 +44,7 @@
- @@ -168,7 +159,7 @@
- getItemsHasMesssages() || $this->getEntityHasMessage()): ?> checked="checked" class="checkbox" /> + getItemsHasMesssages() || $this->getEntityHasMessage()): ?> checked="checked" class="checkbox" />
@@ -176,7 +167,7 @@
- getEntityHasMessage()): ?> checked="checked" class="checkbox" /> + getEntityHasMessage()): ?> checked="checked" class="checkbox" />
@@ -218,7 +209,7 @@
- getItemsHasMesssages()): ?> checked="checked" class="checkbox" /> + getItemsHasMesssages()): ?> checked="checked" class="checkbox" />
@@ -282,26 +273,10 @@
- diff --git a/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php b/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php index 09db996c44e20..7363505f28dc6 100644 --- a/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php +++ b/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php @@ -64,7 +64,6 @@ class Grouped extends \Magento\GroupedProduct\Block\Product\View\Type\Grouped * @param \Magento\Core\Helper\Data $coreHelper * @param CustomerAccountService $customerAccountService * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, @@ -72,8 +71,7 @@ public function __construct( \Magento\Catalog\Helper\Product\Price $priceHelper, \Magento\Core\Helper\Data $coreHelper, CustomerAccountService $customerAccountService, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->_customerAccountService = $customerAccountService; $this->_coreHelper = $coreHelper; @@ -81,8 +79,7 @@ public function __construct( parent::__construct( $context, $arrayUtils, - $data, - $priceBlockTypes + $data ); } diff --git a/app/code/Magento/GroupedProduct/Block/Product/View/Type/Grouped.php b/app/code/Magento/GroupedProduct/Block/Product/View/Type/Grouped.php index 85ea6f8ac7c42..a7e6ab195189d 100644 --- a/app/code/Magento/GroupedProduct/Block/Product/View/Type/Grouped.php +++ b/app/code/Magento/GroupedProduct/Block/Product/View/Type/Grouped.php @@ -53,30 +53,4 @@ public function setPreconfiguredValue() } return $this; } - - /** - * Returns product tier price block html - * - * @param \Magento\Catalog\Model\Product|null $product - * @return string - */ - public function getTierPriceHtml($product = null) - { - if (is_null($product)) { - $product = $this->getProduct(); - } - return $this->_getPriceBlock( - $product->getTypeId() - )->setTemplate( - $this->getTierPriceTemplate() - )->setProduct( - $product - )->setListClass( - 'tier prices grouped items' - )->setShowDetailedPrice( - false - )->setCanDisplayQty( - false - )->toHtml(); - } } diff --git a/app/code/Magento/GroupedProduct/Pricing/Price/FinalPrice.php b/app/code/Magento/GroupedProduct/Pricing/Price/FinalPrice.php index 3479a8470c3fc..2af33e4fc23a4 100644 --- a/app/code/Magento/GroupedProduct/Pricing/Price/FinalPrice.php +++ b/app/code/Magento/GroupedProduct/Pricing/Price/FinalPrice.php @@ -26,56 +26,25 @@ namespace Magento\GroupedProduct\Pricing\Price; -use Magento\Framework\Pricing\Adjustment\Calculator; -use Magento\Framework\Pricing\Amount\AmountInterface; -use Magento\Framework\Pricing\Object\SaleableInterface; -use Magento\Catalog\Pricing\Price\FinalPriceInterface; -use Magento\Framework\Pricing\Price\PriceInterface; +use Magento\Framework\Pricing\Price\AbstractPrice; +use Magento\Catalog\Model\Product; use Magento\GroupedProduct\Model\Product\Type\Grouped; -use Magento\Catalog\Model\ProductFactory; /** * Final price model */ -class FinalPrice implements FinalPriceInterface, PriceInterface +class FinalPrice extends AbstractPrice { /** - * @var string + * Price type final */ - protected $priceType = self::PRICE_TYPE_FINAL; + const PRICE_CODE = 'final_price'; /** - * @var \Magento\Framework\Pricing\Object\SaleableInterface - */ - protected $salableItem; - - /** - * @var \Magento\Framework\Pricing\Adjustment\Calculator - */ - protected $calculator; - - /** - * @var SaleableInterface + * @var Product */ protected $minProduct; - /** - * @var AmountInterface - */ - protected $amount; - - /** - * @param SaleableInterface $salableItem - * @param Calculator $calculator - */ - public function __construct( - SaleableInterface $salableItem, - Calculator $calculator - ) { - $this->salableItem = $salableItem; - $this->calculator = $calculator; - } - /** * Return minimal product price * @@ -83,48 +52,24 @@ public function __construct( */ public function getValue() { - return $this->getMinProduct()->getPriceInfo() - ->getPrice(\Magento\Catalog\Pricing\Price\FinalPriceInterface::PRICE_TYPE_FINAL)->getValue(); - } - - /** - * Get price type code - * - * @return string - */ - public function getPriceType() - { - return $this->priceType; - } - - /** - * Get Price Amount object - * - * @return AmountInterface - */ - public function getAmount() - { - if (!$this->amount) { - $this->amount = $this->calculator->getAmount($this->getValue(), $this->salableItem); - } - return $this->amount; + return $this->getMinProduct()->getPriceInfo()->getPrice(FinalPrice::PRICE_CODE)->getValue(); } /** * Returns product with minimal price * - * @return SaleableInterface + * @return Product */ public function getMinProduct() { if (null === $this->minProduct) { - $products = $this->salableItem->getTypeInstance()->getAssociatedProducts($this->salableItem); + $products = $this->product->getTypeInstance()->getAssociatedProducts($this->product); $minPrice = null; foreach ($products as $item) { $product = clone $item; $product->setQty(\Magento\Framework\Pricing\PriceInfoInterface::PRODUCT_QUANTITY_DEFAULT); $price = $product->getPriceInfo() - ->getPrice(FinalPriceInterface::PRICE_TYPE_FINAL) + ->getPrice(FinalPrice::PRICE_CODE) ->getValue(); if (($price !== false) && ($price <= (is_null($minPrice) ? $price : $minPrice))) { $this->minProduct = $product; @@ -134,17 +79,4 @@ public function getMinProduct() } return $this->minProduct; } - - /** - * @param float $amount - * @param null|string $exclude - * @return AmountInterface - */ - public function getCustomAmount($amount = null, $exclude = null) - { - if ($amount === null) { - $amount = $this->getValue(); - } - return $this->calculator->getAmount($amount, $this->salableItem, $exclude); - } } diff --git a/app/code/Magento/GroupedProduct/etc/di.xml b/app/code/Magento/GroupedProduct/etc/di.xml index 55da7c620a6f7..fc518ce0a0e36 100644 --- a/app/code/Magento/GroupedProduct/etc/di.xml +++ b/app/code/Magento/GroupedProduct/etc/di.xml @@ -68,12 +68,25 @@ - + - - - Magento\GroupedProduct\Pricing\Price\FinalPrice - false + + Magento\GroupedProduct\Pricing\Price\FinalPrice + + Magento\Catalog\Pricing\Price\Pool + + + + + Magento\GroupedProduct\Pricing\Price\Pool + + + + + + + Magento\Framework\Pricing\PriceInfo\Base + Magento\GroupedProduct\Pricing\Price\Collection diff --git a/app/code/Magento/GroupedProduct/etc/frontend/di.xml b/app/code/Magento/GroupedProduct/etc/frontend/di.xml deleted file mode 100644 index 906dd09062f16..0000000000000 --- a/app/code/Magento/GroupedProduct/etc/frontend/di.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - Magento\Catalog\Block\Product\Price - Magento_GroupedProduct::product/price.phtml - - - - - - - - - Magento\Catalog\Block\Product\Price - Magento_GroupedProduct::product/price.phtml - - - - - diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_grouped.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_grouped.xml index 3d6fd862df613..b28577b44461b 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_grouped.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_grouped.xml @@ -31,6 +31,11 @@ Magento_GroupedProduct::css/grouped-product.css + + + Magento_GroupedProduct::js/grouped-product.js + + diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/product/grouped/grouped.phtml b/app/code/Magento/GroupedProduct/view/adminhtml/product/grouped/grouped.phtml index 8fecdc5018d39..90ad3240b85f3 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/product/grouped/grouped.phtml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/product/grouped/grouped.phtml @@ -32,7 +32,7 @@ $_gridPopupBlock->setRowClickCallback('function(){}'); /** @var $_helper \Magento\Core\Helper\Data */ $_helper = $this->helper('Magento\Core\Helper\Data'); ?> -
+
@@ -41,13 +41,4 @@ $_helper = $this->helper('Magento\Core\Helper\Data'); getChildBlock('catalog.product.group.grid.popup.container')->getChildHtml('grid');?>
-
diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/product/stock/disabler.phtml b/app/code/Magento/GroupedProduct/view/adminhtml/product/stock/disabler.phtml index 19728a542db64..e321e94bfa3a1 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/product/stock/disabler.phtml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/product/stock/disabler.phtml @@ -24,7 +24,7 @@ ?> diff --git a/app/code/Magento/Install/view/install/config.phtml b/app/code/Magento/Install/view/install/config.phtml index fdc41575654ff..064537ced8b05 100644 --- a/app/code/Magento/Install/view/install/config.phtml +++ b/app/code/Magento/Install/view/install/config.phtml @@ -156,13 +156,15 @@ @@ -172,11 +174,11 @@ diff --git a/app/code/Magento/Install/view/install/create_admin.phtml b/app/code/Magento/Install/view/install/create_admin.phtml index 9dd3e615abec3..e2f4f14f56495 100644 --- a/app/code/Magento/Install/view/install/create_admin.phtml +++ b/app/code/Magento/Install/view/install/create_admin.phtml @@ -115,12 +115,14 @@ diff --git a/app/code/Magento/Install/view/install/locale.phtml b/app/code/Magento/Install/view/install/locale.phtml index cc34e2e3a52bb..dcfa4d06023c2 100644 --- a/app/code/Magento/Install/view/install/locale.phtml +++ b/app/code/Magento/Install/view/install/locale.phtml @@ -65,8 +65,8 @@ diff --git a/app/code/Magento/Install/view/install/page.phtml b/app/code/Magento/Install/view/install/page.phtml index bd15bba5a3f9b..09c374cfea4f2 100644 --- a/app/code/Magento/Install/view/install/page.phtml +++ b/app/code/Magento/Install/view/install/page.phtml @@ -41,7 +41,7 @@ - + diff --git a/app/code/Magento/Multishipping/view/frontend/checkout/address/select.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/address/select.phtml index 83429561c3366..99af6b47c4798 100644 --- a/app/code/Magento/Multishipping/view/frontend/checkout/address/select.phtml +++ b/app/code/Magento/Multishipping/view/frontend/checkout/address/select.phtml @@ -50,10 +50,8 @@ diff --git a/app/code/Magento/Multishipping/view/frontend/checkout/addresses.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/addresses.phtml index eb1d010e7314b..1906183f93412 100644 --- a/app/code/Magento/Multishipping/view/frontend/checkout/addresses.phtml +++ b/app/code/Magento/Multishipping/view/frontend/checkout/addresses.phtml @@ -29,7 +29,7 @@ * @var $this \Magento\Multishipping\Block\Checkout\Addresses */ ?> -
+
@@ -80,16 +80,3 @@
- - diff --git a/app/code/Magento/Multishipping/view/frontend/checkout/billing.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/billing.phtml index a84c1ceade927..42d83d4dff676 100644 --- a/app/code/Magento/Multishipping/view/frontend/checkout/billing.phtml +++ b/app/code/Magento/Multishipping/view/frontend/checkout/billing.phtml @@ -74,24 +74,18 @@ diff --git a/app/code/Magento/Multishipping/view/frontend/checkout/overview.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/overview.phtml index 9acb15c2fa0fc..acb1a13009180 100644 --- a/app/code/Magento/Multishipping/view/frontend/checkout/overview.phtml +++ b/app/code/Magento/Multishipping/view/frontend/checkout/overview.phtml @@ -24,7 +24,7 @@ */ ?> -
+
@@ -178,8 +178,3 @@
- diff --git a/app/code/Magento/Multishipping/view/frontend/js/components.phtml b/app/code/Magento/Multishipping/view/frontend/js/components.phtml new file mode 100644 index 0000000000000..a9a5166f891d6 --- /dev/null +++ b/app/code/Magento/Multishipping/view/frontend/js/components.phtml @@ -0,0 +1,40 @@ + + +getChildHtml() ?> diff --git a/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_addresses.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_addresses.xml index d5323e39011d2..2668fbd06c276 100644 --- a/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_addresses.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_addresses.xml @@ -40,4 +40,7 @@
+ + + diff --git a/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_billing.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_billing.xml index fdea8ae6ebcbd..39c04becb1d73 100644 --- a/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_billing.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_billing.xml @@ -36,4 +36,7 @@ + + + diff --git a/app/design/frontend/Magento/plushe/Magento_Catalog/layout/catalog_product_view.xml b/app/code/Magento/Newsletter/view/frontend/js/components.phtml similarity index 64% rename from app/design/frontend/Magento/plushe/Magento_Catalog/layout/catalog_product_view.xml rename to app/code/Magento/Newsletter/view/frontend/js/components.phtml index 964aa4638fab9..2787de961cd63 100644 --- a/app/design/frontend/Magento/plushe/Magento_Catalog/layout/catalog_product_view.xml +++ b/app/code/Magento/Newsletter/view/frontend/js/components.phtml @@ -1,5 +1,4 @@ - - - - - - - +?> + +getChildHtml() ?> \ No newline at end of file diff --git a/app/code/Magento/Newsletter/view/frontend/layout/default.xml b/app/code/Magento/Newsletter/view/frontend/layout/default.xml index ec94be2ae870b..4fd3f76cafda0 100644 --- a/app/code/Magento/Newsletter/view/frontend/layout/default.xml +++ b/app/code/Magento/Newsletter/view/frontend/layout/default.xml @@ -24,6 +24,9 @@ */ --> + + + diff --git a/app/code/Magento/Newsletter/view/frontend/subscribe.phtml b/app/code/Magento/Newsletter/view/frontend/subscribe.phtml index 72e17c096819d..df99b50994ab4 100644 --- a/app/code/Magento/Newsletter/view/frontend/subscribe.phtml +++ b/app/code/Magento/Newsletter/view/frontend/subscribe.phtml @@ -32,6 +32,7 @@
"}}' data-validate="{required:true, 'validate-email':true}"/>
@@ -44,20 +45,3 @@ - - diff --git a/app/code/Magento/OfflinePayments/view/frontend/form/ccsave.phtml b/app/code/Magento/OfflinePayments/view/frontend/form/ccsave.phtml index 5f3abdadc9b4b..cf91b1d931023 100644 --- a/app/code/Magento/OfflinePayments/view/frontend/form/ccsave.phtml +++ b/app/code/Magento/OfflinePayments/view/frontend/form/ccsave.phtml @@ -34,7 +34,9 @@
- getInfoData('cc_type') ?> getCcAvailableTypes() as $_typeCode => $_typeName): ?> @@ -135,13 +137,6 @@
 
- getChildHtml() ?> diff --git a/app/code/Magento/PageCache/view/frontend/javascript.phtml b/app/code/Magento/PageCache/view/frontend/javascript.phtml index dac67a9a75bbf..5b7fb5be0fb6b 100644 --- a/app/code/Magento/PageCache/view/frontend/javascript.phtml +++ b/app/code/Magento/PageCache/view/frontend/javascript.phtml @@ -26,9 +26,7 @@ \ No newline at end of file diff --git a/app/code/Magento/Bundle/view/frontend/layout/catalog_category_view.xml b/app/code/Magento/PageCache/view/frontend/js/components.phtml similarity index 60% rename from app/code/Magento/Bundle/view/frontend/layout/catalog_category_view.xml rename to app/code/Magento/PageCache/view/frontend/js/components.phtml index 83782e0ab43b5..c4d3f46b19343 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/catalog_category_view.xml +++ b/app/code/Magento/PageCache/view/frontend/js/components.phtml @@ -1,5 +1,4 @@ - - - - - - bundle - Magento\Bundle\Block\Catalog\Product\Price - catalog/product/price.phtml - - - +?> + +getChildHtml() ?> diff --git a/app/code/Magento/PageCache/view/frontend/layout/default.xml b/app/code/Magento/PageCache/view/frontend/layout/default.xml index f70f74c36365f..d63532d151f19 100644 --- a/app/code/Magento/PageCache/view/frontend/layout/default.xml +++ b/app/code/Magento/PageCache/view/frontend/layout/default.xml @@ -24,6 +24,9 @@ */ --> + + + diff --git a/app/code/Magento/Payment/Model/Checks/CanUseCheckout.php b/app/code/Magento/Payment/Model/Checks/CanUseCheckout.php index 3dede9b3bbe22..890dfa4143f85 100644 --- a/app/code/Magento/Payment/Model/Checks/CanUseCheckout.php +++ b/app/code/Magento/Payment/Model/Checks/CanUseCheckout.php @@ -26,18 +26,17 @@ namespace Magento\Payment\Model\Checks; use Magento\Sales\Model\Quote; -use Magento\Payment\Model\Method\AbstractMethod; class CanUseCheckout implements SpecificationInterface { /** * Check whether payment method is applicable to quote * - * @param \Magento\Payment\Model\Method\AbstractMethod $paymentMethod + * @param PaymentMethodChecksInterface $paymentMethod * @param \Magento\Sales\Model\Quote $quote * @return bool */ - public function isApplicable(AbstractMethod $paymentMethod, Quote $quote) + public function isApplicable(PaymentMethodChecksInterface $paymentMethod, Quote $quote) { return $paymentMethod->canUseCheckout(); } diff --git a/app/code/Magento/Payment/Model/Checks/CanUseForCountry.php b/app/code/Magento/Payment/Model/Checks/CanUseForCountry.php index 2ff38a2ad3495..75242196b6aaa 100644 --- a/app/code/Magento/Payment/Model/Checks/CanUseForCountry.php +++ b/app/code/Magento/Payment/Model/Checks/CanUseForCountry.php @@ -26,17 +26,16 @@ namespace Magento\Payment\Model\Checks; use Magento\Sales\Model\Quote; -use Magento\Payment\Model\Method\AbstractMethod; class CanUseForCountry implements SpecificationInterface { /** * Check whether payment method is applicable to quote - * @param \Magento\Payment\Model\Method\AbstractMethod $paymentMethod + * @param PaymentMethodChecksInterface $paymentMethod * @param \Magento\Sales\Model\Quote $quote * @return bool */ - public function isApplicable(AbstractMethod $paymentMethod, Quote $quote) + public function isApplicable(PaymentMethodChecksInterface $paymentMethod, Quote $quote) { return $paymentMethod->canUseForCountry($quote->getBillingAddress()->getCountry()); } diff --git a/app/code/Magento/Payment/Model/Checks/CanUseForCurrency.php b/app/code/Magento/Payment/Model/Checks/CanUseForCurrency.php index 4c3449699c041..90bdc8630b120 100644 --- a/app/code/Magento/Payment/Model/Checks/CanUseForCurrency.php +++ b/app/code/Magento/Payment/Model/Checks/CanUseForCurrency.php @@ -26,7 +26,6 @@ namespace Magento\Payment\Model\Checks; use Magento\Sales\Model\Quote; -use Magento\Payment\Model\Method\AbstractMethod; class CanUseForCurrency implements SpecificationInterface { @@ -34,11 +33,11 @@ class CanUseForCurrency implements SpecificationInterface * Check whether payment method is applicable to quote * Purposed to allow use in controllers some logic that was implemented in blocks only before * - * @param \Magento\Payment\Model\Method\AbstractMethod $paymentMethod + * @param PaymentMethodChecksInterface $paymentMethod * @param \Magento\Sales\Model\Quote $quote * @return bool */ - public function isApplicable(AbstractMethod $paymentMethod, Quote $quote) + public function isApplicable(PaymentMethodChecksInterface $paymentMethod, Quote $quote) { return $paymentMethod->canUseForCurrency($quote->getStore()->getBaseCurrencyCode()); } diff --git a/app/code/Magento/Payment/Model/Checks/CanUseInternal.php b/app/code/Magento/Payment/Model/Checks/CanUseInternal.php index 47f4fa966edae..ee149c89a5108 100644 --- a/app/code/Magento/Payment/Model/Checks/CanUseInternal.php +++ b/app/code/Magento/Payment/Model/Checks/CanUseInternal.php @@ -26,7 +26,6 @@ namespace Magento\Payment\Model\Checks; use Magento\Sales\Model\Quote; -use Magento\Payment\Model\Method\AbstractMethod; class CanUseInternal implements SpecificationInterface { @@ -34,11 +33,11 @@ class CanUseInternal implements SpecificationInterface * Check whether payment method is applicable to quote * Purposed to allow use in controllers some logic that was implemented in blocks only before * - * @param \Magento\Payment\Model\Method\AbstractMethod $paymentMethod + * @param PaymentMethodChecksInterface $paymentMethod * @param \Magento\Sales\Model\Quote $quote * @return bool */ - public function isApplicable(AbstractMethod $paymentMethod, Quote $quote) + public function isApplicable(PaymentMethodChecksInterface $paymentMethod, Quote $quote) { return $paymentMethod->canUseInternal(); } diff --git a/app/code/Magento/Payment/Model/Checks/Composite.php b/app/code/Magento/Payment/Model/Checks/Composite.php index 1606a8fd7a614..be0f38ef5f805 100644 --- a/app/code/Magento/Payment/Model/Checks/Composite.php +++ b/app/code/Magento/Payment/Model/Checks/Composite.php @@ -26,7 +26,6 @@ namespace Magento\Payment\Model\Checks; use Magento\Sales\Model\Quote; -use Magento\Payment\Model\Method\AbstractMethod; class Composite implements SpecificationInterface { @@ -44,11 +43,11 @@ public function __construct(array $list) /** * Check whether payment method is applicable to quote * - * @param \Magento\Payment\Model\Method\AbstractMethod $paymentMethod + * @param PaymentMethodChecksInterface $paymentMethod * @param \Magento\Sales\Model\Quote $quote * @return bool */ - public function isApplicable(AbstractMethod $paymentMethod, Quote $quote) + public function isApplicable(PaymentMethodChecksInterface $paymentMethod, Quote $quote) { foreach ($this->list as $specification) { if (!$specification->isApplicable($paymentMethod, $quote)) { diff --git a/app/code/Magento/Payment/Model/Checks/PaymentMethodChecksInterface.php b/app/code/Magento/Payment/Model/Checks/PaymentMethodChecksInterface.php new file mode 100644 index 0000000000000..4de32c4f16c61 --- /dev/null +++ b/app/code/Magento/Payment/Model/Checks/PaymentMethodChecksInterface.php @@ -0,0 +1,78 @@ +getBaseGrandTotal(); $minTotal = $paymentMethod->getConfigData('min_order_total'); diff --git a/app/code/Magento/Payment/Model/Checks/ZeroTotal.php b/app/code/Magento/Payment/Model/Checks/ZeroTotal.php index 8b2143fa21bdd..b459dacd42abf 100644 --- a/app/code/Magento/Payment/Model/Checks/ZeroTotal.php +++ b/app/code/Magento/Payment/Model/Checks/ZeroTotal.php @@ -26,7 +26,6 @@ namespace Magento\Payment\Model\Checks; use Magento\Sales\Model\Quote; -use Magento\Payment\Model\Method\AbstractMethod; class ZeroTotal implements SpecificationInterface { @@ -34,11 +33,11 @@ class ZeroTotal implements SpecificationInterface * Check whether payment method is applicable to quote * Purposed to allow use in controllers some logic that was implemented in blocks only before * - * @param \Magento\Payment\Model\Method\AbstractMethod $paymentMethod + * @param PaymentMethodChecksInterface $paymentMethod * @param \Magento\Sales\Model\Quote $quote * @return bool */ - public function isApplicable(AbstractMethod $paymentMethod, Quote $quote) + public function isApplicable(PaymentMethodChecksInterface $paymentMethod, Quote $quote) { $total = $quote->getBaseSubtotal() + $quote->getShippingAddress()->getBaseShippingAmount(); return !($total < 0.0001 && $paymentMethod->getCode() != 'free'); diff --git a/app/code/Magento/Payment/Model/Method/AbstractMethod.php b/app/code/Magento/Payment/Model/Method/AbstractMethod.php index 3faf6d595b280..e775c0846bb6f 100644 --- a/app/code/Magento/Payment/Model/Method/AbstractMethod.php +++ b/app/code/Magento/Payment/Model/Method/AbstractMethod.php @@ -25,11 +25,13 @@ use Magento\Sales\Model\Order\Invoice; use Magento\Sales\Model\Order\Payment; +use Magento\Payment\Model\MethodInterface; +use Magento\Payment\Model\Checks\PaymentMethodChecksInterface; /** * Payment method abstract model */ -abstract class AbstractMethod extends \Magento\Framework\Object implements \Magento\Payment\Model\MethodInterface +abstract class AbstractMethod extends \Magento\Framework\Object implements MethodInterface, PaymentMethodChecksInterface { const ACTION_ORDER = 'order'; diff --git a/app/code/Magento/Payment/view/frontend/form/cc.phtml b/app/code/Magento/Payment/view/frontend/form/cc.phtml index f00b0f21cbe2c..879db9925746a 100644 --- a/app/code/Magento/Payment/view/frontend/form/cc.phtml +++ b/app/code/Magento/Payment/view/frontend/form/cc.phtml @@ -28,7 +28,9 @@
- getInfoData('cc_type') ?> getCcAvailableTypes() as $_typeCode => $_typeName): ?> @@ -127,13 +129,6 @@
 
- getChildHtml() ?> diff --git a/app/code/Magento/Paypal/Block/Adminhtml/Customer/Edit/Tab/Agreement.php b/app/code/Magento/Paypal/Block/Adminhtml/Customer/Edit/Tab/Agreement.php index 290f245582de7..331e610c6242d 100644 --- a/app/code/Magento/Paypal/Block/Adminhtml/Customer/Edit/Tab/Agreement.php +++ b/app/code/Magento/Paypal/Block/Adminhtml/Customer/Edit/Tab/Agreement.php @@ -23,6 +23,8 @@ */ namespace Magento\Paypal\Block\Adminhtml\Customer\Edit\Tab; +use Magento\Customer\Controller\RegistryConstants; + /** * Adminhtml customer billing agreement tab */ @@ -97,8 +99,7 @@ public function getTabTitle() */ public function canShowTab() { - $customer = $this->_coreRegistry->registry('current_customer'); - return !is_null($customer); + return !is_null($this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID)); } /** diff --git a/app/code/Magento/Paypal/view/frontend/express/review.phtml b/app/code/Magento/Paypal/view/frontend/express/review.phtml index c8ca7cd5f0aea..d7b3c204b77ac 100644 --- a/app/code/Magento/Paypal/view/frontend/express/review.phtml +++ b/app/code/Magento/Paypal/view/frontend/express/review.phtml @@ -104,16 +104,9 @@ $shippingAddress = $this->getShippingAddress(); diff --git a/app/code/Magento/Paypal/view/frontend/express/review/address.phtml b/app/code/Magento/Paypal/view/frontend/express/review/address.phtml index e9e7d78e1b718..082bd6a3eff1d 100644 --- a/app/code/Magento/Paypal/view/frontend/express/review/address.phtml +++ b/app/code/Magento/Paypal/view/frontend/express/review/address.phtml @@ -182,22 +182,14 @@ echo $nameWidget diff --git a/app/code/Magento/Paypal/view/frontend/express/shortcut.phtml b/app/code/Magento/Paypal/view/frontend/express/shortcut.phtml index 0ad486c4f4cd7..dc8f2026d2672 100644 --- a/app/code/Magento/Paypal/view/frontend/express/shortcut.phtml +++ b/app/code/Magento/Paypal/view/frontend/express/shortcut.phtml @@ -53,17 +53,15 @@ if ($this->isOrPositionBefore()) { endif; ?> diff --git a/app/code/Magento/Paypal/view/frontend/js/components.phtml b/app/code/Magento/Paypal/view/frontend/js/components.phtml new file mode 100644 index 0000000000000..a54db67f1558e --- /dev/null +++ b/app/code/Magento/Paypal/view/frontend/js/components.phtml @@ -0,0 +1,46 @@ + + +getChildHtml() ?> diff --git a/app/code/Magento/Paypal/view/frontend/layout/checkout_onepage_index.xml b/app/code/Magento/Paypal/view/frontend/layout/checkout_onepage_index.xml index 19cd84f498be1..f8ed5a58e7f67 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/checkout_onepage_index.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/checkout_onepage_index.xml @@ -24,6 +24,9 @@ */ --> + + + diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review.xml index 6986d991ad70a..4629e28332c60 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review.xml @@ -25,6 +25,10 @@ --> + + + + 1column.phtml diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowexpress_review.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowexpress_review.xml index d307d447492d7..c4e09be89b632 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowexpress_review.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowexpress_review.xml @@ -44,4 +44,7 @@
+ + +
diff --git a/app/code/Magento/Paypal/view/frontend/onepage.phtml b/app/code/Magento/Paypal/view/frontend/onepage.phtml index 937f731c16ee9..4e4e5a15be967 100644 --- a/app/code/Magento/Paypal/view/frontend/onepage.phtml +++ b/app/code/Magento/Paypal/view/frontend/onepage.phtml @@ -24,14 +24,8 @@ ?> diff --git a/app/code/Magento/Paypal/view/frontend/payflowexpress/review.phtml b/app/code/Magento/Paypal/view/frontend/payflowexpress/review.phtml index af5ee6bdbd39e..ddb2105111822 100644 --- a/app/code/Magento/Paypal/view/frontend/payflowexpress/review.phtml +++ b/app/code/Magento/Paypal/view/frontend/payflowexpress/review.phtml @@ -149,18 +149,11 @@ diff --git a/app/code/Magento/Persistent/view/frontend/js/components.phtml b/app/code/Magento/Persistent/view/frontend/js/components.phtml new file mode 100644 index 0000000000000..7a6e9f6670304 --- /dev/null +++ b/app/code/Magento/Persistent/view/frontend/js/components.phtml @@ -0,0 +1,40 @@ + + +getChildHtml() ?> diff --git a/app/code/Magento/Persistent/view/frontend/layout/checkout_onepage_index.xml b/app/code/Magento/Persistent/view/frontend/layout/checkout_onepage_index.xml index f92cf75ab7997..5835257bfd279 100644 --- a/app/code/Magento/Persistent/view/frontend/layout/checkout_onepage_index.xml +++ b/app/code/Magento/Persistent/view/frontend/layout/checkout_onepage_index.xml @@ -24,6 +24,9 @@ */ --> + + + diff --git a/app/code/Magento/Persistent/view/frontend/layout/customer_account_create.xml b/app/code/Magento/Persistent/view/frontend/layout/customer_account_create.xml index c1f545e5b1337..1347bd0811b57 100644 --- a/app/code/Magento/Persistent/view/frontend/layout/customer_account_create.xml +++ b/app/code/Magento/Persistent/view/frontend/layout/customer_account_create.xml @@ -24,6 +24,9 @@ */ --> + + + diff --git a/app/code/Magento/Persistent/view/frontend/layout/customer_account_login.xml b/app/code/Magento/Persistent/view/frontend/layout/customer_account_login.xml index c1f545e5b1337..389517c16ecf3 100644 --- a/app/code/Magento/Persistent/view/frontend/layout/customer_account_login.xml +++ b/app/code/Magento/Persistent/view/frontend/layout/customer_account_login.xml @@ -24,6 +24,9 @@ */ --> + + + diff --git a/app/code/Magento/Persistent/view/frontend/remember_me_tooltip.phtml b/app/code/Magento/Persistent/view/frontend/remember_me_tooltip.phtml index e143906ac1f84..83ff60451c3a2 100644 --- a/app/code/Magento/Persistent/view/frontend/remember_me_tooltip.phtml +++ b/app/code/Magento/Persistent/view/frontend/remember_me_tooltip.phtml @@ -33,14 +33,10 @@ ?> diff --git a/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php b/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php index e5b06eb3555fd..5619649a8f1c0 100644 --- a/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php +++ b/app/code/Magento/ProductAlert/Block/Email/AbstractEmail.php @@ -134,4 +134,49 @@ protected function _getUrlParams() { return array('_scope' => $this->getStore(), '_scope_to_url' => true); } + + /** + * @return \Magento\Framework\Pricing\Render + */ + protected function getPriceRender() + { + return $this->_layout->createBlock( + 'Magento\Framework\Pricing\Render', + '', + ['data'=> ['price_render_handle' => 'catalog_product_prices']] + ); + } + + /** + * Return HTML block with tier price + * + * @param \Magento\Catalog\Model\Product $product + * @param string $priceType + * @param string $renderZone + * @param array $arguments + * @return string + */ + public function getProductPriceHtml( + \Magento\Catalog\Model\Product $product, + $priceType, + $renderZone = \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + array $arguments = [] + ) { + if (!isset($arguments['zone'])) { + $arguments['zone'] = $renderZone; + } + + /** @var \Magento\Framework\Pricing\Render $priceRender */ + $priceRender = $this->getPriceRender(); + $price = ''; + + if ($priceRender) { + $price = $priceRender->render( + $priceType, + $product, + $arguments + ); + } + return $price; + } } diff --git a/app/code/Magento/ProductAlert/Model/Email.php b/app/code/Magento/ProductAlert/Model/Email.php index 5182a57e706af..963f863baf4ce 100644 --- a/app/code/Magento/ProductAlert/Model/Email.php +++ b/app/code/Magento/ProductAlert/Model/Email.php @@ -352,7 +352,7 @@ public function send() $product->setCustomerGroupId($this->_customer->getGroupId()); $this->_getPriceBlock()->addProduct($product); } - $block = $this->_getPriceBlock()->toHtml(); + $block = $this->_getPriceBlock(); $templateId = $this->_scopeConfig->getValue( self::XML_PATH_EMAIL_PRICE_TEMPLATE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, @@ -364,7 +364,7 @@ public function send() $product->setCustomerGroupId($this->_customer->getGroupId()); $this->_getStockBlock()->addProduct($product); } - $block = $this->_getStockBlock()->toHtml(); + $block = $this->_getStockBlock(); $templateId = $this->_scopeConfig->getValue( self::XML_PATH_EMAIL_STOCK_TEMPLATE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, @@ -372,6 +372,10 @@ public function send() ); } + $alertGrid = $this->_appState->emulateAreaCode( + \Magento\Framework\App\Area::AREA_FRONTEND, + array($block, 'toHtml') + ); $this->_appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo); $transport = $this->_transportBuilder->setTemplateIdentifier( @@ -379,7 +383,10 @@ public function send() )->setTemplateOptions( array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId) )->setTemplateVars( - array('customerName' => $this->_customerHelper->getCustomerName($this->_customer), 'alertGrid' => $block) + array( + 'customerName' => $this->_customerHelper->getCustomerName($this->_customer), + 'alertGrid' => $alertGrid + ) )->setFrom( $this->_scopeConfig->getValue( self::XML_PATH_EMAIL_IDENTITY, diff --git a/app/code/Magento/ProductAlert/Model/Observer.php b/app/code/Magento/ProductAlert/Model/Observer.php index 77fea2809d73d..b6da42c1d3ab9 100644 --- a/app/code/Magento/ProductAlert/Model/Observer.php +++ b/app/code/Magento/ProductAlert/Model/Observer.php @@ -241,6 +241,7 @@ protected function _processPrice(\Magento\ProductAlert\Model\Email $email) $customer = $previousCustomer; } + /** @var \Magento\Catalog\Model\Product $product */ $product = $this->_productFactory->create()->setStoreId( $website->getDefaultStore()->getId() )->load( diff --git a/app/code/Magento/ProductAlert/etc/crontab.xml b/app/code/Magento/ProductAlert/etc/crontab.xml index cdb453b3845c5..89bb9b70d9f8b 100644 --- a/app/code/Magento/ProductAlert/etc/crontab.xml +++ b/app/code/Magento/ProductAlert/etc/crontab.xml @@ -25,6 +25,8 @@ --> - + + crontab/default/jobs/catalog_product_alert/schedule/cron_expr + diff --git a/app/code/Magento/ProductAlert/view/frontend/email/price.phtml b/app/code/Magento/ProductAlert/view/frontend/email/price.phtml index 61494aed8a601..50b586a1dbfd9 100644 --- a/app/code/Magento/ProductAlert/view/frontend/email/price.phtml +++ b/app/code/Magento/ProductAlert/view/frontend/email/price.phtml @@ -22,10 +22,13 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ + +/** @var $this \Magento\ProductAlert\Block\Email\Price */ ?> getProducts()): ?>

+ diff --git a/app/code/Magento/ProductAlert/view/frontend/email/stock.phtml b/app/code/Magento/ProductAlert/view/frontend/email/stock.phtml index 85d4800a792d4..ce7238c2e042f 100644 --- a/app/code/Magento/ProductAlert/view/frontend/email/stock.phtml +++ b/app/code/Magento/ProductAlert/view/frontend/email/stock.phtml @@ -22,6 +22,8 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ + +/** @var $this \Magento\ProductAlert\Block\Email\Stock */ ?> getProducts()): ?>

@@ -42,12 +44,16 @@ escapeHtml($_product->getShortDescription())): ?>

-

getPrice() != $_product->getFinalPrice()): ?> - helper('Magento\Core\Helper\Data')->currency($_product->getPrice()) ?>
- helper('Magento\Core\Helper\Data')->currency($_product->getFinalPrice()) ?> - - helper('Magento\Core\Helper\Data')->currency($_product->getPrice()) ?> -

+

getProductPriceHtml( + $_product, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_EMAIL, + [ + 'display_label' => __('Price:') + ] + ); + ?> +

diff --git a/app/code/Magento/RecurringPayment/Model/Plugin/ZeroTotal.php b/app/code/Magento/RecurringPayment/Model/Plugin/ZeroTotal.php index 999c58a2f39d6..053d3e7feef6e 100644 --- a/app/code/Magento/RecurringPayment/Model/Plugin/ZeroTotal.php +++ b/app/code/Magento/RecurringPayment/Model/Plugin/ZeroTotal.php @@ -24,7 +24,7 @@ namespace Magento\RecurringPayment\Model\Plugin; use Magento\Sales\Model\Quote; -use Magento\Payment\Model\Method\AbstractMethod; +use Magento\Payment\Model\Checks\PaymentMethodChecksInterface; use Magento\RecurringPayment\Model\Method\RecurringPaymentSpecification; /** @@ -54,7 +54,7 @@ public function __construct( /** * @param \Magento\Payment\Model\Checks\ZeroTotal $subject * @param callable $proceed - * @param AbstractMethod $paymentMethod + * @param PaymentMethodChecksInterface $paymentMethod * @param Quote $quote * @return bool * @@ -63,16 +63,11 @@ public function __construct( public function aroundIsApplicable( \Magento\Payment\Model\Checks\ZeroTotal $subject, \Closure $proceed, - AbstractMethod $paymentMethod, + PaymentMethodChecksInterface $paymentMethod, Quote $quote ) { - return $proceed( - $paymentMethod, - $quote - ) || $this->specification->isSatisfiedBy( - $paymentMethod->getCode() - ) && $this->filter->hasRecurringItems( - $quote - ); + return $proceed($paymentMethod, $quote) + || $this->specification->isSatisfiedBy($paymentMethod->getCode()) + && $this->filter->hasRecurringItems($quote); } } diff --git a/app/code/Magento/Reports/Block/Product/AbstractProduct.php b/app/code/Magento/Reports/Block/Product/AbstractProduct.php index 25455cfd54c2b..34e23f4c59f82 100644 --- a/app/code/Magento/Reports/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Reports/Block/Product/AbstractProduct.php @@ -61,19 +61,16 @@ abstract class AbstractProduct extends \Magento\Catalog\Block\Product\AbstractPr * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\Reports\Model\Product\Index\Factory $indexFactory * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Reports\Model\Product\Index\Factory $indexFactory, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { parent::__construct( $context, - $data, - $priceBlockTypes + $data ); $this->_productVisibility = $productVisibility; $this->_indexFactory = $indexFactory; diff --git a/app/code/Magento/Reports/Block/Product/Widget/Compared.php b/app/code/Magento/Reports/Block/Product/Widget/Compared.php index a8e436b459b1d..0a547149ce143 100644 --- a/app/code/Magento/Reports/Block/Product/Widget/Compared.php +++ b/app/code/Magento/Reports/Block/Product/Widget/Compared.php @@ -53,10 +53,5 @@ protected function _construct() 'three_columns', 3 ); - $this->addPriceBlockType( - 'bundle', - 'Magento\Bundle\Block\Catalog\Product\Price', - 'catalog/product/price.phtml' - ); } } diff --git a/app/code/Magento/Reports/Block/Product/Widget/Viewed/Item.php b/app/code/Magento/Reports/Block/Product/Widget/Viewed/Item.php index e28c51eddc496..9aa322c02c95e 100644 --- a/app/code/Magento/Reports/Block/Product/Widget/Viewed/Item.php +++ b/app/code/Magento/Reports/Block/Product/Widget/Viewed/Item.php @@ -38,19 +38,4 @@ class Item extends \Magento\Catalog\Block\Product\AbstractProduct implements \Ma * @var string */ protected $_indexType = \Magento\Reports\Model\Product\Index\Factory::TYPE_VIEWED; - - /** - * Internal constructor - * - * @return void - */ - protected function _construct() - { - parent::_construct(); - $this->addPriceBlockType( - 'bundle', - 'Magento\Bundle\Block\Catalog\Product\Price', - 'catalog/product/price.phtml' - ); - } } diff --git a/app/code/Magento/Reports/data/reports_setup/data-install-1.6.0.0.php b/app/code/Magento/Reports/data/reports_setup/data-install-1.6.0.0.php index 9ed4558817ac5..c1c85fb46deff 100644 --- a/app/code/Magento/Reports/data/reports_setup/data-install-1.6.0.0.php +++ b/app/code/Magento/Reports/data/reports_setup/data-install-1.6.0.0.php @@ -66,29 +66,7 @@ /** @var $cms \Magento\Cms\Model\Page */ $cms = $installer->getPage()->load('home', 'identifier'); -$reportLayoutUpdate = ' - + + + catalog_product_prices + + + diff --git a/app/code/Magento/Rss/view/frontend/layout/rss_index_wishlist.xml b/app/code/Magento/Rss/view/frontend/layout/rss_index_wishlist.xml index ddf90c9901f05..434dfb0c660e6 100644 --- a/app/code/Magento/Rss/view/frontend/layout/rss_index_wishlist.xml +++ b/app/code/Magento/Rss/view/frontend/layout/rss_index_wishlist.xml @@ -24,11 +24,5 @@ */ --> - - - msrp_rss - Magento\Catalog\Block\Product\Price - Magento_Wishlist::render/item/price_msrp_rss.phtml - - - + + \ No newline at end of file diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items/Grid.php index 98596e95a9e47..9a5f6d40003cf 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Items/Grid.php @@ -336,13 +336,15 @@ public function canApplyCustomPrice($item) */ public function getQtyTitle($item) { - $prices = $item->getProduct()->getTierPrice(); + $prices = $item->getProduct() + ->getPriceInfo() + ->getPrice(\Magento\Catalog\Pricing\Price\TierPrice::PRICE_CODE) + ->getTierPriceList(); if ($prices) { $info = array(); foreach ($prices as $data) { - $qty = $data['price_qty'] * 1; $price = $this->convertPrice($data['price']); - $info[] = __('Buy %1 for price %2', $qty, $price); + $info[] = __('Buy %1 for price %2', $data['price_qty'], $price); } return implode(', ', $info); } else { diff --git a/app/code/Magento/Sales/view/frontend/guest/form.phtml b/app/code/Magento/Sales/view/frontend/guest/form.phtml index 3a5cebba6e7a6..f8863c421d20b 100644 --- a/app/code/Magento/Sales/view/frontend/guest/form.phtml +++ b/app/code/Magento/Sales/view/frontend/guest/form.phtml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -
@@ -79,12 +79,3 @@ - diff --git a/app/code/Magento/Sales/view/frontend/js/components.phtml b/app/code/Magento/Sales/view/frontend/js/components.phtml new file mode 100644 index 0000000000000..97cace3b45b1f --- /dev/null +++ b/app/code/Magento/Sales/view/frontend/js/components.phtml @@ -0,0 +1,49 @@ + + +getChildHtml() ?> diff --git a/app/code/Magento/Sales/view/frontend/layout/default.xml b/app/code/Magento/Sales/view/frontend/layout/default.xml index d86ed5d6cdf98..e9fc0c2386cd7 100644 --- a/app/code/Magento/Sales/view/frontend/layout/default.xml +++ b/app/code/Magento/Sales/view/frontend/layout/default.xml @@ -24,6 +24,9 @@ */ --> + + + diff --git a/app/code/Magento/Sales/view/frontend/order/items.phtml b/app/code/Magento/Sales/view/frontend/order/items.phtml index 235b105506825..5bf0ff4fc204e 100644 --- a/app/code/Magento/Sales/view/frontend/order/items.phtml +++ b/app/code/Magento/Sales/view/frontend/order/items.phtml @@ -75,8 +75,6 @@ diff --git a/app/code/Magento/Sales/view/frontend/reorder/sidebar.phtml b/app/code/Magento/Sales/view/frontend/reorder/sidebar.phtml index 3cf9f60802208..a1459256a1934 100644 --- a/app/code/Magento/Sales/view/frontend/reorder/sidebar.phtml +++ b/app/code/Magento/Sales/view/frontend/reorder/sidebar.phtml @@ -71,19 +71,11 @@ getPagerHtml(); ?> diff --git a/app/code/Magento/Sales/view/frontend/widget/guest/form.phtml b/app/code/Magento/Sales/view/frontend/widget/guest/form.phtml index 5fe6858e8c516..913f3254a2960 100644 --- a/app/code/Magento/Sales/view/frontend/widget/guest/form.phtml +++ b/app/code/Magento/Sales/view/frontend/widget/guest/form.phtml @@ -31,7 +31,7 @@
-
@@ -83,13 +83,4 @@
- diff --git a/app/code/Magento/Sendfriend/view/frontend/send.phtml b/app/code/Magento/Sendfriend/view/frontend/send.phtml index 23a8fd40596cd..2dfbcd5e5f573 100644 --- a/app/code/Magento/Sendfriend/view/frontend/send.phtml +++ b/app/code/Magento/Sendfriend/view/frontend/send.phtml @@ -54,7 +54,19 @@
-
+
getBlockHtml('formkey')?> @@ -117,24 +129,6 @@ diff --git a/app/code/Magento/Store/Model/Storage/Db.php b/app/code/Magento/Store/Model/Storage/Db.php index fad498b340c99..1b4088b6fa313 100644 --- a/app/code/Magento/Store/Model/Storage/Db.php +++ b/app/code/Magento/Store/Model/Storage/Db.php @@ -214,7 +214,7 @@ protected function _initStores() $websiteStores[$store->getWebsiteId()][$store->getId()] = $store; $groupStores[$store->getGroupId()][$store->getId()] = $store; - if (is_null($this->_store) && $store->getCode() === \Magento\Store\Model\Store::DEFAULT_CODE) { + if ($this->_hasSingleStore) { $this->_store = $store; } } diff --git a/app/code/Magento/Tax/Model/Calculation.php b/app/code/Magento/Tax/Model/Calculation.php index adfd71dcd5e7f..f9896b5168edf 100644 --- a/app/code/Magento/Tax/Model/Calculation.php +++ b/app/code/Magento/Tax/Model/Calculation.php @@ -517,17 +517,11 @@ public function getRateRequest( } else { $regionId = $address->getRegionId(); } - $request->setCountryId( - $address->getCountryId() - )->setRegionId( - $regionId - )->setPostcode( - $address->getPostcode() - )->setStore( - $store - )->setCustomerClassId( - $customerTaxClass - ); + $request->setCountryId($address->getCountryId()) + ->setRegionId($regionId) + ->setPostcode($address->getPostcode()) + ->setStore($store) + ->setCustomerClassId($customerTaxClass); return $request; } diff --git a/app/code/Magento/Tax/Pricing/Adjustment.php b/app/code/Magento/Tax/Pricing/Adjustment.php index fb998a17bfcb9..517809c9187f9 100644 --- a/app/code/Magento/Tax/Pricing/Adjustment.php +++ b/app/code/Magento/Tax/Pricing/Adjustment.php @@ -38,7 +38,7 @@ class Adjustment implements AdjustmentInterface /** * Adjustment code tax */ - const CODE = 'tax'; + const ADJUSTMENT_CODE = 'tax'; /** * @var TaxHelper @@ -67,7 +67,7 @@ public function __construct(TaxHelper $taxHelper, $sortOrder = null) */ public function getAdjustmentCode() { - return self::CODE; + return self::ADJUSTMENT_CODE; } /** @@ -118,8 +118,7 @@ public function extractAdjustment($amount, SaleableInterface $saleableItem) public function applyAdjustment($amount, SaleableInterface $saleableItem) { $includingTax = !$this->taxHelper->priceIncludesTax(); - $amount = $this->taxHelper->getPrice($saleableItem, $amount, $includingTax); - return $amount; + return $this->taxHelper->getPrice($saleableItem, $amount, $includingTax); } /** diff --git a/app/code/Magento/Tax/Pricing/Price/Plugin/AttributePrice.php b/app/code/Magento/Tax/Pricing/Price/Plugin/AttributePrice.php new file mode 100644 index 0000000000000..65cbc057d6902 --- /dev/null +++ b/app/code/Magento/Tax/Pricing/Price/Plugin/AttributePrice.php @@ -0,0 +1,100 @@ +taxHelper = $helper; + $this->calculation = $calculation; + } + + /** + * Get Tax Adjustments for configurable product + * + * @param \Magento\ConfigurableProduct\Pricing\Price\AttributePrice $attribute + * @param array $result + * @return array + */ + public function afterPrepareAdjustmentConfig( + \Magento\ConfigurableProduct\Pricing\Price\AttributePrice $attribute, + array $result + ) { + $product = $result['product']; + + $productClassId = $product->getTaxClassId(); + + $defaultValue = $this->applyRate($productClassId, false, false, false); + $result['defaultTax'] = $defaultValue + $result['defaultTax']; + + $currentTax = $this->applyRate($productClassId); + $result['currentTax'] = $currentTax + $result['currentTax']; + + $adjustment = $product->getPriceInfo()->getAdjustment(\Magento\Tax\Pricing\Adjustment::ADJUSTMENT_CODE); + + $result['includeTax'] = $adjustment->isIncludedInBasePrice(); + $result['showIncludeTax'] = $this->taxHelper->displayPriceIncludingTax(); + $result['showBothPrices'] = $this->taxHelper->displayBothPrices(); + return $result; + } + + /** + * Apply Tax Rate + * + * @param int $classId + * @param null $shippingAddress + * @param null $billingAddress + * @param null $customerTaxClass + * @return float + */ + protected function applyRate($classId, $shippingAddress = null, $billingAddress = null, $customerTaxClass = null) + { + $rateRequest = $this->calculation->getRateRequest($shippingAddress, $billingAddress, $customerTaxClass); + $rateRequest->setProductClassId($classId); + return $this->calculation->getRate($rateRequest); + } +} diff --git a/app/code/Magento/Tax/Pricing/Render/Adjustment.php b/app/code/Magento/Tax/Pricing/Render/Adjustment.php index d4aca924dcb6a..faca5958b2f7c 100644 --- a/app/code/Magento/Tax/Pricing/Render/Adjustment.php +++ b/app/code/Magento/Tax/Pricing/Render/Adjustment.php @@ -56,15 +56,15 @@ public function __construct( } /** - * @return null + * @return string */ protected function apply() { - $html = $this->toHtml(); if ($this->displayBothPrices()) { if ($this->getZone() !== \Magento\Framework\Pricing\Render::ZONE_ITEM_OPTION) { - $this->amountRender->setPriceDisplayLabel(__('Excl. Tax:')); + $this->amountRender->setPriceDisplayLabel(__('Excl. Tax')); } + $this->amountRender->setPriceWrapperCss('price-excluding-tax'); $this->amountRender->setPriceId( $this->buildIdWithPrefix('price-excluding-tax-') ); @@ -73,15 +73,12 @@ protected function apply() $this->amountRender->getAmount()->getAdjustmentAmount($this->getAdjustmentCode()) ); } elseif ($this->displayPriceExcludingTax()) { - $this->amountRender->setDisplayValue( $this->amountRender->getDisplayValue() - $this->amountRender->getAmount()->getAdjustmentAmount($this->getAdjustmentCode()) ); } - if (trim($html)) { - $this->amountRender->addAdjustmentHtml($this->getAdjustmentCode(), $html); - } + return $this->toHtml(); } /** @@ -92,7 +89,7 @@ protected function apply() public function getAdjustmentCode() { //@TODO We can build two model using DI, not code. What about passing it in constructor? - return \Magento\Tax\Pricing\Adjustment::CODE; + return \Magento\Tax\Pricing\Adjustment::ADJUSTMENT_CODE; } /** diff --git a/app/code/Magento/Tax/etc/di.xml b/app/code/Magento/Tax/etc/di.xml index 7ca6b7990aadd..f916d6a5490c2 100644 --- a/app/code/Magento/Tax/etc/di.xml +++ b/app/code/Magento/Tax/etc/di.xml @@ -51,4 +51,7 @@ + + + diff --git a/app/code/Magento/Tax/etc/module.xml b/app/code/Magento/Tax/etc/module.xml index ca42eb5853897..099b9fe5254ed 100644 --- a/app/code/Magento/Tax/etc/module.xml +++ b/app/code/Magento/Tax/etc/module.xml @@ -43,6 +43,7 @@ + diff --git a/app/code/Magento/Tax/view/frontend/layout/catalog_product_prices.xml b/app/code/Magento/Tax/view/base/layout/catalog_product_prices.xml similarity index 100% rename from app/code/Magento/Tax/view/frontend/layout/catalog_product_prices.xml rename to app/code/Magento/Tax/view/base/layout/catalog_product_prices.xml diff --git a/app/code/Magento/Tax/view/frontend/pricing/adjustment.phtml b/app/code/Magento/Tax/view/base/pricing/adjustment.phtml similarity index 79% rename from app/code/Magento/Tax/view/frontend/pricing/adjustment.phtml rename to app/code/Magento/Tax/view/base/pricing/adjustment.phtml index 13f3a05cf1ada..d5341d98169ff 100644 --- a/app/code/Magento/Tax/view/frontend/pricing/adjustment.phtml +++ b/app/code/Magento/Tax/view/base/pricing/adjustment.phtml @@ -28,10 +28,9 @@ displayBothPrices()): ?> - - - - getDisplayAmount(false) ?> - - + + getDisplayAmount(false) ?> + diff --git a/app/code/Magento/Tax/view/frontend/pricing/adjustment/bundle.phtml b/app/code/Magento/Tax/view/base/pricing/adjustment/bundle.phtml similarity index 99% rename from app/code/Magento/Tax/view/frontend/pricing/adjustment/bundle.phtml rename to app/code/Magento/Tax/view/base/pricing/adjustment/bundle.phtml index d9da473cc9ce4..9461ca5ef4847 100644 --- a/app/code/Magento/Tax/view/frontend/pricing/adjustment/bundle.phtml +++ b/app/code/Magento/Tax/view/base/pricing/adjustment/bundle.phtml @@ -1,4 +1,3 @@ - - \ No newline at end of file + diff --git a/app/code/Magento/Theme/view/frontend/html/notices.phtml b/app/code/Magento/Theme/view/frontend/html/notices.phtml index 885edbd7fad8c..2d40167f370aa 100644 --- a/app/code/Magento/Theme/view/frontend/html/notices.phtml +++ b/app/code/Magento/Theme/view/frontend/html/notices.phtml @@ -87,16 +87,13 @@ diff --git a/app/code/Magento/Theme/view/frontend/js/components.phtml b/app/code/Magento/Theme/view/frontend/js/components.phtml index cc3515be3fb5f..60ef4c182eea4 100644 --- a/app/code/Magento/Theme/view/frontend/js/components.phtml +++ b/app/code/Magento/Theme/view/frontend/js/components.phtml @@ -51,6 +51,9 @@ ], redirectUrl: [ 'getViewFileUrl('mage/redirect-url.js') ?>' + ], + cookieBlock: [ + 'getViewFileUrl('Magento_Theme::js/notices.js') ?>' ] }); })(jQuery); diff --git a/app/code/Magento/Theme/view/frontend/js/cookie.phtml b/app/code/Magento/Theme/view/frontend/js/cookie.phtml index 4d12a89a3d255..ee5ef4ebe31c6 100644 --- a/app/code/Magento/Theme/view/frontend/js/cookie.phtml +++ b/app/code/Magento/Theme/view/frontend/js/cookie.phtml @@ -35,16 +35,13 @@ diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml index 358212b2ebced..94f1fe9cf0b9e 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml @@ -24,6 +24,9 @@ */ --> + + + @@ -48,9 +51,9 @@ mage/jquery-no-conflict.js - + - headjs/head.load.min.js + headjs/head.min.js @@ -68,6 +71,11 @@ mage/translate.js + + + jquery/jquery.cookie.js + + mage/cookies.js diff --git a/app/code/Magento/User/view/email/password_reset_confirmation.html b/app/code/Magento/User/view/email/password_reset_confirmation.html index 47a0751ce65da..db52f23059419 100644 --- a/app/code/Magento/User/view/email/password_reset_confirmation.html +++ b/app/code/Magento/User/view/email/password_reset_confirmation.html @@ -27,7 +27,7 @@
diff --git a/app/code/Magento/Wishlist/view/frontend/sharing.phtml b/app/code/Magento/Wishlist/view/frontend/sharing.phtml index 4144f095d193b..37e89a87d317d 100644 --- a/app/code/Magento/Wishlist/view/frontend/sharing.phtml +++ b/app/code/Magento/Wishlist/view/frontend/sharing.phtml @@ -25,7 +25,12 @@ /** @var $this \Magento\Wishlist\Block\Customer\Sharing */ ?> - +
getBlockHtml('formkey')?>
@@ -63,13 +68,3 @@ - diff --git a/app/code/Magento/Wishlist/view/frontend/sidebar.phtml b/app/code/Magento/Wishlist/view/frontend/sidebar.phtml index eb514f6d8b416..60b7e0ac6c4bd 100644 --- a/app/code/Magento/Wishlist/view/frontend/sidebar.phtml +++ b/app/code/Magento/Wishlist/view/frontend/sidebar.phtml @@ -42,16 +42,23 @@ $wishlistHelper = $this->helper('Magento\Wishlist\Helper\Data'); hasWishlistItems()): ?>
    - getWishlistItems() as $_item): ?> - getProduct(); ?> - ' : '
  1. ' ?> + getWishlistItems() as $item): ?> + getProduct(); ?> + ' : '
  2. ' ?>
    - + init($product, 'wishlist_sidebar_block')->toHtml() ?>
    - escapeHtml($product->getName()) ?> - getPriceHtml($product, false, '-wishlist') ?> + escapeHtml($product->getName()) ?> + getProductPriceHtml( + $product, + \Magento\Catalog\Pricing\Price\ConfiguredPriceInterface::CONFIGURED_PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + ['item' => $item] + ); + ?>
    isSaleable() && $product->isVisibleInSiteVisibility()): ?> getTypeInstance()->hasRequiredOptions($product)): ?> @@ -65,14 +72,14 @@ $wishlistHelper = $this->helper('Magento\Wishlist\Helper\Data');
    - getWishlistItems())+1) ? '
  3. ' : '' ?> + getWishlistItems()) + 1) ? '' : '' ?>
diff --git a/app/code/Magento/Wishlist/view/frontend/view.phtml b/app/code/Magento/Wishlist/view/frontend/view.phtml index bb5ae1bf64576..efc29812c00f4 100644 --- a/app/code/Magento/Wishlist/view/frontend/view.phtml +++ b/app/code/Magento/Wishlist/view/frontend/view.phtml @@ -31,7 +31,21 @@ -
+ getChildHtml('top'); ?> hasWishlistItems()): ?> getBlockHtml('formkey');?> @@ -61,28 +75,4 @@ {{if entity}}{{/if}} - diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml b/app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml index b88f1b0ab17bb..c4e81a31dc96c 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/layout/default.xml @@ -94,11 +94,6 @@ modernizr/modernizr.js - - - headjs/head.min.js - - mage/dropdown_old.js diff --git a/app/design/frontend/Magento/plushe/css/source/clearless/all.less b/app/design/frontend/Magento/blank/css/source/price.less similarity index 55% rename from app/design/frontend/Magento/plushe/css/source/clearless/all.less rename to app/design/frontend/Magento/blank/css/source/price.less index 60679b51fdf2f..daa876ef5bd49 100644 --- a/app/design/frontend/Magento/plushe/css/source/clearless/all.less +++ b/app/design/frontend/Magento/blank/css/source/price.less @@ -18,19 +18,44 @@ // * needs please refer to http://www.magentocommerce.com for more information. // * // * @category design -// * @package magento2_reference // * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) // * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) // */ -// ============================================== -// Handily import all ClearLess mixins -// ============================================== -@import "settings"; -@import "typography"; -@import "resets"; -@import "helpers"; -@import "sprites"; -@import "icons"; -@import "arrows"; -@import "grids"; \ No newline at end of file +.price-style-1() { + .price { + &-container {} + &-wrapper[data-label]:before { + content: attr(data-label)":"; + } + &-tier_price .price-excluding-tax, + &-tier_price .price-including-tax { + display: inline; + } + &-tier_price .price-adjustments { + font-size: .9em; + &:before { + content: "("; + } + &:after { + content: ")"; + } + } + } +} +.price-style-2() { + .price { + &-including-tax, + &-excluding-tax { + display: inline !important; + } + &-including-tax:before { + content:" / " + } + &-including-tax:after { + content: "("attr(data-label)")"; + } + } +} + +.price-style-1(); diff --git a/app/design/frontend/Magento/blank/css/styles.less b/app/design/frontend/Magento/blank/css/styles.less index 9c979ca902e71..e2720a78fe40b 100644 --- a/app/design/frontend/Magento/blank/css/styles.less +++ b/app/design/frontend/Magento/blank/css/styles.less @@ -50,6 +50,7 @@ @import "source/actions-toolbar.less"; // import theme actions-toolbar @import "source/breadcrumbs.less"; // import theme breadcrumbs @import "source/popups.less"; // import theme popups +@import "source/price.less"; // import theme popups // Magento Import instructions //@magento_import "source/module.less"; // import theme styles diff --git a/app/design/frontend/Magento/plushe/Magento_Checkout/layout/checkout_cart_index.xml b/app/design/frontend/Magento/plushe/Magento_Checkout/layout/checkout_cart_index.xml deleted file mode 100644 index d8cc2bdc93a69..0000000000000 --- a/app/design/frontend/Magento/plushe/Magento_Checkout/layout/checkout_cart_index.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - Summary - strong - - Summary - - summary title - - - - - - - - - - - diff --git a/app/design/frontend/Magento/plushe/Magento_Customer/layout/default.xml b/app/design/frontend/Magento/plushe/Magento_Customer/layout/default.xml deleted file mode 100644 index a6c4e24a9a3f8..0000000000000 --- a/app/design/frontend/Magento/plushe/Magento_Customer/layout/default.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - diff --git a/app/design/frontend/Magento/plushe/Magento_DesignEditor/controls/image_sizing.xml b/app/design/frontend/Magento/plushe/Magento_DesignEditor/controls/image_sizing.xml deleted file mode 100644 index ecb7b5efbfece..0000000000000 --- a/app/design/frontend/Magento/plushe/Magento_DesignEditor/controls/image_sizing.xml +++ /dev/null @@ -1,787 +0,0 @@ - - - - - white-border - - - white-border - Magento_Catalog::product_image_white_borders - - - - - - image-sizing - - - image-type - Magento_Catalog::review_page_product_image:type - - - image-width - Magento_Catalog::review_page_product_image:width - - - image-ratio - Magento_Catalog::review_page_product_image:ratio - - - image-height - Magento_Catalog::review_page_product_image:height - - - - - - image-sizing - - - image-type - Magento_Catalog::customer_account_product_review_page:type - - - image-width - Magento_Catalog::customer_account_product_review_page:width - - - image-ratio - Magento_Catalog::customer_account_product_review_page:ratio - - - image-height - Magento_Catalog::customer_account_product_review_page:height - - - - - - image-sizing - - - image-type - Magento_Catalog::category_page_list:type - - - image-width - Magento_Catalog::category_page_list:width - - - image-ratio - Magento_Catalog::category_page_list:ratio - - - image-height - Magento_Catalog::category_page_list:height - - - - - - image-sizing - - - image-type - Magento_Catalog::category_page_grid:type - - - image-width - Magento_Catalog::category_page_grid:width - - - image-ratio - Magento_Catalog::category_page_grid:ratio - - - image-height - Magento_Catalog::category_page_grid:height - - - - - - image-sizing - - - image-type - Magento_Catalog::product_comparison_list:type - - - image-width - Magento_Catalog::product_comparison_list:width - - - image-ratio - Magento_Catalog::product_comparison_list:ratio - - - image-height - Magento_Catalog::product_comparison_list:height - - - - - - image-sizing - - - image-type - Magento_Catalog::related_products_list:type - - - image-width - Magento_Catalog::related_products_list:width - - - image-ratio - Magento_Catalog::related_products_list:ratio - - - image-height - Magento_Catalog::related_products_list:height - - - - - - image-sizing - - - image-type - Magento_Catalog::upsell_products_list:type - - - image-width - Magento_Catalog::upsell_products_list:width - - - image-ratio - Magento_Catalog::upsell_products_list:ratio - - - image-height - Magento_Catalog::upsell_products_list:height - - - - - - image-sizing - - - image-type - Magento_Catalog::product_page_main_image:type - - - image-width - Magento_Catalog::product_page_main_image:width - - - image-ratio - Magento_Catalog::product_page_main_image:ratio - - - image-height - Magento_Catalog::product_page_main_image:height - - - - - - image-sizing - - - image-type - Magento_Catalog::product_page_main_image_default:type - - - image-width - Magento_Catalog::product_page_main_image_default:width - - - image-ratio - Magento_Catalog::product_page_main_image_default:ratio - - - image-height - Magento_Catalog::product_page_main_image_default:height - - - - - - image-sizing - - - image-type - Magento_Catalog::product_page_more_views:type - - - image-width - Magento_Catalog::product_page_more_views:width - - - image-ratio - Magento_Catalog::product_page_more_views:ratio - - - image-height - Magento_Catalog::product_page_more_views:height - - - - - - image-sizing - - - image-type - Magento_Catalog::side_column_widget_product_thumbnail:type - - - image-width - Magento_Catalog::side_column_widget_product_thumbnail:width - - - image-ratio - Magento_Catalog::side_column_widget_product_thumbnail:ratio - - - image-height - Magento_Catalog::side_column_widget_product_thumbnail:height - - - - - - image-sizing - - - image-type - Magento_Catalog::new_products_content_widget_list:type - - - image-width - Magento_Catalog::new_products_content_widget_list:width - - - image-ratio - Magento_Catalog::new_products_content_widget_list:ratio - - - image-height - Magento_Catalog::new_products_content_widget_list:height - - - - - - image-sizing - - - image-type - Magento_Catalog::new_products_content_widget_grid:type - - - image-width - Magento_Catalog::new_products_content_widget_grid:width - - - image-ratio - Magento_Catalog::new_products_content_widget_grid:ratio - - - image-height - Magento_Catalog::new_products_content_widget_grid:height - - - - - - image-sizing - - - image-type - Magento_Catalog::recently_compared_products_images_names_widget:type - - - image-width - Magento_Catalog::recently_compared_products_images_names_widget:width - - - image-ratio - Magento_Catalog::recently_compared_products_images_names_widget:ratio - - - image-height - Magento_Catalog::recently_compared_products_images_names_widget:height - - - - - - image-sizing - - - image-type - Magento_Catalog::recently_viewed_products_images_names_widget:type - - - image-width - Magento_Catalog::recently_viewed_products_images_names_widget:width - - - image-ratio - Magento_Catalog::recently_viewed_products_images_names_widget:ratio - - - image-height - Magento_Catalog::recently_viewed_products_images_names_widget:height - - - - - - image-sizing - - - image-type - Magento_Catalog::recently_compared_products_images_only_widget:type - - - image-width - Magento_Catalog::recently_compared_products_images_only_widget:width - - - image-ratio - Magento_Catalog::recently_compared_products_images_only_widget:ratio - - - image-height - Magento_Catalog::recently_compared_products_images_only_widget:height - - - - - - image-sizing - - - image-type - Magento_Catalog::recently_viewed_products_images_only_widget:type - - - image-width - Magento_Catalog::recently_viewed_products_images_only_widget:width - - - image-ratio - Magento_Catalog::recently_viewed_products_images_only_widget:ratio - - - image-height - Magento_Catalog::recently_viewed_products_images_only_widget:height - - - - - - image-sizing - - - image-type - Magento_Catalog::bundled_product_customization_page:type - - - image-width - Magento_Catalog::bundled_product_customization_page:width - - - image-ratio - Magento_Catalog::bundled_product_customization_page:ratio - - - image-height - Magento_Catalog::bundled_product_customization_page:height - - - - - - image-sizing - - - image-type - Magento_Catalog::recently_compared_products_grid_content_widget:type - - - image-width - Magento_Catalog::recently_compared_products_grid_content_widget:width - - - image-ratio - Magento_Catalog::recently_compared_products_grid_content_widget:ratio - - - image-height - Magento_Catalog::recently_compared_products_grid_content_widget:height - - - - - - image-sizing - - - image-type - Magento_Catalog::recently_compared_products_list_content_widget:type - - - image-width - Magento_Catalog::recently_compared_products_list_content_widget:width - - - image-ratio - Magento_Catalog::recently_compared_products_list_content_widget:ratio - - - image-height - Magento_Catalog::recently_compared_products_list_content_widget:height - - - - - - image-sizing - - - image-type - Magento_Catalog::recently_viewed_products_grid_content_widget:type - - - image-width - Magento_Catalog::recently_viewed_products_grid_content_widget:width - - - image-ratio - Magento_Catalog::recently_viewed_products_grid_content_widget:ratio - - - image-height - Magento_Catalog::recently_viewed_products_grid_content_widget:height - - - - - - image-sizing - - - image-type - Magento_Catalog::recently_viewed_products_list_content_widget:type - - - image-width - Magento_Catalog::recently_viewed_products_list_content_widget:width - - - image-ratio - Magento_Catalog::recently_viewed_products_list_content_widget:ratio - - - image-height - Magento_Catalog::recently_viewed_products_list_content_widget:height - - - - - - image-sizing - - - image-type - Magento_Catalog::customer_shared_wishlist:type - - - image-width - Magento_Catalog::customer_shared_wishlist:width - - - image-ratio - Magento_Catalog::customer_shared_wishlist:ratio - - - image-height - Magento_Catalog::customer_shared_wishlist:height - - - - - - image-sizing - - - image-type - Magento_Catalog::wishlist_thumbnail:type - - - image-width - Magento_Catalog::wishlist_thumbnail:width - - - image-ratio - Magento_Catalog::wishlist_thumbnail:ratio - - - image-height - Magento_Catalog::wishlist_thumbnail:height - - - - - - image-sizing - - - image-type - Magento_Catalog::wishlist_sidebar_block:type - - - image-width - Magento_Catalog::wishlist_sidebar_block:width - - - image-ratio - Magento_Catalog::wishlist_sidebar_block:ratio - - - image-height - Magento_Catalog::wishlist_sidebar_block:height - - - - - - image-sizing - - - image-type - Magento_Catalog::shared_wishlist_email:type - - - image-width - Magento_Catalog::shared_wishlist_email:width - - - image-ratio - Magento_Catalog::shared_wishlist_email:ratio - - - image-height - Magento_Catalog::shared_wishlist_email:height - - - - - - image-sizing - - - image-type - Magento_Catalog::customer_account_my_tags_tag_view:type - - - image-width - Magento_Catalog::customer_account_my_tags_tag_view:width - - - image-ratio - Magento_Catalog::customer_account_my_tags_tag_view:ratio - - - image-height - Magento_Catalog::customer_account_my_tags_tag_view:height - - - - - - image-sizing - - - image-type - Magento_Catalog::cart_cross_sell_products:type - - - image-width - Magento_Catalog::cart_cross_sell_products:width - - - image-ratio - Magento_Catalog::cart_cross_sell_products:ratio - - - image-height - Magento_Catalog::cart_cross_sell_products:height - - - - - - image-sizing - - - image-type - Magento_Catalog::gift_messages_checkout_thumbnail:type - - - image-width - Magento_Catalog::gift_messages_checkout_thumbnail:width - - - image-ratio - Magento_Catalog::gift_messages_checkout_thumbnail:ratio - - - image-height - Magento_Catalog::gift_messages_checkout_thumbnail:height - - - - - - image-sizing - - - image-type - Magento_Catalog::gift_messages_checkout_small_image:type - - - image-width - Magento_Catalog::gift_messages_checkout_small_image:width - - - image-ratio - Magento_Catalog::gift_messages_checkout_small_image:ratio - - - image-height - Magento_Catalog::gift_messages_checkout_small_image:height - - - - - - image-sizing - - - image-type - Magento_Catalog::mini_cart_product_thumbnail:type - - - image-width - Magento_Catalog::mini_cart_product_thumbnail:width - - - image-ratio - Magento_Catalog::mini_cart_product_thumbnail:ratio - - - image-height - Magento_Catalog::mini_cart_product_thumbnail:height - - - - - - image-sizing - - - image-type - Magento_Catalog::new_products_images_only_widget:type - - - image-width - Magento_Catalog::new_products_images_only_widget:width - - - image-ratio - Magento_Catalog::new_products_images_only_widget:ratio - - - image-height - Magento_Catalog::new_products_images_only_widget:height - - - - - - image-sizing - - - image-type - Magento_Catalog::cart_page_product_thumbnail:type - - - image-width - Magento_Catalog::cart_page_product_thumbnail:width - - - image-ratio - Magento_Catalog::cart_page_product_thumbnail:ratio - - - image-height - Magento_Catalog::cart_page_product_thumbnail:height - - - - - - image-sizing - - - image-type - Magento_Catalog::product_stock_alert_email_product_image:type - - - image-width - Magento_Catalog::product_stock_alert_email_product_image:width - - - image-ratio - Magento_Catalog::product_stock_alert_email_product_image:ratio - - - image-height - Magento_Catalog::product_stock_alert_email_product_image:height - - - - diff --git a/app/design/frontend/Magento/plushe/Magento_DesignEditor/controls/quick_styles.xml b/app/design/frontend/Magento/plushe/Magento_DesignEditor/controls/quick_styles.xml deleted file mode 100644 index 44b5f618b18d2..0000000000000 --- a/app/design/frontend/Magento/plushe/Magento_DesignEditor/controls/quick_styles.xml +++ /dev/null @@ -1,1116 +0,0 @@ - - - - - logo - - - font - - - font-picker - - font-family - - - - - - - - - - - - - - - - - - - Magento_DesignEditor::store-name:font-picker - - - color-picker - - color - Magento_DesignEditor::store-name:color-picker - - - - - logo-uploader - - - Magento_DesignEditor::store-name:logo-uploader - - - - - background - - - color-picker - - background-color - Magento_DesignEditor::header-background:color-picker - - - background-uploader - - - image-uploader - - background-image - Magento_DesignEditor::header-background:image-uploader - - - checkbox - - background-repeat - - - - - - - - Magento_DesignEditor::header-background:tile - - - - - - - - color-picker - ul > .level-top > .submenu, - .navigation > ul > .level-top.more > .submenu > ul, - .level-top.more.hover:after, - .switcher .options > ul - ]]> - background-color - Magento_DesignEditor::menu-background - - - color-picker - - .navigation > ul > .level-top > .submenu, - .switcher .options > ul - - border-color - Magento_DesignEditor::menu-stroke - - - color-picker - ul > .level-top > .submenu a, - .navigation > ul > .level-top > .submenu a span - ]]> - color - Magento_DesignEditor::menu-links - - - color-picker - ul > .level-top > .submenu a:hover, - .navigation > ul > .level-top > .submenu a:hover span - ]]> - color - Magento_DesignEditor::menu-links-hover - - - - color-picker - ul > .level-top > a, - .navigation > ul > .level-top > a > span, - .action.showcart, - .header > .content .links a, - .switcher .options > ul a, - .action.switch - ]]> - color - Magento_DesignEditor::header-links - - - color-picker - ul > .level-top > a:hover, - .navigation > ul > .level-top > a:hover > span, - .navigation > ul > .level-top > a:active span, - .navigation > ul > .level-top > a:focus span, - .navigation > ul > .level-top.hover:hover > a span, - .navigation > ul > .level-top.hover.parent.hover > a span, - .navigation > ul > .level-top.hover.parent > a span, - .action.showcart:hover, - .action.showcart:active, - .action.showcart:focus, - .action.showcart.active, - .header > .content .links a:hover, - .switcher .options > ul a:hover, - .action.switch:focus, - .action.switch:hover, - .action.switch.active - ]]> - color - Magento_DesignEditor::header-links-hover - - - - color-picker - - .block.search input, - .block.search .action.search - - background-color - Magento_DesignEditor::search-field - - - color-picker - - .block.search input, - .block.search .action.search span, - .block.search input[type="password"]::-webkit-input-placeholder, - .block.search input[type="text"]::-webkit-input-placeholder - - color - Magento_DesignEditor::search-field-text - - - color-picker - - .block.search input, - .block.search .action.search - - border-color - Magento_DesignEditor::search-field-stroke - - - - - background - - - color-picker - .item.title:not(.disabled) > .switch:active, - .product.data > .item.title:not(.disabled) > .switch:focus, - .product.data > .item.title:not(.disabled) > .switch:hover, - .product.data > .item.title.active > .switch, - .footer - ]]> - background-color - Magento_DesignEditor::page-background:color-picker - - - background-uploader - - - image-uploader - - background-image - Magento_DesignEditor::page-background:image-uploader - - - checkbox - - background-repeat - - - - - - - - Magento_DesignEditor::page-background:tile - - - - - - - - color-picker - .opc .section > .step, - .opc.wrapper > .opc .section.active > .step-title, - .items.data tbody:nth-child(even) tr, - .cart.summary, - .minicart.wrapper .block.minicart, - .prices.tier, - .form.send.friend .fieldset, - .form.address.edit .fieldset, - .form.edit.account .fieldset, - .form.search.advanced, - .form.orders.search, - .form.contact, - .form.password.forget .fieldset, - .form.create.account .fieldset, - .form.wishlist.share .fieldset, - .block.dashboard:not(.welcome):not(.orders) .content, - .block.reviews.list .item.review:nth-child(odd), - .fieldset.bundle.options > .field, - .block.bundle.summary, - .data.table.reviews tbody tr:nth-child(even) td, - .data.table.wishlist tbody tr:nth-child(even), - .data.table.tags tbody tr:nth-child(even) td, - .data.comparison tr:nth-child(odd) .cell.attribute - ]]> - background-color - Magento_DesignEditor::form-background - - - - color-picker - .field .addon .addbefore, .fieldset > .field .addon .addafter, .product.main.info .product.options.wrapper .field .addon .addbefore, .product.main.info .product.options.wrapper .field .addon .addafter, .form.password.forget .fieldset > .field .addon .addbefore, .form.create.account .fieldset > .field .addon .addbefore, .form.password.forget .fieldset > .field .addon .addafter, .form.create.account .fieldset > .field .addon .addafter, .block.add.review .fieldset > .field:not(.ratings) .addon .addbefore, .block.add.review .fieldset > .field:not(.ratings) .addon .addafter]]> - border-color - Magento_DesignEditor::form-field-stroke - - - color-picker - - input[type="password"]:focus, - input[type="text"]:focus, - select:focus, - textarea:focus - - border-color - Magento_DesignEditor::form-field-stroke-clicked - - - color-picker - .opc .section > .step:before, - .step.login.wrapper .block.guest:before, - .order.data.items tfoot tr:first-child td, - .items.data .item.actions td:before, - .cart.summary .summary.title, - .cart.summary .block, - .data-table td, - - .data.comparison .cell.product.info, - .data.comparison .addto.links, - .data.comparison .cell.label, - .data.comparison .cell.label.product, - .data.comparison .cell.label, - .data.comparison td:last-child, - - .block.widget.viewed, - .block.crosssell, - .block.upsell, - .block.related, - .block.widget.viewed .products.list .item.product .addto.links, - .block.crosssell .products.list .item.product .addto.links, - .block.upsell .products.list .item.product .addto.links, - .block.related .products.list .item.product .addto.links, - .product.info.detailed + .block.upsell, - .product.info.detailed + .block.related, - .toolbar.alternative .pages, - .toolbar.alternative .amount, - .toolbar.alternative .limiter, - .toolbar .options, - .product.info.main .page.title.product + .price-box, - .product.info.main .product.addto.links, - .block.bundle.summary > .title, - .block.bundle.summary .photo, - .block.bundle.summary .box.tocart, - .block.bundle.summary .subtitle, - .product.photo.thumbs .item.thumb .active img, - - .login.container .block.new:before, - .block.filter .filtered .item, - .block.add.review .fieldset > .legend, - .data.table.tags tbody td, - .data.table.reviews tbody td - ]]> - border-color - Magento_DesignEditor::image-stroke-keylines - - - - - - color-picker - .menu a:hover - color - Magento_DesignEditor::radio-checkbox-icon - - - color-picker - .menu a:hover - color - Magento_DesignEditor::radio-checkbox-background - - - color-picker - .menu a:hover - color - Magento_DesignEditor::radio-checkbox-stroke - - - - color-picker - - color - Magento_DesignEditor::button-text - - - color-picker - - background-color - Magento_DesignEditor::button-background - - - color-picker - - background-color - Magento_DesignEditor::button-hover - - - color-picker - - color - Magento_DesignEditor::icons - - - color-picker - - color - Magento_DesignEditor::icons-hover - - - - - color-picker - *:first-child:before]]> - color - Magento_DesignEditor::error-icon - - - color-picker - - background-color - Magento_DesignEditor::error-box - - - - color-picker - *:first-child:before]]> - color - Magento_DesignEditor::success-icon - - - color-picker - - background-color - Magento_DesignEditor::success-box - - - - color-picker - *:first-child:before - ]]> - color - Magento_DesignEditor::notice-icon - - - color-picker - - background-color - Magento_DesignEditor::notice-box - - - - font - - - font-picker - - font-family - - - - - - - - - - - - - - - - - - - Magento_DesignEditor::banner-text:font-picker - - - color-picker - - color - Magento_DesignEditor::banner-text:color-picker - - - - - - font - - - font-picker - ul > .level-top > a, - .action.showcart .qty, - .switcher strong, - .product.name, - .toolbar .limiter select, - .toolbar .sorter select, - .navigation > ul > .level-top > .submenu > ul .level1 > a - ]]> - font-family - - - - - - - - - - - - - - - - - - - Magento_DesignEditor::menu:font-picker - - - color-picker - ul > .level-top > a, - .action.showcart .qty, - .switcher strong, - .product.name, - .toolbar .limiter select, - .toolbar .sorter select - ]]> - color - Magento_DesignEditor::menu:color-picker - - - - - font - - - font-picker - .opc .section > .step-title h2, - .column.main .block > .title - ]]> - font-family - - - - - - - - - - - - - - - - - - - Magento_DesignEditor::page-headings:font-picker - - - color-picker - .opc .section > .step-title h2, - .column.main .block > .title - ]]> - color - Magento_DesignEditor::page-headings:color-picker - - - - - - font - - - font-picker - .legend, - .column.main .block > .title - ]]> - font-family - - - - - - - - - - - - - - - - - - - Magento_DesignEditor::body-text:font-picker - - - color-picker - .legend, - .column.main .block > .title - ]]> - color - Magento_DesignEditor::body-text:color-picker - - - - - - font - - - font-picker - - font-family - - - - - - - - - - - - - - - - - - - Magento_DesignEditor::buttons:font-picker - - - color-picker - - color - Magento_DesignEditor::buttons:color-picker - - - - - - color-picker - span, - .products.wrapper.grid .products.list .secondary .action > span, - .filter a - ]]> - color - Magento_DesignEditor::text-links - - - color-picker - span, - .products.wrapper.grid .products.list .secondary .action:hover > span, - .filter a:hover - ]]> - color - Magento_DesignEditor::text-links-hover - - - - color-picker - - color - Magento_DesignEditor::small-links - - - color-picker - - color - Magento_DesignEditor::small-links-hover - - diff --git a/app/design/frontend/Magento/plushe/Magento_Reports/layout/catalog_product_view.xml b/app/design/frontend/Magento/plushe/Magento_Reports/layout/catalog_product_view.xml deleted file mode 100644 index 455dc6c5b614c..0000000000000 --- a/app/design/frontend/Magento/plushe/Magento_Reports/layout/catalog_product_view.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - widget-viewed - grid - recently_viewed_products_grid_content_widget - - - - - - - widget-viewed - grid - - - - diff --git a/app/design/frontend/Magento/plushe/Magento_Review/layout/catalog_product_view.xml b/app/design/frontend/Magento/plushe/Magento_Review/layout/catalog_product_view.xml deleted file mode 100644 index d49f0001bb6d8..0000000000000 --- a/app/design/frontend/Magento/plushe/Magento_Review/layout/catalog_product_view.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - Reviews - - - - - - - - diff --git a/app/design/frontend/Magento/plushe/Magento_Review/layout/review_product_list.xml b/app/design/frontend/Magento/plushe/Magento_Review/layout/review_product_list.xml deleted file mode 100644 index 5148d484f3f99..0000000000000 --- a/app/design/frontend/Magento/plushe/Magento_Review/layout/review_product_list.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - blank.phtml - - - - diff --git a/app/design/frontend/Magento/plushe/Magento_Theme/layout/default.xml b/app/design/frontend/Magento/plushe/Magento_Theme/layout/default.xml deleted file mode 100644 index 12e7156251cf6..0000000000000 --- a/app/design/frontend/Magento/plushe/Magento_Theme/layout/default.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - plushe - - - - - - links - - - - - - links - - - - - 1 - - - - diff --git a/app/design/frontend/Magento/plushe/Magento_Theme/layout/default_head_blocks.xml b/app/design/frontend/Magento/plushe/Magento_Theme/layout/default_head_blocks.xml deleted file mode 100644 index 1765210c64335..0000000000000 --- a/app/design/frontend/Magento/plushe/Magento_Theme/layout/default_head_blocks.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - css/styles.css - - - - - matchMedia.js - - - - - js/responsive.js - - - - - headjs/head.min.js - - - - - js/jquery.dropdowns.js - - - - - js/tabs.js - - - - - js/navigation-menu.js - - - - - js/theme.js - - - - - selectivizr.js - - lt IE 9 - - - - - diff --git a/app/design/frontend/Magento/plushe/css/print.css b/app/design/frontend/Magento/plushe/css/print.css deleted file mode 100644 index 486b06c3e45dd..0000000000000 --- a/app/design/frontend/Magento/plushe/css/print.css +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ - -* { background:none !important; text-align:left !important; } -body { background:#fff !important; font-size:9pt !important; margin:15px !important; } - -.header-container, -.footer-before-container, -.footer-container, -.widget, -.pager, -.toolbar, -.actions, -.buttons-set { display:none !important; } - -.page-print .data-table .cart-tax-total { background-position:100% -54px; } -.page-print .data-table .cart-tax-info { display:block !important; } - - - - -/* - * My Account -> My Orders - * ------------------------------------------------------------------------------ */ -.order-date { - margin-bottom: 15px; -} - -.order.details .title, -.order.details .caption { - clear: both; - margin-bottom: 15px; -} - -.order.details .title strong, -.order.details .caption strong { - line-height: 1.2; - font-weight: 200; - font-size: 20px; -} - -/* blocks */ -.order.details .block.order { - float: left; - width: 48%; - margin-bottom: 30px; - padding-right: 2%; -} -.order.details .block.order .title { - margin-bottom: 15px; -} -.order.details .block.order .title strong { - line-height: 1.2; - font-weight: 200; - font-size: 20px; -} -.order.details .block.order .content address { - font-style: normal; -} -.data.table.order.tracking { - margin: 10px 0; -} - -/* tables */ -.data.table.order { - margin-bottom: 45px; - width: 100%; -} -.data.table.order thead th { - padding: 0 10px; -} -.data.table.order thead tr:last-child th { - padding-bottom: 10px; - border-bottom: 3px solid #e5e5e5; -} -.data.table.order td.col.qty { - width: 90px; - text-align: left; -} -.data.table.order td.col.price, -.data.table.order td.col.subtotal { - text-align: left; -} -.data.table.order td { - padding: 16px 10px 10px; - vertical-align: top; -} -.data.table.order th { - text-align: left; - font-weight: 400; - font-size: 14px; - vertical-align: top; -} -.data.table.order tr:first-child th { - font-weight: 400; - font-size: 16px; -} - -/* h4 */ -.data.table.order td h4 { - margin: 0; -} - -/* .item.options */ -.data.table.order .item.options, -.data.table.order .item-options { - margin: 5px 0; -} -.data.table.order .item.options dt, -.data.table.order .item-options dt { - font-weight: 400; - display: inline; - margin-right: 10px; - float: left; - clear: left; -} -.data.table.order .item.options dt:after, -.data.table.order .item-options dt:after { - content: ': '; -} -.data.table.order .item.options dd, -.data.table.order .item-options dd { - font-weight: 200; - margin: 0 0 10px 10px; - padding: 0; -} - -/* tfoot */ -.data.table.order tfoot tr:first-child td { - border-top: 3px solid #e5e5e5; - padding-top: 15px; -} -.data.table.order.tracking th, -.data.table.order.tracking td { - padding: 0; -} \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/css/source/clearless/arrows.less b/app/design/frontend/Magento/plushe/css/source/clearless/arrows.less deleted file mode 100644 index 7a67f21bab2ab..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/clearless/arrows.less +++ /dev/null @@ -1,172 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ -.arrow(@pos, @size, @bg-color) { - width: 0; - height: 0; - border: @size solid transparent; - ._abbor_el( @pos, @bg-color ); -} - -.arrowbox(@pos, @size, @bg-color, @offset:50%) { - - @after-margin: @size * -1px; - - position: relative; - background: @bg-color; - - &:after, - &:before { - ._abpos(@pos); - border: solid transparent; - content: " "; - height: 0; - width: 0; - position: absolute; - pointer-events: none; - } - - &:after { - border-color: transparent; - ._abbor_el(@pos, @bg-color); - border-width: @size; - ._abpos_el(@pos, @size, @offset); - ._abmar_el(@pos, @after-margin); - } - -} - -.arrowbox(@pos, @size, @bg-color, @border-width, @border-color, @offset:50%) { - - @before-margin: (@size + round(@border-width * 1.41421356)) * -1px; - - .arrowbox(@pos, @size, @bg-color, @offset); - - border: @border-width solid @border-color; - - &:before { - border-color: transparent; - ._abbor_el(@pos, @border-color); - border-width: @before-margin * -1; - ._abpos_el(@pos, @size, @offset); - ._abmar_el(@pos, @before-margin); - } - -} - -._abpos( @pos ) when ( @pos = left ) { - right: 100%; -} - -._abpos( @pos ) when ( @pos = right ) { - left: 100%; -} - -._abpos( @pos ) when ( @pos = up ) { - bottom: 100%; -} - -._abpos( @pos ) when ( @pos = down ) { - top: 100%; -} - -._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = left ) { - top: @size; -} - -._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = right ) { - top: @size; -} - -._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = up ) { - left: @size; -} - -._abpos_el( @pos, @size, @offset ) when ( @offset = 0 ) and ( @pos = down ) { - left: @size; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = left ) { - top: @offset; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = right ) { - top: @offset; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = up ) { - left: @offset; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and not ( ispixel(@offset) ) and ( @pos = down ) { - left: @offset; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = left ) { - top: @offset + @size; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = right ) { - top: @offset + @size; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = up ) { - left: @offset + @size; -} - -._abpos_el( @pos, @size, @offset ) when not ( @offset = 0 ) and ( ispixel(@offset) ) and ( @pos = down ) { - left: @offset + @size; -} - -._abbor_el( @pos, @color ) when ( @pos = left ) { - border-right-color: @color; -} - -._abbor_el( @pos, @color ) when ( @pos = right ) { - border-left-color: @color; -} - -._abbor_el( @pos, @color ) when ( @pos = up ) { - border-bottom-color: @color; -} - -._abbor_el( @pos, @color ) when ( @pos = down ) { - border-top-color: @color; -} - -._abmar_el( @pos, @margin ) when ( @pos = left ) { - margin-top: @margin; -} - -._abmar_el( @pos, @margin ) when ( @pos = right ) { - margin-top: @margin; -} - -._abmar_el( @pos, @margin ) when ( @pos = up ) { - margin-left: @margin; -} - -._abmar_el( @pos, @margin ) when ( @pos = down ) { - margin-left: @margin; -} diff --git a/app/design/frontend/Magento/plushe/css/source/clearless/grids.less b/app/design/frontend/Magento/plushe/css/source/clearless/grids.less deleted file mode 100644 index bdef0f683b7e9..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/clearless/grids.less +++ /dev/null @@ -1,186 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ -// ============================================== -// Grid mixins -// ============================================== - -// You shouldn't need to touch this! Internal use only. -@column-width: 1; -@total-columns: 1; -@gutter-width: 1; -@grid-width: (@column-width*@total-columns) + (@gutter-width*(@total-columns - 1)); - -.column-wrapper() { - width: 100%; -} - -.inline-column-wrapper() when not (@using-ieclasses) { - letter-spacing: -0.31em; - *letter-spacing: normal; - word-spacing: -0.43em; -} - -.inline-column-wrapper() when (@using-ieclasses) { - letter-spacing: -0.31em; - word-spacing: -0.43em; - .ie7 & { - letter-spacing: normal; - } -} - -.column() { - float: left; - .column-gutter(); -} - -.column( @span ) when (@span = false) { - float: left; -} - -.column( @span, @total-columns:@total-columns, @end-column:false ) when (isnumber(@span)) and (isnumber(@total-columns)) and not (isnumber(@end-column)) { - @showgutter: false; - .column(@showgutter); - .span( @span, @total-columns ); -} - -.column( @span, @total-columns:@total-columns, @end-column:false ) when (isnumber(@span)) and (isnumber(@total-columns)) and (@end-column = true) { - @showgutter: false; - .column(@showgutter); - .span( @span, @total-columns ); - .end-column(); -} - -.column( @span, @end-column ) when (isnumber(@span)) and not (isnumber(@end-column)) { - @showgutter: false; - .column(@showgutter); - .span( @span ); -} - -.column( @span, @end-column ) when (isnumber(@span)) and ( @end-column = true ) { - @showgutter: false; - .column(@showgutter); - .span( @span ); - .end-column(); -} - -.inline-column() { - .inline-block(); - vertical-align: top; - letter-spacing: normal; - word-spacing: normal; - .column-gutter(); -} - -.inline-column( @span ) when (@span = false) { - .inline-block(); - vertical-align: top; - letter-spacing: normal; - word-spacing: normal; -} - -.inline-column( @span, @total-columns:@total-columns, @end-column:false ) when (isnumber(@span)) and (isnumber(@total-columns)) { - @showgutter: false; - .inline-column(@showgutter); - .span( @span, @total-columns ); -} - -.inline-column( @span, @total-columns:@total-columns, @end-column:false ) when (isnumber(@span)) and (@end-column = true) { - @showgutter: false; - .inline-column(@showgutter); - .span( @span, @total-columns ); - .inline-end-column(); -} - -.inline-column( @span, @end-column ) when not (isnumber(@end-column)) { - @showgutter: false; - .inline-column(@showgutter); - .span( @span ); -} - -.inline-column( @span, @end-column ) when (@end-column = true) { - @showgutter: false; - .inline-column(@showgutter); - .span( @span ); - .inline-end-column(); -} - -.end-column() { - margin-right: 0; - float: right; -} - -.inline-end-column() { - margin-right: 0; -} - -.span( @span ) { - .column-width(@span, @total-columns); -} - -.span( @span, @total-columns ) when (isnumber(@total-columns)) { - .column-width(@span, @total-columns); - .column-gutter(@total-columns); -} - -.pre-pad( @span, @total-columns:@total-columns ) { - @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)) / @grid-width); - padding-left: @calc-column-width; -} - -.post-pad( @span, @total-columns:@total-columns ) { - @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)) / @grid-width); - padding-right: @calc-column-width; -} - -.pre-push( @span, @total-columns:@total-columns ) { - @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)) / @grid-width); - margin-left: @calc-column-width; -} - -.post-push( @span, @total-columns:@total-columns ) { - @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)+@gutter-width) / @grid-width); - margin-right: @calc-column-width; -} - -.post-push-end( @span, @total-columns:@total-columns ) { - @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)) / @grid-width); - margin-right: @calc-column-width; -} - -.column-width(@span, @total-columns:@total-columns) { - @calc-column-width: 100%*((((@gutter-width+@column-width)*@span)-@gutter-width) / @grid-width); - width: @calc-column-width; -} - -.column-gutter(@total-columns:@total-columns, @end-column:false) when (@end-column) { - margin-right: 0; -} - -.column-gutter(@total-columns:@total-columns, @end-column:false) when not (@end-column) { - @calc-gutter-width: 100%*(@gutter-width/@grid-width); - margin-right: @calc-gutter-width; -} - - diff --git a/app/design/frontend/Magento/plushe/css/source/clearless/helpers.less b/app/design/frontend/Magento/plushe/css/source/clearless/helpers.less deleted file mode 100644 index 8014159a6722b..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/clearless/helpers.less +++ /dev/null @@ -1,248 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ -// ============================================== -// Misc helpers and shortcuts -// ============================================== - -// Shortcuts -------------------------------- - -.border-radius(@radius:5px) { - -webkit-border-radius: @arguments; - -moz-border-radius: @arguments; - border-radius: @arguments; -} - -.box-sizing(@type: border-box) { - -moz-box-sizing: @type; - -webkit-box-sizing: @type; - -ms-box-sizing: @type; - box-sizing: @type; -} - -.box-shadow(@shadow: 1px 1px 2px rgba(0,0,0,0.25)) { - -webkit-box-shadow: @shadow; - -moz-box-shadow: @shadow; - box-shadow: @shadow; -} - -.filter(@filter: grayscale(100%)) { - -webkit-filter: @filter; - -moz-filter: @filter; - -ms-filter: @filter; - -o-filter: @filter; - filter: @filter; -} - -.transition(@transition) { - -webkit-transition: @transition; - -moz-transition: @transition; - transition: @transition; -} - -.rotate(@rotation) { - -webkit-transform: rotate(@rotation); - -moz-transform: rotate(@rotation); - -o-transform: rotate(@rotation); - transform: rotate(@rotation); -} - -.placeholder(@color: #DDD) { - :-moz-placeholder { - color: @color; - } - ::-webkit-input-placeholder { - color: @color; - } -} - -#gradient { - .horizontal (@start-color, @end-color) when not (@disable-filters) { - background-color: @end-color; - background-repeat: repeat-x; - background-image: -khtml-gradient(linear, left top, right top, from(@start-color), to(@end-color)); /* Konqueror */ - background-image: -moz-linear-gradient(left, @start-color, @end-color); /* FF 3.6+ */ - background-image: -ms-linear-gradient(left, @start-color, @end-color); /* IE10 */ - background-image: -webkit-gradient(linear, left top, right top, color-stop(0%, @start-color), color-stop(100%, @end-color)); /* Safari 4+, Chrome 2+ */ - background-image: -webkit-linear-gradient(left, @start-color, @end-color); /* Safari 5.1+, Chrome 10+ */ - background-image: -o-linear-gradient(left, @start-color, @end-color); /* Opera 11.10 */ - background-image: -ms-linear-gradient(left, @start-color 0%, @end-color 100%); /* IE10+ */ - background-image: linear-gradient(left, @start-color, @end-color); /* the standard */ - filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@start-color,@end-color)); /* IE6 & IE7 */ - -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@start-color,@end-color); /* IE8+ */ - } - .horizontal (@start-color, @end-color) when (@disable-filters) { - background-color: @end-color; - background-repeat: repeat-x; - background-image: -khtml-gradient(linear, left top, right top, from(@start-color), to(@end-color)); /* Konqueror */ - background-image: -moz-linear-gradient(left, @start-color, @end-color); /* FF 3.6+ */ - background-image: -ms-linear-gradient(left, @start-color, @end-color); /* IE10 */ - background-image: -webkit-gradient(linear, left top, right top, color-stop(0%, @start-color), color-stop(100%, @end-color)); /* Safari 4+, Chrome 2+ */ - background-image: -webkit-linear-gradient(left, @start-color, @end-color); /* Safari 5.1+, Chrome 10+ */ - background-image: -o-linear-gradient(left, @start-color, @end-color); /* Opera 11.10 */ - background-image: -ms-linear-gradient(left, @start-color 0%, @end-color 100%); /* IE10+ */ - background-image: linear-gradient(left, @start-color, @end-color); /* the standard */ - } - .vertical (@start-color, @end-color) when (@disable-filters) { - background-color: @end-color; - background-repeat: repeat-x; - background-image: -khtml-gradient(linear, left top, left bottom, from(@start-color), to(@end-color)); /* Konqueror */ - background-image: -moz-linear-gradient(@start-color, @end-color); /* FF 3.6+ */ - background-image: -ms-linear-gradient(@start-color, @end-color); /* IE10 */ - background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @start-color), color-stop(100%, @end-color)); /* Safari 4+, Chrome 2+ */ - background-image: -webkit-linear-gradient(@start-color, @end-color); /* Safari 5.1+, Chrome 10+ */ - background-image: -o-linear-gradient(@start-color, @end-color); /* Opera 11.10 */ - background-image: -ms-linear-gradient(top, @start-color 0%, @end-color 100%); /* IE10+ */ - background-image: linear-gradient(@start-color, @end-color); /* the standard */ - } - .vertical (@start-color, @end-color) when not (@disable-filters) { - background-color: @end-color; - background-repeat: repeat-x; - background-image: -khtml-gradient(linear, left top, left bottom, from(@start-color), to(@end-color)); /* Konqueror */ - background-image: -moz-linear-gradient(@start-color, @end-color); /* FF 3.6+ */ - background-image: -ms-linear-gradient(@start-color, @end-color); /* IE10 */ - background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @start-color), color-stop(100%, @end-color)); /* Safari 4+, Chrome 2+ */ - background-image: -webkit-linear-gradient(@start-color, @end-color); /* Safari 5.1+, Chrome 10+ */ - background-image: -o-linear-gradient(@start-color, @end-color); /* Opera 11.10 */ - background-image: -ms-linear-gradient(top, @start-color 0%, @end-color 100%); /* IE10+ */ - background-image: linear-gradient(@start-color, @end-color); /* the standard */ - filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@start-color,@end-color)); /* IE6 & IE7 */ - -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@start-color,@end-color); /* IE8+ */ - } -} - -// Helpers -------------------------------- - -.clearfix() when not (@using-ieclasses) { - &:before, - &:after { - content: ""; - display: table; - } - &:after { - clear: both; - } - *zoom: 1; -} - -.clearfix() when (@using-ieclasses) { - &:before, - &:after { - content: ""; - display: table; - } - &:after { - clear: both; - } - .ie6 &, .ie7 & { - zoom: 1; - } -} - -.inline-block() when (@using-ieclasses) { - display: inline-block; - .ie7 & { - display: inline; - zoom: 1; - } -} - -.inline-block() when not (@using-ieclasses) { - display: inline-block; - *display: inline; - *zoom: 1; -} - -.ir() { - border: 0; - font: 0/0 a; - text-shadow: none; - color: transparent; - background-color: transparent; -} - -.hidden() { - display: none !important; - visibility: hidden; -} - -.visually-hidden() { - border: 0; - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; - &.focusable:active, - &.focusable:focus { - clip: auto; - height: auto; - margin: 0; - overflow: visible; - position: static; - width: auto; - } -} - -.size(@thesize) { - width: @thesize; - height: @thesize; -} - -.size(@width, @height) { - width: @width; - height: @height; -} - -// System -------------------------------- - -.nudge-l( @pos ) when ( @pos = 0 ) { -} - -.nudge-l( @pos ) when not ( @pos = 0 ) { - left: @pos; -} - -.nudge-r( @pos ) when ( @pos = 0 ) { -} - -.nudge-r( @pos ) when not ( @pos = 0 ) { - right: @pos; -} - -.nudge-t( @pos ) when ( @pos = 0 ) { -} - -.nudge-t( @pos ) when not ( @pos = 0 ) { - top: @pos; -} - -.nudge-b( @pos ) when ( @pos = 0 ) { -} - -.nudge-b( @pos ) when not ( @pos = 0 ) { - bottom: @pos; -} diff --git a/app/design/frontend/Magento/plushe/css/source/clearless/icons.less b/app/design/frontend/Magento/plushe/css/source/clearless/icons.less deleted file mode 100644 index 8752eec300f5f..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/clearless/icons.less +++ /dev/null @@ -1,327 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ -// ============================================== -// Generated content icon helpers -// ---------------------------------------------- -// These can only be used on block or inline-block elements. -// ============================================== - -// Non-sprited icons -------------------------------- - -.prepend-icon( @icon-image, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10px ) when (@using-modernizr) { - .generatedcontent & { - position: relative; - padding-left: @width + @pad; - } - .generatedcontent &:before { - ._generated-icon( @width, @height, @icon-image ); - top: @nudge-top; - left: @nudge-left; - } -} - -.prepend-icon( @icon-image, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10px ) when not (@using-modernizr) { - position: relative; - padding-left: @width + @pad; - &:before { - ._generated-icon( @width, @height, @icon-image ); - top: @nudge-top; - left: @nudge-left; - } -} - -.append-icon( @icon-image, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10px ) when (@using-modernizr) { - .generatedcontent & { - position: relative; - padding-right: @width + @pad; - } - .generatedcontent &:after { - ._generated-icon( @width, @height, @icon-image ); - top: @nudge-top; - right: @nudge-right; - } -} - -.append-icon( @icon-image, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10px ) when not (@using-modernizr) { - position: relative; - padding-right: @width + @pad; - .generatedcontent &:after { - ._generated-icon( @width, @height, @icon-image ); - top: @nudge-top; - right: @nudge-right; - } -} - -// Sprited icons -------------------------------- - -.prepend-sprite-icon(@x, @y, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10px, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (@using-modernizr) { - .generatedcontent & { - position: relative; - padding-left: @width + @pad; - } - .generatedcontent &:before { - ._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); - top: @nudge-top; - left: @nudge-left; - } -} - -.prepend-sprite-icon(@x, @y, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10px, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when not (@using-modernizr) { - position: relative; - padding-left: @width + @pad; - &:before { - ._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); - top: @nudge-top; - left: @nudge-left; - } -} - -.append-sprite-icon(@x, @y, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10px, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (@using-modernizr) { - .generatedcontent & { - padding-right: @width + @pad; - position: relative; - } - .generatedcontent &:after { - ._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); - top: @nudge-top; - right: @nudge-right; - } -} - -.append-sprite-icon(@x, @y, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10px, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when not (@using-modernizr) { - position: relative; - padding-right: @width + @pad; - &:after { - ._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); - top: @nudge-top; - right: @nudge-right; - } -} - -.prepend-sprite-icon-pos(@x, @y, @nudge-left:0, @nudge-top:0, @sprite-grid:@sprite-grid) when (@using-modernizr) { - .generatedcontent &:before { - .sprite-pos(@x, @y, @sprite-grid); - .nudge-l(@nudge-left); - .nudge-t(@nudge-top); - } -} - -.prepend-sprite-icon-pos(@x, @y, @nudge-left:0, @nudge-top:0, @sprite-grid:@sprite-grid) when not (@using-modernizr) { - &:before { - .sprite-pos(@x, @y, @sprite-grid); - .nudge-l(@nudge-left); - .nudge-t(@nudge-top); - } -} - -.append-sprite-icon-pos(@x, @y, @nudge-right:0, @nudge-top:0, @sprite-grid:@sprite-grid) when (@using-modernizr) { - .generatedcontent &:after { - .sprite-pos(@x, @y, @sprite-grid); - .nudge-r(@nudge-right); - .nudge-t(@nudge-top); - } -} - -.append-sprite-icon-pos(@x, @y, @nudge-right:0, @nudge-top:0, @sprite-grid:@sprite-grid) when not (@using-modernizr) { - &:after { - .sprite-pos(@x, @y, @sprite-grid); - .nudge-r(@nudge-right); - .nudge-t(@nudge-top); - } -} - -// ---- Partials ----------------------- - -.prepend-icon-setup(@width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when (@using-modernizr) { - .generatedcontent & { - position: relative; - ._pad-left(@width, @pad); - } - .generatedcontent &:before { - position: absolute; - display: block; - content: ' '; - top: 0; - left: 0; - ._size(@width, @height); - } -} - -.prepend-icon-setup(@width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when not (@using-modernizr) { - position: relative; - ._pad-left(@width, @pad); - &:before { - position: absolute; - display: block; - content: ' '; - top: 0; - left: 0; - ._size(@width, @height); - } -} - -.append-icon-setup(@width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when (@using-modernizr) { - .generatedcontent & { - position: relative; - ._pad-right(@width, @pad); - } - .generatedcontent &:after { - position: absolute; - display: block; - content: ' '; - top: 0; - right: 0; - ._size(@width, @height); - } -} - -.append-icon-setup(@width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when not (@using-modernizr) { - position: relative; - ._pad-right(@width, @pad); - &:after { - position: absolute; - display: block; - content: ' '; - top: 0; - right: 0; - ._size(@width, @height); - } -} - -.prepend-icon-image(@icon-image, @width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when (@using-modernizr) { - ._gc-pad-left(@width, @pad); - .generatedcontent &:before { - background: url(@icon-image) no-repeat 0 0; - ._size(@width, @height); - .nudge-l(@nudge-left); - .nudge-t(@nudge-top); - } -} - -.prepend-icon-image(@icon-image, @width:0, @height:0, @nudge-left:0, @nudge-top:0, @pad:10px) when not (@using-modernizr) { - ._pad-left(@width, @pad); - &:before { - background: url(@icon-image) no-repeat 0 0; - ._size(@width, @height); - .nudge-l(@nudge-left); - .nudge-t(@nudge-top); - } -} - -.append-icon-image(@icon-image, @width:0, @height:0, @nudge-right:0, @nudge-top:0, @pad:10px) when (@using-modernizr) { - ._gc-pad-right(@width, @pad); - .generatedcontent &:after { - background: url(@icon-image) no-repeat 0 0; - ._size(@width, @height); - .nudge-r(@nudge-right); - .nudge-t(@nudge-top); - } -} - -.append-icon-image(@icon-image, @width:0, @height:0, @nudge-right:0, @nudge-top:0, @pad:10px) when not (@using-modernizr) { - ._pad-right(@width, @pad); - &:after { - background: url(@icon-image) no-repeat 0 0; - ._size(@width, @height); - .nudge-r(@nudge-right); - .nudge-t(@nudge-top); - } -} - -// ---- internal use mixins ----------------------- - -._generated-icon(@width, @height, @icon-image) { - position: absolute; - display: block; - content: ' '; - background: url(@icon-image) no-repeat 0 0; - .size(@width, @height); -} - -._generated-sprite-icon(@x, @y, @width, @height, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) { - position: absolute; - display: block; - content: ' '; - .sprite-sized(@x, @y, @width, @height, @sprite-image, @sprite-grid); -} - -._pad-left(@width, @pad) when (@width = 0) { -} - -._pad-left(@width, @pad) when not (@width = 0) { - padding-left: @width + @pad; -} - -._pad-right(@width, @pad) when (@width = 0) { -} - -._pad-right(@width, @pad) when not (@width = 0) { - padding-right: @width + @pad; -} - -._gc-pad-left(@width, @pad) when (@width = 0) { -} - -._gc-pad-right(@width, @pad) when (@width = 0) { -} - -._gc-pad-left(@width, @pad) when not (@width = 0) and (@using-modernizr) { - .generatedcontent & { - ._pad-left(@width, @pad); - } -} - -._gc-pad-left(@width, @pad) when not (@width = 0) and not (@using-modernizr) { - ._pad-left(@width, @pad); -} - -._gc-pad-right(@width, @pad) when not (@width = 0) { - .generatedcontent & { - ._pad-right(@width, @pad); - } -} - -._gc-pad-right(@width, @pad) when not (@width = 0) and not (@using-modernizr) { - ._pad-right(@width, @pad); -} - -._size(@width, @height) when (@width = 0) and (@height = 0) { -} - -._size(@width, @height) when (@width = 0) and not (@height = 0) { - height: @height; -} - -._size(@width, @height) when not (@width = 0) and (@height = 0) { - width: @width; -} - -._size(@width, @height) when not (@width = 0) and not (@height = 0) { - width: @width; - height: @height; -} - - - diff --git a/app/design/frontend/Magento/plushe/css/source/clearless/resets.less b/app/design/frontend/Magento/plushe/css/source/clearless/resets.less deleted file mode 100644 index f48ac3b70fc40..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/clearless/resets.less +++ /dev/null @@ -1,307 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ -.normalize() { - - /* normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */ - - article, - aside, - details, - figcaption, - figure, - footer, - header, - hgroup, - nav, - section, - summary { - display: block; - } - audio, - canvas, - video { - display: inline-block; - *display: inline; - *zoom: 1; - } - audio:not([controls]) { - display: none; - height: 0; - } - [hidden] { - display: none; - } - html { - font-size: 100%; - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; - } - html, - button, - input, - select, - textarea { - font-family: sans-serif; - } - body { - margin: 0; - } - a:focus { - outline: thin dotted; - } - a:hover, - a:active { - outline: 0; - } - h1 { - font-size: 2em; - margin: 0.67em 0; - } - h2 { - font-size: 1.5em; - margin: 0.83em 0; - } - h3 { - font-size: 1.17em; - margin: 1em 0; - } - h4 { - font-size: 1em; - margin: 1.33em 0; - } - h5 { - font-size: 0.83em; - margin: 1.67em 0; - } - h6 { - font-size: 0.75em; - margin: 2.33em 0; - } - abbr[title] { - border-bottom: 1px dotted; - } - b, - strong { - font-weight: bold; - } - blockquote { - margin: 1em 40px; - } - dfn { - font-style: italic; - } - mark { - background: #ff0; - color: #000; - } - p, - pre { - margin: 1em 0; - } - pre, - code, - kbd, - samp { - font-family: monospace, serif; - _font-family: 'courier new', monospace; - font-size: 1em; - } - pre { - white-space: pre; - white-space: pre-wrap; - word-wrap: break-word; - } - q { - quotes: none; - } - q:before, - q:after { - content: ''; - content: none; - } - small { - font-size: 75%; - } - sub, - sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; - } - sup { - top: -0.5em; - } - sub { - bottom: -0.25em; - } - dl, - menu, - ol, - ul { - margin: 1em 0; - } - dd { - margin: 0 0 0 40px; - } - menu, - ol, - ul { - padding: 0 0 0 40px; - } - nav ul, - nav ol { - list-style: none; - list-style-image: none; - } - img { - border: 0; - -ms-interpolation-mode: bicubic; - } - svg:not(:root) { - overflow: hidden; - } - figure { - margin: 0; - } - form { - margin: 0; - } - fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; - } - legend { - border: 0; - padding: 0; - white-space: normal; - *margin-left: -7px; - } - button, - input, - select, - textarea { - font-size: 100%; - margin: 0; - vertical-align: baseline; - *vertical-align: middle; - } - button, - input { - line-height: normal; - } - button, - input[type="button"], - input[type="reset"], - input[type="submit"] { - cursor: pointer; - -webkit-appearance: button; - *overflow: visible; - } - button[disabled], - input[disabled] { - cursor: default; - } - input[type="checkbox"], - input[type="radio"] { - box-sizing: border-box; - padding: 0; - *height: 13px; - *width: 13px; - } - input[type="search"] { - -webkit-appearance: textfield; - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; - box-sizing: content-box; - } - input[type="search"]::-webkit-search-decoration, - input[type="search"]::-webkit-search-cancel-button { - -webkit-appearance: none; - } - button::-moz-focus-inner, - input::-moz-focus-inner { - border: 0; - padding: 0; - } - textarea { - overflow: auto; - vertical-align: top; - } - table { - border-collapse: collapse; - border-spacing: 0; - } -} - -.reset() { - - /* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */ - - html, body, div, span, applet, object, iframe, - h1, h2, h3, h4, h5, h6, p, blockquote, pre, - a, abbr, acronym, address, big, cite, code, - del, dfn, em, img, ins, kbd, q, s, samp, - small, strike, strong, sub, sup, tt, var, - b, u, i, center, - dl, dt, dd, ol, ul, li, - fieldset, form, label, legend, - table, caption, tbody, tfoot, thead, tr, th, td, - article, aside, canvas, details, embed, - figure, figcaption, footer, header, hgroup, - menu, nav, output, ruby, section, summary, - time, mark, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; - } - article, aside, details, figcaption, figure, - footer, header, hgroup, menu, nav, section { - display: block; - } - body { - line-height: 1; - } - ol, ul { - list-style: none; - } - blockquote, q { - quotes: none; - } - blockquote:before, blockquote:after, - q:before, q:after { - content: ''; - content: none; - } - table { - border-collapse: collapse; - border-spacing: 0; - } - -} \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/css/source/clearless/settings.less b/app/design/frontend/Magento/plushe/css/source/clearless/settings.less deleted file mode 100644 index 992b3e18fca6b..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/clearless/settings.less +++ /dev/null @@ -1,50 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ -// ============================================== -// ClearLess default settings -// ---------------------------------------------- -// Override on a per-project basis as required. -// ============================================== - -// General -------------------------------- - -@using-ieclasses: true; // whether or not the markup has html5-boilerplate style IE classes in it or not -@using-modernizr: false; // whether or not modernizer feature-detection classes are being used -@disable-filters: true; // whether or not to disable MS-specific 'filter' properties (can make IE slow!) - -// Typography -------------------------------- - -@base-font-size: 16; // base pixel font size. Used as a default for px -> (r)em conversions - -// Sprites -------------------------------- - -@sprite-image: '/example.png'; -@sprite-grid: 50px; - -// Grid -------------------------------- - -@total-columns: 12; -@column-width: 60px; -@gutter-width: 20px; diff --git a/app/design/frontend/Magento/plushe/css/source/clearless/sprites.less b/app/design/frontend/Magento/plushe/css/source/clearless/sprites.less deleted file mode 100644 index ad52dd959c56b..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/clearless/sprites.less +++ /dev/null @@ -1,75 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ -// ============================================== -// Sprite helpers -// ============================================== - -.sprite(@x, @y, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) { - .sprite-image(@sprite-image); - .sprite-pos(@x, @y, @sprite-grid); -} - -.sprite-sized(@x, @y, @size, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when not (isnumber(@sprite-image)) { - .sprite(@x, @y, @sprite-image, @sprite-grid); - .size(@size); -} - -.sprite-sized(@x, @y, @width, @height, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (isnumber(@height)) { - .sprite(@x, @y, @sprite-image, @sprite-grid); - .size(@width,@height); -} - -.sprite-ir(@x, @y, @size, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when not (isnumber(@sprite-image)) { - .ir(); - .sprite(@x, @y, @sprite-image, @sprite-grid); - .size(@size); -} - -.sprite-ir(@x, @y, @width, @height, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (isnumber(@height)) { - .ir(); - .sprite(@x, @y, @sprite-image, @sprite-grid); - .size(@width,@height); -} - -.sprite-image(@sprite-image:@sprite-image) { - background-image: url(@sprite-image); - background-repeat: no-repeat; -} - -.sprite-pos(@x, @y, @sprite-grid:@sprite-grid) { - background-position: -(@x*@sprite-grid*1px) -(@y*@sprite-grid*1px); -} - -.sprite-pos-sized(@x, @y, @size, @sprite-grid:@sprite-grid) when not (isnumber(@sprite-image)) { - .sprite-pos(@x, @y, @sprite-grid); - .size(@size); -} - -.sprite-pos-sized(@x, @y, @width, @height, @sprite-grid:@sprite-grid) when (isnumber(@height)) { - .sprite-pos(@x, @y, @sprite-grid); - .size(@width,@height); -} - - diff --git a/app/design/frontend/Magento/plushe/css/source/clearless/typography.less b/app/design/frontend/Magento/plushe/css/source/clearless/typography.less deleted file mode 100644 index 261ae7900724f..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/clearless/typography.less +++ /dev/null @@ -1,66 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ -// ============================================== -// Typography related mixins -// ============================================== - -.font-size-rems(@px-size) { - @rem-size: @px-size / @base-font-size; - font-size: ~"@{px-size}px"; - font-size: ~"@{rem-size}rem"; -} - -.font-size-ems(@target-px-size, @context-px-size:@base-font-size) { - font-size: (@target-px-size / @context-px-size) * 1em; -} - -.font-face( @family-name, @font-path, @font-weight:normal, @font-style:normal, @include-svg:false ) when not (@include-svg) { - @font-face { - font-family: @family-name; - src: url('@{font-path}.eot'); - src: url('@{font-path}.eot?#iefix') format('embedded-opentype'), url('@{font-path}.woff') format('woff'), url('@{font-path}.ttf') format('truetype'); - font-weight: @font-weight; - font-style: @font-style; - } -} - -.font-face( @family-name, @font-path, @font-weight:normal, @font-style:normal, @include-svg:false ) when (@include-svg) { - @font-face { - font-family: @family-name; - src: url('@{font-path}.eot'); - src: url('@{font-path}.eot?#iefix') format('embedded-opentype'), url('@{font-path}.woff') format('woff'), url('@{font-path}.ttf') format('truetype'), url('@{font-path}.svg#@{family-name}') format('svg'); - font-weight: @font-weight; - font-style: @font-style; - } -} - -.wrap-words() { - -ms-word-break: break-all; - word-break: break-all; - word-break: break-word; - -webkit-hyphens: auto; - -moz-hyphens: auto; - hyphens: auto; -} \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/css/source/lib/buttons.less b/app/design/frontend/Magento/plushe/css/source/lib/buttons.less deleted file mode 100644 index 488d3a1cecc03..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/lib/buttons.less +++ /dev/null @@ -1,136 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// # Primary buttons -// -// Buttons that performs primary action ([read design and usability article](http://linktousabilityarticle.com/)) -// -// ```html -//

Some text here

-// -// -// -// ``` -// - -.action.myPrimary { - &:extend(.primary.action all); -} - -.primary.action { - &:extend(.button.action all); - background-color: @primaryActionBg; - color: @primaryActionColor; - &:focus, - &:active, - &:hover { - background-color: @primaryActionBgH; - } -} - -// # Secondary buttons -// -// Buttons that performs secondary action ([read design and usability article](http://linktousabilityarticle.com/)) -// -// ```html -// -// -// -// ``` -// - -.action.mySecondary { - &:extend(.secondary.action all); -} - -.secondary.action { - &:extend(.button.action all); - background-color: @secondaryActionBg; - color: @secondaryActionColor; - &:focus, - &:active, - &:hover { - background-color: @secondaryActionBgH; - } -} - -// # Buttons displayed as links -// Buttons that are displayed as links -// -// ```html -// -// -// -// ``` -// - -.action.myLink { - &:extend(.button.link all); -} - -.button.link { - background: none; - border: 0; - display: inline; - color: @link; - margin: 0; - padding: 0; - text-decoration: underline; - &:focus, - &:active, - &:hover { - color: @linkHover; - text-decoration: none; - } -} - -// # Initial styling for button - -.button.action { - border: none; - border-radius: 0; - font: @actionFont; - text-transform: uppercase; - margin: 0; - padding: 9px 11px 9px; - box-shadow: none; - text-shadow: none; - outline: none; - text-decoration: none; -} - -// Buttons Initial Variables - -//@primaryActionBg:; -//@primaryActionBgH:; -//@primaryActionColor:; -//@secondaryActionBg:; -//@secondaryActionBgH:; -//@secondaryActionColor:; -//@actionFont:; - -.action + .action { - margin-left: 5px; -} diff --git a/app/design/frontend/Magento/plushe/css/source/lib/forms.less b/app/design/frontend/Magento/plushe/css/source/lib/forms.less deleted file mode 100644 index 9a5e8e71fd208..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/lib/forms.less +++ /dev/null @@ -1,817 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -.hasRequired { - &:after { - content: attr(data-hasrequired); - display: block; - font-size: @baseFontSize; - margin: 10px 0 0; - color: @requiredField; - letter-spacing: normal; - word-spacing: normal; - } -} - -.load.indicator { - display: inline-block; - margin: 20px auto; - padding: 8px; - vertical-align: middle; - span { - display: block; - line-height: 16px; - &:before { - content: ''; - margin-right: 5px; - display: inline-block; - width: 16px; - height: 16px; - background: url("@{baseDir}/images/loader.gif") no-repeat 0 0; - background-color: @secondary1; - vertical-align: top; - } - } -} - -// #Forms -// -// ```html -//
-//
-// Legend -//
-//
-// -//
-// -//
-//
-// -// -// -//
-// -//
-// -//
-//
-// -//
-// -//
-// -//
-//
-// -// -// -//
-// -//
-// -//
-//
-// -//
-// -//
-// -//
-//
-// -//
-// -//
-// -//
-//
-//
-//
-// -//
-//
-//
-//
-// -//
-// -//
-// -//
This is a note to a text field
-//
-//
-// -//
-// -//
-//
-//
-//
-// -//
-//
-//
-//
-//
-// -// -//
-//
-//
-//
-//
-//
-// -//
-// -//
-//
-//
-//
-// -//
-//
-//
-//
-// -//
-//
-//
-//
-//
-// -//
-// -//
-// -//
-//
-// -//
-// -// -//
-// -//
-// -// -//
-// -//
-// -//
-// -//
-//
-// -//
-// -//
-// -//
-//
-// -//
-// -//
-// -//
-//
-//
-// -//
-// -// -// -//
-// -// Loading indicator... -// -// -// ``` -// - -.form { - .actions { - margin-right: 10px; - text-align: right; - } -} - -.fieldset { - .formFieldset(); - > .field { - .formField(); - } - .fields.range { - .field { - display: inline-block; - letter-spacing: normal; - margin: 0; - vertical-align: top; - word-spacing: normal; - &:first-child { - .control { - .box-sizing(); - padding-right: 30px; - &:after { - content: '\2014'; - display: inline-block; - margin-right: -30px; - text-align: center; - width: 29px; - } - } - input { - width: 98%; - } - } - } - } - .fields.dates { - .field { - display: inline-block; - letter-spacing: normal; - margin: 0 25px 0 0; - padding: 0 34px 0 0; - position: relative; - vertical-align: top; - &:first-child { - margin: 0 30px 0 0; - .control { - .box-sizing(); - &:after { - content: '\2014'; - display: inline-block; - position: absolute; - right: -39px; - top: 7px; - width: 29px; - } - } - } - .ui-datepicker-trigger { - text-decoration: none; - position: absolute; - right: 0; - top: 9px; - &:extend(.button.link all); - } - } - } -} - -input[type="text"], -input[type="search"], -input[type="tel"], -input[type="url"], -input[type="email"], -input[type="datetime"], -input[type="password"], -input[type="number"] { - .inputText(); -} - -input[type="submit"], -input[type="button"] { - &:extend(.primary.action all); -} - -input[type="reset"] { - &:extend(.secondary.action all); -} - -input[type=number]::-webkit-inner-spin-button, -input[type=number]::-webkit-outer-spin-button { - -webkit-appearance: none; - margin: 0; -} - -select { - .controlStyling(); - padding: 5px 10px 4px; - &.multiselect { - height: auto; - } -} - -textarea { - .controlStyling(); - height: auto; - line-height: 1.2; - min-height: 4.8em; - padding: 10px; - resize: vertical; -} - -// #Form validation -// Required field marked with '*' symbol -// -// Validation passed hilighting -// -// Validation error hilight and validation error message -// -// '* Required fields' text -// -// ```html -//
-//
-//
-// -//
-// -//
-//
-// -//
-// -//
-// -//
-//
-// -//
-// -//
-// -//
This is a required field.
-//
-//
-//
-// -// ``` -// - -.fieldset { - // Validation passed - textarea.valid, - select.valid, - input[type="text"].valid, - input[type="search"].valid, - input[type="tel"].valid, - input[type="url"].valid, - input[type="email"].valid, - input[type="datetime"].valid, - input[type="password"].valid, - input[type="number"].valid { - border-color: @validHilight !important; - } - // Validation error - textarea.mage-error, - select.mage-error, - input[type="text"].mage-error, - input[type="search"].mage-error, - input[type="tel"].mage-error, - input[type="url"].mage-error, - input[type="email"].mage-error, - input[type="datetime"].mage-error, - input[type="password"].mage-error, - input[type="number"].mage-error { - border-color: @nonValidHilight !important; - } - div.mage-error[generated] { - color: @nonValidHilight !important; - font-size: @baseFontSizeMiddle; - padding-top: 4px; - } -} - -.form.validation { - .fieldset { - margin: 20px 0; - } - &:extend(.hasRequired all); -} - -// #Form fields arranged to columns -// -// ```html -//
-//
-// Some Settings -//
-// -//
-// -//
-// -//
-//
-// -//
-// -//
-// -//
-//
-// -//
-// -//
-// -//
-//
-// -//
-// -//
-// -//
-//
-// -//
-// -//
-// -//
-//
-//
-//
-// -//
-//
-//
-//
-// -//
-// -//
-// -//
-//
-// -//
-// -//
-// -//
Please enter your message here
-//
-//
-// -//
-// -//
-// -//
-//
-//
-//
-// -//
-// -// ``` -// - -.form.settings { - .formCols(); - .action.submit { - &:extend(.primary.action all); - } -} - -// #Datepicker custom styles -@datepickerArrows: @secondary1; -@datepickerArrowsHover: darken(@datepickerArrows, 10%); -@datepickerTextColor: #000; -@datepickerBg: #efefef; -@datepickerBorder: #fff; -@datepickerShadow: rgba(0, 0, 0, 0.35); -@datepickerCalendarBg: #fff; -@datepickerCalendarBorder: #cfcfcf; -@datepickerCalendarHover: #f9eae7; -@datepickerCalendarToday: #f3d7d2; -@datepickerCalendarActive: lighten(@secondary1, 20%); -@datepickerDisabledBg: #f9f9f9; -@datepickerDisable: #959595; - -.ui-datepicker { - background: @datepickerBg; - border: 4px solid @datepickerBorder; - box-shadow: 5px 5px 10px 0 @datepickerShadow; - .box-sizing(); - display: none; - padding: 15px; - width: auto; - z-index: 999999 !important; - .ui-datepicker-header { - position: relative; - padding: .2em 0; - } - .ui-datepicker-prev, - .ui-datepicker-next { - position: absolute; - top: 2px; - width: 1.8em; - height: 1.8em; - cursor: pointer; - span { - border: solid; - display: block; - font-size: 0; - margin-top: -5px; - position: absolute; - left: 50%; - top: 50%; - width: 0; - height: 0; - } - } - .ui-datepicker-prev { - left: 2px; - span { - margin-left: -8px; - border-width: 5px 8px 5px 0; - border-color: transparent @datepickerArrows transparent transparent; - } - &.ui-datepicker-prev-hover span { - border-color: transparent @datepickerArrowsHover transparent transparent; - } - } - .ui-datepicker-next { - right: 2px; - span { - margin-left: 0; - border-width: 5px 0 5px 8px; - border-color: transparent transparent transparent @datepickerArrows; - } - &.ui-datepicker-next-hover span { - border-color: transparent transparent transparent @datepickerArrowsHover; - } - } - .ui-datepicker-title { - margin: 0 2.3em; - line-height: 1.8em; - text-align: center; - select { - margin: 1px 0; - padding: 0; - } - .ui-datepicker-month, - .ui-datepicker-year { - width: 47%; - } - .ui-datepicker-month { - margin-right: 6%; - } - .ui-datepicker-month-year { - width: 100%; - } - } - table { - width: 100%; - font-size: @baseFontSizeMiddle; - } - th { - font-size: @baseFontSizeMiddle; - } - td { - padding: 0; - } - td span, - td a { - color: @datepickerTextColor; - display: block; - line-height: 14px; - padding: 4px; - text-align: right; - text-decoration: none; - } - .ui-datepicker-buttonpane { - overflow: hidden; - padding-top: 10px; - button { - float: right; - &.ui-datepicker-current { - float: left; - } - } - } - .ui-datepicker-calendar { - background: @datepickerCalendarBg; - border: 1px solid @datepickerCalendarBorder; - th { - background: @datepickerBg; - border: 1px solid @datepickerCalendarBorder; - padding: 4px; - text-transform: uppercase; - } - td { - border: 1px solid @datepickerCalendarBorder; - } - td a { - padding: 4px; - display: block; - } - td .ui-state-hover:hover { - background: @datepickerCalendarHover; - } - .ui-datepicker-week-col { - text-align: center; - border: 1px solid @datepickerCalendarBorder; - } - .ui-datepicker-today { - background: @datepickerCalendarToday; - } - .ui-state-active { - background: @datepickerCalendarActive; - } - .ui-state-disabled { - background: @datepickerDisabledBg; - span { - color: @datepickerDisable; - } - } - } -} - -.ui-datepicker-rtl { - direction: rtl; - .ui-datepicker-prev { - right: 2px; - left: auto; - &:hover { - right: 1px; - left: auto; - } - } - .ui-datepicker-next { - left: 2px; - right: auto; - &:hover { - left: 1px; - right: auto; - } - } - .ui-datepicker-buttonpane { - clear: right; - button { - float: left; - &.ui-datepicker-current { - float: right; - } - } - } - .ui-datepicker-group { - float: right; - } - .ui-datepicker-group-last .ui-datepicker-header { - border-right-width: 0; - border-left-width: 1px; - } - .ui-datepicker-group-middle .ui-datepicker-header { - border-right-width: 0; - border-left-width: 1px; - } -} - -.ui-timepicker-div { - padding: 10px 0 5px 0; - .ui-widget-header { - margin-bottom: 8px; - } - dl { - text-align: left; - dt { - height: 25px; - margin-bottom: -22px; - } - dd { - margin: 0 10px 10px 65px; - } - .ui_tpicker_time_label { - margin-bottom: -25px; - } - } - td { - font-size: 90%; - } -} - -.ui-tpicker-grid-label { - background: none; - border: none; - margin: 0; - padding: 0; -} - -.ui-slider { - position: relative; - text-align: left; - .ui-slider-handle { - position: absolute; - z-index: 2; - cursor: default; - } -} - -.ui-slider-horizontal { - border-radius: 10px; - border: none; - background: @datepickerBg; - height: 10px; - .ui-slider-handle { - margin-left: -5px; - height: 10px; - width: 10px; - border-radius: 10px; - background: @datepickerArrows; - display: block; - position: absolute; - } -} - -/* Field with multiple fields */ - -.fields.group { - letter-spacing: -0.31em; /* webkit */ - *letter-spacing: normal; /* reset IE < 8 */ - word-spacing: -0.43em; /* IE < 8 && gecko */ - margin-right: -20px; - & > * { - letter-spacing: normal; - word-spacing: normal; - } - .field { - .box-sizing(); - vertical-align:top; - margin:0!important; - .label { width:auto; float:none; text-align: left; padding-right:0; } - .control { float:none; width:auto; } - } - &.group-2 .field { - width:50%!important; - display:inline-block; - } - &.group-3 .field { - width:33.3%!important; - display:inline-block; - } - &.group-4 .field { - width:25%!important; - display:inline-block; - } - &.group-5 .field { - width:20%!important; - display:inline-block; - } -} diff --git a/app/design/frontend/Magento/plushe/css/source/lib/grids.less b/app/design/frontend/Magento/plushe/css/source/lib/grids.less deleted file mode 100644 index c65a03b7797fa..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/lib/grids.less +++ /dev/null @@ -1,384 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// # 1. Grid using floated columns -// Full documentation about grid usage: https://github.com/clearleft/clearless#grids -// -// # 1.1 One column -// -// ```html -//
-//
column
-//
-// ``` -// - -.clearlessgrid1 { - .column-wrapper(); - > .grid-1 { - .column(); - .span(12); - .end-column(); - } -} - -// # 1.2 One main column and one right sidebar -// -// ```html -//
-//
column
-// -//
-// ``` -// - -.clearlessgrid2 { - .column-wrapper(); - .main { - .column(); - .span(9); - } - .sidebar { - .column(); - .span(3); - .end-column(); - } -} - -// # 1.3 One main column and one left sidebar -// -// ```html -//
-// -//
column
-//
-// ``` -// - -.clearlessgrid3 { - .column-wrapper(); - .main { - .column(); - .span(9); - .end-column(); - } - .sidebar { - .column(); - .span(3); - } -} - -// # 1.4 One main column and two sidebars -// -// ```html -//
-//
column
-//
column
-//
column
-//
-// ``` -// - -.clearlessgrid4 { - .column-wrapper(); - .main { - .column(); - .span(6); - } - .sidebar1, - .sidebar2 { - .column(); - .span(3); - } - .sidebar2 { - .end-column(); - } -} - -// # 1.5 Four columns -// -// ```html -//
-//
column
-//
column
-//
column
-//
column
-//
-// ``` -// - -.clearlessgrid5 { - .column-wrapper(); - > .grid-1 { - .column(); - .span(3); - &:last-child { - .end-column(); - } - } -} - -// # 1.6 Six columns -// -// ```html -//
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
-// ``` -// - -.clearlessgrid6 { - .column-wrapper(); - > .grid-1 { - .column(); - .span(2); - &:last-child { - .end-column(); - } - } -} - -// # 1.7 Twelve columns -// -// ```html -//
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
-// ``` -// - -.clearlessgrid12 { - .column-wrapper(); - > .grid-1 { - .column(); - .span(1); - &:last-child { - .end-column(); - } - } -} - -// # 2. Grid columns using display: inline-block -// -// # 2.1 One column -// -// ```html -//
-//
column
-//
-// ``` -// - -.inlinegrid1 { - .inline-column-wrapper(); - > .grid-1 { - .inline-column(); - .span(12); - .inline-end-column(); - } -} - -// # 2.2 One main column and two right sidebar -// -// ```html -//
-//
column
-// -//
-// ``` -// - -.inlinegrid2 { - .inline-column-wrapper(); - .main { - .inline-column(); - .span(9); - } - .sidebar { - .inline-column(); - .span(3); - .inline-end-column(); - } -} - -// # 2.3 One main column and one left sidebar -// -// ```html -//
-// -//
column
-//
-// ``` -// - -.inlinegrid3 { - .inline-column-wrapper(); - .main { - .inline-column(); - .span(9); - .inline-end-column(); - } - .sidebar { - .inline-column(); - .span(3); - } -} - -// # 2.4 One main column and two sidebars -// -// ```html -//
-//
column
-//
column
-//
column
-//
-// ``` -// - -.inlinegrid4 { - .inline-column-wrapper(); - .main { - .inline-column(); - .span(6); - } - .sidebar1, - .sidebar2 { - .inline-column(); - .span(3); - } - .sidebar2 { - .inline-end-column(); - } -} - -// # 2.5 Four columns -// -// ```html -//
-//
column
-//
column
-//
column
-//
column
-//
-// ``` -// - -.inlinegrid5 { - .inline-column-wrapper(); - > .grid-1 { - .inline-column(); - .span(3); - &:last-child { - .inline-end-column(); - } - } -} - -// # 2.6 Six columns -// -// ```html -//
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
-// ``` -// - -.inlinegrid6 { - .inline-column-wrapper(); - > .grid-1 { - .inline-column(); - .span(2); - &:last-child { - .inline-end-column(); - } - } -} - -// # 2.7 Twelve columns -// -// ```html -//
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
column
-//
-// ``` -// - -.inlinegrid12 { - .inline-column-wrapper(); - > .grid-1 { - .inline-column(); - .span(1); - &:last-child { - .inline-end-column(); - } - } -} - -// #Common settings - -@total-columns: 12; -@column-width: 60px; -@gutter-width: 20px; - -.gridwrapper > div, -.inlinegridwrapper > div { - background: #e5e5e5; - border: 1px solid #999; - padding: 5px 0; - text-align: center; - .box-sizing(); -} diff --git a/app/design/frontend/Magento/plushe/css/source/lib/icons.less b/app/design/frontend/Magento/plushe/css/source/lib/icons.less deleted file mode 100644 index b641292097d04..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/lib/icons.less +++ /dev/null @@ -1,73 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -.example.icon { - display: inline-block; - margin: 0 0 16px; - width: 20%; - text-align: center; - .iconBefore("", 32px, 0 0 10px 0, 'icons'); - &:before { - content: attr(data-icon); - display: block; - } - &:hover { - color: @secondary2; - } -} - -// #iconBefore -//Add an icon *before* the specified element -// -//**.iconBefore(["content"], [height], [margin], ["font"]);** -// ``` -// My Cart -// ``` -.action.showcart1 { - .iconBefore(@icon-cart, 16px, 0 5px 0 0, "icons"); -} - -// #iconAfter -//Add an icon *after* the specified element -// -//**.iconAfter(["content"], [height], [margin], ["font"]);** -// ``` -// My Cart -// ``` -.action.showcart2 { - .iconAfter(@icon-cart, 16px, 0 0 0 10px, "icons"); -} - -// #iconHideText -//Hide the text to the specified element (not hide the icon) -// -//**.iconHideText([limitWidth]);** -// ``` -// My Cart -// ``` -.action.showcart3 { - .iconAfter(@icon-cart, 16px, 10px,"icons"); - .iconHideText(16px); -} diff --git a/app/design/frontend/Magento/plushe/css/source/lib/messages.less b/app/design/frontend/Magento/plushe/css/source/lib/messages.less deleted file mode 100644 index 6bd368e02015c..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/lib/messages.less +++ /dev/null @@ -1,565 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// Simple messages - -.message( -@_message-type: info, -@_message-color: @message-info-color, -@_message-background: @message-info-background, -@_message-padding: @message-padding, -@_message-margin: @message-margin, -@_message-border-radius: @message-border-radius, -@_message-link-color: @message-info-link-color, -@_message-link-color-hover: @message-info-link-color-hover, -@_message-border: @message-border -) when (@_message-type = info) { - ._message( - @_message-color: @_message-color, - @_message-background: @_message-background, - @_message-padding: @_message-padding, - @_message-margin: @_message-margin, - @_message-border-radius: @_message-border-radius, - @_message-link-color: @_message-link-color, - @_message-link-color-hover: @_message-link-color-hover, - @_message-border: @_message-border - ); -} - -.message( -@_message-type: info, -@_message-color: @message-warning-color, -@_message-background: @message-warning-background, -@_message-padding: @message-padding, -@_message-margin: @message-margin, -@_message-border-radius: @message-border-radius, -@_message-link-color: @message-warning-link-color, -@_message-link-color-hover: @message-warning-link-color-hover, -@_message-border: @message-border -) when (@_message-type = warning) { - ._message( - @_message-color: @_message-color, - @_message-background: @_message-background, - @_message-padding: @_message-padding, - @_message-margin: @_message-margin, - @_message-border-radius: @_message-border-radius, - @_message-link-color: @_message-link-color, - @_message-link-color-hover: @_message-link-color-hover, - @_message-border: @_message-border - ); -} - -.message( -@_message-type: info, -@_message-color: @message-error-color, -@_message-background: @message-error-background, -@_message-padding: @message-padding, -@_message-margin: @message-margin, -@_message-border-radius: @message-border-radius, -@_message-link-color: @message-error-link-color, -@_message-link-color-hover: @message-error-link-color-hover, -@_message-border: @message-border -) when (@_message-type = error) { - ._message( - @_message-color: @_message-color, - @_message-background: @_message-background, - @_message-padding: @_message-padding, - @_message-margin: @_message-margin, - @_message-border-radius: @_message-border-radius, - @_message-link-color: @_message-link-color, - @_message-link-color-hover: @_message-link-color-hover, - @_message-border: @_message-border - ); -} - -.message( -@_message-type: info, -@_message-color: @message-success-color, -@_message-background: @message-success-background, -@_message-padding: @message-padding, -@_message-margin: @message-margin, -@_message-border-radius: @message-border-radius, -@_message-link-color: @message-success-link-color, -@_message-link-color-hover: @message-success-link-color-hover, -@_message-border: @message-border -) when (@_message-type = success) { - ._message( - @_message-color: @_message-color, - @_message-background: @_message-background, - @_message-padding: @_message-padding, - @_message-margin: @_message-margin, - @_message-border-radius: @_message-border-radius, - @_message-link-color: @_message-link-color, - @_message-link-color-hover: @_message-link-color-hover, - @_message-border: @_message-border - ); -} - -.message( -@_message-type: info, -@_message-color: @message-notice-color, -@_message-background: @message-notice-background, -@_message-padding: @message-padding, -@_message-margin: @message-margin, -@_message-border-radius: @message-border-radius, -@_message-link-color: @message-notice-link-color, -@_message-link-color-hover: @message-notice-link-color-hover, -@_message-border: @message-border -) when (@_message-type = notice) { - ._message( - @_message-color: @_message-color, - @_message-background: @_message-background, - @_message-padding: @_message-padding, - @_message-margin: @_message-margin, - @_message-border-radius: @_message-border-radius, - @_message-link-color: @_message-link-color, - @_message-link-color-hover: @_message-link-color-hover, - @_message-border: @_message-border - ); -} - -._message( -@_message-color: @message-info-color, -@_message-background: @message-info-background, -@_message-padding: @message-padding, -@_message-margin: @message-margin, -@_message-border-radius: @message-border-radius, -@_message-link-color: @message-info-link-color, -@_message-link-color-hover: @message-info-link-color-hover, -@_message-border: @message-border -) { - display: block; - color: @_message-color; - background: @_message-background; - padding: @_message-padding; - margin: @message-margin; - border-radius: @_message-border-radius; - ._message-border(@_message-border); - font-size: @message-font-size; - line-height: @message-line-height; - - a { - color: @_message-link-color; - - &:hover { - color: @_message-link-color-hover; - } - } -} - -._message-border(@_message-border) when not (@_message-border = none) { - border: @_message-border; -} - -// Simple messages aliases - -.message-info( -@_message-color: @message-info-color, -@_message-background: @message-info-background, -@_message-padding: @message-padding, -@_message-margin: @message-margin, -@_message-border-radius: @message-border-radius, -@_message-link-color: @message-info-link-color, -@_message-link-color-hover: @message-info-link-color-hover, -@_message-border: @message-border -) { - ._message( - @_message-color: @_message-color, - @_message-background: @_message-background, - @_message-padding: @_message-padding, - @_message-margin: @_message-margin, - @_message-border-radius: @_message-border-radius, - @_message-link-color: @_message-link-color, - @_message-link-color-hover: @_message-link-color-hover, - @_message-border: @_message-border - ); -} - -.message-warning( -@_message-color: @message-warning-color, -@_message-background: @message-warning-background, -@_message-padding: @message-padding, -@_message-margin: @message-margin, -@_message-border-radius: @message-border-radius, -@_message-link-color: @message-warning-link-color, -@_message-link-color-hover: @message-warning-link-color-hover, -@_message-border: @message-border -) { - ._message( - @_message-color: @_message-color, - @_message-background: @_message-background, - @_message-padding: @_message-padding, - @_message-margin: @_message-margin, - @_message-border-radius: @_message-border-radius, - @_message-link-color: @_message-link-color, - @_message-link-color-hover: @_message-link-color-hover, - @_message-border: @_message-border - ); -} - -.message-error( -@_message-color: @message-error-color, -@_message-background: @message-error-background, -@_message-padding: @message-padding, -@_message-margin: @message-margin, -@_message-border-radius: @message-border-radius, -@_message-link-color: @message-error-link-color, -@_message-link-color-hover: @message-error-link-color-hover, -@_message-border: @message-border -) { - ._message( - @_message-color: @_message-color, - @_message-background: @_message-background, - @_message-padding: @_message-padding, - @_message-margin: @_message-margin, - @_message-border-radius: @_message-border-radius, - @_message-link-color: @_message-link-color, - @_message-link-color-hover: @_message-link-color-hover, - @_message-border: @_message-border - ); -} - -.message-success( -@_message-color: @message-success-color, -@_message-background: @message-success-background, -@_message-padding: @message-padding, -@_message-margin: @message-margin, -@_message-border-radius: @message-border-radius, -@_message-link-color: @message-success-link-color, -@_message-link-color-hover: @message-success-link-color-hover, -@_message-border: @message-border -) { - ._message( - @_message-color: @_message-color, - @_message-background: @_message-background, - @_message-padding: @_message-padding, - @_message-margin: @_message-margin, - @_message-border-radius: @_message-border-radius, - @_message-link-color: @_message-link-color, - @_message-link-color-hover: @_message-link-color-hover, - @_message-border: @_message-border - ); -} - -.message-notice( -@_message-color: @message-notice-color, -@_message-background: @message-notice-background, -@_message-padding: @message-padding, -@_message-margin: @message-margin, -@_message-border-radius: @message-border-radius, -@_message-link-color: @message-notice-link-color, -@_message-link-color-hover: @message-notice-link-color-hover, -@_message-border: @message-border -) { - ._message( - @_message-color: @_message-color, - @_message-background: @_message-background, - @_message-padding: @_message-padding, - @_message-margin: @_message-margin, - @_message-border-radius: @_message-border-radius, - @_message-link-color: @_message-link-color, - @_message-link-color-hover: @_message-link-color-hover, - @_message-border: @_message-border - ); -} - -// Messages with lateral icon - -.message-info-icon-lateral( -@_message-icon-position: right, -@_message-icon: @message-info-icon, -@_message-icon-color: @message-info-icon-color, -@_message-icon-background: @message-info-icon-background -) { - ._message-icon-lateral( - @_message-icon-position, - @_message-icon, - @_message-icon-color, - @_message-icon-background - ); -} - -.message-warning-icon-lateral( -@_message-icon-position: right, -@_message-icon: @message-warning-icon, -@_message-icon-color: @message-warning-icon-color, -@_message-icon-background: @message-warning-icon-background -) { - ._message-icon-lateral( - @_message-icon-position, - @_message-icon, - @_message-icon-color, - @_message-icon-background - ); -} - -.message-error-icon-lateral( -@_message-icon-position: right, -@_message-icon: @message-error-icon, -@_message-icon-color: @message-error-icon-color, -@_message-icon-background: @message-error-icon-background -) { - ._message-icon-lateral( - @_message-icon-position, - @_message-icon, - @_message-icon-color, - @_message-icon-background - ); -} - -.message-success-icon-lateral( -@_message-icon-position: right, -@_message-icon: @message-success-icon, -@_message-icon-color: @message-success-icon-color, -@_message-icon-background: @message-success-icon-background -) { - ._message-icon-lateral( - @_message-icon-position, - @_message-icon, - @_message-icon-color, - @_message-icon-background - ); -} - -.message-notice-icon-lateral( -@_message-icon-position: right, -@_message-icon: @message-notice-icon, -@_message-icon-color: @message-notice-icon-color, -@_message-icon-background: @message-notice-icon-background -) { - ._message-icon-lateral( - @_message-icon-position, - @_message-icon, - @_message-icon-color, - @_message-icon-background - ); -} - -// Messages with inner icon - -.message-info-icon-inner( -@_message-icon: @message-info-icon, -@_message-icon-color: @message-info-icon-color, -@_message-icon-background: @message-info-icon-background, -@_message-padding-left: @message-icon-inner-padding-left -) { - ._message-icon-inner( - @_message-icon, - @_message-icon-color, - @_message-icon-background, - @_message-padding-left - ); -} - -.message-warning-icon-inner( -@_message-icon: @message-warning-icon, -@_message-icon-color: @message-warning-icon-color, -@_message-icon-background: @message-warning-icon-background, -@_message-padding-left: @message-icon-inner-padding-left -) { - ._message-icon-inner( - @_message-icon, - @_message-icon-color, - @_message-icon-background, - @_message-padding-left - ); -} - -.message-error-icon-inner( -@_message-icon: @message-error-icon, -@_message-icon-color: @message-error-icon-color, -@_message-icon-background: @message-error-icon-background, -@_message-padding-left: @message-icon-inner-padding-left -) { - ._message-icon-inner( - @_message-icon, - @_message-icon-color, - @_message-icon-background, - @_message-padding-left - ); -} - -.message-success-icon-inner( -@_message-icon: @message-success-icon, -@_message-icon-color: @message-success-icon-color, -@_message-icon-background: @message-success-icon-background, -@_message-padding-left: @message-icon-inner-padding-left -) { - ._message-icon-inner( - @_message-icon, - @_message-icon-color, - @_message-icon-background, - @_message-padding-left - ); -} - -.message-notice-icon-inner( -@_message-icon: @message-notice-icon, -@_message-icon-color: @message-notice-icon-color, -@_message-icon-background: @message-notice-icon-background, -@_message-padding-left: @message-icon-inner-padding-left -) { - ._message-icon-inner( - @_message-icon, - @_message-icon-color, - @_message-icon-background, - @_message-padding-left - ); -} - -// Private mixins - -._message-icon-lateral( -@_message-icon-position, -@_message-icon, -@_message-icon-color, -@_message-icon-background -) { - position: relative; - - &:before { - content: ''; - position: absolute; - width: @message-icon-lateral-width; - text-align: center; - top: 0; - height: 100%; - display: block; - padding: 0; - border-radius: @message-border-radius; - background: @_message-icon-background; - } - - > *:first-child:before { - content: ''; - position: absolute; - overflow: hidden; - top: 50%; - margin-top: -3px; - } - - > *:first-child:after { - content: @_message-icon; - font-family: "icons"; - color: #fff; - font-size: @message-icon-font-size; - position: absolute; - top: 50%; - margin-top: ceil(-@message-icon-font-size / 3 - 2); - width: @message-icon-lateral-width; - text-align: center; - display: block; - } - - ._message-icon-lateral-position( - @_message-icon-position, - @_message-icon-background - ); -} - -._message-icon-lateral-position( -@_message-icon-position, -@_message-icon-background -) when (@_message-icon-position = right) { - padding-right: 60px; - - &:before { - right: 0; - } - > *:first-child:before { - .arrow(left, 5px, @_message-icon-background); - right: @message-icon-lateral-width; - } - > *:first-child:after { - right: 0; - } -} - -._message-icon-lateral-position( -@_message-icon-position, -@_message-icon-background -) when (@_message-icon-position = left) { - padding-left: 60px; - - &:before { - left: 0; - } - > *:first-child:before { - .arrow(right, 5px, @_message-icon-background); - left: @message-icon-lateral-width; - } - > *:first-child:after { - left: 0; - } -} - -._message-icon-inner( -@_message-icon, -@_message-icon-color, -@_message-icon-background, -@_message-padding-left -) { - position: relative; - padding-left: @_message-padding-left; - - > *:first-child:before { - content: @_message-icon; - font-family: "icons"; - color: @_message-icon-color; - position: absolute; - left: 0; - width: @_message-padding-left; - text-align: center; - font-size: @message-icon-font-size; - } -} - - - - -.message.info { - .message-info(); - .message-info-icon-lateral(); -} - -.message.error { - .message-error(); - .message-error-icon-lateral(); -} - -.message.warning { - .message-warning(); - .message-warning-icon-lateral(); -} - -.message.notice { - .message-notice(); - .message-notice-icon-lateral(); -} - -.message.success { - .message-success(); - .message-success-icon-lateral(); -} \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/css/source/lib/navigation.less b/app/design/frontend/Magento/plushe/css/source/lib/navigation.less deleted file mode 100644 index bc2166cd2c702..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/lib/navigation.less +++ /dev/null @@ -1,817 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// # Navigation -// -// -// ```html -//
-// -// ``` -// - -@subNavHeight: auto; -@subNavPadding: 45px; - -@navBg : @headerBg; -@navBgImage : @headerBgImage; - -.navigation { - background-color: @navBg; - background-image: @navBgImage; - background-repeat: repeat; - background-position: 0 0; - border-top: 1px solid; - .borderColorI(@navBg); - position: relative; - z-index: 2; - .clearfix(); - - &:empty { - display: none; - } - - > ul > .level-top { - display: inline-block; - line-height: 1.2; - vertical-align: top; - padding-right: 40px; - - &:last-child { - padding-right: 0; - } - - &.active { - > a:after { - opacity: 1; - border-bottom-color: @primary7; - } - } - - &.hover { - > a:after { - border-bottom-color: @primary1; - } - > .submenu { - border-bottom: 1px solid @primary3; - } - } - - &.hover, - &:hover { - > .submenu { - z-index: 2; - } - &:hover > a span, - &.parent.hover > a span, - &.parent > a span { - color: @primary6; - } - &:hover > a:after, - &.hover > a:after, - &.parent > a:after { - opacity: 1; - } - } - - &.more { - &:after { - cursor: pointer; - content: "\e010"; - font-family: "icons"; - font-size: 16px; - display: inline-block; - padding: .6em .7em 1em; - margin-top: 0.4em; - border-radius: 4px 4px 0 0; - position: relative; - z-index: 1; - } - - &.hover:after { - background: @primary1; - } - - li.level-top { - width: 200px; - margin: 0 0 0 -10px !important; - padding: 7px 10px 7px 30px; - > a { - font-size: 16px; - } - &.hover, - &:hover { - background: @primary1; - > a span { - color: @primary6; - } - &.parent { - .iconBefore(@content: @icon-arrow-right-thick, @margin: 0 8px 0 0, @font: "icons"); - &:before { - float: right; - color: @secondary1; - } - } - .submenu { - display: block !important; - } - } - > a span { - color: @primary5; - } - .submenu { - display: none; - } - > .submenu { - position: absolute; - right: 0; - padding: 0; - left: 0; - top: 0; - margin-left: 230px; - min-height: 100%; - background: @primary1; - .box-sizing(); - .box-shadow(0 10px 8px rgba(0,0,0,0.3)); - .no-boxshadow & { - border: 2px solid @primary3; - border-width: 0 2px 2px; - } - > ul { - background: @primary1; - position: relative; - z-index: 1; - padding: 10px; - } - } - } - > .submenu { - background: none; - border-width: 0; - > ul { - position: relative; - } - } - } - - > a { - position: relative; - display: inline-block; - vertical-align: top; - padding: 1em 0; - font-size: 16px; - text-align: center; - color: @primary5; - &:after { - opacity: 0; - content: ''; - overflow: hidden; - display: block; - position: absolute; - bottom: 0; - left: 50%; - zoom: 1; - z-index: 2; - color: @primary6; - .arrow(top, 10px, @primary1); - } - > span { - color: @primary5; - } - &:active span, - &:focus span { - color: @primary6; - } - &:active:after, - &:focus:after { - opacity: 1; - } - } - - > .submenu { - display: none; - position: absolute; - left: 0; - top: 100%; - background: @primary1; - width: 100%; - z-index: 1; - > ul { - height: @subNavHeight; - padding-top: @subNavPadding; - padding-bottom: @subNavPadding; - li.column { - .box-sizing( border-box ); - width: 25%; - display: inline-block; - padding-right: 30px; - vertical-align: top; - } - .level1 > a { - text-transform: uppercase; - } - .parent ul { - padding-left: 10px; - } - li { - margin: 8px 0; - &:fist-child { - margin-top: 0; - } - } - } - } - } -} - -@media only screen and (max-width: 640px) { - html.opened { - overflow: hidden; - } - - body { - width: 100%; - height: 100%; - &.opened { - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); - position: relative; - height: 100%; - width: 100%; - overflow: hidden; - - .navigation { - left: 0; - -webkit-box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5); - box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5); - .transition(left .3s ease-out 0); - } - .page.wrapper { - margin-right: -86%; - cursor: pointer; - } - } - } - - .page.wrapper { - position: relative; - width: 100%; - float: right; - margin: 0; - .transition(margin .3s ease-out 0); - } - - .navigationLink() { - & > a { - display: block; - padding: 10px 20px; - text-transform: none; - font-size: 20px; - font-weight: 600; - border-bottom: 1px solid @primary2; - color: @primary6; - text-align: left; - &:hover, - &:visited { - color: @primary6; - } - &:active { - background: #dbdcd7; - } - &:after { - border: 0; - } - } - } - - .navigationSubmenu() { - position: absolute; - display: block; - left: 100%; - top: 0; - width: 100%; - overflow-x: hidden; - background: @primary7; - .transition(left .3s ease-out 0); - &.opened { - left: 0; - z-index: 3; - } - > ul { - padding-top: 0; - padding-bottom: 0; - li { - margin: 0; - .navigationLink(); - } - li.column { - width: 100%; - display: block; - padding-right: 0; - } - .parent ul { - padding-left: 0; - } - } - } - - .navigation { - display: block; - position: absolute; - width: 86%; - left: -86%; - height: 100%; - background: @primary7; - overflow: auto; - border-right: #b6b8af 1px solid; - .box-sizing(); - .transition(left .3s ease-out 0); - - ul { - margin: 0; - padding: 0; - li.hidden { - display: none; - } - } - - .nav { - .transition(left .3s linear 0); - position: relative; - overflow: hidden; - > .level-top { - display: block; - padding: 0; - background: @primary7; - .navigationLink(); - > a span { - color: @primary6; - } - &.parent { - &:after { - display: none; - } - > a { - position: relative; - .iconAfter(@content: @icon-arrow-right-thick, @size: 14px, @font: 'icons'); - text-transform: none !important; - &:after { - position: absolute; - width: 18px; - top: 15px; - right: 17px; - left: auto; - opacity: 1; - z-index: auto; - } - } - > .submenu { - .navigationSubmenu(); - } - } - - } - - .action.back { - a { - background: @primary6; - position: relative; - color: @primary7 !important; - border-bottom-color: transparent !important; - cursor: pointer; - .iconBefore(@icon-arrow-left-thick, 14px, 0, "icons"); - &:hover, - &:active, - &:visited { - color: @primary7 !important; - background: @primary6 !important; - } - &:before { - position: absolute; - top: 15px; - left: 3px; - } - span:before { - content: ""; - } - } - &.fixed { - position: fixed; - top: 0; - left: 0; - width: 86%; - z-index: 1; - -webkit-box-shadow: 0 1px 5px rgba(0,0,0,0.6); - box-shadow: 0 1px 5px rgba(0,0,0,0.6); - } - } - - .parent { - &:after { - display: none; - } - > a { - position: relative; - .iconAfter(@icon-arrow-right-thick, 14px, 0, "icons"); - &:after { - position: absolute; - top: 15px; - right: 17px; - } - } - .submenu { - .navigationSubmenu(); - } - } - } - - .account.links { - .resetList(); - > li > a { - background: @primary1; - padding: 10px 20px; - font-weight: 600; - } - a { - text-transform: capitalize; - position: relative; - display: block; - padding: 10px; - cursor: pointer; - font-size: 18px; - border-bottom: 1px solid @primary2; - font-weight: 400; - color: @primary6; - &:hover, - &:visited { - color: @primary6 !important; - } - &:active { - background: #dbdcd7 ; - } - } - .link.compare { - display: none; - } - .customer.welcome { - display: block !important; - background: @primary1; - padding: 0 10px; - border-bottom: 1px solid @primary2; - .customer.name { - position: relative; - display: block; - padding: 10px; - cursor: pointer; - font-size: 18px; - font-weight: 600; - .iconAfter(@icon-expand, 16px, 0, "icons"); - &:after { - position: absolute; - top: 10px; - right: 7px; - } - &.active:after { - content: "\e011"; - } - } - .menu { - margin: 0; - padding: 0; - display: none; - > ul { - margin: 0; - padding: 0; - position: relative; - float: none; - border: none; - background: @primary7; - li { - margin: 0; - } - } - } - &.active { - border-bottom-color: transparent; - .menu { - display: block; - } - } - } - } - - .settings.panel { - border-bottom: 1px solid @primary2; - background: @primary1; - > .title { - font-weight: 600; - position: relative; - padding: 10px 20px; - cursor: pointer; - font-size: 18px; - .iconAfter(@icon-expand, 16px, 0, "icons"); - &:after { - position: absolute; - top: 10px; - right: 17px; - } - } - > .content { - display: none; - margin: 0 10px 10px; - background: @primary7; - border-bottom: 1px solid @primary2; - - .switcher { - padding: 10px 10px 15px; - display: block; - - &:first-child { - padding-bottom: 0; - } - .label { - font-weight: 400; - color: @primary6; - font-size: 16px; - display: block; - padding-bottom: 5px; - } - .options { - display: block; - - strong { - color: @primary6; - display: block; - position: relative; - padding: 10px 40px 10px 20px; - cursor: pointer; - font-size: 16px; - .iconAfter(@icon-expand, 16px, 0, "icons"); - &:after { - position: absolute; - top: 10px; - right: 17px; - } - } - button { - display: none; - } - ul { - display: none; - position: static; - margin: 0 10px 10px; - padding: 0; - border: 0; - min-width: 0; - float: none; - background: none; - color: @primary6; - font-size: 16px; - - li { - margin: 0; - padding: 10px 20px; - border-bottom: 1px solid @primary2; - - a { - color: @primary6; - } - } - } - &.active { - ul { - display: block; - } - strong:after { - content: "\e011"; - } - } - } - } - } - &.active { - > .content { - display: block; - } - > .title:after { - content: "\e011"; - } - } - } - } -} \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/css/source/lib/sections.less b/app/design/frontend/Magento/plushe/css/source/lib/sections.less deleted file mode 100644 index cd0788a1ef54e..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/lib/sections.less +++ /dev/null @@ -1,203 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -.data-tabs() { - .clearfix(); - position: relative; - z-index: 1; - > .item.title { - float: left; - > .switch { - display: block; - position: relative; - top: 1px; - z-index: 2; - } - } - > .item.content { - width: 100%; - float: right; - margin-left: -100%; - display: none; - .box-sizing(); - &.active { - display: block; - } - } - - .tabs > .term-content.active { - border: 1px solid #BFBFBF; - color: hsl(0, 0%, 50%); - display: block; - } -} - -.data-tabs-styling() { - > .item.title { - margin-right: 1px; - min-height: 35px; - > .switch { - font-size: 14px; - line-height: 1; - font-weight: 600; - text-decoration: none; - padding: 11px 11px 8px; - border: 2px solid #e5e5e5; - background: rgba(0, 0, 0, 0.03); - border-bottom: none; - text-transform: uppercase; - border-radius: 4px 4px 0 0; - } - &:not(.disabled) > .switch:active, - &:not(.disabled) > .switch:focus, - &:not(.disabled) > .switch:hover, - &.active > .switch { - background: #fff; - border-width: 3px; - padding: 10px 10px 8px; - outline: none; - } - &.active > .switch { - padding: 10px 20px 11px !important; - } - } - > .item.content { - .clearfix; - margin-top: 36px; - padding: 20px; - &:before { - content: ''; - border-top: 3px solid #e5e5e5; - width: 100%; - display: block; - position: absolute; - left: 0; - .box-sizing(); - margin: -20px 0 20px; - } - } -} - -.data-accordion() { - > .item.title { - .box-sizing(); - width: 100%; - > .item.switch { - display: block; - } - } - > .item.content { - .clearfix(); - .box-sizing(); - display: none; - &.active { - display: block; - } - } -} - -.data-accordion-styling() { - margin: 0; - padding: 0; - > .item.title { - margin: 3px 0 0; - > .switch { - display: block; - font-size: 14px; - line-height: 1; - font-weight: 600; - text-decoration: none; - padding: 11px; - border: 2px solid #e5e5e5; - background: #f8f8f8; - text-transform: uppercase; - border-radius: 4px; - } - &:not(.disabled) > .switch:active, - &:not(.disabled) > .switch:focus, - &:not(.disabled) > .switch:hover, - &.active > .switch { - background: #fff; - border-width: 3px; - padding: 10px; - outline: none; - } - &.active > .switch { - border-radius: 4px 4px 0 0; - } - } - > .item.content { - margin: 0; - padding: 20px; - background: #fff; - } -} - -// # Sections -// -// ```html -//
-//
-// Details -//
-//
-//

Fit to be tied. Get the perfect level of lift in our Tie-front Tankini. Featuring removable padding and cup-specific sizes for support and shaping. From our Forever Sexy Swim collection of push-up tops and bottoms in sun-loving colors and prints.

-//

- Removable push-up padding
- Lined hidden underwire cups
- Front tie
- Adjustable straps can be worn classic or cross-back
- Available in two lengths: 17 3/4" and 18 3/4"
- Imported Italian nylon/Lycra® spandex

-//
-// -//
-// Tags -//
-//
-//

A playful little push-up. Bring the lightweight lift and custom comfort of the Fabulous by Victoria’s Secret bra to the beach. This triangle top is finished with pretty ruching and a sweet center bow. From our fun, flirty Beach Sexy Swim Collection.

-//

- Ruched cups with center bow
- Push-up padding for extreme lift
- Underwire
- Ties at neck; looped back tie for adjustability and extra support
- Imported nylon/spandex

-//
-// -//
-// Reviews -//
-//
-//

Relaxed elegance. The flowy fit of this halter tankini makes beach style a breeze. The built in bra top provides just the right amount of support. Look slimmer in seconds® in this figure-loving top designed exclusively for Victoria’s Secret.

-//

- Built-in bra with molded foam padding
- Halter straps tie at neck
- Imported nylon/spandex

-//
-//
-// ``` -// - -@media only screen -and (max-width : 99999px) { - .product.data { - .data-tabs(); - .data-tabs-styling(); - } -} - -@media only screen -and (max-width : 768px) { - .product.data { - .data-accordion(); - .data-accordion-styling(); - } -} \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/css/source/lib/snippets.less b/app/design/frontend/Magento/plushe/css/source/lib/snippets.less deleted file mode 100644 index fde287b1a244b..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/lib/snippets.less +++ /dev/null @@ -1,552 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -.resetList(@margin: 0, @padding: 0) { - padding: @padding; - margin: @margin; - list-style-type: none; - list-style-image: none; -} - -.borderColor (@color) when (lightness(@color) > 50%) { - border-color: darken(@color, 13%); -} - -.borderColor (@color) when (lightness(@color) =< 50%) { - border-color: lighten(@color, 13%); -} - -.borderColorI (@color) when (lightness(@color) > 50%) { - border-color: lighten(@color, 13%); -} - -.borderColorI (@color) when (lightness(@color) =< 50%) { - border-color: darken(@color, 13%); -} - -.pageWidth(@maxWidth: @LayoutMaxWidth, @minWidth: @LayoutMinWidth, @padding: 10px) { - padding-left: @padding; - padding-right: @padding; - margin: 0 auto; - min-width: (@minWidth - (2 * @padding)); - max-width: (@maxWidth - (2 * @padding)); -} - -.transitionDelay(@delay) { - -webkit-transition-delay: @delay; - -moz-transition-delay: @delay; - -ms-transition-delay: @delay; - -o-transition-delay: @delay; - transition-delay: @delay; -} - -.resetAction() { - border: none; - border-radius: 0; - background: none; - margin: 0; - padding: 0; - box-shadow: none; - text-shadow: none; - outline: none; -} - -.actionLink() { - display: inline; - color: @link; - text-decoration: none; - &:focus, - &:active, - &:hover { - color: @linkHover; - } -} - -.colorA(@c1, @c2) { - color: @c1; - > span { - color: @c1; - } - &:hover, - &:hover > span { - color: @c2; - } -} - -.fieldStyle() { - margin: 0 0 10px; - &:last-child { - margin-bottom: 0; - } - .nested { - .field { - margin: 5px 0; - } - padding: 0; - } -} - -.labelStyle() { - text-transform: uppercase; - font-weight: 600; - padding: 0 0 5px; -} - -.formInline(@labelWidth: 50%) { - > .field { - .clearfix(); - } - > .field > .control, - > .field > .label { - margin: 0; - float: left; - width: @labelWidth; - .box-sizing(); - } - > .field > .control { - width: 100% - @labelWidth; - } - > .field.no-label { - .control { - margin-left: @labelWidth; - } - } -} - -.profileBlockWithBg { - .box-sizing(); - background: @primary1; - padding: 30px; -} - -.visuallyHidden { - .visually-hidden() -} - - -// #Forms mixins -// -// Mixins for all form elements - -.controlStyling() { - .box-sizing(); - background: @fieldBg; - border: 1px solid @primary3; - border-radius: 3px; - font: @baseFontWeight @baseFontSize @baseFont; - // Prevent background color leak outs - background-clip: padding-box; - outline: none; - &:focus { - border-color: @primary4; - } - .control & { - width: 100%; - } - &:disabled { - opacity: 0.5; - } -} - -.inputText() { - .controlStyling(); - height: 32px; - line-height: 1; - padding: 0 10px; - &::-webkit-input-placeholder { - line-height: 1.333; - } - &:-ms-input-placeholder { - line-height: 1.333; - } - .eq-ie8 & { - padding-top: 8px; - } -} - -// * -// Forms -// -------------------------------------- */ -.formFieldset() { - border: 0; - margin: 30px 10px 30px 30px; - padding: 0; - letter-spacing: -0.31em; - word-spacing: -0.43em; - > * { - letter-spacing: normal; - word-spacing: normal; - } - > .legend { - float: left; - font: @baseFontWeight @legendFontSize/1.2 @baseFont; - margin: -30px 30px 50px -30px; - width: 100%; - & + br { - display: block; - .clearfix(); - } - } -} - -.formField() { - .box-sizing(); - margin: 0 0 20px; - > .label { - display: block; - padding-bottom: 5px; - } - .nested .field { - margin: 5px 0; - } - &.choice { - > .control { - width: auto; - } - > .label { - display: inline; - } - > input { - vertical-align: top; - margin-top: 2px; - margin-right: 5px; - } - } - &.required > .label > span:first-child:after { - content: '*'; - color: @requiredField; - } - .addon { - display: table; - padding: 0; - width: 100%; - textarea, - select, - input { - box-shadow: none; - display: table-cell; - margin: 0; - width: 100%; - } - .addbefore, - .addafter { - height: 0; - white-space: nowrap; - display: inline-block; - display: table-cell; - vertical-align: middle; - width: 1px; - .inputText(); - } - } - .note { - font-size: @baseFontSizeMiddle; - margin-top: 3px; - padding-left: 15px; - &:before { - border-bottom: 5px solid @baseColor; - border-left: 5px solid transparent; - border-right: 5px solid transparent; - content: ''; - display: inline-block; - font-size: 0; - line-height: 0; - margin: 4px 0 0 -14px; - position: absolute; - vertical-align: top; - width: 0; - } - } -} - -.formCols(@fieldWidth : 50%) { - > .field { - display: inline-block; - padding-right: 20px; - vertical-align: top; - width: @fieldWidth; - } - .nested .field { - width: 100%; - } - .actions { - margin-right: 30px; - } -} - -.formCommon() { - .fieldset { - .box-sizing(); - .formCols(); - .formFieldset(); - width: 690px; - background: @primary1; - padding: 30px 10px 30px 30px; - border: 0; - margin: 0 0 40px; - position: relative; - z-index: 1; - .legend { - float: left; - line-height: 1.2; - font-size: 20px; - font-weight: @baseFontWeight; - padding-bottom: 20px; - width: 100%; - padding: 0 40px 20px 0; - background: #fff; - margin: -30px -10px 30px -30px; - & + br { - display: block; - clear: both; - } - } - > .field { - .formField(); - .fieldStyle(); - > .label { - display: block; - padding: 0 0 5px; - } - margin-bottom: 20px; - } - > .field.note, - .field.street, - .field.choice.newsletter { - width: 100%; - } - .field.fullname { - width: 100%; - .fields.group-5 .field { - width: 20%; - } - } - .field.dob { - .fields.group .field { - .box-sizing(); - width: 33%; - position: relative; - z-index: 1; - .label { - position: absolute; - top: 10px; - font-size: @baseFontSizeMiddle; - line-height: 16px; - } - .control { - margin-left: 27px; - } - &:last-child { - padding-right: 0; - width: 34%; - } - } - } - } - .action.save, - .action.submit, - .action.add { - &:extend(.primary.action all); - } - .actions { - .clearfix(); - .primary { - float: right; - } - .secondary { - float: left; - } - width: 690px; - } - .fieldset.create.account { - &:after { - content: attr(data-hasrequired); - display: block; - position: absolute; - top: 100%; - left: 0; - padding: 10px 0 0; - letter-spacing: normal; - word-spacing: normal; - color: @secondary1; - } - } -} - -// * -// Icons -// -------------------------------------- */ - -.iconBefore(@content: '', @size: 16px, @margin: 0, @font: 'icons') { - &:before { - font-family: "@{font}"; - font-size: @size; - line-height: @size; - height: @size; - margin: @margin; - overflow: hidden; - content: @content; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - display: inline-block; - vertical-align: middle; - text-align: center; - } -} - -.iconAfter(@content: '', @size: 16px, @margin: 0, @font: 'icons') { - &:after { - font-family: "@{font}"; - font-size: @size; - line-height: @size; - height: @size; - margin: @margin; - overflow: hidden; - content: @content; - font-style: normal; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - display: inline-block; - vertical-align: middle; - text-align: center; - } -} - -.iconHideText(@limitWidth: 16px) { - width: @limitWidth; - display: block; - line-height: 0; - white-space: nowrap; - vertical-align: middle; - text-align: center; - text-indent: -999em; - &:active { - outline: 0; - } - &:after { - text-indent: 0; - display: block; - margin: 0; - } -} - -.iconShowText() { - text-indent: 0; - line-height:inherit; - height:inherit; -} - -.iconRemove(@position: 'after') when (@position = 'after') { - &:after { - display: none; - } -} - -.iconRemove(@position: 'after') when (@position = 'before') { - &:before { - display: none; - } -} - -/* - Responsive --------------------------------------- */ - -.mobileAction { - .box-sizing(); - display: block; - margin: 0 auto 15px; - padding: 10px; - width: 100%; - max-width: 100%; - line-height: 1; - float: none; - text-align: center; - text-decoration: none; - text-transform: uppercase; - border: none; - span { - font-size: 18px; - } -} - -.mobilePrimaryAction { - .mobileAction(); - background-color: @primaryActionBg; - color: @primaryActionColor; -} - -.mobileSecondaryAction { - .mobileAction(); - background-color: @secondaryActionBg; - color: @secondaryActionColor; -} - -.formResponsive() { - .fieldset { - width: 100%; - padding: 20px; - margin: 0 -20px; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; - .legend { - margin: 0; - padding: 0 0 10px 0; - background: transparent; - } - > .field { - width: 100%; - display: block; - padding-right: 0; - } - } - .action.save, - .action.submit, - .action.add { - .mobilePrimaryAction(); - } - .actions { - width: 100%; - margin-top: 15px; - .primary { - float: none; - } - .secondary { - margin: 15px 0 0; - float: none; - text-align: center; - } - } - .fieldset.create.account { - &:after { - content: attr(data-hasrequired); - position: relative; - } - } -} \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/css/source/responsive/responsive.less b/app/design/frontend/Magento/plushe/css/source/responsive/responsive.less deleted file mode 100644 index 14e6642f56ef1..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/responsive/responsive.less +++ /dev/null @@ -1,2378 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -///* Smartphones (portrait and landscape) ----------- */ -//@media only screen -//and (min-device-width : 320px) -//and (max-device-width : 480px) { -///* Styles */ -//} -// -///* Smartphones (landscape) ----------- */ -//@media only screen -//and (min-width : 321px) { -///* Styles */ -//} -// -///* Smartphones (portrait) ----------- */ -//@media only screen -//and (max-width : 320px) { -///* Styles */ -//} -// -///* iPads (portrait and landscape) ----------- */ -//@media only screen -//and (min-device-width : 768px) -//and (max-device-width : 1024px) { -///* Styles */ -//} -// -///* iPads (landscape) ----------- */ -//@media only screen -//and (min-device-width : 768px) -//and (max-device-width : 1024px) -//and (orientation : landscape) { -///* Styles */ -//} -// -///* iPads (portrait) ----------- */ -//@media only screen -//and (min-device-width : 768px) -//and (max-device-width : 1024px) -//and (orientation : portrait) { -///* Styles */ -//} -// -///* Desktops and laptops ----------- */ -//@media only screen -//and (min-width : 1224px) { -///* Styles */ -//} -// -///* Large screens ----------- */ -//@media only screen -//and (min-width : 1824px) { -///* Styles */ -//} -// -///* iPhone 4 ----------- */ -//@media -//only screen and (-webkit-min-device-pixel-ratio : 1.5), -//only screen and (min-device-pixel-ratio : 1.5) { -///* Styles */ -//} - -/* Smartphones (portrait) ----------- */ -@media only screen -and (max-width : @breakPoint1) { - .scrollTable { - .wrapper.table { - overflow-x: auto; - } - } - - html { - height: 100%; - } - - body { - padding-top: 0 !important; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); - } - - html, - .columns, - .footer > .content, - .page.main > .page.title, - .page.messages { - min-width: 0; - } - - .columns, - .page.main > .page.title, - .page.messages { - padding-left: 20px; - padding-right: 20px; - } - - .column.main { - min-height: 0; - } - - .column.left { - padding-right: 0; - } - - .column.right { - padding-left: 0; - } - - .layout-1 .column.main { - float: none; - display: block; - } - - .layout-2-left { - .column.main { - float: none !important; - width: 100%; - display: block; - } - .column.left { - float: none; - width: 100%; - display: block; - } - } - - .layout-2-right { - .column.main { - float: none; - width: 100%; - display: block; - } - .column.right { - float: none; - width: 100%; - display: block; - } - } - - .layout-3 { - .column.main { - width: 100%; - float: none !important; - display: block !important; - } - .column.left { - float: none; - width: 100%; - display: block; - } - .column.right { - float: none !important; - display: block !important; - width: 100%; - } - } - - .column.main .block, - .sidebar .block { - > .title { - strong { - font-weight: 400; - font-size: 20px; - } - } - } - - .notice.global.site { - position: static; - } - - .outer.wrapper { - overflow: hidden; - position: relative; - } - - .active-nav { - height: 100%; - .outer.wrapper { - height: 100%; - width: 100%; - } - } - - .products.wrapper .products.list { - .item { - .product.actions { - opacity: 1; - visibility: visible; - .action.tocart, - .secondary { - visibility: visible; - width: 100%; - } - .action.tocart { - padding: 10px 11px - } - .primary { - margin: 12px 0; - } - } - .secondary { - margin-left: 0; - border: none; - .box-sizing(); - position: static; - .action { - width: 100%; - padding: 10px 0; - display: block; - } - } - &:hover { - border: 1px solid transparent; - background: transparent; - } - } - } - - .search.results, - .category.view { - .toolbar { - .pager { - display: none; - .pages { - > ol { - line-height: 33px; - a, - strong { - padding: 0 5px; - } - } - } - } - .sorter, - .limiter { - select { - padding: 5px 10px 4px; - } - } - .modes { - float: right; - margin-right: 0; - margin-left: 0; - .mode { - span { - width: 18px; - &:after { - font-size: 18px; - width: 18px; - height: 18px; - line-height: 18px; - } - } - &.grid { - .iconAfter(@icon-grid, 18px, 0, "icons"); - .iconHideText(18px); - display: inline-block; - } - &.list { - .iconAfter(@icon-list, 18px, 0, "icons"); - .iconHideText(18px); - display: inline-block; - } - } - } - } - .toolbar.bottom .toolbar { - .pager { - display: block; - } - .settings { - display: none; - } - } - .products.wrapper.grid .products.list .item.product { - width: 50%; - .box-sizing(); - .secondary { - background: transparent; - } - } - .products.wrapper.list .products.list .item.product { - .product.photo { - float: none; - } - .product.details { - display: block; - padding: 15px 0 0; - text-align: center; - .product.name { - font-size: 18px; - } - .price-box { - font-size: 16px; - } - } - } - .product.photo { - .img.photo.container { - position: static !important; - width: auto !important; - height: auto !important; - img { - position: static !important; - width: auto !important; - height: auto !important; - } - } - } - } - - img { - max-width: 100%; - } - - .page.wrapper { - width: 100%; - float: right; - position: relative; - @tparams: margin .3s ease-out 0; - .transition(@tparams); - .active-nav & { - margin-right: -86%; - } - .navigation + .widget.static.block, - .breadcrumbs + .widget.static.block { - margin: 50px 0 0; - } - & + .widget.static.block { - display: none; - } - } - - // Header - .page.header { - padding: 0; - position: relative; - margin-bottom: 35px; - .switcher, - .links, - .panel { - display: none; - } - .content { - position: relative; - min-width: 0; - max-width: 100%; - padding: 0; - } - .logo { - float: none; - width: 100%; - text-align: center; - padding: 10px 0; - } - .block.search { - display: block; - height: 35px; - padding: 0; - margin: 15px -15px 0 0; - float: none; - text-align: left; - position: relative; - z-index: 13; - position: absolute; - top: 100%; - left: 0; - right: 65px; - .content { - padding-left: 65px; - } - .field { - float: none; - } - .label { - display: inline-block; - width: 32px; - height: 32px; - position: absolute; - top: 0; - left: 60px; - text-indent: -9999px; - z-index: 1; - } - .control { - width: auto; - float: none; - .input-text { - width: 0; - margin-right: 0; - height: 35px; - padding: 0; - margin-right: 32px; - border: 1px solid transparent; - box-sizing: content-box; - text-indent: 10px; - @tparams: all .3s linear 0; - .transition(@tparams); - &:focus { - margin-right: 0; - width: 100%; - padding: 0 38px 0 0; - border-color: @primary3; - } - } - } - .actions { - margin-left: -105px; - position: relative; - left: 65px; - .action.search { - background: none; - border: none; - span { - .iconAfter(@icon-magnifying-glass, 22px, 0, "icons"); - color: @primary6; - .iconHideText(22px); - &:after { - height: 24px; - line-height: 24px; - } - } - } - } - .search.autocomplete { - top: 35px !important; - width: 100% !important; - border: none; - } - } - .minicart.wrapper { - position: absolute; - top: 100%; - right: 20px; - margin: 15px 0 0; - .action.showcart { - z-index: 1; - margin: 0; - color: @primary5; - } - .block.minicart { - display: none; - } - } - .widget.static.block { - display: none; - } - } - - // Toggle Nav - .action.toggle.nav { - display: block; - margin-top: 19px; - position: absolute; - top: 100%; - left: 20px; - font-size: 0; - z-index: 14; - .iconAfter(@icon-menu, 32px, 0, "icons"); - .iconHideText(32px); - cursor: pointer; - &:before { - position: absolute; - width: 100%; - height: 100%; - left: -100%; - top: -20px; - padding: 20px 0; - content: ""; - } - .active-nav &:before { - position: fixed; - padding: 0; - left: 86%; - right: 0; - top: 0; - bottom: 0; - } - } - - // Breadcrumbs - .breadcrumbs { - display: none; - } - - // Footer - .footer { - padding: 30px 0; - > .content { - padding: 0 20px; - } - .block.newsletter { - width: 100%; - float: none; - margin-bottom: 30px; - } - .links { - width: 45%; - margin: 0 5% 0 0; - float: left; - - & ul > li { - margin-bottom: 12px; - } - li { - display: block; - margin-bottom: 12px; - &:after { - content: ''; - } - a { - font-size: 16px; - } - } - & + .links li:first-child:before { - content: ''; - } - } - .copyright { - padding-top: 20px; - clear: both; - font-size: 12px; - color: @primary3; - } - } - - // * - // * Mage_Checkout - // * - // * Shopping Cart - // ----------------------------------------------------------------------------- */ - .checkout-cart-index { - .page.main > .page.title { - margin: 0 0 15px; - padding: 0; - h1 { - border-top: 2px solid @primary2; - display: block; - margin: 0 10px; - padding: 17px 0 0; - span { - font-size: 36px; - } - } - .checkout.methods.items { - display: block; - padding: 12px 10px; - } - } - .checkout.methods.items { - background: @primary1; - margin: 15px 0 0; - padding: 0; - text-align: center; - > .item { - background: @commonBg; - margin: 0; - padding: 0 10px 20px; - &:first-child { - padding-top: 20px; - } - } - .action { - float: none; - } - .checkout.paypal.after:after { - line-height: 1; - } - } - - // PayPal retina button - .paypal.checkout.paypal-logo { - background: @paypalRetinaButton no-repeat 50% 50%; - background-size: 100%; - max-width: 255px; - width: 100%; - input { - opacity: 0; - width: 100%; - } - } - - .action.checkout { - .mobilePrimaryAction(); - } - - // Cross-sell block - .block.crosssell { - border: 0; - padding: 0; - .content { - overflow-x: scroll; - } - .products.list.items.crosssell { - margin: 0; - white-space: nowrap; - .item.product { - display: inline-block; - float: none; - margin: 0 0 10px; - width: 43%; - .product { - white-space: normal; - .actions { - display: none; - } - } - .img.photo.container { - max-width: 100%; - } - } - } - } - } - - .cart { - // Main actions - &.main.actions { - text-align: center; - .clearfix(); - .action { - &.update { - .mobileSecondaryAction(); - margin-top: 15px; - } - &.continue { - position: relative; - top: 0; - } - &.clear { - display: none; - } - } - } - - &.table.wrapper, - &.summary { - float: none; - width: auto; - } - - // Summary block - &.summary { - position: static; - display: block; - margin-left: -10px; - margin-right: -10px; - padding: 14px 10px; - .summary.title { - font-size: 22px; - padding-left: 12px; - } - .block { - font-size: 16px; - > .title { - padding: 10px 12px; - strong { - font-size: 18px; - &:after { - font-size: 26px; - } - } - } - .items.methods { - dd { - margin-bottom: 10px; - } - } - .fieldset { - font-size: 14px; - } - input, - select, - .action span { - font-size: 16px; - } - } - } - - &.table.wrapper.detailed + .cart.summary { - margin-top: 0; - } - - &.totals { - padding: 38px 10px 10px; - td, - th { - padding: 8px 0 8px 5px; - } - .mark { - padding-left: 9px; - } - .amount { - padding-right: 3px; - } - .mark, - .amount, - td:first-child strong { - font-size: 18px; - line-height: 30px; - vertical-align: bottom; - } - td:not(:first-child) strong { - font-size: 30px; - vertical-align: bottom; - } - } - - // Cart products table - &.table.wrapper { - thead { - display: none; - } - .product.photo { - max-width: 60px; - position: absolute; - left: 0; - top: 25px; - span, - img { - max-width: 60px; - max-height: 60px; - } - } - - .col { - &.item { - display: block; - padding: 25px 80px 10px 70px; - position: relative; - min-height: 60px; - .product.name { - font-size: 18px; - margin: 0 0 10px; - } - dl { - margin: 0; - padding-bottom: 12px; - clear: both; - dt, - dd { - line-height: 1.1; - } - dd { - margin-bottom: 12px; - margin-left: 0; - } - } - - } - &.price, - &.subtotal { - display: block; - padding: 0 20px 5px 70px; - text-align: left; - &:before { - content: attr(data-label); - display: inline-block; - margin-right: 7px; - min-width: 65px; - } - span:before { - content: attr(data-label); - display: inline-block; - font-size: 12px; - margin-right: 7px; - } - } - &.price { - margin-top: -30px; - } - &.price.excl.tax + .col.price.incl.tax { - &:before { - visibility: hidden; - } - } - - &.subtotal.excl.tax + .col.subtotal.incl.tax { - &:before { - visibility: hidden; - } - } - - &.qty { - display: block; - position: absolute; - top: 15px; - right: 5px; - &:before { - content: attr(data-label); - display: inline-block; - font-size: 14px; - margin-bottom: 7px; - text-transform: uppercase; - } - + .col.subtotal { - padding-top: 8px; - padding-left: 70px; - } - input { - font-size: 16px; - } - } - } - - .item.info { - .clearfix(); - display: block; - position: relative; - font-size: 16px; - } - - .item.actions { - border-bottom: 1px solid @primary2; - td { - padding-bottom: 20px; - padding-top: 12px; - &:before { - display: none; - } - .action { - margin-left: 25px; - } - } - div.actions { - padding: 0; - } - .action.delete span:after { - margin-top: -2px; - } - } - - .items.data { - tbody:nth-child(2n) tr { - background: @commonBg; - } - } - } - } - - // * - // * Mage_Checkout - // * - // * One page Checkout - // ----------------------------------------------------------------------------- */ - - // Checkout progress block - .opc.wrapper { - float: none; - margin: 0 -18px; - width: auto; - - // Step title - > .opc .section { - > .step-title { - padding: 20px; - h2 { - font-size: 22px; - } - } - - &.allow > .step-title h2:after { - display: none; - } - } - - // Forms - .form:not(.login) { - font-size: 16px; - &:after { - display: none; - } - - .fieldset > .field { - display: block; - padding: 0; - width: 100%; - } - - input, - select, - textarea { - font-size: 16px; - } - - .field { - &.fullname + .field.company, - &.name-lastname + .field.company, - &.country, - &.taxvat { - margin: 0 0 10px; - } - .nested { - padding: 0; - .field { - margin-bottom: 0; - } - } - } - - .actions { - margin: 40px 0 10px; - position: relative; - text-align: center; - .action { - &.continue { - float: none; - padding: 18px 0 16px; - width: 90%; - span { - font-size: 24px; - line-height: 26px; - } - } - &.back span:before { - display: none; - } - } - .secondary { - clear: none; - float: none; - padding-top: 27px; - text-align: center; - } - } - - .choice input { - margin-top: 3px; - } - } - - // Gift messages - .gift.message { - dd { - margin-left: 0; - &.options.individual .product { - float: none; - } - } - } - - .gift-messages { - h3 { - font-size: 16px; - } - &-form { - ol, - ul { - list-style: none; - margin: 0; - padding: 0; - } - .item { - margin: 0 0 30px; - position: relative; - .details input, - .details textarea { - width: 100%; - } - .field:last-child { - margin-bottom: 10px; - } - } - .product-img-box { - position: absolute; - width: 60px; - left: 0; - top: 0; - p { - margin: 0 0 10px; - } - img { - max-height: 60px; - max-width: 60px; - } - } - .product-name { - font-size: 18px; - font-weight: 600; - margin: 0 0 10px; - } - .details { - padding-left: 70px; - } - } - } - - // Payment methods - .items.methods.payment { - dt { - font-weight: normal; - margin: 0 0 10px; - } - dd { - margin: 0; - padding: 0; - > ul { - list-style: none; - margin: 0; - padding: 5px 10px 15px 20px; - > li { - margin: 5px 0 0; - } - label { - display: block; - em { - display: none; - } - &.required:after { - color: @secondary1; - content: "*"; - } - } - .input-box > input, - .input-box > select { - width: 100%; - } - .v-fix { - display: inline-block; - } - } - } - } - - // Order review table - .order-review { - font-size: 16px; - .review.table.wrapper { - margin-bottom: 10px; - } - .order.review.data { - th, - td { - padding-left: 0; - padding-right: 5px; - text-align: left; - &.qty { - text-align: center; - } - } - } - th.col.item, - th.col.price, - th.col.subtotal { - white-space: nowrap; - } - th.excl.tax span, - th.col.incl.tax span { - font-size: 12px; - } - } - - .grand.total { - display: block; - .clearfix(); - .mark { - font-size: 16px; - white-space: nowrap; - } - .amount { - padding: 0; - } - } - - .checkout.submit.order .actions .primary { - float: none; - } - - .order-review .actions { - text-align: center; - .secondary { - float: none; - margin: 30px 0 0; - } - .action.checkout { - float: none; - padding: 18px 0 16px; - width: 90%; - span { - font-size: 24px; - line-height: 26px; - } - } - &.back span:before { - display: none; - } - } - - // Load indicator -// .load.indicator { -///* left: 0; -// position: absolute; -// top: 10px; -// width: 100%;*/ -// } - } - - // Your Checkout Progress block - .block.progress.onepage { - background: @primary1; - border-top: 1px solid @primary2; - border-bottom: 1px solid @primary2; - float: none; - margin: 35px -18px 0; - width: auto; - > .title { - margin: 0; - padding: 11px 22px; - position: relative; - cursor: pointer; - strong { - font-size: 18px; - font-weight: 600; - } - &:before { - content: @icon-expand-mobile; - font-family: Arial, sans-serif; - font-weight: 400; - font-size: 30px; - position: absolute; - right: 20px; - top: 2px; - } - &.active:before { - top: 1px; - content: @icon-collapse-mobile; - } - } - > .content { - background: @commonBg; - display: none; - margin: 0 10px 10px; - padding: 10px; - } - dl { - margin: 0; - } - dt { - font-size: 20px; - font-weight: 200; - > a { - font-weight: 400; - font-size: 14px; - margin-left: 20px; - text-decoration: underline; - } - } - dd, - .complete .payment .title { - font-size: 16px; - line-height: 1.4; - font-weight: 400; - &:last-child { - margin: 0; - } - } - .separator { - display: none; - } - } - - // Header checkout progress button - .action.toggle.checkout.progress { - background: none; - cursor: pointer; - display: block; - float: right; - height: auto; - margin: -52px 18px 0 0; - padding: 0; - overflow: hidden; - width: auto; - } - - // Checkout login - .step.login.wrapper { - padding: 0 0 20px; - .block { - float: none; - font-size: 16px; - width: 100%; - &.guest { - margin: 0; - padding: 0; - &:before { - display: none; - } - .actions { - margin-left: 0; - } - } - } - .actions { - padding: 20px 0 0; - position: relative; - text-align: center; - width: 100%; - .secondary { - font-size: 14px; - margin: 15px 0 0; - } - .action { - &.login, - &.continue { - width: 100%; - span { - font-size: 18px; - } - } - } - } - } - - /* - Magento_Checkout - Multishipping - -------------------------------------- */ - - .multicheckout { - &.progress { - width: 100%; - float: none; - li { - display: block; - padding: 10px 20px; - text-decoration: none; - font-size: 20px; - font-weight: 600; - border-bottom: 1px solid @primary2; - color: @primary6; - &.active { - color: @secondary1; - } - } - + .form.address.edit { - float: none; - width: 100%; - } - } - &.form.address, - &.form.billing, - &.form.shipping, - &.form.overview, - &.success, - &.change.billing { - float: none; - width: 100%; - } - &.form.address { - .col.address select { - max-width: 100%; - } - .items.data { - display: block; - width: 100%; - thead { - display: none; - } - tbody { - display: block; - width: 100%; - } - tr, - td { - display: block; - width: 100%; - .box-sizing(); - } - .col.product { - .product.name { - font-size: 18px; - } - } - .col.delete { - border-bottom: 1px solid @primary2; - padding-bottom: 10px; - margin-bottom: 20px; - } - .col.qty { - text-align: left; - padding-top: 0; - } - } - } - .actions { - .action { - width: 100%; - display: block; - float: none; - text-align: center; - margin-bottom: 10px; - } - } - .title, - .subtitle { - .action { - .mobilePrimaryAction(); - } - } - > .block.shipping, - &.overview > .block.billing { - .box { - &.address { - float: none; - width: 100%; - } - &.method { - float: none; - width: 100%; - } - &.items { - overflow-x: scroll; - } - } - } - } - - // Login page - - .customer-account-login { - .page.title { - display: none; - } - } - - .login.container { - padding: 20px; - margin: 0 -20px; - .block { - float: none; - width: 100%; - > .title { - margin-bottom: 15px; - } - .actions { - position: static; - text-align: center; - bottom: 0; - width: 100%; - margin: 0; - padding: 0; - .secondary { - float: none; - margin: 15px 0 0; - } - } - &.login { - padding: 0; - .actions { - margin: 20px 0 0; - } - } - &.new { - padding: 0; - .actions { - margin: 20px 0 0; - } - } - } - .action.login, - .action.create { - .mobilePrimaryAction(); - } - } - - .form.login { - .fieldset.login { - .field { - .label { - padding: 0 0 5px 0; - display: block; - width: 100%; - float: none; - font-size: 16px; - text-align: left; - } - .control { - width: 100%; - } - } - } - } - - /* - Forms - -------------------------------------- */ - .form.send.friend, - .form.address.edit, - .form.edit.account, - .form.search.advanced, - .form.orders.search, - .form.contact, - .form.password.forget, - .form.create.account, - .form.wishlist.share, - .form.password.reset, - .form.add.tag, - .form.paypal.review { - .formResponsive(); - } - - .form.search.advanced, - .form.orders.search, - .form.contact { - padding: 20px; - margin: 0 -20px; - .actions { - padding-right: 0; - margin-top: 20px; - text-align: center; - } - .action { - .mobilePrimaryAction(); - } - .fields.range { - display: table; - width: 100%; - > .field { - display: table-cell; - width: 50%; - } - } - } - - .form.contact { - .fieldset { - .field { - &.comment { - width: 100%; - margin-left: 0; - } - } - } - } - - .form.send.friend { - .fieldset.recipients { - .actions .primary { - float: none; - } - } - } - - /* - Mage_Customer - Account - ----------------------------------------------------------------------------- */ - .layout-2-left.account { - .column.main { - display: block; - width: 100%; - float: none; - } - .column.left { - border-top: 4px solid @primary2; - display: block; - width: 100%; - float: none; - margin-top: 20px; - padding-top: 20px; - } - } - - .sales-order-history, - .review-customer-index, - .sales-order-view, - .sales-order-invoice, - .adminhtml-order-shipment, - .sales-order-creditmemo, - .checkout-onepage-index .order-review, - .downloadable-customer-products, - .form.wishlist.items, - .block.dashboard.orders, - .block.billing.agreements { - &:extend(.scrollTable all); - } - - .accountActions { - .primary, - .secondary { - float: none; - } - .primary { - .action { - .mobilePrimaryAction(); - } - } - .secondary { - margin-bottom: 15px; - .action.back { - display: block; - float: none; - text-align: center; - } - } - } - - .account { - .column.main { - .my-account, - .block, - .form { - .actions { - &:extend(.accountActions all); - } - } - > .actions { - &:extend(.accountActions all); - } - } - > .block, - .my-account > .block { - margin-bottom: 20px; - } - } - - .billing-agreements > .actions, - .recurring-payments .buttons-set { - text-align: center; - margin-bottom: 20px; - } - - // Account navigation - .block.account.nav { - .content { - margin: 0 -20px; - .items { - > li { - margin-bottom: 0; - a, - strong { - display: block; - padding: 10px 20px; - text-decoration: none; - font-size: 20px; - font-weight: 600; - border-bottom: 1px solid @primary2; - color: @primary6; - } - &.current strong { - color: @secondary1; - } - } - } - } - } - - // Toggle account navigation - .page.title { - .toggle.accountnav { - padding-top: 12px; - font-size: 16px; - background: transparent; - cursor: pointer; - } - > .action { - .mobilePrimaryAction(); - } - } - - .block.dashboard { - .box { - float: none; - width: 100%; - margin-bottom: 15px; - } - .recent.orders { - .col.shipping { - display: none; - } - } - } - - .block.dashboard:not(.welcome):not(.orders) { - .content { - padding: 20px; - margin: 0 -20px; - } - .subtitle { - margin-bottom: 10px; - } - } - - .data.table.orders { - margin: 0 -8px; - td, - th { - padding: 10px 8px; - &.col.actions { - .action { - display: block; - &:last-child { - margin-right: 0; - } - } - } - } - .col.shipping { - display: none; - } - } - - /* - Address book - -------------------------------------- */ - - .block.addresses:not(.dashboard) { - margin-bottom: 20px; - .content { - padding: 20px; - margin: 0 -20px; - } - &.default { - float: none; - width: 100%; - } - &.list { - float: none; - width: 100%; - } - } - - .form.newsletter { - .action.save { - .mobilePrimaryAction(); - } - } - - .account { - .column.main { - .tags.items.cloud { - .item { - font-size: 18px; - } - } - } - } - - /* - My Account -> Billing agreements - -------------------------------------- */ - .billing.agreements { - .form.new.agreement { - .formCols(100%); - .action.create { - width: 100%; - padding-top: 7px; - padding-bottom: 6px; - } - } - } - - - /* - My Account -> Wishlist - -------------------------------------- */ - .account { - .form.wishlist.items { - .data.table.wishlist { - margin-bottom: 0; - thead { - display: none; - } - textarea { - width: 15em; - } - } - } - } - - /* - My Account -> My orders - ----------------------------------------------------------------------------- */ - - .order.details { - .order.toolbar { - clear: both; - float: none; - .action { - margin: 0 0 10px; - display: block; - font-size: 18px; - } - } - .block.order { - float: none; - width: 100%; - padding: 0; - .content { - padding: 20px; - margin: 0 -20px; - } - } - .order.info { - > dt { - margin-bottom: 15px; - } - > dd { - padding: 0; - background: @primary7; - margin: 0 -20px; - .items { - .item { - float: none; - margin-right: 0; - a, strong { - display: block; - padding: 10px 20px; - text-decoration: none; - font-size: 20px; - font-weight: 600; - border-bottom: 1px solid @primary2; - color: @primary6; - } - strong { - color: @secondary1; - } - } - } - } - } - .subtitle.caption { - margin-bottom: 20px; - } - .additional.details { - .order.comments { - padding: 20px; - margin: 0 -20px 20px; - } - } - > .actions { - margin-bottom: 20px; - } - .wrapper.table { - margin-bottom: 45px; - .data.table.order { - margin-bottom: 0; - } - } - } - - // Widgets - .widget.static.block { - margin-bottom: 15px; - } - - /* Product Page */ - .layout-1 { - .columns { - padding-left: 18px; - padding-right: 18px; - } - .column.main { - float: none; - } - } - - .product.info.main, - .product.photo.main, - .product.media, - .product.data, - .box.tocart .field, - .box.tocart .actions, - .product.photo.thumbs { - float: none; - width: auto; - max-width: 100%; - } - - .product.photo.thumbs { - padding: 0; - overflow-x: auto; - white-space: nowrap; - -webkit-overflow-scrolling: touch; - .item.thumb { - display: inline-block; - margin-right: 5px; - position: relative; - vertical-align: bottom; - white-space: normal; - span { - height: auto !important; - width: 100% !important; - max-width: 100%; - img { - border: 2px solid transparent; - position: static; - height: auto !important; - width: 100% !important; - max-width: 100%; - } - } - .active { - img { - border: 2px solid #ff9600; - } - } - } - } - - .box.tocart .actions { - text-align: center; - } - - .product.data { - display: block; - > .item.content { - &:before { - display: none; - } - } - } - - .product.photo .notice { - display: none; - } - - .product.info.additional { - .page.title.product { - margin-bottom: 10px; - } - .stock { - margin: 15px 0; - } - } - - .product.info.main { - &.responsive { - .page.title, - .stock:not(.alert) { - display: none; - } - } - .price-box { - border: none !important; - margin: 0; - } - .prices.tier { - clear: both; - } - .product.alert { - margin: 10px 0; - } - .product.attibute.sku { - margin-bottom: 10px; - } - .product.add.form { - clear: both; - .actions { - margin-right: 0; - .action.primary.customize, - .action.primary.tocart { - max-width: 400px; - padding: 18px 10px 14px; - width: 100%; - } - } - } - .type-configurable & { - select { - width: 99.5% !important; - } - } - .product.social.links { - border-top: 1px solid @primary2; - padding: 10px 0; - float: none; - text-align: right; - .action.mailto { - display: inline-block; - span { - .iconAfter(@icon-envelope, 24px, 0, "icons"); - .iconHideText(24px); - color: @primary3; - } - } - } - .actions.bundle { - clear: both; - text-align: center; - .action.primary.customize { - margin: 24px 0; - max-width: 400px; - padding: 18px 10px 14px; - width: 100%; - } - } - .price-box { - .price-excluding-tax, - .price-including-tax { - display: block; - } - } - .product.addto.links { - display: inline-block; - font-size: 18px; - border: none; - margin: 0; - padding: 10px; - position: absolute; - vertical-align: top; - .action.towishlist { - font-size: 16px; - } - .action.tocompare { - display: none; - } - } - - .table.data.grouped { - width: 100%; - clear: both; - } - } - - .catalog-product-view .column.main { - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - .product.info.additional, - .product.media { - -webkit-order: -1; - -ms-flex-order: -1; - order: -1; - } - } - - .product.media { - .img.photo.container { - height: auto !important; - width: auto !important; - > img { - position: static !important; - height: auto !important; - width: auto !important; - max-width: 100%; - } - } - &:before { - content: attr(data-title); - color: @primary5; - display: block; - font-size: 30px; - font-weight: 200; - line-height: 1.2; - margin-bottom: 30px; - } - } - - .product.info.detailed { - background: @primary1; - border-bottom: 1px solid @primary2; - margin: 0 -18px; - .product.data > .item.title { - float: none; - margin: 0; - position: relative; - .switch { - background: @primary1; - border: none; - border-top: 1px solid @primary2; - font-size: 18px; - color: @primary6; - border-radius: 0; - padding: 11px 18px; - position: static; - text-transform: none; - } - &:before { - content: @icon-expand; - display: block; - font-family: "icons"; - font-size: 15px; - position: absolute; - top: 11px; - right: 18px; - } - &.active { - .switch { - padding: 11px 18px !important; - } - &:before { - content: @icon-collapse; - } - } - } - .product.data > .item.content { - color: @primary6; - font-size: 18px; - float: none; - margin: 0 10px 10px; - padding: 10px 18px; - width: auto; - &.active { - background: #fff; - -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .1); - box-shadow: 0 1px 1px rgba(0, 0, 0, .1); - &+.item.title { - .switch { - border-top: none; - } - } - } - &:last-child { - border-bottom: 1px solid @primary2; - } - .product.attributes th { - font-size: 18px; - padding: 26px 10px 10px; - } - } - .block.add.review { - background: none; - .fieldset > .legend { - border: none; - margin: 0; - strong { - display: block; - font-size: 18px; - line-height: 1.2; - margin: 0; - } - } - .actions, - .field:not(.ratings) { - width: 100%; - } - .action.submit { - .mobilePrimaryAction(); - margin-bottom: 10px; - } - } - .block.reviews.list { - margin-left: 0; - } - } - - .block.add.review { - margin: 0; - padding: 0; - } - - .block.product.tags { - margin-bottom: 0; - .title { - display: none; - } - .field { - .note { - font-size: 12px; - padding-left: 0; - &:before { - display: none; - } - } - } - } - - .column.main .block.widget.viewed, - .column.main .block.crosssell, - .column.main .block.upsell, - .column.main .block.related, - .column.main .block.widget.new, - .column.main .block.widget.compared { - border: none; - padding: 0; - .item.product { - .product.photo { - span { - height: auto !important; - width: auto !important; - img { - position: static !important; - height: auto; - width: auto; - max-width: 100%; - } - } - } - .actions { - display: none; - } - &:hover { - .actions { - visibility: hidden; - } - } - } - .content { - overflow-x: auto; - margin: 0 -18px; - white-space: nowrap; - -webkit-overflow-scrolling: touch; - } - .products.list { - margin: 0; - .item.product { - white-space: normal; - .product.photo { - display: block; - float: none; - margin: 0 0 10px; - } - width: 40% !important; - } - } - } - - .block.related { - .actions { - display: none; - } - } - - .box.tocart { - .checkout.paypal { - display: block; - &.after { - &:before { - display: block; - } - } - &.before { - &:before { - display: block; - } - } - } - } - - .product.info.detailed + .block.upsell, - .product.info.detailed + .block.related { - margin-top: 30px; - clear: none; - float: none; - width: auto; - border-top: 0; - padding-top: 0; - padding-left: 0; - border-left: 0; - .products.list { - margin: 0; - .item.product { - display: inline-block; - width: 40%; - padding: 20px; - .product.photo { - float: none; - display: block; - margin: 0 0 10px; - } - } - } - } - - input[type="password"], - input[type="text"], - input[type="number"] { - font-size: 18px; - } - - .fieldset > .field > .label { - font-size: 18px; - font-weight: normal; - text-transform: none; - } - - .fieldset > .field .note { - padding-left: 0 !important; - margin: 5px; - &:before { - display: none; - } - } - - .bundle.options.container { - margin: 0; - padding: 0; - &:before { - display: none; - } - .product.add.form { - margin: 0 -18px; - padding: 20px 18px 280px; - } - .product.options.wrapper, - .product.options.bottom { - float: none; - width: auto; - > .fieldset { - margin-left: 0; - margin-right: 0; - } - } - .product.options.bottom { - .price-box { - display: none; - } - .action.back.customization { - color: @primary3; - .iconAfter(@icon-close-thick, 22px, 0, "icons"); - .iconHideText(22px); - top: 26px; - right: 18px; - } - } - p.required { - display: none; - } - } - - .block.bundle.summary { - background: @primary1; - margin: 0; - padding: 0 20px; - float: none; - position: absolute; - margin: -280px 0 0; - top: 100% !important; - width: 90%; - .box-sizing(); - .content { - padding: 0; - } - .bundle.summary, - .photo, - .title, - .product.name, - .available, - .addto { - display: none !important; - } - .price-box { - float: left; - width: 80%; - .price-label { - display: block; - float: none; - margin-bottom: 5px; - } - .price-excluding-tax { - margin-right: 10px; - } - .full-product-price { - float: none; - } - } - .box.tocart { - padding-bottom: 0; - border: none; - .control { - width: auto; - } - .field.qty { - .box-sizing(); - width: 18%; - float: right; - padding-right: 0; - } - input.qty { - height: 49px; - } - .actions { - clear: both; - margin-right: 0; - .action.primary.tocart { - padding: 18px 10px 14px; - width: 100%; - } - } - } - } - - .fieldset.bundle.options { - .legend { - margin-left: 0; - } - > .field { - margin: 0 0 20px; - .label { - display: inline-block; - font-size: 16px; - width: 90%; - } - input[type="checkbox"], - input[type="radio"] { - margin-top: 3px; - vertical-align: top; - } - > .label { - font-size: 22px; - } - } - } - - // * - // * Widgets - // * - // ----------------------------------------------------------------------------- */ - - // Recently Viewed - - .block.widget.viewed .content, - .block.crosssell .content, - .block.upsell .content, - .block.related .content, - .block.widget.new .content, - .block.widget.compared .content { - margin: 0; - } - - .block.widget.viewed, - .block.widget.new { - .minilist.products.items .item.product { - .product.details { - overflow: hidden; - padding: 0; - } - &:hover { - .product.actions { - visibility: hidden; - } - } - - } - } - - /* - Overlay popup - -------------------------------------- */ - .popup { - left: 0; - top: 5%; - margin: 0 auto; - width: 90%; - .actions { - .action.submit { - .mobilePrimaryAction(); - } - .action.cancel { - .mobileSecondaryAction(); - } - } - } - - /* - Magento_Catalog Compare - -------------------------------------- */ - .catalog-product-compare-index { - .action.print { - margin: -20px 0 20px; - } - } -} diff --git a/app/design/frontend/Magento/plushe/css/source/styles/base.less b/app/design/frontend/Magento/plushe/css/source/styles/base.less deleted file mode 100644 index 9e193368c964a..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/styles/base.less +++ /dev/null @@ -1,427 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// #General reset -// For resetting default browser styles of standard html elements ClearLess library provides normalize or reset solution. Here we use **normalize**. It sets default parameters to certain values. -// -// **If the property of an element is not set directly in this document, it is inherited from normalize** (http://github.com/necolas/normalize.css) -// -// #General settings -// -// Applying custom font -// -// Setting font for html, body, button, input, select, textarea -// -// Reseting elements styles: nav ul, nav ol -// - -.font-face( "sourcesanspro", "@{baseDir}/fonts/sourcesanspro/sourcesanspro-200-normal-webfont", 200, normal, true ); -.font-face( "sourcesanspro", "@{baseDir}/fonts/sourcesanspro/sourcesanspro-200-normal-webfont", 200, normal, true ); -.font-face( "sourcesanspro", "@{baseDir}/fonts/sourcesanspro/sourcesanspro-400-normal-webfont", 400, normal, true ); -.font-face( "sourcesanspro", "@{baseDir}/fonts/sourcesanspro/sourcesanspro-600-normal-webfont", 600, normal, true ); -.font-face( "sourcesanspro", "@{baseDir}/fonts/sourcesanspro/sourcesanspro-700-normal-webfont", 700, normal, true ); -.font-face( "marvel", "@{baseDir}/fonts/marvel/marvel-400-normal-webfont", 400, normal, true ); - -.font-face( "icons", "@{baseDir}/fonts/icons/icons", 400, normal, true ); - -html, body, button, input, select, textarea { - font: @baseFontWeight @baseFontSize/@baseLineHeight @baseFont; - color: @baseColor; -} - -nav ul, nav ol { - .resetList(); -} - -// # Headings -// -// ```html -//

Heading 1

-// -//

Heading 2

-// -//

Heading 3

-// -//

Heading 4

-// -//
Heading 5
-// -//
Heading 6
-// ``` -// - -h1 { - color: @h1color; - font: @h1font; -} - -h2 { - color: @h2color; - font: @h2font; -} - -h3 { - color: @h3color; - font: @h3font; -} - -h4 { - color: @h4color; - font: @h4font; -} - -h5 { - color: @h5color; - font: @h5font; -} - -h6 { - color: @h6color; - font: @h6font; -} - -// #Links -// -// ```html -// Link -// Visited link -// Hovered link -// Active link -// ``` -// - -a { - color: @link; - text-decoration: none; - &:visited { - color: @link; - } - &:hover, - &:active { - color: @linkHover; - } -} - -// #Inline markup -// -// #abbr -// -// ```html -// The abbr element and abbr element with title examples -// ``` - - -// #b -// -// ```html -// The b element example -// ``` - -// #strong -// -// ```html -// The strong element example -// ``` - -// #em -// -// ```html -// The em element example -// ``` -// - -// #i -// -// ```html -// The i element example -// ``` -// - -// #cite -// -// ```html -// The cite element example -// ``` -// - -// #code -// -// ```html -// The code element example -// ``` -// - -// #del -// -// ```html -// The del element example -// ``` -// - -// #s -// -// ```html -// The s element example -// ``` -// - -// #img -// -// ```html -// The img element example example -// ``` -// - -// #mark -// -// ```html -// The mark element example -// ``` -// - -// #q -// -// ```html -// The q element inside a q element example -// ``` -// - -q { - &:before { - content: "\201c"; - } - &:after { - content: "\201d"; - } - q { - &:before { - content: "\2018"; - } - &:after { - content: "\2019"; - } - } -} - -// #small -// -// ```html -// The small element example -// ``` -// - -// #sub -// -// ```html -// The subscript element example -// ``` -// - -// #sup -// -// ```html -// The superscript element example -// ``` -// - -// #u -// -// ```html -// The u element example -// ``` -// - -// #Paragraph -// -// ```html -//

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede.

-//

Cras vel libero id lectus rhoncus porta. Suspendisse convallis felis ac enim. Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui.

-// ``` -// - -// #Ordered list -// -// ```html -//
    -//
  1. Item 1
  2. -//
  3. Item 2
  4. -//
  5. Item 3 -//
      -//
    1. Item 1
    2. -//
    3. Item 2
    4. -//
    5. Item 3
    6. -//
    -//
  6. -//
  7. Item 4
  8. -//
-// ``` -// - -// #Unordered list -// -// ```html -//
    -//
  • Item 1
  • -//
  • Item 2
  • -//
  • Item 3 -//
      -//
    1. Item 1
    2. -//
    3. Item 2
    4. -//
    5. Item 3
    6. -//
    -//
  • -//
  • Item 4
  • -//
-// ``` -// - -// #Descriptions -// -// ```html -//
-//
Title 1
-//
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede. Cras vel libero id lectus rhoncus porta. Suspendisse convallis felis ac enim. Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui. Nunc risus. Proin scelerisque augue. Nam ullamcorper. Phasellus id massa. Pellentesque nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nunc augue. Aenean sed justo non leo vehicula laoreet. Praesent ipsum libero, auctor ac, tempus nec, tempor nec, justo.
-//
Title 2
-//
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi luctus. Duis lobortis. Nulla nec velit. Mauris pulvinar erat non massa. Suspendisse tortor turpis, porta nec, tempus vitae, iaculis semper, pede. Cras vel libero id lectus rhoncus porta. Suspendisse convallis felis ac enim. Vivamus tortor nisl, lobortis in, faucibus et, tempus at, dui. Nunc risus. Proin scelerisque augue. Nam ullamcorper. Phasellus id massa. Pellentesque nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nunc augue. Aenean sed justo non leo vehicula laoreet. Praesent ipsum libero, auctor ac, tempus nec, tempor nec, justo.
-//
-// ``` -// - -// #Table -// -// ```html -//
@@ -40,14 +43,18 @@

escapeHtml($_product->getShortDescription())): ?> -

+

-

getPrice() != $_product->getFinalPrice()): ?> - helper('Magento\Core\Helper\Data')->currency($_product->getPrice()) ?>
- helper('Magento\Core\Helper\Data')->currency($_product->getFinalPrice()) ?> - - helper('Magento\Core\Helper\Data')->currency($_product->getPrice()) ?> -

+

getProductPriceHtml( + $_product, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_EMAIL, + [ + 'display_label' => __('Price:') + ] + ); + ?> +

Dear {{escapehtml var=$user.name}},

There was recently a request to change the password for your account.

-

If you requested this password change, please click on the following link to reset your password: {{store url="adminhtml/auth/resetpassword/" _query_id=$user.id _query_token=$user.rp_token}}

+

If you requested this password change, please click on the following link to reset your password: {{store url="admin/auth/resetpassword/" _query_id=$user.id _query_token=$user.rp_token}}

If clicking the link does not work, please copy and paste the URL into your browser instead.


If you did not make this request, you can ignore this message and your password will remain the same.

diff --git a/app/code/Magento/Webapi/view/adminhtml/integration/activate/permissions/tab/webapi.phtml b/app/code/Magento/Webapi/view/adminhtml/integration/activate/permissions/tab/webapi.phtml index 0f05871cd6c7f..9aec659ae5f68 100644 --- a/app/code/Magento/Webapi/view/adminhtml/integration/activate/permissions/tab/webapi.phtml +++ b/app/code/Magento/Webapi/view/adminhtml/integration/activate/permissions/tab/webapi.phtml @@ -40,9 +40,11 @@ isTreeEmpty()): ?> diff --git a/app/code/Magento/Weee/Helper/Data.php b/app/code/Magento/Weee/Helper/Data.php index 40f7de33210cb..960fc68cb432f 100644 --- a/app/code/Magento/Weee/Helper/Data.php +++ b/app/code/Magento/Weee/Helper/Data.php @@ -406,33 +406,6 @@ public function getOriginalAmount($product) return 0; } - /** - * Adds HTML containers and formats tier prices accordingly to the currency used - * - * @param \Magento\Catalog\Model\Product $product - * @param array &$tierPrices - * @return $this - */ - public function processTierPrices($product, &$tierPrices) - { - $weeeAmount = $this->getAmountForDisplay($product); - $store = $this->_storeManager->getStore(); - foreach ($tierPrices as $index => &$tier) { - $html = $store->formatPrice( - $store->convertPrice($this->_taxData->getPrice($product, $tier['website_price'], true) + $weeeAmount), - false - ); - $tier['formated_price_incl_weee'] = '' . $html . ''; - $html = $store->formatPrice( - $store->convertPrice($this->_taxData->getPrice($product, $tier['website_price']) + $weeeAmount), - false - ); - $tier['formated_price_incl_weee_only'] = '' . $html . ''; - $tier['formated_weee'] = $store->formatPrice($store->convertPrice($weeeAmount)); - } - return $this; - } - /** * Check if fixed taxes are used in system * diff --git a/app/code/Magento/Weee/Pricing/Adjustment.php b/app/code/Magento/Weee/Pricing/Adjustment.php index d23c03acc1b03..26f5520f71261 100644 --- a/app/code/Magento/Weee/Pricing/Adjustment.php +++ b/app/code/Magento/Weee/Pricing/Adjustment.php @@ -29,6 +29,7 @@ use Magento\Framework\Pricing\Adjustment\AdjustmentInterface; use Magento\Framework\Pricing\Object\SaleableInterface; use Magento\Weee\Helper\Data as WeeeHelper; +use Magento\Tax\Pricing\Adjustment as TaxAdjustment; /** * Weee pricing adjustment @@ -38,7 +39,7 @@ class Adjustment implements AdjustmentInterface /** * Adjustment code weee */ - const CODE = 'weee'; + const ADJUSTMENT_CODE = 'weee'; /** * Weee helper @@ -73,7 +74,7 @@ public function __construct(WeeeHelper $weeeHelper, $sortOrder = null) */ public function getAdjustmentCode() { - return self::CODE; + return self::ADJUSTMENT_CODE; } /** @@ -98,8 +99,7 @@ public function isIncludedInDisplayPrice() [ \Magento\Weee\Model\Tax::DISPLAY_INCL, \Magento\Weee\Model\Tax::DISPLAY_INCL_DESCR, - \Magento\Weee\Model\Tax::DISPLAY_EXCL_DESCR_INCL, - 4 + \Magento\Weee\Model\Tax::DISPLAY_EXCL_DESCR_INCL ] ); } @@ -136,7 +136,7 @@ public function applyAdjustment($amount, SaleableInterface $saleableItem) */ public function isExcludedWith($adjustmentCode) { - return ($adjustmentCode === self::CODE) || $adjustmentCode === \Magento\Tax\Pricing\Adjustment::CODE; + return (($adjustmentCode == self::ADJUSTMENT_CODE) || ($adjustmentCode == TaxAdjustment::ADJUSTMENT_CODE)); } /** diff --git a/app/code/Magento/Weee/Pricing/Render/Adjustment.php b/app/code/Magento/Weee/Pricing/Render/Adjustment.php index d190872dec822..3e491a8e93187 100644 --- a/app/code/Magento/Weee/Pricing/Render/Adjustment.php +++ b/app/code/Magento/Weee/Pricing/Render/Adjustment.php @@ -69,23 +69,14 @@ public function __construct( */ protected function apply() { - if ($this->typeOfDisplay( - [ - Tax::DISPLAY_EXCL, - Tax::DISPLAY_EXCL_DESCR_INCL - ] - ) - ) { + if ($this->typeOfDisplay([Tax::DISPLAY_EXCL, Tax::DISPLAY_EXCL_DESCR_INCL])) { $this->finalAmount = $this->amountRender->getDisplayValue(); $this->amountRender->setDisplayValue( $this->amountRender->getDisplayValue() - $this->amountRender->getAmount()->getAdjustmentAmount($this->getAdjustmentCode()) ); } - $html = $this->toHtml(); - if (trim($html)) { - $this->amountRender->addAdjustmentHtml($this->getAdjustmentCode(), $html); - } + return $this->toHtml(); } /** @@ -95,8 +86,7 @@ protected function apply() */ public function getAdjustmentCode() { - //@TODO We can build two model using DI, not code. What about passing it in constructor? - return \Magento\Weee\Pricing\Adjustment::CODE; + return \Magento\Weee\Pricing\Adjustment::ADJUSTMENT_CODE; } /** @@ -189,13 +179,7 @@ protected function getWeeeAttributesForDisplay() */ protected function isDisplayFpt() { - $isDisplayFpt = $this->typeOfDisplay( - [ - Tax::DISPLAY_INCL_DESCR, - Tax::DISPLAY_EXCL_DESCR_INCL - ] - ); - + $isDisplayFpt = $this->typeOfDisplay([Tax::DISPLAY_INCL_DESCR, Tax::DISPLAY_EXCL_DESCR_INCL]); return $isDisplayFpt; } } diff --git a/app/code/Magento/Weee/view/adminhtml/renderer/tax.phtml b/app/code/Magento/Weee/view/adminhtml/renderer/tax.phtml index b6a7d87305125..f7ba2fcec1930 100644 --- a/app/code/Magento/Weee/view/adminhtml/renderer/tax.phtml +++ b/app/code/Magento/Weee/view/adminhtml/renderer/tax.phtml @@ -35,7 +35,7 @@ $data = ['fptAttribute' => [ ]]; ?>
diff --git a/app/code/Magento/Weee/view/frontend/layout/catalog_product_prices.xml b/app/code/Magento/Weee/view/base/layout/catalog_product_prices.xml similarity index 100% rename from app/code/Magento/Weee/view/frontend/layout/catalog_product_prices.xml rename to app/code/Magento/Weee/view/base/layout/catalog_product_prices.xml diff --git a/app/code/Magento/Weee/view/frontend/pricing/adjustment.phtml b/app/code/Magento/Weee/view/base/pricing/adjustment.phtml similarity index 93% rename from app/code/Magento/Weee/view/frontend/pricing/adjustment.phtml rename to app/code/Magento/Weee/view/base/pricing/adjustment.phtml index 2f67a786065c2..da2c8b77d2e4b 100644 --- a/app/code/Magento/Weee/view/frontend/pricing/adjustment.phtml +++ b/app/code/Magento/Weee/view/base/pricing/adjustment.phtml @@ -29,10 +29,8 @@ /** @var \Magento\Weee\Pricing\Render\Adjustment $this */ $weeeSeparator = $openBrace = $closeBrace = ''; -//if ($this->getZone() !== \Magento\Framework\Pricing\Render::ZONE_ITEM_OPTION) { - $openBrace = '('; - $closeBrace = ')'; -//} +$openBrace = '('; +$closeBrace = ')'; ?> showInclDescr()): // incl. + weee ?> diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget.php b/app/code/Magento/Widget/Block/Adminhtml/Widget.php index 8295f7dc7f5c2..05135caf5cc93 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget.php @@ -53,6 +53,7 @@ protected function _construct() $this->_updateButton('save', 'class', 'add-widget'); $this->_updateButton('save', 'id', 'insert_button'); $this->_updateButton('save', 'onclick', 'wWidget.insertWidget()'); + $this->_updateButton('save', 'region', 'footer'); $this->_formScripts[] = 'wWidget = new WysiwygWidget.Widget(' . '"widget_options_form", "select_widget_type", "widget_options", "' . diff --git a/app/code/Magento/Widget/Model/Template/Filter.php b/app/code/Magento/Widget/Model/Template/Filter.php index 8fa4f630b715d..02a25137fdafc 100644 --- a/app/code/Magento/Widget/Model/Template/Filter.php +++ b/app/code/Magento/Widget/Model/Template/Filter.php @@ -51,6 +51,7 @@ class Filter extends \Magento\Cms\Model\Template\Filter * @param \Magento\Framework\View\LayoutInterface $layout * @param \Magento\Framework\View\LayoutFactory $layoutFactory * @param \Magento\Framework\App\State $appState + * @param \Magento\Backend\Model\UrlInterface $backendUrlBuilder * @param \Magento\Widget\Model\Resource\Widget $widgetResource * @param \Magento\Widget\Model\Widget $widget */ @@ -65,6 +66,7 @@ public function __construct( \Magento\Framework\View\LayoutInterface $layout, \Magento\Framework\View\LayoutFactory $layoutFactory, \Magento\Framework\App\State $appState, + \Magento\Backend\Model\UrlInterface $backendUrlBuilder, \Magento\Widget\Model\Resource\Widget $widgetResource, \Magento\Widget\Model\Widget $widget ) { @@ -80,7 +82,8 @@ public function __construct( $storeManager, $layout, $layoutFactory, - $appState + $appState, + $backendUrlBuilder ); } diff --git a/app/code/Magento/Wishlist/Block/AbstractBlock.php b/app/code/Magento/Wishlist/Block/AbstractBlock.php index d2e3a422fc08f..4dc3a810233fc 100644 --- a/app/code/Magento/Wishlist/Block/AbstractBlock.php +++ b/app/code/Magento/Wishlist/Block/AbstractBlock.php @@ -24,16 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Wishlist\Block; /** * Wishlist Product Items abstract Block - * - * @category Magento - * @package Magento_Wishlist - * @author Magento Core Team */ -namespace Magento\Wishlist\Block; - abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProduct { /** @@ -65,21 +60,18 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd * @param \Magento\Framework\App\Http\Context $httpContext * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Framework\App\Http\Context $httpContext, \Magento\Catalog\Model\ProductFactory $productFactory, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->httpContext = $httpContext; $this->_productFactory = $productFactory; parent::__construct( $context, - $data, - $priceBlockTypes + $data ); $this->_isScopePrivate = true; } @@ -304,48 +296,6 @@ public function hasWishlistItems() return $this->getWishlistItemsCount() > 0; } - /** - * Returns product price block html - * Overwrites parent price html return to be ready to show configured, partially configured and - * non-configured products - * - * @param \Magento\Catalog\Model\Product $product - * @param bool $displayMinimalPrice - * @param string $idSuffix - * - * @return string - */ - public function getPriceHtml($product, $displayMinimalPrice = false, $idSuffix = '') - { - $type_id = $product->getTypeId(); - if ($this->_catalogData->canApplyMsrp($product)) { - $realPriceHtml = $this->_preparePriceRenderer( - $type_id - )->setProduct( - $product - )->setDisplayMinimalPrice( - $displayMinimalPrice - )->setIdSuffix( - $idSuffix - )->setIsEmulateMode( - true - )->toHtml(); - $product->setAddToCartUrl($this->getAddToCartUrl($product)); - $product->setRealPriceHtml($realPriceHtml); - $type_id = $this->_mapRenderer; - } - - return $this->_preparePriceRenderer( - $type_id - )->setProduct( - $product - )->setDisplayMinimalPrice( - $displayMinimalPrice - )->setIdSuffix( - $idSuffix - )->toHtml(); - } - /** * Retrieve URL to item Product * diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php index 56ddead98b3e5..b7c8c30bc0a28 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php @@ -60,7 +60,6 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock * @param \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool * @param \Magento\Framework\Data\Form\FormKey $formKey * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, @@ -68,8 +67,7 @@ public function __construct( \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool, \Magento\Framework\Data\Form\FormKey $formKey, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->_formKey = $formKey; $this->_helperPool = $helperPool; @@ -77,8 +75,7 @@ public function __construct( $context, $httpContext, $productFactory, - $data, - $priceBlockTypes + $data ); } diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column.php index d96982ad9ca76..f9422452e62ca 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Wishlist\Block\Customer\Wishlist\Item; + /** * Wishlist block customer item column - * - * @category Magento - * @package Magento_Wishlist - * @author Magento Core Team */ -namespace Magento\Wishlist\Block\Customer\Wishlist\Item; - class Column extends \Magento\Wishlist\Block\AbstractBlock { /** diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php index c8da2ab2a3cb7..f4407b01235c6 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Wishlist\Block\Customer\Wishlist\Item\Column; + /** * Wishlist block customer item cart column - * - * @category Magento - * @package Magento_Wishlist - * @author Magento Core Team */ -namespace Magento\Wishlist\Block\Customer\Wishlist\Item\Column; - class Cart extends \Magento\Wishlist\Block\Customer\Wishlist\Item\Column { /** diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php index 389cbd7ab22ea..d1a91bddd726a 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php @@ -24,15 +24,13 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Wishlist\Block\Customer\Wishlist\Item; + /** * Wishlist block customer items * - * @category Magento - * @package Magento_Wishlist - * @author Magento Core Team + * @method \Magento\Wishlist\Model\Item getItem() */ -namespace Magento\Wishlist\Block\Customer\Wishlist\Item; - class Options extends \Magento\Wishlist\Block\AbstractBlock { /** @@ -58,23 +56,20 @@ class Options extends \Magento\Wishlist\Block\AbstractBlock * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Framework\App\Http\Context $httpContext, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->_helperPool = $helperPool; parent::__construct( $context, $httpContext, $productFactory, - $data, - $priceBlockTypes + $data ); } diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Items.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Items.php index a59540b4f19e8..468e30f1c1737 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Items.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Items.php @@ -24,15 +24,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Wishlist\Block\Customer\Wishlist; + /** * Wishlist block customer items - * - * @category Magento - * @package Magento_Wishlist - * @author Magento Core Team */ -namespace Magento\Wishlist\Block\Customer\Wishlist; - class Items extends \Magento\Framework\View\Element\Template { /** @@ -48,13 +44,13 @@ public function __construct(\Magento\Framework\View\Element\Template\Context $co /** * Retrieve table column object list * - * @return array + * @return \Magento\Wishlist\Block\Customer\Wishlist\Item\Column[] */ public function getColumns() { $columns = array(); foreach ($this->getLayout()->getChildBlocks($this->getNameInLayout()) as $child) { - if ($child->isEnabled()) { + if ($child instanceof \Magento\Wishlist\Block\Customer\Wishlist\Item\Column && $child->isEnabled()) { $columns[] = $child; } } diff --git a/app/code/Magento/Wishlist/Block/Share/Wishlist.php b/app/code/Magento/Wishlist/Block/Share/Wishlist.php index 04061a8394606..55cda9f968199 100644 --- a/app/code/Magento/Wishlist/Block/Share/Wishlist.php +++ b/app/code/Magento/Wishlist/Block/Share/Wishlist.php @@ -54,23 +54,20 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService * @param array $data - * @param array $priceBlockTypes */ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Framework\App\Http\Context $httpContext, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService, - array $data = array(), - array $priceBlockTypes = array() + array $data = array() ) { $this->_customerAccountService = $customerAccountService; parent::__construct( $context, $httpContext, $productFactory, - $data, - $priceBlockTypes + $data ); } diff --git a/app/code/Magento/Wishlist/Model/Item.php b/app/code/Magento/Wishlist/Model/Item.php index f6d94a7a4fc7f..4801283f29934 100644 --- a/app/code/Magento/Wishlist/Model/Item.php +++ b/app/code/Magento/Wishlist/Model/Item.php @@ -23,6 +23,12 @@ */ namespace Magento\Wishlist\Model; +use Magento\Catalog\Model\Product\Configuration\Item\ItemInterface; +use Magento\Framework\Model\AbstractModel; +use Magento\Wishlist\Model\Item\Option; +use Magento\Wishlist\Model\Item\OptionFactory; +use Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory; + /** * Wishlist item model * @@ -38,12 +44,7 @@ * @method string getDescription() * @method \Magento\Wishlist\Model\Item setDescription(string $value) */ -use Magento\Wishlist\Model\Item\Option; -use Magento\Wishlist\Model\Item\OptionFactory; -use Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory; - -class Item extends \Magento\Framework\Model\AbstractModel implements - \Magento\Catalog\Model\Product\Configuration\Item\ItemInterface +class Item extends AbstractModel implements ItemInterface { const EXCEPTION_CODE_NOT_SALABLE = 901; diff --git a/app/code/Magento/Wishlist/view/frontend/item/column/cart.phtml b/app/code/Magento/Wishlist/view/frontend/item/column/cart.phtml index c29c325fcf294..8ee432496fcbd 100644 --- a/app/code/Magento/Wishlist/view/frontend/item/column/cart.phtml +++ b/app/code/Magento/Wishlist/view/frontend/item/column/cart.phtml @@ -27,13 +27,12 @@ /* @var \Magento\Wishlist\Model\Item $item */ $item = $this->getItem(); $product = $item->getProduct(); -$options = $this->getChildBlock('customer.wishlist.item.options') - ->setItem($item) - ->getConfiguredOptions(); ?> -getPriceHtml($product, empty($options));?> +getChildNames() as $childName): ?> + getLayout()->renderElement($childName, false); ?> +
- canHaveQty() && $item->getProduct()->isVisibleInSiteVisibility()): ?> + canHaveQty() && $product->isVisibleInSiteVisibility()): ?> @@ -53,9 +52,7 @@ $options = $this->getChildBlock('customer.wishlist.item.options')
-getChildNames() as $childName): ?> - getLayout()->renderElement($childName, false); ?> - + isVisibleInSiteVisibility()): ?>

diff --git a/app/code/Magento/Wishlist/view/frontend/item/configure/addto.phtml b/app/code/Magento/Wishlist/view/frontend/item/configure/addto.phtml index df087aa314c4c..8fc200e90932e 100644 --- a/app/code/Magento/Wishlist/view/frontend/item/configure/addto.phtml +++ b/app/code/Magento/Wishlist/view/frontend/item/configure/addto.phtml @@ -39,9 +39,7 @@

\ No newline at end of file diff --git a/app/code/Magento/Wishlist/view/frontend/item/list.phtml b/app/code/Magento/Wishlist/view/frontend/item/list.phtml index a74d809fd8157..44b08b72332f0 100644 --- a/app/code/Magento/Wishlist/view/frontend/item/list.phtml +++ b/app/code/Magento/Wishlist/view/frontend/item/list.phtml @@ -24,6 +24,7 @@ */ ?> getColumns(); ?>
diff --git a/app/code/Magento/Wishlist/view/frontend/js/components.phtml b/app/code/Magento/Wishlist/view/frontend/js/components.phtml new file mode 100644 index 0000000000000..3059c2084b4cb --- /dev/null +++ b/app/code/Magento/Wishlist/view/frontend/js/components.phtml @@ -0,0 +1,47 @@ + + +getChildHtml() ?> diff --git a/app/code/Magento/Wishlist/view/frontend/layout/default.xml b/app/code/Magento/Wishlist/view/frontend/layout/default.xml index 9655a6007e4fb..ad9772e7480d0 100644 --- a/app/code/Magento/Wishlist/view/frontend/layout/default.xml +++ b/app/code/Magento/Wishlist/view/frontend/layout/default.xml @@ -24,6 +24,9 @@ */ --> + + + diff --git a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_bundle.xml b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_bundle.xml index ad14d827fc42f..a477b24356795 100644 --- a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_bundle.xml +++ b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_bundle.xml @@ -25,11 +25,6 @@ --> - - - Magento_Bundle::bundle.js - - Magento_Bundle::js/product-summary.js @@ -42,11 +37,13 @@ - - - - Magento_Catalog::product/price_msrp_item.phtml - + + + + product.price.render.default + configured_price + item_view + @@ -61,11 +58,10 @@ + - - - + product.info.addtocart @@ -81,21 +77,8 @@ - - - bundle - Magento\Bundle\Block\Catalog\Product\Price - catalog/product/price.phtml - - + - + - - - bundle - Magento\Bundle\Block\Catalog\Product\Price - catalog/product/view/price.phtml - - diff --git a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_configurable.xml b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_configurable.xml index 3c266d53bdf78..4fcfe46d66654 100644 --- a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_configurable.xml +++ b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_configurable.xml @@ -24,6 +24,9 @@ */ --> + + + type-configurable diff --git a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_index.xml b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_index.xml index 736ea4b4bafed..1138642649f3e 100644 --- a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_index.xml +++ b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_index.xml @@ -44,14 +44,14 @@ actions Add to Cart - product.price.render.default - final_price + configured_price item_list + diff --git a/app/code/Magento/Wishlist/view/frontend/render/item/price_msrp_item.phtml b/app/code/Magento/Wishlist/view/frontend/render/item/price_msrp_item.phtml index ba18d0229cb43..694048dea841f 100644 --- a/app/code/Magento/Wishlist/view/frontend/render/item/price_msrp_item.phtml +++ b/app/code/Magento/Wishlist/view/frontend/render/item/price_msrp_item.phtml @@ -53,36 +53,21 @@ getIdSuffix(); ?> getRandomString(20); ?> - + + getMsrpPriceMessage($_product) ?> getRandomString(20); ?> - +
- - diff --git a/app/code/Magento/Wishlist/view/frontend/shared.phtml b/app/code/Magento/Wishlist/view/frontend/shared.phtml index 20c8459fbd124..3d6ae0f7acd69 100644 --- a/app/code/Magento/Wishlist/view/frontend/shared.phtml +++ b/app/code/Magento/Wishlist/view/frontend/shared.phtml @@ -53,7 +53,14 @@ $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Im escapeHtml($product->getName()) ?> - getPriceHtml($product) ?> + getProductPriceHtml( + $product, + \Magento\Catalog\Pricing\Price\ConfiguredPriceInterface::CONFIGURED_PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + ['item' => $item] + ); + ?> getDetailsHtml($item) ?>
getEscapedDescription($item) ?>
-// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -//
#Column 1Column 2Column 3
1Cell 4Cell 5Cell 6
2Cell 7Cell 8Cell 9
3Cell 10Cell 11Cell 12
4Cell 13Cell 14Cell 15
5Cell 16Cell 17Cell 18
-// ``` -// - -table { - th { - border-right: 1px solid @primary2; - font-size: @baseFontSizeBigger; - padding: 7px 10px; - &:last-child { - border-right: 0; - } - } - td { - border-right: 1px solid @primary2; - padding: 7px 10px; - vertical-align: top; - &:last-child { - border-right: 0; - } - } - tbody tr:nth-child(odd) td { - background: @primary1; - } -} - -// #Blockquote -// -// ```html -//
-//

The cite element represents the title of a work (e.g. a book, a paper, an essay, a poem, a score, a song, a script, a film, a TV show, a game, a sculpture, a painting, a theatre production, a play, an opera, a musical, an exhibition, a legal case report, etc). This can be a work that is being quoted or referenced in detail (i.e. a citation), or it can just be a work that is mentioned in passing.

-//

A person's name is not the title of a work — even if people call that person a piece of work — and the element must therefore not be used to mark up people's names. (In some cases, the b element might be appropriate for names; e.g. in a gossip article where the names of famous people are keywords rendered with a different style to draw attention to them. In other cases, if an element is really needed, the span element can be used.)

-// http://www.w3.org/html/wg/drafts/html/master/text-level-semantics.html -//
-// ``` -// - -blockquote { - margin: 10px 20px 10px 40px; - &:before { - color: @primary4; - content: "\201C"; - display: block; - font-family: Georgia, serif; - font-size: 60px; - font-style: italic; - position: absolute; - left: 15px; - top: 10px; - } - cite { - color: @primary4; - font-style: italic; - font-size: @baseFontSizeMiddle; - margin: 1em 0; - } -} - -// #HR -// -// ```html -//
-// ``` -// - -hr { - background: @primary3; - border: 0; - color: @primary3; - height: 1px; - margin: 1em 0; -} diff --git a/app/design/frontend/Magento/plushe/css/source/styles/magento.less b/app/design/frontend/Magento/plushe/css/source/styles/magento.less deleted file mode 100644 index 976718629d980..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/styles/magento.less +++ /dev/null @@ -1,1549 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// #Mixins -// -// Common mixins used for styling magento elements -// - -.pagerLabel() { - font-weight: @baseFontWeight; - line-height: 25px; - margin-right: 5px; -} - -// #Search form -// -// ```html -// -// ``` -// - -.block.search { - input { - border-radius: 3px 0 0 3px; - border-right: 0; - float: left; - width: 100%; - &:focus + { - border-color: @primary3; - } - } - .field .control { - width: 260px; - } - .label, - > .title, - .action.advanced { - display: none; - } - .action.search { - background: @primary7; - border: 1px solid @primary3; - border-radius: 0 3px 3px 0; - color: @primary3; - float: left; - padding: 7px; - &:hover { - color: @primary6; - } - span { - .iconAfter(@icon-magnifying-glass, 16px, 0, 'icons'); - .iconHideText(16px); - } - .search.autocomplete { - display: none !important; - } - } - ::-webkit-input-placeholder { - color: @primary4; - } - :-moz-placeholder { - color: @primary4; - } - ::-moz-placeholder { - color: @primary4; - } - :-ms-input-placeholder { - color: @primary4; - } -} - -// #Newsletter sign up form -// -// ```html -// -// ``` -// - -.block.newsletter { - > .title { - display: none; - } - .label { - display: block; - font-size: @baseFontSizeBigger; - line-height: 1.2; - margin-bottom: 10px; - } - .control { - .box-sizing(); - float: left; - padding-right: 45px; - width: 100%; - } - input[type="text"] { - width: 100%; - } - .actions { - float: right; - margin-left: -45px; - padding-left: 10px; - } - .action.subscribe { - .box-sizing(); - background: @primaryActionBg; - border-radius: 3px; - border: 1px solid @primaryActionBg; - padding: 7px; - vertical-align: top; - &:hover { - background: @primaryActionBgH; - } - span { - .iconAfter(@icon-envelope, 16px, 0, "icons"); - .iconHideText(16px); - color: @primary7; - } - } -} - -// #Mage Catalog -// -// #Breadcrumbs -// -// ```html -// -// ``` -// - -.breadcrumbs { - font-size: @baseFontSizeMiddle; - .items { - margin: 0; - padding: 0; - } - .item { - display: inline; - font-weight: @baseFontWeightLighter; - &:before { - content: " / "; - } - &:first-child:before { - content: ""; - } - } - strong { - font-weight: @baseFontWeight; - } -} - -// #Pager -// -// ```html -//
-// Page -//
    -//
  1. -//
  2. 1
  3. -//
  4. 2
  5. -//
  6. 3
  7. -//
  8. -//
-//
-// ``` -// - -.pages { - ol { - .resetList(); - } - .item { - display: inline-block; - } - a { - padding: 0 3px; - } - strong { - color: @secondary1; - font-weight: normal; - padding: 0 3px; - } - > .label { - display: none; - } - .action { - &.previous { - .iconAfter(@icon-arrow-left-thick, 16px, 0, "icons"); - .iconHideText(16px); - display: inline-block; - } - &.next { - .iconAfter(@icon-arrow-right-thick, 16px, 0, "icons"); - .iconHideText(16px); - display: inline-block; - } - color: @primary3; - &:hover { - color: darken(@primary3, 20%); - } - } -} - -// #View switcher -// -// ```html -//
-// View as -// -// Grid -// -// -// List -// -// View as -// -// Grid -// -// -// List -// -//
-// ``` -// - -.modes { - .label { - display: none; - } - .mode { - border: 1px solid @primary3; - color: @primary3; - display: inline-block; - margin: 0 3px; - overflow: hidden; - padding: 4px; - &.active { - background: @primary3; - border-color: @primary3; - cursor: default; - color: @primary7; - span { - color: @primary7; - } - &:hover { - background: @primary3; - border-color: @primary3; - color: @primary7; - span { - color: @primary7; - } - } - } - &:hover { - background: @primary4; - border-color: @primary4; - color: @primary7; - span { - color: @primary7; - } - } - &.grid { - .iconAfter(@icon-grid, 13px, 0, "icons"); - .iconHideText(13px); - display: inline-block; - } - &.list { - .iconAfter(@icon-list, 13px, 0, "icons"); - .iconHideText(13px); - display: inline-block; - } - } -} - -// #"Sort by" switcher -// -// ```html -//
-// -// -// -// Set Ascending Direction -// -// -// Set Descending Direction -// -//
-// ``` -// - -.sorter { - .label { - .pagerLabel(); - } - select { - padding: 0; - } - .action.sort { - &.desc { - .iconAfter(@icon-arrow-down-thick, 13px, 0, "icons"); - .iconHideText(13px); - display: inline-block; - } - &.asc { - .iconAfter(@icon-arrow-up-thick, 13px, 0, "icons"); - .iconHideText(13px); - display: inline-block; - } - } -} - -// #Pager limiter -// -// ```html -//
-// Show -// -// per page -//
-// ``` -// - -.limiter { - .label { - .pagerLabel(); - } - select { - padding: 0; - } - .text { - display: none; - } -} - -// #Tags -// -// ```html -// -// ``` -// - -.tags.items.cloud { - .resetList(); - margin: 0 0 20px; - .item { - .resetList(); - display: inline-block; - margin: 0 0 5px 5px; - &:first-child { - margin-left: 0; - } - } - .amount { - margin-left: 3px; - &:before { - content: '('; - } - &:after { - content: ')'; - } - } -} - -// #Ratings -// -// ```html -//
-// -//
-//
-//
-// -//
-// -// -// -// -// -// -// -// -// -// -//
-//
-//
-// -//
-// -// -// -// -// -// -// -// -// -// -//
-//
-//
-// -//
-// -// -// -// -// -// -// -// -// -// -//
-//
-//
-//
-//
-// ``` -// - -.field.ratings { - @starSize: 16px; - border-bottom: 1px solid; - .borderColor(@primary1); - padding-bottom: 15px; - margin-bottom: 30px; - overflow: hidden; - position: relative; - z-index: 1; - .nested { - display: table; - } - .field.rating { - display: table-row; - > .label { - display: table-cell; - vertical-align: top; - padding: 6px 0; - } - .control { - padding: 5px 10px; - display: table-cell; - z-index: 1; - &:before { - letter-spacing: 0.2em; - position: absolute; - z-index: 1; - display: block; - float: left; - font-family: "icons"; - content: "\e009\e009\e009\e009\e009"; - font-style: normal; - font-size: @starSize; - color: fade(@secondary1, 30%); - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - } - input:focus + label:before, - input:checked + label:before { - color: @secondary1; - opacity: 1; - } - input[type="radio"] { - position: absolute; - margin-left: -999em; - } - label { - position: absolute; - display: block; - span { - display: none; - } - &:before { - letter-spacing: 0.2em; - font-family: "icons"; - font-style: normal; - font-size: @starSize; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - opacity: 0; - } - &:hover { - &:before { - color: @secondary1; - opacity: 1; - } - & ~ label:before { - opacity: 0 !important; - } - } - cursor: pointer; - } - .rating-1 { - z-index: 6; - &:before { - content: "\e009"; - } - } - .rating-2 { - z-index: 5; - &:before { - content: "\e009\e009"; - } - } - .rating-3 { - z-index: 4; - &:before { - content: "\e009\e009\e009"; - } - } - .rating-4 { - z-index: 3; - &:before { - content: "\e009\e009\e009\e009"; - } - } - .rating-5 { - z-index: 2; - &:before { - content: "\e009\e009\e009\e009\e009"; - } - } - } - } -} - -// #Login form -// The login form's design differs from default form layout: labels are in the same line as inputs (in default form layout labels and corresponding inputs are in different lines) The code is the same, it differs only with styles. -// -// ```html -// -// ``` -// - -.fieldset { - &.login { - margin: 0; - padding: 0; - > .field { - .clearfix(); - > .label { - .box-sizing(); - float: left; - margin: 0; - padding-right: 10px; - padding-top: 7px; - text-align: right; - width: 40%; - } - > .control { - float: left; - margin: 0; - width: 60%; - } - } - .actions { - text-align: right; - .action.login { - &:extend(.primary.action all); - } - .secondary { - margin-top: 0.8em; - } - } - } -} - -// #Loader -// -// ```html -//
-// ``` -// - -.loader { - background: url("@{baseDir}/images/loader.gif") no-repeat 50% 50%; - .size(20px); -} - -// #Button with loader -// -// ```html -// -// ``` -// - -.action.mySecondaryButton { - &:extend(.secondary.action all); - &.loading { - padding-right: 30px; - position: relative; - &:after { - background: url("@{baseDir}/images/loader.gif") no-repeat 50% 50%; - .size(16px); - content: ""; - margin: -8px 0 0; - position: absolute; - right: 7px; - top: 50%; - } - } -} - -// #Text block under loader -// -// ```html -//
-//

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris sed lobortis magna, quis tincidunt elit. Donec molestie scelerisque ligula, ut eleifend nisl laoreet nec. Vivamus dapibus urna id risus porttitor cursus.

-//

Etiam lorem leo, accumsan quis est sit amet, tempus pellentesque ante. Donec rutrum convallis lacus, ac iaculis nulla scelerisque a. Pellentesque malesuada, mi eu condimentum volutpat, mi turpis congue sapien, et ornare nunc nunc vitae nibh. Duis scelerisque purus a sapien ultrices tempor. Sed nec blandit mauris, vel volutpat dolor.

-//

Vestibulum viverra tempus mi a accumsan. Nunc congue quis leo sed scelerisque. Fusce scelerisque magna nulla, sed malesuada nunc congue vel. Donec placerat malesuada bibendum. Nam bibendum nunc at neque consequat placerat. Aenean eu rutrum sapien. Vivamus vel mi urna. Suspendisse sit amet elit nunc.

-//
-// ``` -// - -.textUnderLoader { - background: @primary1; - border: 1px solid @primary3; - padding: 10px 20px; - &.loading { - position: relative; - &:before { - background: @primary7; - opacity: 0.7; - content: ""; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - } - &:after { - background: url("@{baseDir}/images/loader.gif") no-repeat 50% 50%; - .size(16px); - content: ""; - margin: -8px 0 0 -8px; - position: absolute; - left: 50%; - top: 50%; - } - } -} - -// #Mage Checkout -// -// #Checkout address form -// The checkout address form has specific logical fields grouping. Here styles are provided to separate the logical groups. The code is the same, it differs only with styles. -// -// ```html -//
-//
-//
-// -//
-// -//
-//
-//
-//
-// -//
-// -//
-//
-//
-// -//
-// -//
-//
-//
-// -//
-// -//
-//
-//
-// -//
-// -//
-//
-//
-// -//
-//
-//
-//
-//
-//
-// -//
-// -//
-//
-//
-// -//
-// -//
-//
-//
-// -//
-// -//
-//
-//
-// -//
-// -//
-//
-//
-// -//
-// -//
-//
-//
-// -//
-// -//
-//
-//
-// -// -//
-//
-//
-// -// -//
-//
-// -// -//
-//
-//
-// -//
-//
-//
-//
-// ``` -// - -.opc { - .fieldset { - margin: 20px 0; - .formCols(); - } - .field { - margin-bottom: 10px; - } - .field.fullname + .field.company, - .field.name-lastname + .field.company, - .field.country, - .field.taxvat { - margin: 0 40% 30px 0; - } - .actions .primary .action { - &:extend(.primary.action all); - } - .form { - &:extend(.hasRequired all); - } -} - -// #Payment method credit card form -// This form differs from the standard layout by its code and by design. Here labels are in the same line as inputs. It is necessary to replace the code by the new one. -// -// ```html -//
    -//
  • -// -//
    -// -//
    -//
  • -//
  • -// -//
    -// -//
    -//
  • -//
  • -// -//
    -//
    -// -//
    -//
    -// -//
    -//
    -//
  • -//
-// ``` -// - -.form-list { - .resetList(); - .required { - em { - display: none; - } - &:first-child:after { - color: @requiredField; - content: '*'; - } - } - > li { - .clearfix(); - margin: 0 0 10px; - .field { - .clearfix(); - margin: 10px 0 0; - &:first-child { - margin: 0; - } - } - > label, - .field > label { - .box-sizing(); - clear: left; - float: left; - padding: 7px 10px 0 0; - text-align: right; - width: 30%; - } - .input-box { - float: left; - width: 70%; - > input, - > select, - > textarea { - width: 100%; - } - > .v-fix { - float: left; - margin: 0 10px 0 0; - } - } - } -} - -// #Shopping Cart -// #Shopping cart estimation settings -// The shopping card estimation settings design differs from standard form layout by the code and by the design. Here the code and the styles are provided. -// -// ```html -//
-// -//
-//
Estimate Shipping and Tax
-//
-//
-//
-//

Enter your destination to get a shipping estimate.

-//
-// -//
-// -//
-//
-//
-// -//
-// -//
-//
-//
-// -//
-// -//
-//
-//
-// -//
-// -//
-//
-//
-// -//
-//
-//
-//
-//
-//
-//
Flat Rate
-//
-//
-// -// -//
-//
-//
-//
-// -//
-//
-//
-//
-// -//
-//
Discount Codes
-//
-//
-//
-//
-// -// -//
-// -//
-//
-//
-//
-// -//
-//
-//
-//
-//
-//
-//
-// -// -//
-// ``` -// - -.cart.summary { - .fieldset { - border: 0; - font-size: @baseFontSizeMiddle; - padding: 0; - margin: 0; - .field { - margin: 0 0 10px; - &:not(.choice) { - .label { - padding: 0 0 5px; - display: block; - } - } - } - .action:not(.check) { - &:extend(.primary.action all); - padding: 6px 11px 5px; - span { - font-size: @baseFontSizeMiddle; - line-height: @baseFontSizeMiddle; - } - } - &.coupon, - &.estimate { - .actions { - display: table-cell; - width: 1%; - white-space: nowrap; - vertical-align: bottom; - } - } - &.coupon .field, - .field.postcode { - display: table-cell; - padding-right: 10px; - vertical-align: bottom; - width: 99%; - div.mage-error { - position: absolute; - } - } - &.rates { - padding-top: 25px; - .actions { - text-align: right; - } - } - } - .title { - cursor: pointer; - line-height: @baseFontSizeBigger; - margin: 0; - padding: 10px 5px; - } - .content { - padding: 15px 15px 20px; - } - input[type="text"] { - padding: 0 5px; - font-size: 12px; - height: 30px; - } - select { - padding: 5px 5px 4px; - font-size: 12px; - } - .items.methods { - dt { - font-weight: @baseFontWeightBolder; - } - dd { - margin: 10px 10px 25px; - } - } -} - -// #Popup -// ```html -// -//
-//
-// -//
-// -//
-//
-// -//
-//
-// ``` -// - -.popup { - background: @primary2; - border: 1px solid @primary3; - display: inline-block; - padding: 20px; - position: relative; - > .close { - color: @primary4; - cursor: pointer; - position: absolute; - right: 5px; - top: 3px; - .iconBefore(@icon-close-thick, 12px, 0, "icons"); - &:hover { - color: @primary6; - } - } - .fade & { - background: @pageMainBg; - box-shadow: 0 0 10px 0 @primary4; - } - > .header, - > .content { - margin: 0 0 5px; - } - > .header { - font-size: @baseFontSizeBigger; - font-weight: @baseFontWeightBolder; - } - .actions { - margin: 15px 0 0; - .action.submit { - &:extend(.primary.action all); - margin-right: 10px; - } - .action.cancel { - &:extend(.secondary.action all); - } - } - &.system { - background: @pageMainBg; - padding: 0; - > .header { - background: @primary2; - border-bottom: 1px solid @primary3; - border-radius: 5px 5px 0 0; - cursor: move; - padding: 10px 20px; - } - > .content { - padding: 20px; - } - > .footer { - border-top: 1px solid @primary3; - padding: 10px 20px; - } - .actions { - margin: 0; - } - .close { - right: 8px; - top: 8px; - } - } -} - -.fade { - background-color: @primeBlackOpacity; - position: relative; - left: 0; - top: 0; - right: 0; - bottom: 0; - padding: 10%; -} - - -// #CSS tooltip -// -// ####Accepted parameters -// **.tooltipSimple(*[background]*, *[color]*, *[fontSize]*, *[margin]*, *[padding]*, *[maxWidth]*, *[cursor]*);** -// -// Tooltip can be added to any element -// ```html -// Projects in Sublime Text capture the full contents of the workspace, -// -// Your content -//
Tooltip content
-//
-// including modified and unsaved files. -// You can switch between projects in a manner similar to Goto Anything, -// and the switch is instant, with no save prompts - all your modifications will be restored next time the project is opened. -// ``` -// - -// #Radiobutton tooltip -// -// ```html -//
-// -// -//
Tooltip content
-//
-// ``` - -.tooltip { - .tooltipCSS(rgba(0,0,0,.5), #fff, 16px, 10px 0 0, 8px, 500px, help); -} - -// #JS tooltip: -// -// ####Accepted parameters -// **.tooltipJS(*[background]*, *[color]*, *[fontSize]*, *[padding]*, *[maxWidth]*);** -// -// ####Add attributes to the tag: -// -// **tooltip**="text tooltip" -// -// **tooltip-position**="n, nw, ne, w, e, s, sw, se" -// -// ```html -//
-// -// -// -//
-// -// -// -//
-// -// -// -//
-// ``` - -.tipsy { - .tooltipJS(rgba(0,0,0,.9), #fff); -} - -// #Tooltip mixins: -.tooltipCSS(@background: @primeBlackOpacity, @color: @primary7, @fontSize: 16px, @margin: 10px 0 0, @padding: 4px 8px, @maxWidth: 200px, @cursor: help) { - display: inline-block; - vertical-align: middle; - line-height: 1.1; - cursor: @cursor; - .tooltip-content { - display: none; - position: absolute; - max-width: @maxWidth; - margin: @margin; - padding: @padding; - background: @background; - color: @color; - border-radius: 3px; - z-index: 20; - &:before { - content: ''; - position: absolute; - width: 0; - height: 0; - top: -5px; - left: 20px; - border-left: 5px solid transparent; - border-right: 5px solid transparent; - border-bottom: 5px solid @background; - } - } - &:hover > .tooltip-content { - display: block; - } -} - -.tooltipJS(@background: @primeBlackOpacity, @color: @primary7, @fontSize: 16px, @padding: 5px, @maxWidth: 200px) { - position: absolute; - left: 0; - top: 0; - display: none; - padding: @padding; - font-size: @fontSize; - z-index: 9999; - .tipsy-inner { - padding: 5px 8px 4px; - background-color: @background; - color: @color; - max-width: @maxWidth; - border-radius: 3px; - } - .tipsy-arrow { - position: absolute; - width: 0; - height: 0; - border-left: 5px solid transparent; - border-right: 5px solid transparent; - border-bottom: 5px solid @background; - } - &.tipsy-s .tipsy-arrow { - top: 0; - left: 50%; - margin-left: -4px; - } - &.tipsy-se .tipsy-arrow { - top: 0; - left: 10px; - } - &.tipsy-sw .tipsy-arrow { - top: 0; - right: 10px; - } - &.tipsy-n .tipsy-arrow, - &.tipsy-ne .tipsy-arrow, - &.tipsy-nw .tipsy-arrow { - bottom: 0; - border-left: 5px solid transparent; - border-right: 5px solid transparent; - border-top: 5px solid @background; - border-bottom: none; - } - &.tipsy-n .tipsy-arrow { - left: 50%; - margin-left: -4px; - } - &.tipsy-ne .tipsy-arrow { - left: 10px; - } - &.tipsy-nw .tipsy-arrow { - right: 10px; - } - &.tipsy-w .tipsy-arrow, - &.tipsy-e .tipsy-arrow { - top: 50%; - margin-top: -4px; - border-top: 5px solid transparent; - border-bottom: 5px solid transparent; - } - &.tipsy-w .tipsy-arrow { - right: 0; - border-right: none; - border-left: 5px solid @background; - } - &.tipsy-e .tipsy-arrow { - left: 0; - border-right: 5px solid @background; - border-left: none; - } -} - - -.example-tooltips {/*presentation styles*/ - padding: 70px; - text-align: center; -} - -.example-tooltips button {/*presentation styles*/ - width: 70px; - height: 70px; - font-size: 18px; - margin: 10px 5px; -} diff --git a/app/design/frontend/Magento/plushe/css/source/vars.less b/app/design/frontend/Magento/plushe/css/source/vars.less deleted file mode 100644 index 92730eb39d74a..0000000000000 --- a/app/design/frontend/Magento/plushe/css/source/vars.less +++ /dev/null @@ -1,283 +0,0 @@ -// /** -// // * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. -// * -// * @category design -// * @package magento2_reference -// * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) -// * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -// */ - -// Primary colors -@primary1: #f8f8f8; -@primary2: #e5e5e5; -@primary3: #c2c2c2; -@primary4: #999; -@primary5: #837d75; -@primary6: #675f55; -@primary7: #fff; -@primeBlack: #7f7f7f; -@primeBlackOpacity: rgba(0, 0, 0, 0.5); -@commonBg: #fff; - -// Secondary colors -@secondary1: #da370a; -@secondary2: #55c2e6; - -// Buttons -@primaryActionBg: @secondary1; -@primaryActionBgH: darken(@secondary1, 10%); -@primaryActionColor: #fff; - -@secondaryActionBg: @primary3; -@secondaryActionBgH: darken(@primary3, 10%); -@secondaryActionColor: #fff; - -@actionFont: 600 14px/16px; - -// Tooltip -@optionsBg: rgba(0, 0, 0, .8); -@optionsColor: #fff; - -// Layout -@LayoutMaxWidth: 1025px; -@LayoutMinWidth: 1025px; - -// Links -@link: #332e29; -@linkHover: @secondary1; - -// Base font -@baseFont: "sourcesanspro"; -@baseFontSizeBigger: 16px; -@base-font-size: 14px; // re-declarate base font size for clearLess -@baseFontSize: 14px; -@baseFontSizeMiddle: 12px; -@baseFontSizeSmall: 10px; -@baseFontWeight: 400; -@baseFontWeightLighter: 200; -@baseFontWeightBolder: 700; -@baseLineHeight: 1.33; -@baseColor: @primary6; - -@pageMainBg: #fff; -@headerBg: #d6d7d2; -@headerBgImage: url("@{baseDir}/images/header-bg.jpg"); -@pageBottomBg: @pageMainBg; -@footerBg: @pageMainBg; -@textColor: @primary6; -@linksColor: @primary6; -@gutter-width: 0; -@using-ieclasses: false; - -// Headings: -// H1 -@h1font: 200 30px/1.2 @baseFont; -@h1color: @primary6; - -// H2 -@h2font: 400 20px/1.2 @baseFont; -@h2color: @primary6; - -// H3 -@h3font: 600 18px/1.2 @baseFont; -@h3color: @primary6; - -// H4 -@h4font: 600 16px/1.2 @baseFont; -@h4color: @primary6; - -// H5 -@h5font: 600 14px/1.2 @baseFont; -@h5color: @primary6; - -// H6 -@h6font: 600 12px/1.2 @baseFont; -@h6color: @primary6; - -// Forms -@legendFontSize: 20px; -@fieldBg: #fff; - -// Required fields and validation -@requiredField: #da370a; -@nonValidHilight: #da370a; -@validHilight: #42b649; - -// Messages colors -@messageIconColor: #fff; -// Success message -@messageSuccessColor: #1b6720; -@messageSuccessBg: #d3edd5; -@messageSuccessIconBg: #42b649; -// Error message -@messageErrorColor: #911c00; -@messageErrorBg: #ffd9d0; -@messageErrorIconBg: #ff3200; -// Notice message, Info message -@messageNoticeColor: #926e00; -@messageNoticeBg: #ffedb8; -@messageNoticeIconBg: #ffc000; - -@baseDir: ~".."; //default -@paypalRetinaButton: url("@{baseDir}/images/express-checkout-retina.png"); - -// # Icons -// ``` -// @icon-pencil -// @icon-menu -// @icon-location -// @icon-info -// @icon-flag -// @icon-expand -// @icon-exclamation -// @icon-dropdown -// @icon-collapse -// @icon-close-thick -// @icon-checkmark -// @icon-cart -// @icon-arrow-up-thin -// @icon-arrow-right-thin -// @icon-arrow-left-thin -// @icon-arrow-down-thin -// @icon-arrow-up-thick -// @icon-arrow-right-thick -// @icon-arrow-left-thick -// @icon-arrow-down-thick -// @icon-wishlist -// @icon-comment -// @icon-comment-reflected -// @icon-list -// @icon-grid -// @icon-close-thin -// @icon-trash -// @icon-envelope -// @icon-magnifying-glass -// @icon-arrow-right-filled -// @icon-arrow-bottom-filled -// @icon-arrow-left-filled -// @icon-arrow-up-filled -// @icon-star -// @icon-calendar -// ``` - -@icon-pencil: "\e006"; -@icon-menu: "\e007"; -@icon-location: "\e008"; -@icon-info: "\e00a"; -@icon-flag: "\e00c"; -@icon-expand: "\e00d"; -@icon-exclamation: "\e00e"; -@icon-dropdown: "\e010"; -@icon-collapse: "\e011"; -@icon-close-thick: "\e012"; -@icon-checkmark: "\e013"; -@icon-cart: "\e014"; -@icon-arrow-up-thin: "\e015"; -@icon-arrow-right-thin: "\e016"; -@icon-arrow-left-thin: "\e017"; -@icon-arrow-down-thin: "\e018"; -@icon-arrow-up-thick: "\e019"; -@icon-arrow-right-thick: "\e01a"; -@icon-arrow-left-thick: "\e01b"; -@icon-arrow-down-thick: "\e01c"; -@icon-wishlist: "\e01d"; -@icon-comment: "\e01e"; -@icon-comment-reflected: "\e01f"; -@icon-list: "\e002"; -@icon-grid: "\e003"; -@icon-close-thin: "\e004"; -@icon-trash: "\e000"; -@icon-envelope: "\e001"; -@icon-magnifying-glass: "\e005"; -@icon-arrow-right-filled: "\e02b"; -@icon-arrow-bottom-filled: "\e02c"; -@icon-arrow-left-filled: "\e02a"; -@icon-arrow-up-filled: "\e029"; -@icon-star: "\e009"; -@icon-calendar: "\e00b"; - -// Responsive -@breakPoint1: 640px; -@icon-expand-mobile: "+"; -@icon-collapse-mobile: "–"; - - - - -// Messages variables - -@message-border: none; -@message-border-radius: 3px; -@message-padding: 13px 20px 12px; -@message-margin: 3px 0; -@message-font-size: 14px; -@message-line-height: 16px; -@message-icon-font-size: 20px; -@message-icon-inner-padding-left: 40px; -@message-icon-lateral-width: 30px; - -// Info -@message-info-color: @messageNoticeColor; -@message-info-background: @messageNoticeBg; -@message-info-link-color: @link; -@message-info-link-color-hover: @linkHover; -@message-info-icon: @icon-info; -@message-info-icon-color: #c07600; -@message-info-icon-background: @messageNoticeIconBg; -@message-info-border: @message-border; - -// Warning -@message-warning-color: @messageNoticeColor; -@message-warning-background: @messageNoticeBg; -@message-warning-link-color: @link; -@message-warning-link-color-hover: @linkHover; -@message-warning-icon: @icon-info; -@message-warning-icon-color: #c07600; -@message-warning-icon-background: @messageNoticeIconBg; -@message-warning-border: @message-border; - -// Error -@message-error-color: @messageErrorColor; -@message-error-background: @messageErrorBg; -@message-error-link-color: @link; -@message-error-link-color-hover: @linkHover; -@message-error-icon: @icon-info; -@message-error-icon-color: #b30000; -@message-error-icon-background: @messageErrorIconBg; -@message-error-border: @message-border; - -// Success -@message-success-color: @messageSuccessColor; -@message-success-background: @messageSuccessBg; -@message-success-link-color: @link; -@message-success-link-color-hover: @linkHover; -@message-success-icon: @icon-checkmark; -@message-success-icon-color: #006400; -@message-success-icon-background: @messageSuccessIconBg; -@message-success-border: @message-border; - -// Notice -@message-notice-color: @messageNoticeColor; -@message-notice-background: @messageNoticeBg; -@message-notice-link-color: @link; -@message-notice-link-color-hover: @linkHover; -@message-notice-icon: @icon-info; -@message-notice-icon-color: #c07600; -@message-notice-icon-background: @messageNoticeIconBg; -@message-notice-border: @message-border; diff --git a/app/design/frontend/Magento/plushe/css/styles.less b/app/design/frontend/Magento/plushe/css/styles.less deleted file mode 100644 index 2507f5de4d903..0000000000000 --- a/app/design/frontend/Magento/plushe/css/styles.less +++ /dev/null @@ -1,5713 +0,0 @@ -/** -// * Magento -// * -// * NOTICE OF LICENSE -// * -// * This source file is subject to the Academic Free License (AFL 3.0) -// * that is bundled with this package in the file LICENSE_AFL.txt. -// * It is also available through the world-wide-web at this URL: -// * http://opensource.org/licenses/afl-3.0.php -// * If you did not receive a copy of the license and are unable to -// * obtain it through the world-wide-web, please send an email -// * to license@magentocommerce.com so we can send you a copy immediately. -// * -// * DISCLAIMER -// * -// * Do not edit or add to this file if you wish to upgrade Magento to newer -// * versions in the future. If you wish to customize Magento for your -// * needs please refer to http://www.magentocommerce.com for more information. - * - * @category design - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ - -.normalize(); - -@import "source/clearless/all"; // import ClearLess -@import "source/styles/base"; -@import "source/lib/snippets"; -@import "source/lib/buttons"; -@import "source/lib/forms"; -@import "source/lib/grids"; -@import "source/lib/icons"; -@import "source/lib/messages"; -@import "source/lib/navigation"; -@import "source/lib/sections"; -@import "source/vars"; -@import "source/styles/magento"; - -strong { - font-weight: 700; -} - -.items { - .resetList(); -} - -.hidden, -.no-display { - .hidden(); -} - -/* - Forms --------------------------------------- */ -.field.required > .label > span:first-child:after { - content: '*'; - color: @requiredField; -} -.fields .field { - padding-right: 20px; -} - -/* - Magento_Theme --------------------------------------- */ -html, body, button, input, select, textarea { - color: @textColor; - font: 400 14px/1.33 "sourcesanspro"; -} - -html { - background: @footerBg; -} - -body { - position: relative; -} - -.page.wrapper { - background: @pageMainBg; -} - -.action.skip { - .visually-hidden(); -} - -/* - Page Layout --------------------------------------- */ -.columns { - .pageWidth(); -} - -.page.main { - .clearfix(); - clear: both; - padding: 30px 0; -} - -.page.title { - .clearfix(); - margin-bottom: 30px; - .title { - display: inline; - margin: 0; - line-height: 1.2; - font-weight: @baseFontWeightLighter; - font-size: 30px; - color: @primary5; - } - .action { - float: right; - &:extend(.primary.action all); - } -} - -.page.main > .page.title { - .pageWidth(); - margin-bottom: 30px; -} - -.column.main { - min-height: 500px; -} - -.column.left, -.column.right { - .box-sizing(); - min-height: 1px; -} - -.layout-1 { - .column.main { - .column(12); - } -} - -.layout-2-left { - .column.main { - float: right !important; - .column(10); - } - .column.left { - .column(2); - padding-right: 12px; - } -} - -.layout-2-right { - .column.main { - .column(10); - } - .column.right { - .column(2); - padding-left: 12px; - } -} - -.layout-3 { - .column.main { - .clearfix(); - .column(8); - float: none !important; - display: inline-block !important; - vertical-align: top; - } - .column.left { - .column(2); - float: left; - padding-right: 12px; - } - .column.right { - .column(2); - float: none !important; - display: inline-block !important; - padding-left: 12px; - } -} - -/* - Header --------------------------------------- */ -.page.header { - background-color: @headerBg; - background-image: @headerBgImage; - background-repeat: repeat; - background-position: 0; - border-bottom: 1px solid; - .borderColor(@headerBg); - padding: 15px 0; - > .content { - .pageWidth(); - .clearfix(); - border: 0; - padding-top: 0; - padding-bottom: 0; - .links { - .resetList(); - margin-bottom: 5px; - li { - margin-left: 20px; - display: inline; - text-transform: capitalize; - } - a { - .colorA(@primary5, @secondary1); - } - } - text-align: right; - } - - .panel { - .pageWidth(); - .clearfix(); - margin-bottom: 15px; - text-align: right; - } -} - -.logo { - font-family: "marvel"; - font-style: normal; - font-weight: @baseFontWeight; - font-size: 55px; - display: block; - float: left; - line-height: 1; - text-align: center; - img { - display: inline-block; - vertical-align: middle; - margin: 0 auto; - } - span { - display: inline-block; - vertical-align: middle; - margin-left: 15px; - color: @primary5; - margin-top: -8px; - } - &:active { - outline: 0; - } -} - -/* - Header Banner --------------------------------------- */ -.page.header .panel .widget { - display: inline-block; - text-align: left; -} - -.banner-header:visited, -.banner-header:hover, -.banner-header { - font-size: @baseFontSizeBigger; - text-transform: uppercase; - color: @secondary1; -} - -/* - Search --------------------------------------- */ -.block.search { - float: right; - > .content { - white-space: nowrap; - } - .field, - .actions, - .field .control { - float: left; - } - .actions { - margin-right: 0; - } - .search.autocomplete { - background: @primary7; - border: 1px solid @primary3; - border-width: 0 1px 1px; - border-radius: 0 0 5px 5px; - overflow: hidden; - z-index: 5; - display: none; - ul { - .resetList(); - li { - border-top: 1px solid @primary2; - cursor: pointer; - padding: 5px 40px 5px 10px; - position: relative; - text-align: left; - white-space: normal; - &:first-child { - border-top: none; - } - &:hover { - background: @primary1; - } - .amount { - color: @primary4; - font-weight: 600; - position: absolute; - right: 7px; - top: 6px; - } - } - } - } -} - -/* - Navigation --------------------------------------- */ -.navigation { - z-index: 4; - > ul > .level-top { - &.hover, - &:hover { - > .submenu { - z-index: 3; - } - } - &.more { - > .submenu { - background: @primary1; - > ul { - .pageWidth(); - position: relative; - } - } - &.hover { - > .submenu { - border-bottom: 1px solid @primary3; - overflow: visible !important; - } - } - } - } -} - -.navigation > ul, -.navigation > ul > .level0 > .submenu > ul.level0 { - .pageWidth(); - padding-left: 0; - padding-right: 0; -} - -@media only screen and (max-width: 640px) { - .navigation > ul, - .navigation > ul > .level0 > .submenu > ul.level0 { - min-width: 100%; - max-width: 100%; - } -} - -/* - General block --------------------------------------- */ -.column.main .block, -.sidebar .block { - margin-bottom: 45px; - > .title { - margin-bottom: 15px; - strong { - line-height: 1.2; - font-weight: @baseFontWeightLighter; - font-size: 20px; - } - .qty.counter { - font-size: 16px; - } - } - &.filter { - .item { - margin-bottom: 10px; - } - } -} - -.qty.counter { - &:before { - content: "("; - } - &:after { - content: ")"; - } -} - -.sidebar .block > .title strong { - font-size: 18px; -} - -/* - Sidebar Paypal logo --------------------------------------- */ -.sidebar .paypal.acceptance { - margin-bottom: 45px; -} - -/* - Breadcrumbs --------------------------------------- */ -.breadcrumbs { - .pageWidth(); - margin-top: 30px; -} - -/* - Footer --------------------------------------- */ -.footer { - background: @footerBg; - border-top: 1px solid; - .borderColor(@footerBg); - padding: 30px 0 80px; - > .content { - .pageWidth(); - text-align: left; - border: 0; - padding-top: 0; - padding-bottom: 0; - } - .links { - ul { - .resetList(); - } - display: inline-block; - padding: 0; - margin: 1px 3px 19px 0; - li { - list-style: none; - list-style-image: none; - margin: 0; - padding: 0; - display: inline; - &:after { - content: ' | '; - } - &:last-child:after { - content: ''; - } - } - + .links li:first-child:before { - content: ' | '; - } - a { - .colorA(@primary5, @secondary1); - } - } - .copyright { - font-size: @base-font-size; - display: block; - padding-top: 10px; - } - .bugs { - margin-top: 25px; - font-size: 12px; - span { - &:after { - content: '\00a0\2014\00a0'; - display: inline-block; - } - } - a { - font-weight: bold; - } - } - .switcher-store { - margin-bottom: 30px; - } -} - -/* - Switchers --------------------------------------- */ -.switcher { - display: inline-block; - text-align: left; - .page.header .panel & { - margin-right: 25px; - &:last-child { - margin-right: 0; - } - } - font-size: 11px; - vertical-align: middle; - .label { - display: none; - } - strong { - color: @primary5; - font-weight: 600; - } - .options { - display: inline-block; - position: relative; - z-index: 1; - > ul { - .resetList(); - margin: 0; - padding: 5px 10px; - position: absolute; - top: 100%; - right: 0; - margin-left: -11px; - min-width: 100%; - float: left; - background: @primary1; - border: 1px solid darken(@headerBg, 5%); - visibility: hidden; - opacity: 0; - .transition(visibility 0s linear 2s); - li { - margin: 5px 0; - white-space: nowrap; - } - } - &.active { - z-index: 999; - > ul { - visibility: visible; - opacity: 1; - .transitionDelay(0s); - } - } - &.active strong, - &:hover strong { - color: @primary6; - } - } -} - -.action.switch { - .resetAction(); - vertical-align: top; - color: @primary5; - span { - .iconAfter(@content: '\e02c', @font: "icons"); - .iconHideText(); - &:after { - line-height: 12px; - } - } - &:focus, - &:hover, - &.active { - color: @primary6; - } - &.active span:after { - content: "\e029"; - } - .no-js &:focus + ul { - visibility: visible; - opacity: 1; - .transitionDelay(0s); - } -} - -/* - Global Notices --------------------------------------- */ -.notice.global.site { - .box-sizing(); - position: absolute; - width: 100%; - padding: 8px; - background: #4d5d64; - color: #fff; - top: 0; - left: 0; - text-align: center; - p { - margin: 0; - } -} - -/* - Additional Information --------------------------------------- */ -.data.table.additional.attributes { - width: 100%; - th, - td { - .box-sizing(); - padding: 7px 10px; - text-align: left; - } - th { - width: 40%; - } - td { - width: 60%; - } - tr:nth-child(2n+1) th, - tr:nth-child(2n+1) td { - background: @primary1; - } -} - -/* - Reviews --------------------------------------- */ -@starSize : 16px; -.reviews.summary { - line-height: @starSize; - .action { - font-size: @baseFontSizeMiddle; - } - .reviews.actions { - font-size: @baseFontSizeMiddle; - display: inline; - } - .action.view { - span:before { - content: ' '; - } - } - .action.view + .action.add { - &:before { - content: '\00A0|\00A0\00A0'; - display: inline-block; - color: @link; - } - } - &.short:not(.no-rating) { - .action.view { - span { - display: none; - } - &:before { - content: '('; - display: inline-block; - } - &:after { - content: ')'; - display: inline-block; - } - } - } -} - -.block.reviews.dashboard .rating, -.reviews.summary .rating { - width: 5 * @starSize; - margin-right: 3px; - line-height: 1; - color: fade(@secondary1, 30%); - display: inline-block; - vertical-align: top; - margin-top: -1px; - > span { - display: block; - overflow: hidden; - color: @secondary1; - height: 0; - padding-top: @starSize; - line-height: 1; - margin-top: -@starSize; - &:before { - margin-top: -@starSize; - } - } - &:before, - > span:before { - display: block; - top: 0; - left: 0; - width: 100%; - font-family: "icons"; - content: @icon-star@icon-star@icon-star@icon-star@icon-star; - font-style: normal; - font-size: @starSize; - speak: none; - font-weight: normal; - -webkit-font-smoothing: antialiased; - } -} - -/* - Customer Reviews --------------------------------------- */ -.block.reviews.list { - margin: 0 0 30px -20px; - padding: 0; - > .title { - display: none; - } - .item.review { - padding: 15px; - .review.title { - font-weight: 600; - display: block; - margin: 15px 0; - } - &:nth-child(odd) { - background: @primary1; - } - } - .review.details { - .author { - strong { - text-transform: uppercase; - font-weight: 600; - } - } - .review.date { - font-size: 12px; - } - p { - margin: 5px 0; - span { - display: none; - } - } - } -} - -.block.add.review { - margin: 0 0 30px -20px; - padding: 20px; - background: @primary1; - .title { - display: none; - } - .fieldset { - .formFieldset(); - border: 0; - padding: 0; - margin: 0; - > .legend { - .box-sizing(); - float: left; - width: 100%; - margin: 0 0 20px; - padding: 10px 0 30px; - border-bottom: 1px solid; - .borderColor(@primary1); - & + br { - clear: both; - display: block !important; - } - span { - line-height: 1.2; - font-weight: @baseFontWeightLighter; - font-size: 20px; - } - strong { - margin-left: 20px; - font-size: @baseFontSize; - font-weight: 600; - } - } - > .field:not(.ratings) { - .formField(); - .fieldStyle(); - > .label { - padding: 0 0 5px; - } - } - } - .action.submit { - &:extend(.primary.action all); - } - .action.cancel { - .resetAction(); - .actionLink(); - position: absolute; - left: 100%; - text-decoration: underline; - text-transform: uppercase; - margin-left: 20px; - margin-top: 10px; - } - .actions, - .field:not(.ratings) { - width: 60%; - } - .actions { - padding-top: 20px; - text-align: right; - position: relative; - z-index: 1; - } -} - -/* - Review details --------------------------------------- */ -.review.view { - .product.name { - display: inline-block; - margin: 0; - } - .product.details { - float: left; - margin-right: 30px; - } - .product.photo { - display: block; - margin-bottom: 30px; - } - .review.details { - margin: 30px 0; - display: table; - - .ratings.summary { - margin-bottom: 30px; - strong { - font-weight: 600; - display: block; - margin: 0 0 15px; - } - .item { - display: table-row; - } - .label { - padding: 0 0 10px; - padding-right: 10px; - display: table-cell; - &:after { - content: ': '; - } - } - } - .review.date { - font-size: @baseFontSizeMiddle; - } - .review.title { - font-weight: 600; - font-size: @baseFontSizeBigger; - margin: 0 0 15px; - } - } -} - -.customer.review.view + .actions { - clear: both; -} - -/* - Messages --------------------------------------- */ -.page.messages { - .pageWidth(); - margin: 15px auto; -} - -/* - Magento_Checkout - One page --------------------------------------- */ -.block.progress.onepage { - .content > dt { - font-size: @baseFontSizeBigger; - font-weight: @baseFontWeight; - margin: 0 0 10px 0; - a { - font-size: @baseFontSize; - } - } - dd.complete { - padding: 0; - margin: 0 0 30px; - .cards.items { - dd { - margin-left: 0; - .card.item { - font-size: 12px; - margin: 5px 0 10px; - dt { - font-weight: bold; - } - dd { - margin-bottom: 5px; - } - } - } - } - } - address { - font-style: normal; - } -} - -// Payment methods - for OPC and Order pages -.payment.method { - .block.progress.onepage &, - .order.details .block.order & { - margin: 0; - .content { - margin: 5px 0; - padding: 0; - } - &.purchase.order, - &.checkmemo { - .content strong:after { - content: ": "; - } - .content .number { - white-space: nowrap; - } - } - .data.table { - th { - font-size: 14px; - padding: 5px 0; - text-align: left; - width: 50%; - } - td { - padding: 5px; - } - } - } -} - - -.opc.wrapper { - > .opc { - .resetList(); - .section { - margin-bottom: 4px; - > .step.title { - padding: 15px 20px; - line-height: 1; - background: @secondary1; - font-size: 22px; - h2 { - font-weight: @baseFontWeight; - font-size: 18px; - margin: 0; - padding: 0; - color: #fff; - } - .number { - display: none; - } - } - &.active { - > .step.title { - background: @primary1; - margin-bottom: 0; - h2 { - color: @primary6; - } - } - } - &.allow > .step.title { - cursor: pointer; - h2:after { - display: block; - } - } - > .step.content { - padding: 0 20px 20px; - background: @primary1; - &:before { - content: ''; - border-top: 3px solid @primary2; - display: block; - margin-bottom: 20px; - } - } - } - } - .form:not(.login) { - .fieldset { - .formCols(); - padding: 0; - margin: 20px 0; - border: 0; - position: relative; - } - .field { - .fieldStyle(); - &:not(.choice) { - .label { - display: block; - padding-bottom: 5px; - } - } - } - .field.fullname + .field.company, - .field.name-lastname + .field.company, - .field.country, - .field.taxvat { - margin: 0 40% 30px 0; - } - .field.confirm, - .field.password { - margin-top: 20px; - margin-bottom: 20px; - } - .field.choice { - width: 100%; - display: block; - } - .field.persistent, - .field.save { - margin: 20px 0 0; - } - .field.addresses { - margin-bottom: 20px; - } - &:after { - content: attr(data-hasrequired); - display: block; - letter-spacing: normal; - word-spacing: normal; - color: @secondary1; - } - } - .actions { - .clearfix(); - text-align: right; - button.action { - float: right; - &:extend(.primary.action all); - } - .secondary { - padding-top: 10px; - clear: right; - float: right; - } - } - .check.payable { - margin: 0 0 0 20px; - .title { - display: inline-block; - padding: 5px 0; - width: 30%; - } - .content { - display: inline-block; - margin: 0; - padding: 5px 0; - width: 68%; - } - } - .methods.payment { - margin:15px 0; - .item.content { - padding:0; - & > * { - padding:15px 0; - } - } - .items, - .fieldset.items { - margin: 0 0 0 6px; - } - .paypal.field.items { - padding: 0; - width: 100%; - } - .paypal.icon { - display: inline-block; - margin-right: 5px; - vertical-align: middle; - } - } -} - -.action.toggle.checkout.progress { - display: none; -} - -.opc.loading .active { - position: relative; - z-index: 1; - &:before { - content: ''; - display: block; - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: rgba(255, 255, 255, 0.1); - } - .actions .secondary, - .actions .primary { - visibility: hidden; - overflow: hidden; - height:0px; - } - .actions .load.indicator { - margin-top:0; - } -} - -.fieldset.ccard { - > .legend { - margin:15px 0; - } - .formCols(); - padding: 20px 0; - margin: 20px 0; - border: 0; - position: relative; -} -.fieldset.ccard .field { - &.logos { - img { - display: inline-block; - vertical-align: middle; - } - } - .fieldStyle(); - &:not(.choice) { - .label { - display: block; - padding-bottom: 5px; - } - } - &.cvv { - input.cvv { width:80px; } - .tooltip { - .box-shadow(0 0 3px rgba(0,0,0,0.25)); - background: @primary7; - border: 1px solid @primary3; - z-index: 99; - width:500px; - height:250px; - position: fixed; - float:left; - top:50%; - left:50%; - padding:25px; - text-align: center; - margin:-125px 0 0 -250px; - background-color:@pageMainBg; - border:1px solid @primary2; - &:before { - content:''; - position: fixed; - z-index: -1; - display: block; - top:0; left: 0; right:0; bottom: 0; - background-color:fade(@pageMainBg, 15%); - } - } - } -} - -/* - Load Indicator --------------------------------------- */ -.load.indicator { - display: inline-block; - padding: 8px; - vertical-align: middle; - span { - display: block; - line-height: 16px; - &:before { - content: ''; - margin-right: 5px; - display: inline-block; - width: 16px; - height: 16px; - background: url(../images/loader.gif) no-repeat 0 0; - background-color: @secondary1; - vertical-align: top; - } - } -} - -/* - Step Login --------------------------------------- */ -.step.login.wrapper { - .clearfix(); - position: relative; - z-index: 1; - padding-bottom: 70px; - .block { - .column(6); - .box-sizing(); - .fieldset { - border: 0; - margin: 0; - padding: 0; - .field { - width: 100%; - } - } - &.guest { - padding-left: 50px; - &:before { - content: ''; - border-left: 1px solid @primary2; - position: absolute; - top: 0; - margin-left: -25px; - bottom: 20px; - } - } - } - button.action:not(.reload) { - &:extend(.primary.action all); - } - .actions { - position: absolute; - bottom: 0; - padding: 20px 0; - text-align: right; - margin: 0; - width: 50%; - .secondary { - font-size: @baseFontSizeMiddle; - margin-top: .5em; - line-height: 1.4em; - margin-bottom: -1.9em; - } - } - .guest .actions { - margin-left: -50px; - } -} - -.fieldset.guest { - > .field { - .fieldStyle(); - } -} - -/* - Step Review --------------------------------------- */ -.checkout.submit.order { - .actions { - margin-top: 20px; - .clearfix(); - .primary { - float: right; - } - .secondary { - clear:none; - float: left; - line-height: 32px; - } - } -} - -.order.data.items { - tfoot tr:first-child td { - border-top: 3px solid @primary2; - padding-top: 15px; - } - tr.total td { - padding-top: 5px; - padding-bottom: 5px; - text-align: right; - } - tr.total:last-child td { - padding-bottom: 20px; - } - tr.grand.total td { - vertical-align: middle; - } - tr.grand.total .amount { - font-size: 24px; - color: @secondary1; - } - tr.tax.totals.details { - display: none; - &.shown { - display: table-row; - } - } - tr.tax.totals.summary { - .detailed { - cursor: pointer; - .iconBefore(@content: @icon-expand, @size: 18px, @font: "icons"); - &:before { - vertical-align: top; - font-size: 12px; - margin-right: 5px; - } - } - &.expanded .detailed:before { - content: @icon-collapse; - } - } - tfoot { - .amount { - text-align: right; - } - } -} - -.order.review.data { - th.col.price, - th.col.subtotal { - text-align: right; - padding-right: 10px; - } - th.col.item { - text-align: left; - padding-left: 20px; - } -} - -.checkout.agreements { - margin: 10px 0; - .item { - margin: 0 0 10px; - &:last-child { - margin: 0; - } - } - .agreement { - background-color: @primary1; - border: 1px solid @primary2; - font-size: 11px; - overflow: auto; - margin: 0 0 10px; - padding: 15px; - } -} - -/* - Magento_Checkout - Multishipping --------------------------------------- */ -.multicheckout { - &.progress { - .resetList(); - li { - font-size: 16px; - font-weight: 400; - margin: 0 0 10px 0; - &.active { - font-weight: bold; - } - } - } - .title { - .clearfix(); - margin: 0 0 30px; - > strong { - font-size: 20px; - font-weight: 400; - margin: 4px 0 0; - } - } - .subtitle { - display: block; - .clearfix(); - margin: 0 0 20px; - > span { - font-size: 18px; - font-weight: normal; - margin: 4px 0 0; - } - } - .title, - .subtitle { - .action { - font-weight: 400; - font-size: 14px; - margin-left: 20px; - text-decoration: underline; - display: inline-block; - text-transform: lowercase; - &:hover { - text-decoration: none; - } - } - } - .content { - .clearfix(); - > .block { - margin-bottom: 20px; - &:last-child { - margin-bottom: 0; - } - } - } - address { - font-style: normal; - } -// Shipping metods - > .block.shipping .box, - > .block.billing .box { - &:extend(.profileBlockWithBg all); - margin-bottom: 20px; - &:last-child { - margin-bottom: 0; - } - } - > .block.shipping, - &.overview > .block.billing { - .box { - &.address { - float: left; - width: 49%; - } - &.method { - float: right; - width: 49%; - } - &.items { - clear: both; - } - } - } -// Overview - &.overview { - > .block.billing { - .clearfix(); - .box.method { - p { - margin: 0 0 10px; - } - th, - td { - font-size: 14px; - padding: 0; - } - } - } - > .block.shipping { - .content { - margin-bottom: 20px; - &:last-child { - margin-bottom: 0; - } - } - } - > .checkout.review { - .grand.total { - margin: 15px 0; - text-align: right; - .label { - font-size: 18px; - font-weight: 400; - } - .price { - color: @secondary1; - font-size: 24px; - font-weight: 700; - } - } - } - .box.method { - .payment.method { - margin: 0; - } - .title { - margin: 0 0 5px; - } - .content { - margin: 0 0 0 10px; - } - } - } - -// Oher goods (can't be shipped: virtual, downloadable) - .block.other .content { - &:extend(.profileBlockWithBg all); - } - -// Change billing - &.change.billing { - .box { - .box-sizing(); - background: @primary1; - float: left; - margin-bottom: 20px; - margin-left: 2%; - padding: 30px; - width: 49%; - &.odd { - clear: left; - margin-left: 0; - } - .actions { - margin: 15px 0 0; - } - } - .actions { - clear: left; - } - } - -// Actions - .actions { - .clearfix(); - margin: 20px 0; - } - &.change.billing .actions { - margin-top: 0; - } - .action { - &.update { - &:extend(.secondary.action all); - } - &.back { - float: left; - margin: 9px 0 0; - span:before { - content: "\00AB\00A0"; - } - } - &.continue, - &.submit { - &:extend(.primary.action all); - &.disabled { - opacity: 0.3; - &:hover { - background: @primaryActionBg; - } - } - } - &.add { - &:extend(.primary.action all); - float: right; - text-decoration: none; - text-transform: uppercase; - } - } - &.success .action.continue { - &:extend(.button.link all); - text-decoration: none; - text-transform: none; - } - -// Tables - .product.name { - margin-bottom: 0; - } - .items.data { - .col { - &.item { - padding-left: 0; - text-align: left; - } - } - th.col { - &.item, - &.qty { - padding-bottom: 5px; - } - } - .mark, - .amount { - text-align: right; - } - tfoot tr { - &.total { - &:first-child td { - border-top: 3px solid #e5e5e5; - padding-top: 15px; - } - &:last-child td { - border-bottom: 0; - } - td { - padding-top: 5px; - padding-bottom: 5px; - text-align: right; - - } - &.grand { - td { - vertical-align: middle; - } - .amount { - color: @secondary1; - font-size: 24px; - } - } - } - } - .applicable { - padding-top: 7px; - } - } - .block .items.data { - tr td { - &:first-child { - padding-left: 0; - } - &:last-child { - padding-right: 0; - } - } - } - .shipping .items.data tr:last-child td { - border-bottom: 1px solid @primary2; - } - .sp-methods, - .items.methods { - margin: 0; - dt { - margin: 0; - } - dd { - margin: 0; - padding: 0; - ul { - margin: 0 0 15px; - padding: 10px; - } - } - } - - &.form.address { - .control.address { - margin-top: -6px; - select { - max-width: 450px; - } - } - } -} - -.block.gift.message { - margin: 30px 0 0; - .title { - font-size: 16px; - font-weight: 400; - margin-bottom: 15px; - } -} - -/* - Magento_Checkout - Gift Message --------------------------------------- */ -.gift.message { - > .legend { - font-size: 16px; - margin: 0 0 20px; - } - .block.items { - .box-sizing(); - background: @primary2; - margin:0 -20px; - //height: 310px; - //overflow: auto; - padding: 20px; - } - dt { - margin: 30px 0 0; - &:first-child { - margin: 0; - } - .title { - font-size: 16px; - margin: 0 0 15px; - } - > .price { - margin: 0 0 10px; - } - } - dd { - margin: 20px 0 0 20px; - } - .field.choice input { - margin-right: 5px; - margin-top: 2px; - vertical-align: top; - } - .activate.message { - display: inline-block; - margin: 10px 0 0; - + div { - .fieldset { - margin-top: 0; - } - } - } - .options.order { - .field.text { - width: 100%; - } - } - .options.individual { - ol { - .resetList(); - } - li { - .clearfix(); - border-bottom: 1px solid @primary2; - margin: 0 0 15px; - padding: 0 0 15px; - overflow: hidden; - } - .number { - border-bottom: 1px solid @primary2; - color: @primary4; - margin: 0 0 15px; - padding: 0 0 5px; - } - .product { - float: left; - margin-right: 20px; - text-align: center; - > .product { - float: none; - margin: 0; - } - .img { - margin-bottom: 5px; - } - } - .options-items-container { - width: 100%; - .field { - .box-sizing(); - width: 100%; - } - } - .field.text { - width: 100%; - } - .item.options { - overflow: hidden; - } - } - .extra-options-container { - margin: 10px 0 0; - .field.choice { - margin: 0 0 10px; - } - } - .multicheckout & { - margin: 20px 0; - .fieldset { - margin: 20px 0; - } - .block.message { - margin: 0; - .fieldset { - margin: 0; - } - } - .field { - display: inline-block; - padding-right: 20px; - vertical-align: top; - width: 50%; - } - } -} - -/* - Magento_Checkout - Shopping Cart --------------------------------------- */ -.cart.container { - .clearfix(); - position: relative; - z-index: 1; -} - -.cart.actions { - padding: 20px 0; - .action.continue { - position: absolute; - text-decoration: underline; - right: 0; - top: 3px; - } - .action.update, - .action.clear { - &:extend(.secondary.action all); - } -} - -.items.data { - width: 100%; - thead tr:last-child th { - padding-bottom: 10px; - } - th > span { - white-space: nowrap - } - th.col.item > span { - display: none; - } - td.col.qty { - width: 40px; - text-align: center; - .control { - margin-top: -6px; - } - } - th.col.qty { - text-transform: uppercase; - } - input.qty { - width: 50px; - text-align: center - } - td.col.price, - td.col.subtotal { - text-align: right; - } - .img.photo.container, - .product.photo { - padding-right: 20px; - display: table-cell; - width: 1%; - vertical-align: top; - } - .product.photo { - .img.photo.container { - display: block; - padding:0; - width:auto; - } - } - .product.details { - display: table-cell; - width: 99%; - vertical-align: top; - } - .item.actions { - text-align: right; - div.actions { - padding-bottom: 30px; - } - } - td { - border-left:0; - border-right:0; - padding: 26px 10px 10px; - vertical-align: top; - background: transparent; - } - td:first-child { - padding-left: 20px; - } - td:last-child { - padding-right: 20px; - } - tbody:nth-child(even) tr { - background: @primary1; - } - th { - border-left:0; - border-right:0; - text-align: center; - font-weight: @baseFontWeight; - font-size: @baseFontSize; - vertical-align: top; - } - tr:first-child th { - font-weight: @baseFontWeight; - font-size: @baseFontSizeBigger; - } - .item.actions td { - padding: 0 20px 10px; - line-height: 16px; - .action { - margin-left: 20px; - } - .action.towishlist { - font-size: @baseFontSize; - } - .action.delete { - vertical-align: top; - margin-top: 0; - } - &:before { - content: ''; - border-top: 1px solid @primary2; - display: block; - height: 0; - overflow: hidden; - margin: 0 0 10px; - } - } - .item.options { - dt { - font-weight: @baseFontWeight; - display: inline; - margin-right: 10px; - float: left; - clear: left; - &:after { - content: ': '; - } - } - dd { - font-weight: @baseFontWeightLighter; - margin: 0 0 10px 10px; - padding: 0; - em:after { - content:':'; - } - } - - } -} - -.cart.table.wrapper { - float: left; - width: 665px; -} - -.cart.summary { - position: relative; - z-index: 1; - margin-top: 33px; - background: @primary1; - display: inline-block; - width: 290px; - padding: 20px; - margin-left: 10px; - .summary.title { - font-size: 20px; - font-weight: 200; - display: block; - border-bottom: 3px solid @primary2; - padding-bottom: 15px; - } - .block { - margin-bottom: 0; - border-bottom: 1px solid @primary2; - > .title { - cursor: pointer; - padding: 10px 5px; - margin: 0; - line-height: 16px; - strong { - font-size: @baseFontSizeMiddle; - font-weight: 600; - &:after { - content: @icon-expand; - font-family: "icons"; - float: right; - font-weight: @baseFontWeight; - font-size: @baseFontSizeBigger; - line-height: 16px; - } - } - &.active strong:after { - content: @icon-collapse; - } - - } - > .content { - display: none; - padding: 15px 15px 20px; - } - &.active { - > .content { - display: block; - } - } - .fieldset { - padding: 0; - margin: 0; - border: 0; - .field { - margin: 0 0 10px; - } - } - font-size: @baseFontSizeMiddle; - input[type="text"] { - padding: 0 5px; - font-size: @baseFontSizeMiddle; - height: 30px; - } - .field:not(.choice) { - .label { - padding: 0 0 5px; - display: block; - } - } - select { - padding: 5px 5px 4px; - font-size: @baseFontSizeMiddle; - } - .action { - &:extend(.primary.action all) - ; - padding: 6px 11px 5px; - span { - font-size: @baseFontSizeMiddle; - line-height: 12px; - } - &.check span { - .actionLink(); - } - } - } -} - -.cart.container { - & > .summary.sticky { - position: fixed; - display: inline-block !important; - } - & > .summary.bottom { - position: absolute; - vertical-align: bottom; - bottom: 0; - } -} - -.cart &>.summary.fixed, -.cart.container &>.summary &>.container.fixed { - position: fixed; - top: 0; -} - -.cart.table.wrapper.detailed + .cart.summary { - margin-top: 54px; -} - - - -.sp-methods, -.items.methods { - dt, - .item.title { - font-weight: bold; - } - dd, - .item.options { - margin: 0 0 15px; - padding: 10px; - } -} -.field.choice.payment { - > .label { - font-weight: bold; - } -} - -.data-table { - width: 100%; - border: 0; - td { - border-right: 1px solid @primary2; - padding: 5px; - vertical-align: top; - } - td:last-child { - border: 0; - } -} - -.cart.totals { - .table.totals { - width: 100%; - } - padding: 20px 0; - td, - th { - text-align: right; - padding: 4px 0 4px 5px; - } - td:not(:first-child) { - strong { - font-size: 24px; - color: @secondary1; - } - } - td:first-child { - text-align: left; - padding-left: 0; - strong { - font-size: @baseFontSize; - } - } -} - -.checkout.methods.items { - background: #fff; - padding: 20px; - .item { - margin: 15px auto; - text-align: center; - } - .action.multicheckout { - text-decoration: underline; - } - .page.title & { - display: none; - } -} - -/* - Magento_Checkout - Mini cart --------------------------------------- */ -.minicart.wrapper { - float: right; - margin-right: 40px; - z-index: 11; - .block.minicart { - .clearfix(); - left: -100%; - margin-top: 15px; - position: absolute; - z-index: 2; - background: @primary1; - border: 2px solid darken(@primary1, 13%); - border-radius: 3px; - text-align: center; - padding: 58px 345px 25px 15px; - &:before { - content: ''; - border-left: 10px solid transparent; - border-right: 10px solid transparent; - border-bottom: 10px solid @primary1; - height: 0; - width: 0; - overflow: hidden; - display: block; - position: absolute; - top: 0; - margin-top: -10px; - margin-right: 25px; - right: 0; - zoom: 1; - z-index: 2; - } - > .content { - margin-top: -33px; - .subtotal { - .clearfix(); - .mark { - display: inline-block; - font-weight: 600; - font-size: 18px; - float: left; - line-height: 24px; - } - > .amount { - text-align: right; - float: right; - display: inline-block; - font-weight: @baseFontWeightBolder; - font-size: 24px; - line-height: 24px; - color: @secondary1; - } - .amount.incl.tax { - display: block; - font-size: @baseFontSize; - &:after { - content: ')'; - } - .price:after { - content: ' ('; - } - } - } - .disclaimer { - font-size: @baseFontSizeMiddle; - } - .actions { - .secondary { - margin-top: 15px; - margin-bottom: -15px; - text-align: right; - a { - color: @secondary1; - } - } - } - .subtitle { - display: block; - text-align: left; - padding: 0 50px; - margin: 0 0 15px 0; - font-weight: @baseFontWeight; - &.empty { - margin: 10px -320px 0 0; - padding: 0; - float: right; - width: 310px; - clear: right; - } - } - } - .minicart.empty.text, - > .title, - > .content .subtotal, - > .content .disclaimer, - > .content > .actions { - margin: 0 -330px 15px 0; - text-align: left; - float: right; - width: 310px; - clear: right; - } - > .title { - .text { - display: none; - } - .qty:before { - content: attr(title) ": "; - } - } - .minicart.empty.text { - margin-top: 15px; - } - > .title strong { - font-weight: 400; - } - } - &.active { - &:before { - content: ''; - position: fixed; - z-index: 1; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: #000; - opacity: 0.01; - } - position: relative; - z-index: 11; - .block.minicart { - left: auto; - right: -20px; - } - } - .action.previous, - .action.next { - .resetAction(); - width: 25px; - overflow: hidden; - span { - .iconAfter(@content: @icon-arrow-right-thick, @size: 42px, @font: "icons"); - .iconHideText(42px); - color: @primary3; - margin-left: -10px; - overflow: hidden; - } - &[disabled] { - opacity: 0.3; - } - position: absolute; - right: 10px; - top: 50%; - margin-top: -22px; - } - .action.previous { - right: auto; - left: 0; - span:after { - content: @icon-arrow-left-thick; - } - } - .action.close { - position: absolute; - top: 10px; - right: 15px; - } - p { - clear: both; - } -} - -.block.minicart.empty > .title, -.eq-ie8 .minicart.wrapper.active:before { - display: none; -} - -/* - Product options --------------------------------------- */ -.minicart { - @textColor: @primary6; - .product.options.wrapper { - position: relative; - display: inline; - z-index: 1; - margin: 7px 0; - .more { - color: @textColor; - font-size: @baseFontSizeMiddle; - line-height: 1; - padding: 0; - border-bottom: 1px dotted @textColor; - cursor: help; - } - &:hover { - z-index: 99; - .product.options.details { - display: block; - } - &:before { - content: ''; - border-left: 10px solid @optionsBg; - border-top: 10px solid transparent; - border-bottom: 10px solid transparent; - height: 0; - width: 0; - overflow: hidden; - display: block; - position: absolute; - top: 0; - margin-top: 0; - left: -10px; - zoom: 1; - z-index: 2; - } - } - - } - .product.options.details { - display: none; - position: absolute; - background: @optionsBg; - border-radius: 6px; - padding: 10px; - right: 100%; - top: 50%; - margin-top: -20px; - margin-right: 10px; - float: left; - max-width: 200px; - min-width: 100px; - .title { - font-weight: 600; - } - color: @optionsColor; - } - .product.options.list { - padding-left: 10px; - dt { - font-size: @baseFontSizeMiddle; - display: inline; - margin: 0; - padding: 0; - font-weight: 600; - &:after { - content: ': '; - } - &:before { - content: ''; - display: block; - } - } - dd { - font-size: @baseFontSizeMiddle; - display: inline-block; - padding: 0; - margin: 0; - } - } - .item:not(.shown) + .shown, - :first-child { - .product.options.details { - right: auto; - left: 100%; - margin-left: 10px; - } - .product.options.wrapper:before { - border-right: 10px solid @optionsBg; - border-left: 0; - left: auto; - right: -10px; - } - } -} - -.minicart.wrapper .block.minicart > .content > .actions .primary { - .clearfix(); - text-align: center; - .checkout.paypal { - display: inline; - input[type="image"] { - margin-top: 5px; - float: left; - } - &:after { - float: none; - } - } - .action.checkout { - float: right; - } -} - -.block.minicart { - .products.minilist { - @itemWidth : 187px; - float: left; - padding: 0; - border-right: 1px solid darken(@primary1, 13%); - max-width: @itemWidth*3; - padding: 0 30px; - position: relative; - z-index: 1; - .minilist.items { - position: relative; - white-space: nowrap; - } - &.animation { - .items-wrapper { - overflow: hidden; - } - position: relative; - .item { - visibility: visible; - } - } - .item { - padding: 0 20px; - .box-sizing(); - vertical-align: top; - text-align: left; - &:before { - content: ''; - width: 0; - display: block; - border-left: 1px solid darken(@primary1, 13%); - height: 100%; - margin-left: -20px; - position: absolute; - } - &.item:not(.shown) + .shown:before, - &:first-child:before { - display: none; - } - white-space: normal; - display: none; - display: inline-block; - width: @itemWidth; - visibility: hidden; - .box-sizing(); - margin-left: 0; - - .wrapper.active &.shown { - visibility: visible; - } - &.hidden { - margin-left: -@itemWidth !important; - } - - .product.photo { - display: block; - margin-bottom: 10px; - .photo.container { - overflow: visible !important; - margin: 0 auto; - } - .photo.image { - border: 1px solid darken(@primary1, 11%); - display: block; - margin: 0 auto; - } - } - .pricing { - margin-top: 10px; - &:not(.complex) { - .label.display { - display: none; - } - } - .label:after { - content: ': '; - } - } - .actions { - float: right; - } - .action.edit { - font-size: @baseFontSizeMiddle; - } - .product.options.wrapper + .action.edit { - margin-right:16px; - &:before { - content: '|'; - display: inline-block; - text-decoration: none; - padding: 0 3px; - } - &:hover:before { - color: @primary6; - } - } - .action.delete { - position: absolute; - margin-left: -5px; - margin-top: -1.35em; - bottom: 0; - } - } - } -} - -.eq-ie8 .block.minicart { - .products.minilist { - .action.delete, - .action.edit { - visibility: hidden; - } - .shown { - .action.delete, - .action.edit { - visibility: visible; - } - } - .item { - &:before { - border-left: 0; - } - } - } -} - -.action.delete { - display: inline-block; - span { - color: @primary3; - .iconAfter(@content: @icon-trash, @font: 'icons'); - .iconHideText(); - } - &:focus, - &:active, - &:hover { - outline: none; - span { - color: @primary4; - } - } -} - -.action.checkout { - &:extend(.primary.action all); -} - -.action.checkout.shadow { - span { - text-shadow: 0px 1px 2px #000; - } -} - -.action.close { - .resetAction; - span { - .iconAfter(@content: @icon-close-thick, @size: 11px, @font: 'icons'); - .iconHideText(11px); - } -} - -.action.showcart { - .iconAfter(@content: @icon-cart, @size: 32px, @font: 'icons'); - .iconHideText(32px); - margin-top: 20px; - margin-left: 20px; - color: @primary5; - position: relative; - &:hover, - &:active, - &:focus, - &.active { - color: @primary4; - outline: none; - } - - .qty { - position: absolute; - left: 70%; - top: 0; - margin-top: -30%; - text-indent: 0; - background: @secondary1; - display: inline-block; - border: 1px solid @secondary1; - border-radius: 50px; - font-size: @baseFontSize; - font-weight: 600; - color: #fff; - @height: 1.7em; - line-height: @height; - vertical-align: middle; - .box-sizing(); - min-width: 1.1 * @height; - min-height: @height; - text-align: center; - padding: 0 4px; - &:before, - &:after { - content: ""; - } - } - .qty.empty { - display: none; - } -} - -/* - Paypal button --------------------------------------- */ -.checkout.paypal { - display: none; - input[type="image"] { - display: inline-block; - vertical-align: top; - } - display: inline-block; - vertical-align: top; - &.before:before { - content: "- " attr(data-label) " -"; - text-transform: uppercase; - display: inline-block; - line-height: 32px; - font-size: @baseFontSize; - vertical-align: middle; - margin: 0 5px; - } - &.after:after { - content: "- " attr(data-label) " -"; - text-transform: uppercase; - display: inline-block; - line-height: 32px; - font-size: 14px; - vertical-align: middle; - margin: 0 5px; - } - .box.tocart & { - margin-top: 10px; - } -} - -.box.tocart .checkout.paypal { - &.after:after { - display: none; - } - &.after:before { - content: "- " attr(data-label) " -"; - text-transform: uppercase; - display: inline-block; - line-height: 32px; - font-size: @baseFontSize; - vertical-align: middle; - margin: 0 5px; - } -} - -.checkout.methods .checkout.paypal { - &.after:after { - display: block; - text-align: center; - } -} - -/* - Magento_Sales --------------------------------------- */ -.block.reorder { - padding-right: 30px; - .item { - padding-left: 20px; - input { - float: left; - margin-top: 2px; - margin-left: -20px; - } - } - .subtitle { - display: block; - margin: 0 0 15px; - font-weight: 600; - } - .actions { - margin: 15px 0 0; - text-align: left; - .primary, - .secondary { - margin: 0 10px 10px 0; - display: inline-block; - vertical-align: middle; - } - } -} - -/* - Magento_Newsletter --------------------------------------- */ -.block.newsletter { - @fit: 45px; - text-align: left; - .fieldset { - margin: 0; - } - .title { - display: none; - } - .field { - .clearfix(); - } - .label { - display: block; - font-size: 16px; - margin-bottom: 10px; - line-height: 1.2; - } - .control { - float: left; - width: 100%; - .box-sizing(); - padding-right: @fit; - } - .actions { - padding-left: 10px; - float: right; - margin-left: -@fit; - } - input[type="text"] { - width: 100%; - } - .footer & { - width: 310px; - float: right; - } -} - -.action.subscribe { - .resetAction(); - background: @secondary1; - border-radius: 3px; - padding: 7px; - border: 1px solid @secondary1; - vertical-align: top; - span { - .iconAfter(@content: @icon-envelope, @font: 'icons'); - .iconHideText(); - color: #fff; - } -} - -.form.newsletter.manage { - .fieldset { - margin: 0 0 20px; - padding: 0; - border: 0; - .legend { - float: left; - margin: 0 0 20px; - font-weight: 200; - } - .legend + br { - display: block; - clear: both; - } - } - .action.save { - &:extend(.primary.action all); - } - .actions .primary { - margin-bottom: 15px; - } -} - -/* - Widgets --------------------------------------- */ -.widget ul { - .resetList(); -} - -.widget.static.block { - .clearfix(); - .page.header &, - .footer & { - display: inline-block; - } -} - -.widget.link, -.widget.static.block { - .product.info.main + &, - .product.info.detailed + &, - .block.search + & { - clear: both; - } -} - -span.widget.link, -.widget.static.block { - .footer .links & { - margin-left: 3px; - white-space: normal; - &:before { - content: ' | '; - display: inline-block; - margin-right: 3px; - } - } -} - -.widget.link, -.widget.static.block { - .minicart.wrapper .block.minicart > .content & { - clear: right; - float: right; - margin: 0 -330px 15px 0; - text-align: left; - width: 310px; - } - .minicart.wrapper .block.minicart > .content .actions & { - margin-right: 0; - } -} - -.widget.link + .product.info.detailed { - margin-top: 20px; -} - -span.widget.link { - display: inline-block; -} - -.widget.mini.products.images { - .item { - display: inline-block; - margin: 0 3px; - } -} - -/* - Magento_Catalog - Compare --------------------------------------- */ -.block.compare { - > .title .qty { - font-size: 16px; - margin-right: -5px; - &:before { - content: '('; - } - &:after { - content: ')'; - } - } - .item { - padding-right: 20px; - overflow: hidden; - } - .product.name { - float: left; - } - .action.delete { - margin-right: -20px; - float: right; - } - .action.compare { - &:extend(.secondary.action all); - float: right; - } - .action.clear { - float: left; - margin-top: 10px; - } - .actions { - .clearfix(); - margin-top: 15px; - } -} - -.catalog-product-compare-index { - .action.print { - float: right; - margin-top: -50px; - } -} - -.comparison.wrapper { - clear: both; - position: relative; - z-index: 1; - &:after { - content: ''; - position: absolute; - z-index: 2; - right: 0; - top: 0; - height: 100%; - width: 15px; - } - margin-bottom: 50px; -} - -.comparison.container { - overflow-y: hidden; - overflow-x: auto; -} - -.data.comparison { - table-layout: fixed; - - .cell.label { - width: 130px; - padding-left: 10px; - font-weight: 600; - text-align: left; - border-right: 1px solid @primary2; - .attribute.label { - display: block; - width: 100%; - word-break: break-all; - } - &.product { - border-bottom: 1px solid @primary2; - } - } - .cell { - padding: 15px; - vertical-align: top; - p:first-child { - margin-top: 0; - } - .attibute.value { - width: 100%; - overflow: hidden; - } - } - .cell.product { - width: 140px; - &.info { - border-bottom: 1px solid @primary2; - } - } - .cell.attribute { - font-size: @baseFontSizeMiddle; - img { - max-width: 100%; - height: auto; - } - } - td:last-child { - border-right: 1px solid @primary2; - } - tbody:first-child .cell.attribute { - background-color: @primary1; - } - tr:nth-child(odd) .cell.attribute { - background-color: @primary7; - } - tr:nth-child(even) .cell.attribute { - background-color: @primary1; - } - .product.photo { - .img.photo.container { - display: inline-block !important; - } - text-align: center; - display: block; - margin: 0 auto 15px; - } - .actions, - .price-box, - .product.rating, - .product.name { - margin: 15px 0; - } - .addto.links { - margin-top: 15px; - padding-top: 15px; - border-top: 1px solid @primary2; - font-size: @baseFontSizeMiddle; - } - .cell.remove { - padding-top: 0; - padding-bottom: 0; - text-align: right; - .action.delete { - &:extend(.secondary.action all); - float: right; - padding: 4px; - span { - overflow: hidden; - line-height: 0; - &:after { - content: @icon-close-thick; - font-size: @baseFontSizeMiddle; - color: #fff; - } - } - margin-right: -15px; - } - } -} - -.comparison.headings { - position: absolute; - z-index: 2; - top: 0; - left: 0; - width: auto; - background-color: @pageMainBg; - th { - background-color: @pageMainBg; - } -} - -/* - Magento_Catalog - Compare --------------------------------------- */ -.item.link.compare { - .qty { - &:before { - content: '('; - } - &:after { - content: ')'; - } - } -} - -/* - Magento_Catalog - Product lists --------------------------------------- */ -.productItems() { - @spacing: 0 0 10px; - .item.product { - .column(4); - .box-sizing(); - .layout-3 & { - width: 50%; - } - display: inline-block; - vertical-align: top; - margin: 0; - padding: 20px; - float: none; - .product.photo { - float: left; - margin-right: 20px; - } - .product.details { - overflow: hidden; - } - .product.name, - .price-box { - margin: @spacing; - } - .addto.links { - .action:after { - content: ''; - display: block; - } - } - .actions { - visibility: hidden; - .primary { - margin: 0 0 10px; - } - } - &:hover { - .actions { - visibility: visible; - } - } - } -} - -.blocklist() { - clear: both; - margin: 30px 0; - padding-top: 25px; - border-top: 1px solid @primary2; - .products.list { - clear: both; - margin: 0 -20px; - .productItems(); - } -} - -.block.related { - .action.select { - .resetAction(); - .actionLink(); - } - .field.choice.related { - margin: 0 0 10px; - } -} - -.block.widget.viewed, -.block.crosssell, -.block.upsell, -.block.related, -.block.widget.new, -.block.widget.compared { - .blocklist(); -} - -.block.crosssell { - .products.list.items.crosssell { - .clearfix(); - margin: 0 -13px; - .item.product { - .column(2); - padding: 13px; - .product.photo { - float: none; - display: block; - margin: 0 0 10px; - } - margin-bottom: 90px; - .actions { - position: absolute; - } - } - } -} - -.block.widget.viewed { - .products.list.items.widget-viewed-grid { - .item.product { - .column(2); - float: none; - display: inline-block; - .layout-2-left &, - .layout-2-right & { - width: 19.99%; - } - .layout-3 & { - width: 25%; - } - .product.photo { - float: none; - display: block; - margin: 0 0 10px; - } - } - } - .products.list.items.widget-viewed-list { - .item.product { - .column(12); - float: none; - display: inline-block; - } - } -} - -.block.widget.compared { - .products.list.items.widget-compared-grid { - .item.product { - .column(2); - float: none; - display: inline-block; - .layout-2-left &, - .layout-2-right & { - width: 19.99%; - } - .layout-3 & { - width: 25%; - } - .product.photo { - float: none; - display: block; - margin: 0 0 10px; - } - } - } - .products.list.items.widget-compared-list { - .item.product { - .column(12); - float: none; - display: inline-block; - } - } -} - -.block.widget.new { - .products.list.items.widget-new-grid, - .products.list.items.new.grid { - .item.product { - width: 20%; - float: none; - display: inline-block; - .layout-2-left &, - .layout-2-right & { - .column(3); - float: none; - display: inline-block; - } - .layout-3 & { - .column(4); - float: none; - display: inline-block; - } - .product.photo { - float: none; - display: block; - margin: 0 0 10px; - } - } - } - .products.list.items.widget-new-list { - .item.product { - .column(12); - float: none; - display: inline-block; - } - } -} - -// Sidebar widgets -.sidebar .block.widget.viewed, -.sidebar .block.crosssell, -.sidebar .block.upsell, -.sidebar .block.related, -.sidebar .block.widget.new, -.sidebar .block.widget.compared { - border: 0; - padding-top: 0; -} - -// Images and names template -.sidebar .minilist.products.items { - margin: 0; - .item.product { - margin: 0 0 20px; - padding: 0; - position: relative; - width: 100%; - .product.actions { - visibility: hidden; - .transition( visibility .01s ease-in-out 0.1s ); - } - &:hover { - .product.actions { - visibility: visible; - } - } - position: relative; - z-index: 1; - } - .product.details { - overflow: hidden; - padding-bottom: 40px; - } - .product.photo { - float: left; - margin: 0 10px 10px 0; - } - .product.name { - overflow: hidden; - } - .actions { -/* */ - } - .primary { - bottom: -10px; - left: 0; - position: absolute; - } - .action.tocart { - &:extend(.secondary.action all); - padding: 5px 11px; - display: inline-block; - } - .secondary { - position: absolute; - left:100%; - margin-left: -5px; - top:0; - } -} - -// Images only template -.block.widget.photos { - margin: 0 0 30px; - .items { - list-style: none; - .clearfix(); - margin: 0; - padding: 0; - } - .item { - float: left; - margin: 0 3px 3px 0; - padding: 0; - } - .product.photo { - margin-right: 0; - } -} - -.product.info.detailed + .block.upsell, -.product.info.detailed + .block.related { - margin-top: 70px; - clear: none; - float: right; - width: 140px; - border-top: 0; - padding-top: 0; - padding-left: 25px; - border-left: 1px solid @primary2; - .products.list { - margin: 0; - .item.product { - display: block; - width: auto; - padding: 13px 0; - .product.photo { - float: none; - display: block; - margin: 0 0 10px; - } - } - } -} - -.block.widget { - @optionsHeigth: 23px; - .pager { - float: right; - .amount { - float: left; - line-height: @optionsHeigth + 2px; - margin: 2px 15px 0 0; - display: none; - } - .text { - display: none; - } - } - .pages { - margin-left: 15px; - float: left; - .label { - line-height: @optionsHeigth + 2px; - display: inline-block; - } - strong.label { - font-weight: 400; - float: left; - line-height: @optionsHeigth + 2px; - margin-top: 2px; - margin-right: 5px; - display: none; - } - input { - width: 30px; - margin: 0 5px; - text-align: center; - padding: 0 5px; - height: @optionsHeigth + 2px; - line-height: @optionsHeigth + 2px; - } - > ol { - .resetList; - display: inline-block; - vertical-align: top; - margin-top: 2px; - line-height: @optionsHeigth + 2px; - vertical-align: middle; - li { - display: inline; - } - strong, - a { - padding: 0 3px; - } - strong { - font-weight: 400; - color: @secondary1; - } - } - } - .action.next, - .action.previous { - overflow: hidden; - display: inline-block; - vertical-align: middle; - span { - color: @primary3; - .iconAfter(@content: '', @font: "icons"); - .iconHideText(); - } - } - .action.next span:after { - content: @icon-arrow-right-thin; - } - .action.previous span:after { - content: @icon-arrow-left-thin; - } -} - -// Orders and returns -.find.orders { - .label { - display: block; - margin: 0 0 3px; - } - .control { - margin: 0 0 10px; - } - .action.submit { - &:extend(.secondary.action all); - padding: 5px 11px; - } -} - -/* - Magento_Catalog - Layered Navigation --------------------------------------- */ -.block.filter { - .subtitle { - display: none; - } - > .content { - padding: 0; - } - .filtered { - .item { - border-top: 1px solid @primary3; - padding: 2px 0 5px; - margin: 0 0 5px; - position: relative; - z-index: 1; - } - .label { - font-weight: 600; - text-transform: uppercase; - display: block; - } - } - .action.remove { - overflow: hidden; - display: inline-block; - padding: 4px; - position: absolute; - top: -1px; - right: 0; - background: @primary3; - span { - color: #fff; - .iconAfter(@content: @icon-close-thick, @size: 13px, @font: "icons"); - .iconHideText(13px); - } - } - .actions { - margin-bottom: 30px; - } - .action.reset { - font-size: 12px; - text-transform: lowercase; - text-decoration: underline; - } - dt { - text-transform: uppercase; - } - dd { - margin: 0; - padding: 15px 0 25px; - } - .count { - font-size: 12px; - &:before { - content: ' ('; - } - &:after { - content: ')'; - } - } -} - -/* - Magento_Catalog - Product Listing --------------------------------------- */ -.toolbar { - @optionsHeigth: 23px; - clear: both; - margin: 17px 0; - &:first-child { - margin-top: 0; - } - &.alternative { - direction: rtl; - .pager { - direction: ltr; - } - .settings { - display: inline; - direction: ltr; - } - .pages, - .amount, - .limiter { - border-left: 1px solid @primary2; - padding: 2px 0 2px 15px; - } - } - .amount { - display: none; - } - .clearfix(); - .settings { - display: inline; - } - .modes { - margin-left: 30px; - display: inline-block; - margin-top: 3px; - margin-right: 14px; - vertical-align: top; - .label { - display: none; - } - } - .limiter, - .sorter { - .clearfix(); - padding: 2px 0; - float: left; - display: inline-block; - select { - margin-top: 1px; - margin-right: 5px; - } - } - .options { - float: left; - border: 1px solid @primary2; - white-space: nowrap; - height: @optionsHeigth; - line-height: @optionsHeigth; - overflow: visible; - display: block; - padding: 0 7px; - .current { - font-weight: 400; - float: left; - padding-right: 7px; - } - ul { - .resetList(); - height: 0; - overflow: hidden; - clear: both; - padding: 0 30px 0 7px; - margin: 0 -8px; - border: 1px solid @primary3; - visibility: hidden; - top: -(@optionsHeigth + 1px); - background: #fff; - position: relative; - z-index: 2; - } - .action.switch { - float: right; - margin-top: 4px; - } - .selected { - color: @secondary1; - } - &.active { - ul { - height: auto; - visibility: visible; - } - } - } - .pager { - float: right; - .amount { - float: left; - line-height: @optionsHeigth + 2px; - margin: 2px 15px 0 0; - } - .text { - display: none; - } - } - .pages { - margin-left: 15px; - float: left; - .label { - line-height: @optionsHeigth + 2px; - display: inline-block; - } - strong.label { - font-weight: 400; - float: left; - line-height: @optionsHeigth + 2px; - margin-top: 2px; - margin-right: 5px; - display: none; - } - input { - width: 30px; - margin: 0 5px; - text-align: center; - padding: 0 5px; - height: @optionsHeigth + 2px; - line-height: @optionsHeigth + 2px; - } - > ul { - .resetList(); - display: inline-block; - vertical-align: top; - margin-top: 2px; - line-height: @optionsHeigth + 2px; - vertical-align: middle; - li { - display: inline; - .label { - position: absolute; - width: 1px; - height: 1px; - margin: -1px; - padding: 0; - overflow: hidden; - clip: rect(0,0,0,0); - border: 0; - } - } - strong, - a { - padding: 0 3px; - } - strong { - font-weight: 400; - color: @secondary1; - } - } - } -} - -/* - Magento_Catalog - Product List --------------------------------------- */ -@imageHeight: 180px; -@imageWidth: 180px; - -.category.image { - img { - max-width: 100%; - } -} - -.products.wrapper .products.list { - .item { - .product.photo { - display: block; - margin-bottom: 10px; - text-align: center; - > .photo { - display: block; - margin: 0 auto; - } - } - z-index: 1; - position: relative; - border: 1px solid transparent; - background: transparent; - &:hover { - border: 1px solid @primary3; - background: @primary1; - .product.actions { - opacity: 1; - visibility: hidden; - .action.tocart, - .secondary { - visibility: visible; - } - } - z-index: 99; - } - .product.actions { - opacity: 0.8; - visibility: hidden; - .action.tocart, - .secondary { - visibility: hidden; - } - } - .price-box, - .product.reviews { - display: block; - margin-bottom: 7px; - } - .secondary { - border: solid @primary3; - .box-sizing(); - white-space: nowrap; - position: absolute; - .action { - padding: 10px; - white-space: normal; - vertical-align: top; - display: inline-block; - line-height: 1; - } - } - } -} - -.products.wrapper.grid { - margin-bottom: 20px; -} - -.products.wrapper.grid .products.list { - .item.product { - .box-sizing(); - @total-columns: 10; - .column(2); - display: inline-block; - float: none; - .layout-2-left &, - .layout-2-right & { - @total-columns: 12; - .column(3); - display: inline-block; - float: none; - margin-bottom: 30px; - } - .layout-3 & { - @total-columns: 12; - .column(4); - display: inline-block; - float: none; - margin-bottom: 30px; - } - padding: 9px 9px 9px; - vertical-align: top; - } - .secondary { - border-width: 1px; - background: @primary1; - top: 100%; - .box-sizing(); - left: -1px; - right: -1px; - .action { - padding: 10px 0; - text-align: center; - width: 49%; - } - } -} - -.products.wrapper.list .products.list { - margin-bottom: 20px; - .item.product { - .clearfix(); - display: block; - border-bottom: 1px solid @primary3; - padding: 9px 9px 9px 9px; - .product.details { - padding-bottom: 40px; - } - margin-bottom: -1px; - } - .product.details { - display: table; - } - .product.photo { - float: left; - margin-right: 9px; - margin-bottom: 0; - } - .secondary { - bottom: 0; - top: auto !important; - margin-left: 18px; - border-width: 1px 0 0; - right: 20px; - } - .product.description { - margin: 9px 0; - } -} - -/* - General product item styling --------------------------------------- */ -.product.name { - color: @primary6; - font-weight: 600; - line-height: 1.2; - display: block; - margin-bottom: 10px; -} - -.price-box p, -.pricing p { - margin: 5px 0; - &:first-child { - margin-top: 0; - } - &:last-child { - margin-bottom: 0; - } -} - -.product.details .price-box .price-excluding-tax, -.product.details .price-box .price-including-tax { - display: block; -} - -.old-price, -.old.price { - text-decoration: line-through; -} - -.special-price, -.special.price { - color: @secondary1; -} - -.stock[title] { - line-height: 16px; - span:before { - content: ''; - line-height: 16px; - background: #42b649; - display: inline-block; - border-radius: 5px; - width: 10px; - height: 10px; - margin-right: 5px; - vertical-align: middle; - } - &.unavailable { - color: @primary3; - span:before { - background: @primary3; - } - } -} - -.product.item .product.description { - font-size: @baseFontSizeMiddle; -} - -.action.tocart { - &:extend(.primary.action all); - padding: 5px 11px; - - .block .product.actions & { - display: inline-block; - margin: 10px 0; - } -} - -.action.tocompare, -.action.towishlist { - font-size: 12px; - span:before { - content: "\002B\00A0"; - } - .item.product & { - margin-left: 0; - } -} - -/* - Magento_Catalog - Product View --------------------------------------- */ -.fieldset { - .formFieldset(); - > .field { - .formField(); - } -} - -.product.info.main { - float: right; - width: 430px; - padding-bottom: 30px; - - .layout-2-left &, - .layout-2-right & { - width: 370px; - } - .layout-3 & { - float: none; - width: 100%; - } -} - -.product.info.main { - .price-box { - font-size: 20px; - padding-bottom: 10px; - margin: 15px 0; - line-height: 1.2; - font-weight: @baseFontWeightLighter; - } - .page.title.product + .price-box { - border-bottom: 1px solid @primary2; - } - .col.price .price-box { - margin: 0; - } - p { - margin: 5px 0; - } - .old-price { - font-size: @baseFontSizeBigger; - .price-label { - //display: none; - } - .price { - text-decoration: line-through; - } - } - .stock { - margin: 15px 0; - } - .product.options.bottom { - .price-box { - display: none; - } - } - .product.addto.links { - margin: 15px 0 0; - padding-top: 10px; - border-top: 1px solid @primary2; - .action { - float: left; - margin-right: 15px; - } - } - .product.alert { - font-size: 12px; - margin: 5px 0; - } -} - -.product.main.info { - .product.options.wrapper { - .field { - .fieldStyle(); - .formField(); - &:not(.choice) > .label { - .labelStyle(); - } - } - .type-configurable & { - select { - min-width: 40%; - width: auto; - padding: 2px; - } - } - } - .product.options.wrapper .fieldset { - margin: 0; - .field.required .control .field.choice .label span:after { - content: ""; - } - .field.date { - input[type="text"] { - width: auto; - } - } - .datetime-picker + .ui-datepicker-trigger { - margin: 0 15px 0 7px; - } - .payment.product.options, - .payment.product.schedule { - .content { - margin: 5px 0 0; - } - } - } -} - -.action.primary.customize, -.action.primary.tocart { - &:extend(.primary.action all); - line-height: 16px; - padding: 9px 15px; - span { - font-weight: 400; - font-size: @baseFontSizeBigger; - } -} - -.product.media { - float: left; - width: 540px; - padding-bottom: 30px; - - .layout-2-left &, - .layout-2-right & { - width: 400px; - } - .layout-3 & { - float: none; - width: 100%; - } -} - -.box.tocart { - .clearfix(); - margin: 15px 0; - .field { - float: left; - padding-right: 10px; - } - .label { - display: block; - text-align: left; - font-weight: 600; - text-transform: uppercase; - line-height: 25px; - } - .control { - width: 60px; - text-align: center; - } - .actions { - float: left; - padding-top: 24px; - } - .qty { - text-align: center; - } -} - -.prices.tier { - padding: 20px; - margin: 15px 0; - background: @primary1; - strong { - font-weight: @baseFontWeight; - } -} - -.product.social.links { - float: right; - text-align: right; -} - -.action.mailto { - span { - .iconAfter(@content: @icon-envelope, @font: "icons"); - .iconHideText(); - color: @primary3; - } -} - -.product.photo.thumbs { - float: left; - padding-left: 15px; - .title { - display: none; - } - .item.thumb { - margin-bottom: 8px; - img { - border: 1px solid transparent; - } - .active img { - border: 1px solid @primary5; - } - } -} - -.product.photo.main { - float: left; - text-align: center; - .notice { - font-size: 11px; - } -} - -.magento-zoom > .img > img { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - margin: auto; - max-height: 100%; - max-width: 100%; -} - -.product.attibute.sku { - font-size: @baseFontSizeMiddle; - .value { - display: inline - } - .type:after { - content: '#'; - } -} - -.product.attibute.description { - img { - max-width: 100%; - height: auto; - } -} - -@media only screen -and (max-width : 99999px) { - .product.data { - .column(10); - .data-tabs(); - .data-tabs-styling(); - } - - .temp-upsell-placeholder { - .column(2); - background: red; - height: 200px; - margin-top: 50px; - } -} - -@media only screen -and (max-width : 768px) { - .product.data { - .column(12); - .data-accordion(); - .data-accordion-styling(); - } - - .temp-upsell-placeholder { - .column(12); - background: red; - height: 200px; - margin-top: 20px; - } -} - -// Catalog Inventory -.availability.only { - &.detailed { - display: none; - &.active { - display: block; - } - } - .data.table { - width: 100%; - } -} - -/* - Magento_Bundle - Product View --------------------------------------- */ -body.type-bundle { - overflow-x: hidden; -} - -@media only screen -and (max-width : 768px) { - body.type-bundle { - overflow: auto; - .customize { - &:before { - left: -10px; - right: -10px; - - } - } - } -} - -.product.info.main { - .action.primary.customize { - margin: 40px 0; - } -} - -.bundle.options.container { - margin: 45px 0; - clear: both; - position: relative; - z-index: 1; - &:before { - position: relative; - z-index: 1; - content: ''; - display: block; - position: absolute; - left: -999em; - right: -999em; - z-index: -1; - background: @primary1; - top: 0; - bottom: 0; - } - - .product.add.form { - .clearfix(); - position: relative; - z-index: 1; - display: none; - padding: 45px 0; - } - .product.options.wrapper { - float: left; - width: 500px; - - .layout-2-left &, - .layout-2-right & { - width: 450px; - } - .layout-3 & { - width: 360px; - } - } - .product.options.bottom { - .box-sizing(); - float: left; - padding: 0 10px 20px 30px; - width: 500px; - clear: left; - } - - .prices.tier { - background: @primary2; - + .price-box { - font-size: @baseFontSizeBigger; - .price { - color: @secondary1; - } - } - } -} - -.fieldset.bundle.options { - border: 0; - padding: 0; - margin: 0; - .legend { - font-size: 26px; - font-weight: 200; - float: left; - margin-bottom: 20px; - } - .legend + br { - display: block; - clear: both; - } - .bundle-slide-back { - float: right; - } - > .field { - > .label { - font-size: 20px; - font-weight: 200; - display: block; - margin-bottom: 20px; - } - margin: 0 0 50px; - padding: 20px; - background: @primary7; - &:last-child { - margin-bottom: 0; - } - } - .nested { - .field { - margin: 10px 0; - } - .field.qty { - margin-top: 20px; - .label { - display: inline-block; - vertical-align: middle; - span:after { - content: ':'; - } - } - .control { - width: 60px; - display: inline-block; - vertical-align: middle; - } - input { - text-align: center; - } - } - } -} - -.product.options.wrapper { - .nested.mage-error-group { - position: relative; - z-index: 1; - .field { - z-index: 2; - position: relative; - } - &:before { - z-index: 1; - border:1px solid @nonValidHilight !important; - background: fadeout(@nonValidHilight,96%); - content: ''; - left:-8px; - right:-8px; - top:-5px; - bottom:-5px; - display: block; - position: absolute; - } - } -} - -.block.bundle.summary { - background: @primary7; - margin-top: 54px; - float: right; - position: relative; - width: 380px; - - .layout-2-left &, - .layout-2-right & { - width: 320px; - } - .layout-3 & { - width: 230px; - } - > .title { - font-weight: 400; - border-bottom: 3px solid @primary2; - line-height: 1; - padding: 20px 20px 10px; - margin-bottom: 0; - } - .photo { - float: left; - border: 1px solid @primary2; - margin-right: 20px; - .photo { - float: none; - border: none; - margin-right: 0; - } - } - > .content { - padding: 20px; - } - .price-box { - .clearfix(); - padding: 20px 0 0; - clear: both; - line-height: 24px; - .price-label { - float: left; - font-size: 18px; - font-weight: 600; - } - .full-product-price { - float: right; - .price { - color: @secondary1; - font-weight: 700; - font-size: 24px; - } - } - } - .box.tocart { - padding: 10px 0 20px; - border-top: 1px solid @primary2; - border-bottom: 1px solid @primary2; - } - .addto.links { - .action { - font-size: 14px; - margin-right: 20px; - &:last-child { - margin-right: 0; - } - } - } - .subtitle { - display: block; - margin: 20px -20px 0; - font-weight: @baseFontWeightLighter; - font-size: 20px; - border-bottom: 3px solid @primary2; - line-height: 1; - padding: 20px 20px 10px; - margin-bottom: 0; - } - .bundle.summary { - div > ul { - list-style: none; - margin: 10px 0 0; - padding: 0; - > li { - margin: 0 0 10px; - > div > div { - margin: 0 0 5px; - } - } - } - } -} - -.action.back.customization { - .resetAction(); - .actionLink(); - position: absolute; - top: 57px; - right: 0; -} - -/* - CMS --------------------------------------- */ -img[align="left"] { - margin: 0 22px 22px 0; -} - -img[align="right"] { - margin: 0 0 22px 22px; -} - -.home.main.slider { - img { - width: 100%; - display: block; - } -} - -/* - Magento_Customer --------------------------------------- */ -.customer.welcome { - display: inline-block !important; - position: relative; - z-index: 1; - cursor: pointer; - .menu { - padding:0; - margin: 0; - } - .menu > ul { - font-weight: 600; - font-size: @baseFontSizeMiddle; - margin: 0; - position: absolute; - top: 100%; - margin-left: -11px; - float: left; - right: 0; - text-align: left; - background: @primary1; - border: 1px solid darken(@headerBg, 5%); - visibility: hidden; - opacity: 0; - .transition(visibility 0s linear .2s); - li { - margin: 15px; - display: block; - white-space: nowrap; - } - } - &.active { - z-index: 9999; - .menu > ul { - visibility: visible; - opacity: 1; - .transitionDelay(0s); - } - } - .page.header .content & .customer.name { - font-weight: 400; - span { - color: @primary5; - .iconAfter(@content: @icon-arrow-bottom-filled, @font: "icons"); - &:after { - line-height: @base-font-size; - } - } - &:focus span, - &:hover span, - &.active span { - color: @primary6; - outline: 0; - } - &.active span:after { - content: @icon-arrow-up-filled; - } - } - & + li { - display: none; - } -} - -.customer.welcome + li, -.customer.welcome + .greet.welcome + li { - display: none !important; -} - -.login.container { - .clearfix(); - background: @primary1; - padding: 40px; - position: relative; - z-index: 1; - padding-bottom: 150px; - .block { - .box-sizing(); - float: left; - width: 50%; - > .title { - margin-bottom: 25px; - } - .actions { - .box-sizing(); - text-align: right; - position: absolute; - bottom: 140px; - width: 50%; - padding: 0 40px; - .secondary { - margin-bottom: -2em; - margin-top: 0.8em; - line-height: 1.2em; - float: right; - } - } - &.login { - padding-right: 90px; - .actions { - margin-left: -90px; - } - } - &.new { - padding-left: 40px; - .actions { - margin-left: -40px; - } - &:before { - content: ''; - border-left: 1px solid; - .borderColor(@primary1); - position: absolute; - top: 40px; - margin-left: -40px; - bottom: 60px; - } - } - } - .action.login, - .action.create { - &:extend(.primary.action all); - } -} - -.form.login { - .fieldset.login { - .formFieldset(); - .formInline(40%); - margin: 0; - padding: 0; - border: 0; - .field { - .fieldStyle(); - .label { - padding-top: 7px; - padding-right: 10px; - text-align: right; - } - } - } -} - -.form.login, -.step.login { - .field.persistent { - .link.tip { - display: inline-block; - padding-top: 7px; - } - .checkbox { - margin-top: 10px; - } - } -} - -.action.reload { - .resetAction(); - position: absolute; - background: #fff; - padding: 2px; - span { - // TODO: add 'reload' icon to mui - .iconAfter(@content: @icon-info, @size: 22px, @font: "icons"); - .iconHideText(22px); - color: @secondary1; - text-shadow: 0px 1px rgba(0, 0, 0, 0.4); - } -} - -/* - Registration --------------------------------------- */ -.form.send.friend, -.form.address.edit, -.form.edit.account, -.form.search.advanced, -.form.orders.search, -.form.contact, -.form.password.forget, -.form.create.account, -.form.wishlist.share, -.form.password.reset, -.form.paypal.review, -.form.send.confirmation { - .formCommon(); -} - -.form.send.friend { - .fieldset.recipients { - .fields { - .clearfix(); - margin-bottom: 30px; - position: relative; - z-index: 1; - .field { - .box-sizing(); - width: 50%; - padding-right: 20px; - float: left; - } - } - .action.delete { - position: absolute; - right: 0; - top: 50%; - } - .actions { - width: 100%; - margin: 0; - .action.add { - &:extend(.secondary.action all); - } - .primary { - float: left; - } - } - } -} - -.form.address.edit .field.company, -.form.edit.account .field.password.current, -.form.edit.account .field.choice { - margin-right: 30%; -} - -.form.address.edit .field.note.default, -.form.address.edit .field.choice.set, -.form.wishlist.share .field.emails, -.form.wishlist.share .field.text, -.form.wishlist.share .field.choice { - width: 100%; -} - -// Move to other place -.form.search.advanced, -.form.orders.search, -.form.contact { - .box-sizing(); - background: @primary1; - padding: 40px; - .fieldset { - width: auto; - background: none; - margin-bottom: 0; - .legend { - background: none; - } - } - .actions { - width: auto; - padding-right: 30px; - text-align: right; - .action { - &:extend(.primary.action all); - } - } - .fields.range { - .field:first-child { - .control { - padding-right: 30px; - position: relative; - &:after { - content: '\2014'; - display: inline-block; - margin-right: 0; - position: absolute; - right: 6px; - top: 5px; - text-align: center; - width: 25px; - } - } - } - } -} - -.form.contact { - .fieldset { - .field { - float: left; - width: 40%; - margin-right: 60%; - &.comment { - width: 55%; - margin-left: -55%; - margin-right: 0; - float: none; - textarea { - min-height: 13.2em; - } - } - } - } -} - -/* - Review paypal express checkout order --------------------------------------- */ -.paypal.review.view { - .paypal.subtitle.caption { - margin-bottom: 25px; - .action { - margin-left: 10px; - } - strong { - font-size: 20px; - font-weight: 200; - line-height: 1.2; - } - } - .form.paypal.review { - .fieldset { - width: 100%; - &.shipping.address { - float: right; - width: 49%; - } - &.billing.address { - float: left; - width: 49%; - } - &.shipping.method { - clear: both; - } - .nested { - margin-top: 10px; - } - } - } - .actions { - margin-top: 35px; - .action.update { - &:extend(.secondary.action all); - margin-left: 10px; - } - } - .paypal.review.items { - clear: left; - } - .data.table.paypal.review.items { - width: 100%; - td, - th { - padding: 10px 20px; - text-align: left; - &.col.total { - text-align: right; - } - } - th { - font-size: 16px; - font-weight: 400; - } - tbody tr:nth-child(odd) td { - background: @primary1; - } - tfoot tr:first-child td { - border-top: 3px solid @primary2; - padding-top: 15px; - } - } - - .block.shipping.information, - .block.billing.information { - margin-bottom: 45px; - > .content { - .clearfix(); - } - .box { - float: left; - padding-right: 2%; - width: 48%; - > .content { - background: @primary1; - padding: 30px; - .select { - width: 100%; - } - .actions { - margin: 25px 0 0; - } - } - } - address { - font-style: normal; - } - .subtitle { - display: block; - font-size: 18px; - font-weight: 200; - margin-bottom: 20px; - .action { - display: inline-block; - font-size: 14px; - font-weight: 400; - margin-left: 20px; - text-decoration: underline; - text-transform: lowercase; - } - } - } -} - -.paypal.iframe { - display: none; -} - -/* - MISC --------------------------------------- */ -.action.back { - span:before { - content: '\00AB\00A0'; - } -} - -/* - Magento_Customer - Account --------------------------------------- */ -.layout-2-left.account { - .column.main { - .column(9); - } - .column.left { - .column(3); - } -} - -.block.account.nav { - .title { - font-size: 18px; - } - .item { - margin-bottom: 10px; - &.current { - color: @secondary1; - a { - color: @secondary1; - } - } - } - .item strong { - font-weight: 400; - } -} - -.account { - .pager { - .amount, - .limiter { - display: inline-block; - } - } - .form { - .fieldset > .legend { - margin: 0 0 30px; - } - } - .column.main { - > .actions, - .form > .actions, - .block > .actions { - .clearfix(); - margin: 30px 0 0; - > .primary { - float: right; - } - > .secondary { - float: left; - } - } - } - .data.table { - width: 100%; - td, - th { - padding: 10px 20px; - text-align: left; - &.col.actions { - white-space: nowrap; - .action:last-child { - margin-left: 20px; - } - .action:first-child, - .action.details { - margin-left: 0; - } - } - em { - font-style: normal; - } - } - th { - font-size: 16px; - font-weight: @baseFontWeight; - } - tr:nth-child(odd) td { - background: @primary1; - } - } -} - -.block.dashboard { - .title .action, - .subtitle .action { - font-weight: @baseFontWeight; - font-size: @baseFontSize; - margin-left: 20px; - text-decoration: underline; - display: inline-block; - text-transform: lowercase; - span { - } - &:first-letter { - text-transform: uppercase; - } - } - .box { - .box-sizing(); - float: left; - width: 50%; - line-height: 1.666; - address { - font-style: normal; - } - } - .content { - .clearfix(); - } -} - -.block.dashboard:not(.welcome):not(.orders) { - .content { - background: @primary1; - padding: 30px; - } - .subtitle { - font-size: 18px; - font-weight: @baseFontWeightLighter; - display: block; - margin-bottom: 20px; - } -} - -.data.table.orders { - td, - th { - &.col.total { - text-align: right; - } - } -} - -/* - Address book --------------------------------------- */ -.block.addresses:not(.dashboard) { - .box-sizing(); - float: left; - .title .action, - .subtitle .action { - font-weight: @baseFontWeight; - font-size: @baseFontSize; - margin-left: 20px; - text-decoration: underline; - display: inline-block; - text-transform: lowercase; - &:first-letter { - text-transform: uppercase; - } - } - .content { - background: @primary1; - padding: 30px; - } - .subtitle { - font-size: 18px; - font-weight: @baseFontWeightLighter; - display: block; - margin-bottom: 20px; - } - .box { - &:first-child { - margin-bottom: 30px; - } - } - address { - line-height: 1.666; - font-style: normal; - } - &.default { - float: left; - width: 60%; - } - &.list { - float: right; - width: 35%; - .item { - margin-bottom: 30px; - } - .item.actions { - margin-top: 15px; - } - .action { - margin-right: 10px; - } - } -} - -.customer-address-index .column.main .actions { - clear: left; -} - -/* - My Account -> My Product Reviews --------------------------------------- */ -.data.table.reviews { - .product.name { - margin: 0; - } -} - -/* - Wishlist sidebar --------------------------------------- */ -.block.wishlist { - .subtitle { - display: block; - font-weight: 600; - margin: 0 0 15px; - } -} - -/* - My Account -> My Wishlist --------------------------------------- */ -.wrapper.table { - .data.table.wishlist { - @optionsBg: rgba(0, 0, 0, .8); - @optionsColor: #fff; - - margin-bottom: 15px; - - thead th { - padding-top: 0; - padding-bottom: 10px; - text-align: left; - font-weight: @baseFontWeight; - font-size: @baseFontSizeBigger; - } - - td, - th { - padding: 16px 10px 10px; - vertical-align: top; - } - - td:first-child, - th:first-child { - padding-left: 20px; - } - - td:last-child, - th:last-child { - padding-right: 20px; - } - - tbody tr:nth-child(even) { - background: @primary1; - } - - textarea { - width: 100%; - } - - .box.tocart .qty { - width: 50px; - } - - .col.photo { - width: 100px; - } - .col.actions { - width: 200px; - .price-excluding-tax, - .price-including-tax { - display: block; - } - } - } - & + .actions { - .primary { - margin-bottom: 15px; - .action.share, - .action.update { - &:extend(.primary.action all); - padding: 5px 11px; - } - .action.update { - margin-left: 5px; - } - } - } -} -/* - Page -> Advanced Search --------------------------------------- */ -.form.search.advanced { - .range.price.fields.group { - .field { - .box-sizing(); - .column(6); - padding-right: 0; - } - .field:first-child input { - width: 96%; - } - } - .range.dates.fields.group { - .field { - .box-sizing(); - .column(6); - padding-right: 0; - .control { - padding-right: 20px; - } - } - .field:first-child .control { - padding-right: 50px; - .ui-datepicker-trigger { - right: 32px; - } - } - } - .group.price { - .addon { - .addafter { - color: @textColor; - border: none; - background: none; - padding: 0 20px 0 5px; - } - } - } -} - -/* - Popular Search Terms --------------------------------------- */ -.search.terms { - .resetList(); - .item { - display: inline-block; - margin-right: 3px; - } -} - -/* - My Account -> My orders --------------------------------------- */ -.order.details { - .clearfix(); - - .status { - margin: 0 0 .5em; - line-height: 1.2; - font-weight: 400; - font-size: 30px; - float: left; - } - - .subtitle.caption, - .title { - strong { - line-height: 1.2; - font-weight: 200; - font-size: 20px; - } - .action { - margin-left: 10px; - } - } - - .subtitle.caption { - margin-bottom: 45px; - } - - .order.toolbar { - clear: none; - float: right; - - .action { - margin-left: 10px; - } - } - - .block.order { - float: left; - width: 48%; - padding-right: 2%; - - &.billing.address { - clear: left; - } - .content { - background: @primary1; - padding: 30px; - } - p { - margin-top: 0; - &:last-child { - margin-bottom: 0; - } - } - } - - .order.info { - clear: both; - - > dt { - line-height: 1.2; - font-weight: 200; - font-size: 20px; - } - - > dd { - margin: 0; - .items { - .clearfix(); - background: @primary1; - margin: 10px 0 0 0; - padding: 30px; - .item { - float: left; - margin-right: 15px; - } - } - } - } - - .additional.details { - margin-bottom: 45px; - .order.comments { - background: @primary1; - padding: 30px; - } - .subtitle.caption { - font-size: 20px; - font-weight: 200; - line-height: 1.2; - margin-bottom: 15px; - } - &.gift { - .gift.message { - background: @primary1; - padding: 30px; - dt { - margin: 0; - } - dd { - margin: 0 0 0 40px; - } - } - } - } -} - -.order.details.items { - .order.toolbar { - margin: 5px 0 0 0; - } - .order.title { - margin-bottom: 10px; - } - h3.product-name { - margin: 0; - } - .action.show { - text-decoration: none; - .iconAfter(@content: @icon-arrow-bottom-filled, @size: 12px, @font: "icons"); - &.expanded:after { - content: @icon-arrow-up-filled; - } - } - .gift.message.details { - position: relative; - } - .gift.message { - margin: 0; - } - .action.close { - position: absolute; - right: 0; - top: 0; - span { - .iconAfter(@content: @icon-close-thick, @size: 12px, @font: "icons"); - } - } - + .order.details.view { - margin-top: 45px; - } -} - -.shipping-tracking-popup { - .action.close { - &:extend(.secondary.action all); - text-indent: 0; - - span { - width: auto; - text-indent: 0; - &:after { - content: ""; - display: none; - } - } - } -} - -.data.table { - th, td { - border-right-width:0; - } -} -.data.table.order { - margin-bottom: 45px; - width: 100%; - - thead th { - padding: 0 10px; - } - - thead tr:last-child th { - padding-bottom: 10px; - } - - td.col.qty { - width: 90px; - text-align: left; - } - - td.col.price, - td.col.subtotal { - text-align: left; - } - td { - padding: 16px 10px 10px; - vertical-align: top; - - h4 { - margin: 0; - } - } - td:first-child, - th:first-child { - padding-left: 20px; - } - td:last-child, - th:last-child { - padding-right: 20px; - } - tbody:nth-child(even) tr { - background: @primary1; - } - th { - text-align: left; - font-weight: 400; - font-size: 14px; - vertical-align: top; - } - tr:first-child th { - font-weight: 400; - font-size: 16px; - } - .item-options { - margin: 5px 0; - - dt { - font-weight: 400; - display: inline; - margin-right: 10px; - float: left; - clear: left; - - &:after { - content: ': '; - } - } - dd { - font-weight: 200; - margin: 0 0 5px 10px; - padding: 0; - } - } - - tfoot tr:first-child td { - border-top: 3px solid @primary2; - padding-top: 15px; - } - - &.tracking { - th, td { - padding: 0; - } - .label { - width: 40%; - } - } - .qty.summary { - .resetList(); - .label { - &:after { - content: ": "; - } - } - } -} - -/* - My Account -> Billing agreements --------------------------------------- */ -.billing.agreements { - .data.table { - margin-bottom: 40px; - } - .form.new.agreement { - .formCols(30%); - - .fieldset { - margin: 0; - > .legend { - margin: 0 0 20px; - } - } - - .action.create { - padding-top: 7px; - padding-bottom: 6px; - } - } -} - -/* - My Account -> Recurring payments --------------------------------------- */ -.recurring.order.details { - .block.view.info { - .clearfix(); - .box { - float: left; - padding-right: 2%; - width: 48%; - .subtitle { - font-size: 20px; - font-weight: 200; - line-height: 1.2; - display: inline-block; - margin-bottom: 15px; - } - .content { - background: @primary1; - padding: 30px; - .clearfix(); - } - .data.table { - th, - td { - padding: 4px 7px; - } - } - } - } - > .actions { - .primary { - text-align: right; - .action { - &:extend(.primary.action all); - } - } - } -} - -/* - My Account -> Send confirmation link --------------------------------------- */ -.form.send.confirmation { - .action.send { - &:extend(.primary.action all); - } -} - -/* - Overlay popup --------------------------------------- */ -.window.overlay { - background: @primeBlackOpacity; - display: none; - min-height: 100%; - position: absolute; - top: 0; - left: 0; - width: 100%; - z-index: 990; - &.active { - display: block; - } -} - -.popup { - background: @primary7; - left: 50%; - top: 40%; - position: absolute; - margin: -85px 0 0 -250px; - width: 500px; - z-index: 1000; - position: fixed; - display: none; - &.active { - display: block; - } - > .action.close span { - .iconHideText(); - &:after { - content: ""; - } - } - .title { - font-size: 18px; - margin: 0 0 30px; - strong { - font-weight: 400; - } - } - .fieldset { - .action.close span { - line-height: inherit; - text-indent: 0; - width: auto; - &:after { - content: ""; - display: none; - } - } - } -} - -.truncated { - position: relative; - .truncated.full.value { - background: @optionsBg; - color: @optionsColor; - display: none; - position: absolute; - border-radius: 5px; - padding: 10px; - right: 100%; - top: 50%; - margin-top: -20px; - margin-right: 15px; - max-width: 200px; - min-width: 100px; - &.show { - display: block; - &:before { - content: ''; - border-left: 10px solid @optionsBg; - border-top: 10px solid transparent; - border-bottom: 10px solid transparent; - height: 0; - width: 0; - overflow: hidden; - display: block; - position: absolute; - top: 12px; - margin-top: 0; - right: -10px; - z-index: 2; - } - } - > p { - margin-top: 0; - } - dl { - margin: 0; - dt { - display: inline; - font-weight: 600; - &:after { - content: ':'; - } - } - dd { - margin: 0; - white-space: normal; - } - } - } - .action.details { - font-size: @baseFontSizeMiddle; - border-bottom: 1px dotted @link; - cursor: help; - } -} - -/* - Minimum Advertising Price --------------------------------------- */ -.map.popup { - background: @commonBg; - border: 1px solid @primary3; - margin: 18px 0 0; - position: absolute; - padding: 20px; - width: 300px; - z-index: 10; - &:before { - border-color: transparent transparent @primary7 transparent; - border-style: solid; - border-width: 0 15px 15px; - content: ""; - height: 0; - left: 50%; - margin: 0 0 0 -7px; - position: absolute; - top: -15px; - width: 0; - z-index: 2; - } - &:after { - border-color: transparent transparent @primary3 transparent; - border-style: solid; - border-width: 0 16px 16px; - content: ""; - height: 0; - left: 50%; - margin: 0 0 0 -8px; - position: absolute; - top: -16px; - width: 0; - z-index: 1; - } - .title { - margin-bottom: 20px; - } - .map.msrp .old.price { - text-decoration: line-through; - } - .form.map.checkout { - float: right; - } - .content { - margin: 15px 0 0; - .map.msrp, - .map.price { - > .label:after { - content: ": "; - } - } - .map.price > .label { - font-weight: 700; - } - } - .price-excluding-tax, - .price-including-tax { - display: block; - } - + .category.view { - position: relative; - z-index: 1; - } -} - -@import "source/responsive/responsive.less"; diff --git a/app/design/frontend/Magento/plushe/fonts/.htaccess b/app/design/frontend/Magento/plushe/fonts/.htaccess deleted file mode 100644 index d7ef2e0846f35..0000000000000 --- a/app/design/frontend/Magento/plushe/fonts/.htaccess +++ /dev/null @@ -1,13 +0,0 @@ -# deny *everything* - - Order Allow,Deny - Deny from all - - -# but now allow just *certain* necessary files: - - Order Allow,Deny - Allow from all - - -IndexIgnore */* \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/fonts/icons/icons.dev.svg b/app/design/frontend/Magento/plushe/fonts/icons/icons.dev.svg deleted file mode 100644 index 661704d2967fd..0000000000000 --- a/app/design/frontend/Magento/plushe/fonts/icons/icons.dev.svg +++ /dev/null @@ -1,99 +0,0 @@ - - - - -This is a custom SVG font generated by IcoMoon. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/fonts/icons/icons.eot b/app/design/frontend/Magento/plushe/fonts/icons/icons.eot deleted file mode 100644 index b84de058ea763..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/icons/icons.eot and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/icons/icons.svg b/app/design/frontend/Magento/plushe/fonts/icons/icons.svg deleted file mode 100644 index 560b55877c2c6..0000000000000 --- a/app/design/frontend/Magento/plushe/fonts/icons/icons.svg +++ /dev/null @@ -1,99 +0,0 @@ - - - - -This is a custom SVG font generated by IcoMoon. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/fonts/icons/icons.ttf b/app/design/frontend/Magento/plushe/fonts/icons/icons.ttf deleted file mode 100644 index 04a1a990a5d25..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/icons/icons.ttf and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/icons/icons.woff b/app/design/frontend/Magento/plushe/fonts/icons/icons.woff deleted file mode 100644 index 02d652643c348..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/icons/icons.woff and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/marvel/OFL.txt b/app/design/frontend/Magento/plushe/fonts/marvel/OFL.txt deleted file mode 100644 index 077aee25e6b01..0000000000000 --- a/app/design/frontend/Magento/plushe/fonts/marvel/OFL.txt +++ /dev/null @@ -1,93 +0,0 @@ -Copyright (c) 2011, Carolina Trebol , -with Reserved Font Name "Marvel". -This Font Software is licensed under the SIL Open Font License, Version 1.1. -This license is copied below, and is also available with a FAQ at: -http://scripts.sil.org/OFL - - ------------------------------------------------------------ -SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ------------------------------------------------------------ - -PREAMBLE -The goals of the Open Font License (OFL) are to stimulate worldwide -development of collaborative font projects, to support the font creation -efforts of academic and linguistic communities, and to provide a free and -open framework in which fonts may be shared and improved in partnership -with others. - -The OFL allows the licensed fonts to be used, studied, modified and -redistributed freely as long as they are not sold by themselves. The -fonts, including any derivative works, can be bundled, embedded, -redistributed and/or sold with any software provided that any reserved -names are not used by derivative works. The fonts and derivatives, -however, cannot be released under any other type of license. The -requirement for fonts to remain under this license does not apply -to any document created using the fonts or their derivatives. - -DEFINITIONS -"Font Software" refers to the set of files released by the Copyright -Holder(s) under this license and clearly marked as such. This may -include source files, build scripts and documentation. - -"Reserved Font Name" refers to any names specified as such after the -copyright statement(s). - -"Original Version" refers to the collection of Font Software components as -distributed by the Copyright Holder(s). - -"Modified Version" refers to any derivative made by adding to, deleting, -or substituting -- in part or in whole -- any of the components of the -Original Version, by changing formats or by porting the Font Software to a -new environment. - -"Author" refers to any designer, engineer, programmer, technical -writer or other person who contributed to the Font Software. - -PERMISSION & CONDITIONS -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Font Software, to use, study, copy, merge, embed, modify, -redistribute, and sell modified and unmodified copies of the Font -Software, subject to the following conditions: - -1) Neither the Font Software nor any of its individual components, -in Original or Modified Versions, may be sold by itself. - -2) Original or Modified Versions of the Font Software may be bundled, -redistributed and/or sold with any software, provided that each copy -contains the above copyright notice and this license. These can be -included either as stand-alone text files, human-readable headers or -in the appropriate machine-readable metadata fields within text or -binary files as long as those fields can be easily viewed by the user. - -3) No Modified Version of the Font Software may use the Reserved Font -Name(s) unless explicit written permission is granted by the corresponding -Copyright Holder. This restriction only applies to the primary font name as -presented to the users. - -4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font -Software shall not be used to promote, endorse or advertise any -Modified Version, except to acknowledge the contribution(s) of the -Copyright Holder(s) and the Author(s) or with their explicit written -permission. - -5) The Font Software, modified or unmodified, in part or in whole, -must be distributed entirely under this license, and must not be -distributed under any other license. The requirement for fonts to -remain under this license does not apply to any document created -using the Font Software. - -TERMINATION -This license becomes null and void if any of the above conditions are -not met. - -DISCLAIMER -THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE -COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM -OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.eot b/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.eot deleted file mode 100644 index 59d0da2feff21..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.eot and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.svg b/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.svg deleted file mode 100644 index 864d374918c1a..0000000000000 --- a/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.svg +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.ttf b/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.ttf deleted file mode 100644 index d5a74aa443599..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.ttf and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.woff b/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.woff deleted file mode 100644 index ed785d30386af..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/marvel/marvel-400-normal-webfont.woff and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.eot b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.eot deleted file mode 100644 index e22984c807424..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.eot and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.svg b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.svg deleted file mode 100644 index 6cdfecda0803d..0000000000000 --- a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.svg +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.ttf b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.ttf deleted file mode 100644 index b081effa23ca1..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.ttf and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.woff b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.woff deleted file mode 100644 index 0cc7b8d7815bb..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-200-normal-webfont.woff and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.eot b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.eot deleted file mode 100644 index 3490416ce5062..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.eot and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.svg b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.svg deleted file mode 100644 index 83388d83b58f5..0000000000000 --- a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.svg +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.ttf b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.ttf deleted file mode 100644 index fe5d758dce70b..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.ttf and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.woff b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.woff deleted file mode 100644 index 9799be38b24ef..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-400-normal-webfont.woff and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.eot b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.eot deleted file mode 100644 index 1f11e3af0d468..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.eot and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.svg b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.svg deleted file mode 100644 index ca699f72cc446..0000000000000 --- a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.svg +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.ttf b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.ttf deleted file mode 100644 index 680103c671287..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.ttf and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.woff b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.woff deleted file mode 100644 index 56e335d010688..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-600-normal-webfont.woff and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.eot b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.eot deleted file mode 100644 index d0743324939c1..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.eot and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.svg b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.svg deleted file mode 100644 index fcd05c3683a41..0000000000000 --- a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.svg +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.ttf b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.ttf deleted file mode 100644 index bf5f60a6654b6..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.ttf and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.woff b/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.woff deleted file mode 100644 index 42ca5dc005aab..0000000000000 Binary files a/app/design/frontend/Magento/plushe/fonts/sourcesanspro/sourcesanspro-700-normal-webfont.woff and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/i18n/en_US.csv b/app/design/frontend/Magento/plushe/i18n/en_US.csv deleted file mode 100644 index 062b8524da10b..0000000000000 --- a/app/design/frontend/Magento/plushe/i18n/en_US.csv +++ /dev/null @@ -1,4 +0,0 @@ -"%1 items","%1" -"1 item","1" -"My Cart (1 item)","My Cart (1)" -"My Cart (%1 items)","My Cart (%1)" diff --git a/app/design/frontend/Magento/plushe/images/banner1.jpg b/app/design/frontend/Magento/plushe/images/banner1.jpg deleted file mode 100644 index 5f91054dab522..0000000000000 Binary files a/app/design/frontend/Magento/plushe/images/banner1.jpg and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/images/banner2.jpg b/app/design/frontend/Magento/plushe/images/banner2.jpg deleted file mode 100644 index 6d00c1a05d5b0..0000000000000 Binary files a/app/design/frontend/Magento/plushe/images/banner2.jpg and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/images/banner3.jpg b/app/design/frontend/Magento/plushe/images/banner3.jpg deleted file mode 100644 index fff706df31cc4..0000000000000 Binary files a/app/design/frontend/Magento/plushe/images/banner3.jpg and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/images/banner4.jpg b/app/design/frontend/Magento/plushe/images/banner4.jpg deleted file mode 100644 index efc84cbe21a2e..0000000000000 Binary files a/app/design/frontend/Magento/plushe/images/banner4.jpg and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/images/blog_bg.png b/app/design/frontend/Magento/plushe/images/blog_bg.png deleted file mode 100644 index f20b394d5a218..0000000000000 Binary files a/app/design/frontend/Magento/plushe/images/blog_bg.png and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/images/express-checkout-retina.png b/app/design/frontend/Magento/plushe/images/express-checkout-retina.png deleted file mode 100644 index cb7603592ef8f..0000000000000 Binary files a/app/design/frontend/Magento/plushe/images/express-checkout-retina.png and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/images/header-bg.jpg b/app/design/frontend/Magento/plushe/images/header-bg.jpg deleted file mode 100644 index 994156d1a36a2..0000000000000 Binary files a/app/design/frontend/Magento/plushe/images/header-bg.jpg and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/images/info_photo.jpg b/app/design/frontend/Magento/plushe/images/info_photo.jpg deleted file mode 100644 index dc150e4367e78..0000000000000 Binary files a/app/design/frontend/Magento/plushe/images/info_photo.jpg and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/images/loader.gif b/app/design/frontend/Magento/plushe/images/loader.gif deleted file mode 100644 index 53b5ac653eb1e..0000000000000 Binary files a/app/design/frontend/Magento/plushe/images/loader.gif and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/images/logo.gif b/app/design/frontend/Magento/plushe/images/logo.gif deleted file mode 100644 index 7f1dc1ad3c939..0000000000000 Binary files a/app/design/frontend/Magento/plushe/images/logo.gif and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/images/logo_notext.gif b/app/design/frontend/Magento/plushe/images/logo_notext.gif deleted file mode 100644 index 133a77524368f..0000000000000 Binary files a/app/design/frontend/Magento/plushe/images/logo_notext.gif and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/images/main_image1.jpg b/app/design/frontend/Magento/plushe/images/main_image1.jpg deleted file mode 100644 index 728174638d031..0000000000000 Binary files a/app/design/frontend/Magento/plushe/images/main_image1.jpg and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/images/social-links.png b/app/design/frontend/Magento/plushe/images/social-links.png deleted file mode 100644 index 66eb6c9083e3b..0000000000000 Binary files a/app/design/frontend/Magento/plushe/images/social-links.png and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/images/texture.png b/app/design/frontend/Magento/plushe/images/texture.png deleted file mode 100644 index 2b5301b01cd63..0000000000000 Binary files a/app/design/frontend/Magento/plushe/images/texture.png and /dev/null differ diff --git a/app/design/frontend/Magento/plushe/js/jquery.dropdowns.js b/app/design/frontend/Magento/plushe/js/jquery.dropdowns.js deleted file mode 100644 index 168f52bb2216b..0000000000000 --- a/app/design/frontend/Magento/plushe/js/jquery.dropdowns.js +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -;(function($, document) { - 'use strict'; - - $.fn.dropdown = function(options) { - var defaults = { - parent: null, - autoclose: true, - btnArrow: '.arrow', - menu: '[data-target="dropdown"]', - activeClass: 'active' - }; - - var options = $.extend(defaults, options); - var actionElem = $(this), - self = this; - - this.openDropdown = function(elem) { - elem - .addClass(options.activeClass) - .parent() - .addClass(options.activeClass); - - $(options.btnArrow, elem).text('▲'); - }; - - this.closeDropdown = function(elem) { - elem - .removeClass(options.activeClass) - .parent() - .removeClass(options.activeClass); - - $(options.btnArrow, elem).text('▼'); - }; - - /* Reset all dropdowns */ - this.reset = function(params) { - var params = params || {}, - dropdowns = params.elems || actionElem; - - dropdowns.each(function(index, elem) { - self.closeDropdown($(elem)); - }); - }; - - /* document Event bindings */ - if(options.autoclose === true) { - $(document).on('click.hideDropdown', this.reset); - $(document).on('keyup.hideDropdown', function(e) { - var ESC_CODE = '27'; - - if (e.keyCode == ESC_CODE) { - self.reset(); - } - }); - }; - - if (options.events) { - $.each(options.events, function(index, event) { - $(document).on(event.name, event.selector, event.action); - }); - } - - return this.each(function() { - var elem = $(this), - parent = $(options.parent) || elem.parent(), - menu = $(options.menu, parent) || $('.dropdown-menu', parent); - - elem.off('click.toggleDropdown'); - menu.off('click.preventMenuClosing'); - elem.on('click.toggleDropdown', function() { - if(options.autoclose === true) { - self.reset({elems: actionElem.not(elem)}); - }; - self[elem.hasClass('active') ? 'closeDropdown' : 'openDropdown'](elem); - - return false; - }); - - menu.on('click.preventMenuClosing', function(e) { - e.stopPropagation(); - }); - }); - }; - - $(document).ready(function() { - $('[data-toggle="dropdown"]').dropdown(); - }); -})(window.jQuery, document); \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/js/navigation-menu.js b/app/design/frontend/Magento/plushe/js/navigation-menu.js deleted file mode 100644 index 7debbcdda2255..0000000000000 --- a/app/design/frontend/Magento/plushe/js/navigation-menu.js +++ /dev/null @@ -1,557 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -/*jshint jquery:true*/ - -(function($) { - 'use strict'; - - $.widget('mage.navigationMenu', { - options: { - itemsContainer: '> ul', - topLevel: 'li.level0', - topLevelSubmenu: '> .submenu', - topLevelHoverClass: 'hover', - expandedTopLevel: '.more', - hoverInTimeout: 300, - hoverOutTimeout: 500, - submenuAnimationSpeed: 200, - collapsable: true, - collapsableDropdownTemplate: - '' - }, - - _create: function() { - this.itemsContainer = $(this.options.itemsContainer, this.element); - this.topLevel = $(this.options.topLevel, this.element); - this.topLevelSubmenu = $(this.options.topLevelSubmenu, this.topLevel); - - this._bind(); - }, - - _init: function() { - if (this.options.collapsable) { - setTimeout($.proxy(function() { - this._checkToCollapseOrExpand(); - }, this), 100); - } - }, - - _bind: function() { - this._on({ - 'mouseenter > ul > li.level0': function(e) { - if (!this.entered) { // fix IE bug with 'mouseenter' event - this.timeoutId && clearTimeout(this.timeoutId); - this.timeoutId = setTimeout($.proxy(function() { - this._openSubmenu(e); - }, this), this.options.hoverInTimeout); - this.entered = true; - } - }, - 'mouseleave > ul > li.level0': function(e) { - this.entered = null; - - this.timeoutId && clearTimeout(this.timeoutId); - this.timeoutId = setTimeout($.proxy(function() { - this._closeSubmenu(e.currentTarget); - }, this), this.options.hoverOutTimeout); - }, - 'click': function(e) { - e.stopPropagation(); - } - }); - - $(document) - .on('click.hideMenu', $.proxy(function(e) { - var isOpened = this.topLevel.filter(function() { - return $(this).data('opened'); - }); - - if (isOpened) { - this._closeSubmenu(null, false); - } - }, this)); - - $(window) - .on('resize', $.proxy(function() { - this.timeoutOnResize && clearTimeout(this.timeoutOnResize); - this.timeoutOnResize = setTimeout($.proxy(function() { - if (this.options.collapsable) { - if ($(this.options.expandedTopLevel, this.element).length) { - this._expandMenu(); - } - this._checkToCollapseOrExpand(); - } - }, this), 300); - }, this)); - }, - - _openSubmenu: function(e) { - var menuItem = e.currentTarget; - - if (!$(menuItem).data('opened')) { - this._closeSubmenu(menuItem, true, true); - - $(this.options.topLevelSubmenu, menuItem) - .slideDown(this.options.submenuAnimationSpeed, $.proxy(function() { - $(menuItem).addClass(this.options.topLevelHoverClass); - $(menuItem).data('opened', true); - }, this)); - } else if ($(e.target).closest(this.options.topLevel)) { - $(e.target) - .addClass(this.options.topLevelHoverClass) - .siblings(this.options.topLevel) - .removeClass(this.options.topLevelHoverClass); - } - }, - - _closeSubmenu: function(menuItem, excludeCurrent, fast) { - var topLevel = $(this.options.topLevel, this.element), - activeSubmenu = $(this.options.topLevelSubmenu, menuItem || null); - - $(this.options.topLevelSubmenu, topLevel) - .filter(function() { - return excludeCurrent ? $(this).not(activeSubmenu) : true; - }) - .slideUp(fast ? 0 : this.options.submenuAnimationSpeed); - - topLevel - .removeClass(this.options.topLevelHoverClass) - .data('opened', false); - }, - - _checkToCollapseOrExpand: function() { - if ($("html").hasClass("lt-640") || $("html").hasClass("w-640")) { - return; - } - - var navWidth = this.itemsContainer.width(), - totalWidth = 0, - startCollapseIndex = 0; - - $.each($(this.options.topLevel, this.element), function(index, item) { - totalWidth = totalWidth + $(item).outerWidth(true); - - if (totalWidth > navWidth && !startCollapseIndex) { - startCollapseIndex = index - 2; - } - }); - - this[startCollapseIndex ? '_collapseMenu' : '_expandMenu'](startCollapseIndex); - }, - - _collapseMenu: function(startCollapseIndex) { - this.elemsToCollapse = this.topLevel.filter(function(index) { - return index > startCollapseIndex; - }); - this.elemsToCollapseClone = $('
').append(this.elemsToCollapse.clone()).html(); - - this.collapsableDropdown = $(this.options.collapsableDropdownTemplate).tmpl({elems: this.elemsToCollapseClone}); - - this.itemsContainer - .append(this.collapsableDropdown); - - this.elemsToCollapse.detach(); - }, - - _expandMenu: function() { - if ($.browser.version != 8.0) { - this.elemsToCollapse && this.elemsToCollapse.appendTo(this.itemsContainer); - this.collapsableDropdown && this.collapsableDropdown.remove(); - } else { - setTimeout($.proxy(function() { - var moreWrapper = $('.more', this.element); - - if (moreWrapper.length > 1) { - moreWrapper.eq(moreWrapper.length - 1).remove(); - } - }, this), 1); - } - }, - - _destroy: function() { - this._expandMenu(); - } - }); - - /* - * Provides "Continium" effect for submenu - * */ - $.widget('mage.navigationMenu', $.mage.navigationMenu, { - options: { - parentLevel: '> ul > li.level0', - submenuAnimationSpeed: 150, - submenuContiniumEffect: false - }, - - _init: function() { - this._super(); - this._applySubmenuStyles(); - }, - - _applySubmenuStyles: function() { - $(this.options.topLevelSubmenu, $(this.options.topLevel, this.element)) - .removeAttr('style'); - - $(this.options.topLevelSubmenu, $(this.options.parentLevel, this.element)) - .css({ - display: 'block', - height: 0, - overflow: 'hidden' - }); - }, - - _openSubmenu: function(e) { - var menuItem = e.currentTarget, - submenu = $(this.options.topLevelSubmenu, menuItem), - openedItems = $(this.options.topLevel, this.element).filter(function() { - return $(this).data('opened'); - }); - - if (submenu.length) { - this.heightToAnimate = $(this.options.itemsContainer, submenu).outerHeight(true); - - if (openedItems.length) { - this._closeSubmenu(menuItem, true, this.heightToAnimate, $.proxy(function() { - submenu.css({ - height: 'auto' - }); - $(menuItem) - .addClass(this.options.topLevelHoverClass); - }, this), e); - } else { - submenu.animate({ - height: this.heightToAnimate - }, this.options.submenuAnimationSpeed, $.proxy(function() { - $(menuItem) - .addClass(this.options.topLevelHoverClass); - }, this)); - } - - $(menuItem) - .data('opened', true); - } else { - this._closeSubmenu(menuItem); - } - }, - - _closeSubmenu: function(menuItem, excludeCurrent, heightToAnimate, callback, e) { - var topLevel = $(this.options.topLevel, this.itemsContainer), - expandedTopLevel = e && $(e.target).closest(this.options.expandedTopLevel); - - if (!excludeCurrent) { - $(this.options.topLevelSubmenu, $(this.options.parentLevel, this.element)) - .animate({ - height: 0 - }); - - topLevel - .data('opened', false) - .removeClass(this.options.topLevelHoverClass); - } else { - var prevOpenedItem = topLevel.filter(function() { - return $(this).data('opened'); - }), - prevOpenedSubmenu = $(this.options.topLevelSubmenu, prevOpenedItem); - - prevOpenedSubmenu.animate({ - height: heightToAnimate - }, this.options.submenuAnimationSpeed, 'linear', function() { - $(this).css({ - height: 0 - }); - callback && callback(); - }); - - prevOpenedItem - .data('opened', false) - .removeClass(this.options.topLevelHoverClass); - } - }, - - _collapseMenu: function() { - this._superApply(arguments); - this._applySubmenuStyles(); - } - }); - - // Responsive menu - $.widget('mage.navigationMenu', $.mage.navigationMenu, { - options: { - responsive: false, - origNavPlaceholder: '.page.header', - mainContainer: 'body', - pageWrapper: '.page.wrapper', - openedMenuClass: 'opened', - toggleActionPlaceholder: '.block.search', - itemWithSubmenu: 'li.parent', - titleWithSubmenu: 'li.parent > a', - submenu: 'li.parent > .submenu', - toggleActionTemplate: - '', - submenuActionsTemplate: - '' - }, - - _init: function() { - this._super(); - - this.mainContainer = $(this.options.mainContainer); - this.pageWrapper = $(this.options.pageWrapper); - this.toggleAction = $(this.options.toggleActionTemplate).tmpl({}); - - if (this.options.responsive) { - mediaCheck({ - media: '(max-width: 640px)', - entry: $.proxy(function() { - this._toggleMobileMode(); - }, this), - exit: $.proxy(function() { - this._toggleDesktopMode(); - }, this) - }); - } - }, - - _bind: function() { - this._super(); - this._bindDocumentEvents(); - }, - - _bindDocumentEvents: function() { - if (!this.eventsBound) { - $(document) - .on('click.toggleMenu', '.action.toggle.nav', $.proxy(function(e) { - if ($(this.element).data('opened')) { - this._hideMenu(); - } else { - this._showMenu(); - } - e.stopPropagation(); - this.mobileNav.scrollTop(0); - this._fixedBackLink(); - }, this)) - .on('click.hideMenu', this.options.pageWrapper, $.proxy(function() { - if ($(this.element).data('opened')) { - this._hideMenu(); - this.mobileNav.scrollTop(0); - this._fixedBackLink(); - } - }, this)) - .on('click.showSubmenu', this.options.titleWithSubmenu, $.proxy(function(e) { - this._showSubmenu(e); - - e.preventDefault(); - this.mobileNav.scrollTop(0); - this._fixedBackLink(); - }, this)) - .on('click.hideSubmenu', '.action.back', $.proxy(function(e) { - this._hideSubmenu(e); - this.mobileNav.scrollTop(0); - this._fixedBackLink(); - }, this)); - - this.eventsBound = true; - } - }, - - _showMenu: function() { - $(this.element).data('opened', true); - this.mainContainer.add( "html" ).addClass(this.options.openedMenuClass); - }, - - _hideMenu: function() { - $(this.element).data('opened', false); - this.mainContainer.add( "html" ).removeClass(this.options.openedMenuClass); - }, - - _showSubmenu: function(e) { - var submenu = $(e.currentTarget).siblings('.submenu'); - - submenu - .addClass('opened') - .closest('.navigation > ul') - .css({ - height: submenu.outerHeight(true) - }); - }, - - _hideSubmenu: function(e) { - var submenuSelector = '.submenu', - submenu = $(e.currentTarget).closest(submenuSelector); - - submenu.removeClass('opened'); - - if (!$('.submenu.opened').length) { - submenu - .closest('.navigation > ul') - .removeAttr('style'); - } else { - submenu - .closest('.navigation > ul') - .css({ - height: submenu.closest('.submenu.opened').outerHeight(true) - }); - } - }, - - _renderSubmenuActions: function() { - $.each($(this.options.itemWithSubmenu), $.proxy(function(index, item) { - var actions = $(this.options.submenuActionsTemplate).tmpl({ - category: $('> a > span', item).text(), - categoryURL: $('> a', item).attr('href') - }), - submenu = $('> .submenu', item), - items = $('> ul', submenu); - - items.prepend(actions); - -// submenu -// .css({ -// height: $(window).outerHeight(true) - 1 -// }); - }, this)); - }, - - _toggleMobileMode: function() { - this._expandMenu(); - - $(this.options.topLevelSubmenu, $(this.options.topLevel, this.element)) - .removeAttr('style'); - - this.toggleAction.insertBefore(this.options.toggleActionPlaceholder); - this.mobileNav = $(this.element).detach().clone(); - this.mainContainer.prepend(this.mobileNav); - this.mobileNav.find('> ul').addClass('nav'); - this._insertExtraItems(); - this.mobileNav.scroll($.proxy( - function() { - this._fixedBackLink(); - }, this - )); - - this._renderSubmenuActions(); - this._bindDocumentEvents(); - }, - - _toggleDesktopMode: function() { - this.mobileNav && this.mobileNav.remove(); - this.toggleAction.detach(); - $(this.element).insertAfter(this.options.origNavPlaceholder); - - $(document) - .off('click.toggleMenu', '.action.toggle.nav') - .off('click.hideMenu', this.options.pageWrapper) - .off('click.showSubmenu', this.options.titleWithSubmenu) - .off('click.hideSubmenu', '.action.back'); - - this.eventsBound = false; - - this._applySubmenuStyles(); - }, - - _insertExtraItems: function() { - if ($('.header > .panel .switcher').length) { - var settings = $('.header > .panel') - .clone() - .addClass('settings'); - - this.mobileNav.prepend(settings); - - settings.wrapInner('
'); - settings.prepend('
Settings
'); - - settings.find('> .title') - .dropdown({ - autoclose: false, - menu: '> .content' - }); - - settings.find('.switcher.language .options > strong') - .dropdown({ - autoclose: false, - menu: '.switcher.language .options > ul' - }); - - settings.find('.switcher.currency .options > strong') - .dropdown({ - autoclose: false, - menu: '.switcher.currency .options > ul' - }); - } - - if ($('.header > .content > .links li').length) { - var account = $('.header > .content > .links') - .clone() - .addClass('account'); - - this.mobileNav.prepend(account); - - account.find('.customer.welcome > .customer') - .dropdown({ - autoclose: false, - menu: '.customer.welcome > .menu' - }); - } - }, - - _fixedBackLink: function() { - var linksBack = this.mobileNav.find('.submenu .action.back'); - var linkBack = this.mobileNav.find('.submenu.opened > ul > .action.back').last(); - - linksBack.removeClass('fixed'); - - if(linkBack.length) { - var subMenu = linkBack.parent(), - navOffset = this.mobileNav.find('.nav').position().top, - linkBackHeight = linkBack.height(); - - if (navOffset <= 0) { - linkBack.addClass('fixed'); - subMenu.css({ - paddingTop: linkBackHeight - }) - } else { - linkBack.removeClass('fixed'); - subMenu.css({ - paddingTop: 0 - }) - } - } - } - }); -})(window.jQuery); \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/js/responsive.js b/app/design/frontend/Magento/plushe/js/responsive.js deleted file mode 100644 index 2628c64764603..0000000000000 --- a/app/design/frontend/Magento/plushe/js/responsive.js +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ - -; -(function($) { - 'use strict'; - - $(document).ready(function(){ - mediaCheck({ - media: '(max-width: 640px)', - - // Switch to Mobile Version - entry: function() { - // minicart - $('.action.showcart').addClass('is-disabled'); - - $('.action.showcart').on( "click", function() { - if ($(this).hasClass('is-disabled')) { - window.location = $(this).attr("href"); - } - }); - - $('.action.toggle.checkout.progress') - .on('click.gotoCheckoutProgress', function(e){ - var myWrapper = '#checkout-progress-wrapper'; - scrollTo(myWrapper + ' .title'); - $(myWrapper + ' .title').addClass('active'); - $(myWrapper + ' .content').show(); - }); - - $('body') - .on('click.checkoutProgress', '#checkout-progress-wrapper .title', function(e){ - $(this).toggleClass('active'); - $('#checkout-progress-wrapper .content').toggle(); - }); - - (function() { - var productInfoMain = $('.product.info.main'), - productInfoAdditional = $("#product-info-additional"); - - if (!productInfoAdditional.length) { - - var productTitle = productInfoMain.find(".page.title.product").clone(), - productStock = productInfoMain.find(".stock:not(.alert)").clone(); - - productInfoAdditional = $("
", { - id: "product-info-additional", - addClass: "product info additional" - }); - - $('.catalog-product-view .column.main') - .prepend(productInfoAdditional); - - productInfoAdditional - .append(productTitle) - .append(productStock); - - } else { - productInfoAdditional.removeClass("hidden"); - } - - productInfoMain.addClass("responsive"); - - })(); - var galleryElement = $('[data-role=media-gallery]'); - setTimeout(function(){ - if (galleryElement.length && galleryElement.data('zoom')) { - galleryElement.zoom('disable'); - } - if (galleryElement.length && galleryElement.data('gallery')) { - galleryElement.gallery("option","disableLinks",false); - } - if (galleryElement.length && galleryElement.data('galleryFullScreen')) { - galleryElement.galleryFullScreen('disable'); - } - }, 2000); - - }, - - // Switch to Desktop Version - exit: function() { - // minicart - $('.action.showcart').removeClass('is-disabled'); - - (function() { - - var productInfoMain = $('.product.info.main'), - productInfoAdditional = $("#product-info-additional"); - - if(productInfoAdditional.length) { - productInfoAdditional.addClass("hidden"); - productInfoMain.removeClass("responsive"); - } - - })(); - - var galleryElement = $('[data-role=media-gallery]'); - if (galleryElement.length && galleryElement.data('zoom')) { - galleryElement.zoom('enable'); - } - if (galleryElement.length && galleryElement.data('gallery')) { - galleryElement.gallery("option","disableLinks",true); - } - if (galleryElement.length && galleryElement.data('galleryFullScreen')) { - galleryElement.galleryFullScreen('enable'); - } - } - }); - }); -})(window.jQuery); diff --git a/app/design/frontend/Magento/plushe/js/sticky.js b/app/design/frontend/Magento/plushe/js/sticky.js deleted file mode 100644 index 64000be11e584..0000000000000 --- a/app/design/frontend/Magento/plushe/js/sticky.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -/*jshint browser:true jquery:true*/ -(function($, window) { - $.widget('mage.sticky', { - options: { - container: '' - }, - - /** - * Bind handlers to scroll event - * @private - */ - _create: function() { - $(window).on('scroll', $.proxy(this._setTop, this)); - }, - - /** - * float Block on windowScroll - * @private - */ - _setTop: function() { - if ((this.element).is(':visible')) { - var startOffset = this.element.parent().offset().top + parseInt(this.element.css("margin-top")), - currentOffset = $(document).scrollTop(), - parentHeight = $(this.options.container).height() - parseInt(this.element.css("margin-top")), - discrepancyOffset = currentOffset - startOffset; - - if (discrepancyOffset >= 0) { - if (discrepancyOffset + this.element.innerHeight() < parentHeight) { - this.element.css('top', discrepancyOffset); - } - } else { - this.element.css('top', 0); - } - } - } - }); -})(jQuery, window); diff --git a/app/design/frontend/Magento/plushe/js/tabs.js b/app/design/frontend/Magento/plushe/js/tabs.js deleted file mode 100644 index 4deecc66b1501..0000000000000 --- a/app/design/frontend/Magento/plushe/js/tabs.js +++ /dev/null @@ -1,169 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -; -(function($) { - 'use strict'; - - $.fn.terms = function(args){ - - // default - var defaults = { - start:0, - wrapper:'', - showAnchor:'', - effects:'slide' - }; - - var options = $.extend(defaults, args); - - this.each(function() { - var obj = $(this), - wrapper = (options.wrapper !== '') ? '> ' + options.wrapper : '', - switches = $(wrapper + '> [data-section="title"] > [data-toggle="switch"]',obj), - terms = $(wrapper + '> [data-section="content"]',obj), - t = switches.length, - marginTop = $(switches[0]).closest('[data-section="title"]').css('position') == 'absolute' ? 0 : null, - title, - current, - - init = function() { - if (t > 0) { - if($(switches[0]).closest('[data-section="title"]').css('display')=='table-cell') { - obj.addClass('adjusted'); - var linksList; - if (obj[0].tagName=='DL') { - linksList = jQuery('
'); - } else { - linksList = jQuery('
'); - } - linksList.addClass('sections-nav'); - obj.prepend(linksList); - - for (var i=0; i < t; i++) { - title = $(switches[i]).html(); - var classes = $(switches[i]).closest('[data-section="title"]').attr('class'); - var dataSection = $(switches[i]).closest('[data-section="title"]').attr('data-section'); - var itemHref = $(switches[i]).attr('href'); - var itemClass = $(switches[i]).attr('class'); - $(switches[i]).parent('[data-section="title"]').hide(); - switches[i] = jQuery('',{ - href: itemHref, - 'class' : itemClass, - html: title - }).appendTo(linksList); - $(switches[i]).wrap(''); - } - } - $(switches).each(function(ind,el){ - $(el).click(function(event){ - event.preventDefault(); - showItem(ind); - }); - if (marginTop !== null) { - $(el).closest('[data-section="title"]').css({'top' : marginTop + 'px'}); - marginTop = marginTop + $(el).closest('[data-section="title"]').outerHeight(true); - obj.css({'min-height' : marginTop + 'px' }); - } - }); - - var fromUrl = false; - if (window.location.hash.length > 0) { - $(terms).each(function(ind,el) { - if ( '#info-'+$(el).attr('id') == window.location.hash) { - showItem(ind); - $('html, body').animate({ - scrollTop: $(switches[ind]).offset().top - }, 700); - fromUrl = true; - } - }); - } - if (fromUrl === false) { - if ( options.start % 1 === 0 ) { - current = options.start + 1; - showItem(options.start); - } else { - $(terms).each(function(ind,el) { - if ( $(el).attr('id') == options.start) { - current = ind + 1; - showItem(ind); - $('html, body').animate({ - scrollTop: $(switches[ind]).offset().top - }, 700); - } - }); - } - } - } - }, - - - showItem = function(item) { - if (item != current && !$(switches[item]).closest('[data-section="title"]').hasClass('disabled') ) { - $(switches).closest('[data-section="title"]').removeClass('active'); - if (options.wrapper !== '') { - $(switches).parent().parent().removeClass('active'); - } - $(terms).removeClass('active'); - $(switches[item]).closest('[data-section="title"]').addClass('active'); - if (options.wrapper !== '') { - $(switches[current]).parent().parent().addClass('active'); - } - $(terms[item]).addClass('active'); - - /*if ($(terms[item]).attr('id')) { - scr = document.body.scrollTop; - window.location.hash='#tab-' + $(terms[item]).attr('id'); - document.body.scrollTop = scr; - }*/ - current = item; - } else if ( - // Check if this is accordion width as criteria for now - (obj.attr('data-sections') == 'accordion' - || $(switches[item]).closest('[data-section="title"]').css('width') == obj.css('width') - ) - && item == current && !$(switches[item]).closest('[data-section="title"]').hasClass('disabled') - ) { - $(switches).closest('[data-section="title"]').removeClass('active'); - if (options.wrapper !== '') { - $(switches).parent().parent().removeClass('active'); - } - $(terms).removeClass('active'); - current = -1; - } - }, - - applyEffect = function(item, effect) { - }; - - init(); - }); - }; - $(document).ready(function() { - $('[data-sections]').terms(); - }); - -})(window.jQuery); - - - diff --git a/app/design/frontend/Magento/plushe/js/theme.js b/app/design/frontend/Magento/plushe/js/theme.js deleted file mode 100644 index a56c6586f05bd..0000000000000 --- a/app/design/frontend/Magento/plushe/js/theme.js +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ - -; -(function($) { - 'use strict'; - - function listScroll() { - var list = $('[data-action="scroll"]').addClass('carousel'); - var listInner = $('> .minilist.items', list); - var items = $('.item', list); - var itemWidth = $(items).length ? $(items[0]).outerWidth() : null; - var perpage = (itemWidth !== null) ? Math.floor(list.outerWidth()/itemWidth) : null; - var pages = (perpage !== null) ? Math.floor(items.length/perpage) : null; - var page=0; - for (var i=0 ; i < perpage; i++) { - $(items[i + page*perpage]).addClass('shown'); - }; - for (var i=perpage; i < items.length; i++) { - $(items[i + page*perpage]).addClass('hidden'); - }; - if ( itemWidth*items.length > list.outerWidth() ) { - var next = $(''); - var previous = $('').attr('disabled', 'disabled'); - list.append(previous); - list.append(next); - listInner.wrap('
'); - $('.items-wrapper').css('width', itemWidth*perpage); - next.on('click.itemsScroll', function() { - list.addClass('animation'); - items.removeClass('shown'); - items.removeClass('hidden'); - listInner.animate({ - left: '-=' + itemWidth*perpage, - }, 400, 'easeInOutCubic', function() { - // Animation complete. - page = page + 1; - for (var i=0 ; i < perpage; i++) { - $(items[i + page*perpage]).addClass('shown'); - }; - for (var i=perpage; i < items.length; i++) { - $(items[i + page*perpage]).addClass('hidden'); - }; - if (window.console) { - console.log(i); - } - previous.removeAttr('disabled'); - if (page == pages) { - next.attr('disabled', 'disabled'); - } - list.removeClass('animation'); - }); - }); - previous.on('click.itemsScroll', function() { - list.addClass('animation'); - items.removeClass('shown'); - items.removeClass('hidden'); - listInner.animate({ - left: '+=' + itemWidth*perpage, - }, 400, 'easeInOutCubic', function() { - // Animation complete. - page = page - 1; - for (var i=0 ; i < perpage; i++) { - $(items[i + page*perpage]).addClass('shown'); - }; - for (var i=perpage; i < items.length; i++) { - $(items[i + page*perpage]).addClass('hidden'); - }; - next.removeAttr('disabled'); - if (page == 0) { - previous.attr('disabled', 'disabled'); - } - list.removeClass('animation'); - }); - }); - - } - } - - $(document).ready(function() { - listScroll(); - - if ($('body').hasClass('checkout-cart-index')) { - $('.cart.summary > .block > .title').dropdown({autoclose:false, menu:'.title + .content'}); - if ($('#co-shipping-method-form .fieldset.rates').length > 0 && $('#co-shipping-method-form .fieldset.rates :checked').length === 0 ) { - $('.block.shipping > .title').addClass('active'); - $('.block.shipping').addClass('active'); - } - } - - if ($('[role="navigation"]').length) { - $('[role="navigation"]').navigationMenu({ - responsive: true, - submenuContiniumEffect: true - }); - } else { - $('').navigationMenu({ - responsive: true, - submenuContiniumEffect: true - }); - } - - }); - -})(window.jQuery); \ No newline at end of file diff --git a/app/design/frontend/Magento/plushe/mage/gallery.css b/app/design/frontend/Magento/plushe/mage/gallery.css deleted file mode 100644 index 225705dc644ed..0000000000000 --- a/app/design/frontend/Magento/plushe/mage/gallery.css +++ /dev/null @@ -1,223 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Mage - * @package js - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -@font-face { - font-family: 'icons-blank-theme'; - src: url('../fonts/Blank-Theme-Icons/Blank-Theme-Icons.eot'); - src: url('../fonts/Blank-Theme-Icons/Blank-Theme-Icons.eot?#iefix') format('embedded-opentype'), url('../fonts/Blank-Theme-Icons/Blank-Theme-Icons.woff') format('woff'), url('../fonts/Blank-Theme-Icons/Blank-Theme-Icons.ttf') format('truetype'), url('../fonts/Blank-Theme-Icons/Blank-Theme-Icons.svg#icons-blank-theme') format('svg'); - font-weight: normal; - font-style: normal; -} -.loading-mask { - position: relative; - z-index: 9999; -} -.loading-mask:before { - content: ''; - position: absolute; - left: 0; - top: 0; - right: 0; - bottom: 0; - background-color: rgba(204, 204, 204, 0.5); - background-image: url('../images/loader-1.gif'); - background-position: 50% 50%; - background-repeat: no-repeat; -} -.loading-mask .loader > p { - display: none; -} -.ui-widget-overlay { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - background: rgba(204, 204, 204, 0.5); -} -.zoom.lense { - position: absolute; - z-index: 9999; - overflow: hidden; - background: #ffffff; - outline: 1px solid #d1d1d1; -} -.zoom.lightbox { - position: fixed; - height: auto !important; - width: auto !important; - left: 20px !important; - top: 20px !important; - right: 20px; - bottom: 20px; - border: 1px solid #d1d1d1; - background-color: #ffffff; - -webkit-box-shadow: 0 5px 5px rgba(0, 0, 0, 0.2); - -moz-box-shadow: 0 5px 5px rgba(0, 0, 0, 0.2); - box-shadow: 0 5px 5px rgba(0, 0, 0, 0.2); -} -.zoom.lightbox .img.photo.container img { - position: absolute; - max-width: 100%; - max-height: 100%; - margin: auto; - left: 0 !important; - right: 0 !important; - top: 0 !important; - bottom: 0 !important; - display: block; -} -.zoom.lightbox .ui-dialog-titlebar-close:before { - background-image: url('../images/sprite-gallery.png'); -} -.zoom.lightbox .ui-dialog-titlebar-close { - position: absolute; - line-height: 1; - top: 20px; - right: 20px; - display: inline-block; -} -.zoom.lightbox .ui-dialog-titlebar-close > span { - position: absolute; - width: 1px; - height: 1px; - margin: -1px; - padding: 0; - overflow: hidden; - clip: rect(0, 0, 0, 0); - border: 0; -} -.zoom.lightbox .ui-dialog-titlebar-close:before { - content: ''; - display: inline-block; - width: 13px; - height: 13px; - line-height: 13px; - vertical-align: middle; - background-image: url('../images/sprite-gallery.svg'); - background-position: -60px 0; - background-repeat: no-repeat; - margin: 0; -} -.zoom.lightbox .gallery.control.prev:before, -.zoom.lightbox .gallery.control.next:before { - background-image: url('../images/sprite-gallery.png'); -} -.zoom.lightbox .gallery.control.prev, -.zoom.lightbox .gallery.control.next { - position: absolute; - top: 50%; - margin-top: -57px; - display: inline-block; -} -.zoom.lightbox .gallery.control.prev:before, -.zoom.lightbox .gallery.control.next:before { - content: ''; - display: inline-block; - width: 29px; - height: 57px; - line-height: 57px; - vertical-align: middle; - background-image: url('../images/sprite-gallery.svg'); - background-position: 0 0; - background-repeat: no-repeat; - margin: 0; -} -.zoom.lightbox .gallery.control.prev { - left: 20px; -} -.zoom.lightbox .gallery.control.next { - right: 20px; -} -.zoom.lightbox .gallery.control.next:before { - background-position: -30px 0px; -} -.zoom.lightbox .product.photo.main { - position: absolute; - top: 33px; - left: 49px; - right: 49px; - bottom: 130px; - margin: 0 20px 72px 20px; -} -.zoom.lightbox .product.photo.main:before { - content: ""; - position: absolute; - top: 0; - right: 0; - left: 0; - bottom: 0; - z-index: 1; -} -.zoom.lense .zoom.inner > img { - position: absolute; -} -.zoom.lightbox .product.photo.thumbs { - width: 100%; - padding: 15px 15px 15px 15px; - background: #ffffff; - position: absolute; - bottom: 0; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - -ms-box-sizing: border-box; - box-sizing: border-box; -} -.zoom.lightbox .product.photo.thumbs ul { - margin: 0; - padding: 0; - list-style-type: none; - list-style-image: none; - white-space: nowrap; - position: relative; - vertical-align: top; - overflow: auto; -} -.zoom.lightbox .product.photo.thumbs .item.thumb { - display: inline-block; - margin: 0 0 0 20px; - line-height: 1; -} -.zoom.lightbox .product.photo.thumbs li:first-child { - margin-left: 0; -} -.zoom.lightbox .product.photo.thumbs a { - border: 1px solid transparent; - display: block; - outline: none; -} -.zoom.lightbox .product.photo.thumbs .active { - border-color: #ff5f10; -} -.zoom.lightbox .product.photo.thumbs .item.thumb img { - border: none; - position: static; -} -.zoom.lightbox .gallery.control { - -webkit-touch-callout: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} diff --git a/app/design/frontend/Magento/plushe/media/preview.jpg b/app/design/frontend/Magento/plushe/media/preview.jpg index c15840788eda9..9352afc4f89f9 100644 Binary files a/app/design/frontend/Magento/plushe/media/preview.jpg and b/app/design/frontend/Magento/plushe/media/preview.jpg differ diff --git a/app/design/frontend/Magento/plushe/theme.xml b/app/design/frontend/Magento/plushe/theme.xml index d4b9fe5dc8085..ed8f817e911f0 100644 --- a/app/design/frontend/Magento/plushe/theme.xml +++ b/app/design/frontend/Magento/plushe/theme.xml @@ -26,7 +26,8 @@ --> Magento Plushe - 1.0.0.0 + 2.0.0.0 + Magento/blank media/preview.jpg diff --git a/app/design/frontend/Magento/plushe/view.xml b/app/design/frontend/Magento/plushe/view.xml deleted file mode 100644 index e890597439efc..0000000000000 --- a/app/design/frontend/Magento/plushe/view.xml +++ /dev/null @@ -1,298 +0,0 @@ - - - - - 100 - 275 - 48 - - 166 - 370 - - 0 - - small_image - 285 - 1 - 285 - - image - 285 - 1 - 285 - - small_image - 180 - 1 - 230 - - small_image - 180 - 1 - 230 - - small_image - 140 - 1 - 140 - - small_image - 140 - 1 - 140 - - small_image - 140 - 1 - 140 - - image - 400 - 1 - 495 - - image - 400 - 1 - 495 - - thumbnail - 90 - 1 - 90 - - thumbnail - 50 - 1 - 50 - - small_image - 166 - 1 - 166 - - small_image - 166 - 1 - 166 - - thumbnail - 50 - 1 - 50 - - small_image - 50 - 1 - 50 - - thumbnail - 76 - 1 - 76 - - small_image - 76 - 1 - 76 - - thumbnail - 140 - 1 - 140 - - small_image - 135 - 1 - 135 - - small_image - 166 - 1 - 166 - - small_image - 135 - 1 - 135 - - small_image - 166 - 1 - 166 - - small_image - 113 - 1 - 113 - - small_image - 113 - 1 - 113 - - thumbnail - 50 - 1 - 50 - - small_image - 135 - 1 - 135 - - small_image - 100 - 1 - 100 - - thumbnail - 140 - 1 - 140 - - thumbnail - 75 - 1 - 75 - - small_image - 75 - 1 - 75 - - thumbnail - 78 - 1 - 78 - - small_image - 78 - 1 - 78 - - thumbnail - 80 - 1 - 80 - - small_image - 76 - 1 - 76 - - - 58 - - - "marvel" - #837d75 - - #d6d7d2 - header-bg.jpg - repeat - - #f8f8f8 - #c2c2c2 - #675f55 - #f47a1f - - #837d75 - #675f55 - #ffffff - #e5e5e5 - #ffffff - #675f55 - #c2c2c2 - - #ffffff - - no-repeat - - #f8f8f8 - #c2c2c2 - #e5e5e5 - #c2c2c2 - - #c2c2c2 - #999999 - #e5e5e5 - #f8f8f8 - #c2c2c2 - - #675f55 - #e5e5e5 - #999999 - - #f47a1f - #ffffff - #ff953b - #c2c2c2 - #999999 - #837d75 - - #55c2e6 - #f8f8f8 - #e5e5e5 - #675f55 - - #675f55 - #ffffff - #c2c2c2 - #ffffff - #000000 - #c2c2c2 - - #ff3200 - #ffffff - #d3edd5 - #ffffff - #ffedb8 - #ffffff - - "marvel", Arial, sans-serif - #675f55 - "sourcesanspro", Arial, sans-serif - #675f55 - "sourcesanspro", Arial, sans-serif - #675f55 - - "sourcesanspro", Arial, sans-serif - #675f55 - - "sourcesanspro", Arial, sans-serif - #ffffff - - #675f55 - #f47a1f - #f47a1f - #675f55 - #675f55 - #c2c2c2 - - diff --git a/dev/tests/integration/framework/Magento/TestFramework/Event/PhpUnit.php b/dev/tests/integration/framework/Magento/TestFramework/Event/PhpUnit.php index c3522e3850ad4..847b399c018b1 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Event/PhpUnit.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Event/PhpUnit.php @@ -69,13 +69,7 @@ public function __construct(\Magento\TestFramework\EventManager $eventManager = } /** - * An error occurred. - * Method is required by implemented interface, but is not needed by the class. - * - * @param \PHPUnit_Framework_Test $test - * @param \Exception $e - * @param float $time - * + * {@inheritdoc} * @SuppressWarnings(PHPMD.ShortVariable) * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -84,13 +78,7 @@ public function addError(\PHPUnit_Framework_Test $test, \Exception $e, $time) } /** - * A failure occurred. - * Method is required by implemented interface, but is not needed by the class. - * - * @param \PHPUnit_Framework_Test $test - * @param \PHPUnit_Framework_AssertionFailedError $e - * @param float $time - * + * {@inheritdoc} * @SuppressWarnings(PHPMD.ShortVariable) * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -99,13 +87,7 @@ public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_Ass } /** - * Incomplete test. - * Method is required by implemented interface, but is not needed by the class. - * - * @param \PHPUnit_Framework_Test $test - * @param \Exception $e - * @param float $time - * + * {@inheritdoc} * @SuppressWarnings(PHPMD.ShortVariable) * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -114,14 +96,16 @@ public function addIncompleteTest(\PHPUnit_Framework_Test $test, \Exception $e, } /** - * Skipped test. - * Method is required by implemented interface, but is not needed by the class. - * - * @param \PHPUnit_Framework_Test $test - * @param \Exception $e - * @param float $time - * @since Method available since Release 3.0.0 - * + * {@inheritdoc} + * @SuppressWarnings(PHPMD.ShortVariable) + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function addRiskyTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) + { + } + + /** + * {@inheritdoc} * @SuppressWarnings(PHPMD.ShortVariable) * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -130,10 +114,7 @@ public function addSkippedTest(\PHPUnit_Framework_Test $test, \Exception $e, $ti } /** - * A test suite started. - * - * @param \PHPUnit_Framework_TestSuite $suite - * @since Method available since Release 2.2.0 + * {@inheritdoc} */ public function startTestSuite(\PHPUnit_Framework_TestSuite $suite) { @@ -145,10 +126,7 @@ public function startTestSuite(\PHPUnit_Framework_TestSuite $suite) } /** - * A test suite ended. - * - * @param \PHPUnit_Framework_TestSuite $suite - * @since Method available since Release 2.2.0 + * {@inheritdoc} */ public function endTestSuite(\PHPUnit_Framework_TestSuite $suite) { @@ -159,9 +137,7 @@ public function endTestSuite(\PHPUnit_Framework_TestSuite $suite) } /** - * A test started. - * - * @param \PHPUnit_Framework_Test $test + * {@inheritdoc} */ public function startTest(\PHPUnit_Framework_Test $test) { @@ -172,12 +148,7 @@ public function startTest(\PHPUnit_Framework_Test $test) } /** - * A test ended. - * Method signature is implied by implemented interface, not all parameters are needed. - * - * @param \PHPUnit_Framework_Test $test - * @param float $time - * + * {@inheritdoc} * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function endTest(\PHPUnit_Framework_Test $test, $time) diff --git a/dev/tests/integration/framework/bootstrap.php b/dev/tests/integration/framework/bootstrap.php index 72ac131699434..a0f65e9f90b61 100644 --- a/dev/tests/integration/framework/bootstrap.php +++ b/dev/tests/integration/framework/bootstrap.php @@ -32,11 +32,8 @@ $testsTmpDir = "{$testsBaseDir}/tmp"; $magentoBaseDir = realpath("{$testsBaseDir}/../../../"); -\Magento\Framework\Autoload\IncludePath::addIncludePath( - array( - "{$testsBaseDir}/framework", - "{$testsBaseDir}/testsuite" - ) +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath( + array("{$testsBaseDir}/framework", "{$testsBaseDir}/testsuite") ); function tool_autoloader($className) diff --git a/dev/tests/integration/framework/tests/unit/framework/bootstrap.php b/dev/tests/integration/framework/tests/unit/framework/bootstrap.php index 37dfbd9f1d367..55ad628f84d4e 100644 --- a/dev/tests/integration/framework/tests/unit/framework/bootstrap.php +++ b/dev/tests/integration/framework/tests/unit/framework/bootstrap.php @@ -27,4 +27,4 @@ $rootDir = realpath(__DIR__ . '/../../../../../../../'); require_once $rootDir . '/app/bootstrap.php'; -\Magento\Framework\Autoload\IncludePath::addIncludePath($rootDir . '/dev/tests/integration/framework'); +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath($rootDir . '/dev/tests/integration/framework'); diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Workaround/Cleanup/TestCasePropertiesTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Workaround/Cleanup/TestCasePropertiesTest.php index a75b9221cafa8..5cda9ce522029 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Workaround/Cleanup/TestCasePropertiesTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Workaround/Cleanup/TestCasePropertiesTest.php @@ -61,7 +61,7 @@ public function testEndTestSuiteDestruct() $testClass = $testSuite->testAt(0); $propertyObjectMock = $this->getMock('stdClass', array('__destruct')); - $propertyObjectMock->expects($this->once())->method('__destruct'); + $propertyObjectMock->expects($this->atLeastOnce())->method('__destruct'); $testClass->setPropertyObject($propertyObjectMock); foreach ($this->_fixtureProperties as $property) { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/AbstractTest.php index 0dadb0ecb5288..8b8fe5ed7ac65 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/AbstractTest.php @@ -130,14 +130,6 @@ public function testGetMinimalQty() $this->assertGreaterThan(0, $this->_block->getMinimalQty($this->_product)); } - public function testGetPriceHtml() - { - $this->_block->setLayout( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\View\LayoutInterface') - ); - $this->assertContains('10', $this->_block->getPriceHtml($this->_product)); - } - public function testGetReviewsSummaryHtml() { $this->_block->setLayout( @@ -153,40 +145,6 @@ public function testGetProduct() $this->assertSame($this->_product, $this->_block->getProduct()); } - public function testGetTierPriceTemplate() - { - $this->assertEquals('product/view/tierprices.phtml', $this->_block->getTierPriceTemplate()); - $this->_block->setData('tier_price_template', 'test.phtml'); - $this->assertEquals('test.phtml', $this->_block->getTierPriceTemplate()); - } - - public function testGetTierPriceHtml() - { - $this->_block->setLayout( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\View\LayoutInterface') - ); - $html = $this->_block->getTierPriceHtml(); - $this->assertNotEmpty($html); - $this->assertContains('2', $html); /* Buy 2 */ - $this->assertContains('8', $html); /* Price 8 */ - $this->assertContains('5', $html); /* Buy 5 and price 5 */ - } - - public function testGetTierPrices() - { - $prices = $this->_block->getTierPrices(); - $this->assertNotEmpty($prices); - $this->assertGreaterThanOrEqual(2, count($prices)); - $this->assertArrayHasKey('price', $prices[0]); - $this->assertArrayHasKey('savePercent', $prices[0]); - $this->assertArrayHasKey('formated_price', $prices[0]); - $this->assertArrayHasKey('formated_price_incl_tax', $prices[0]); - - $this->_product->setFinalPrice(7); - $prices = $this->_block->getTierPrices(); - $this->assertEquals(1, count($prices)); - } - public function testGetImageLabel() { $this->assertEquals($this->_product->getName(), $this->_block->getImageLabel()); diff --git a/dev/tests/integration/testsuite/Magento/Cron/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Cron/Model/ObserverTest.php index cad07426c6fb6..f2d9a513bb3dd 100644 --- a/dev/tests/integration/testsuite/Magento/Cron/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Cron/Model/ObserverTest.php @@ -40,6 +40,9 @@ protected function setUp() $this->_model->dispatch('this argument is not used'); } + /** + * @magentoConfigFixture current_store crontab/default/jobs/catalog_product_alert/schedule/cron_expr 8 * * * * + */ public function testDispatchScheduled() { $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php index 52a2bae211337..9252aeeda8434 100755 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php @@ -1061,4 +1061,13 @@ public function testResetPasswordActionSuccess() ); $this->assertRedirect($this->stringStartsWith($this->_baseControllerUrl . 'edit')); } + + public function testIndexActionCorrectTabsQty() + { + $this->dispatch('backend/customer/index/new/'); + $html = $this->getResponse()->getBody(); + $this->assertSelectCount('.tab-item-link', 2, $html); + $this->assertSelectCount('[title="Account Information"]', 1, $html); + $this->assertSelectCount('[title="Addresses"]', 1, $html); + } } diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Catalog/Product/LinksTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Catalog/Product/LinksTest.php deleted file mode 100644 index 2059af715fdb5..0000000000000 --- a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Catalog/Product/LinksTest.php +++ /dev/null @@ -1,176 +0,0 @@ -objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->registry = $this->objectManager->get('Magento\Framework\Registry'); - $this->taxCalculationModel = $this->objectManager->create('Magento\Tax\Model\Calculation'); - - $this->linksBlock = $this->objectManager->get('Magento\Framework\View\LayoutInterface') - ->createBlock('Magento\Downloadable\Block\Catalog\Product\Links'); - } - - public function tearDown() - { - $this->registry->unregister('product'); - $this->registry->unregister(RegistryConstants::CURRENT_CUSTOMER_ID); - $this->registry->unregister('_fixture/Magento_Tax_Model_Calculation_Rule'); - $this->registry->unregister('_fixture/Magento_Tax_Model_Calculation_Rate'); - } - - /** - * Test that has no customer registered. - * - * @magentoDataFixture Magento/Downloadable/_files/product_with_files.php - */ - public function testGetFormattedLinkPriceNoCustomer() - { - $product = $this->objectManager->create('Magento\Catalog\Model\Product')->load(1); - $this->registry->register('product', $product); - $link = array_values($this->linksBlock->getLinks())[0]; - $formattedLink = $this->linksBlock->getFormattedLinkPrice($link); - $this->assertEquals('+$15.00', $formattedLink); - } - - /** - * Test that uses customer's billing address as tax calculation base. - * - * @magentoConfigFixture current_store tax/display/type 3 - * @magentoConfigFixture current_store tax/calculation/based_on billing - * @magentoDataFixture Magento/Downloadable/_files/product_with_files.php - * @magentoDataFixture Magento/Customer/_files/customer.php - * @magentoDataFixture Magento/Customer/_files/customer_address.php - * @magentoDataFixture Magento/Customer/_files/customer_group.php - * @magentoDataFixture Magento/Tax/_files/tax_classes.php - */ - public function testGetFormattedLinkPriceCustomerBasedTax() - { - /** set the product and tax classes from tax_class fixture */ - $this->setUpTaxClasses(); - $link = array_values($this->linksBlock->getLinks())[0]; - $formattedLink = $this->linksBlock->getFormattedLinkPrice($link); - $this->assertEquals( - '+$15.00'. - ' (+$16.13 Incl. Tax)', - $formattedLink - ); - } - - /** - * Test a customer outside of region. - * - * @magentoConfigFixture current_store tax/display/type 3 - * @magentoConfigFixture current_store tax/calculation/based_on billing - * @magentoDataFixture Magento/Downloadable/_files/product_with_files.php - * @magentoDataFixture Magento/Customer/_files/customer.php - * @magentoDataFixture Magento/Customer/_files/customer_address.php - * @magentoDataFixture Magento/Customer/_files/customer_group.php - * @magentoDataFixture Magento/Tax/_files/tax_classes.php - */ - public function testGetFormattedLinkPriceCustomerBasedTaxDiffRegion() - { - /** set the product and tax classes from tax_class fixture */ - $this->setUpTaxClasses(13); - $link = array_values($this->linksBlock->getLinks())[0]; - $formattedLink = $this->linksBlock->getFormattedLinkPrice($link); - $this->assertEquals('+$15.00', $formattedLink); - } - - /** - * Test that has a customer but product based tax. - * - * @magentoConfigFixture current_store tax/display/type 3 - * @magentoDataFixture Magento/Downloadable/_files/product_with_files.php - * @magentoDataFixture Magento/Customer/_files/customer.php - */ - public function testGetFormattedLinkPriceCustomerProductTax() - { - $product = $this->objectManager->create('Magento\Catalog\Model\Product')->load(1); - $product->setTaxPercent(10); - $product->save(); - - $this->registry->register('product', $product); - $this->registry->register(RegistryConstants::CURRENT_CUSTOMER_ID, 1); - - $link = array_values($this->linksBlock->getLinks())[0]; - $formattedLink = $this->linksBlock->getFormattedLinkPrice($link); - $this->assertEquals( - '+$15.00'. - ' (+$16.50 Incl. Tax)', - $formattedLink - ); - } - - /** - * Set the product and tax classes from tax_class fixture - * - * @param int $addressRegionId Region to use for customer billing address. - * Defaults to 12 which is the same as in tax rate fixture - */ - private function setUpTaxClasses($addressRegionId = 12) - { - $taxRule = $this->registry->registry('_fixture/Magento_Tax_Model_Calculation_Rule'); - $customerTaxClasses = $taxRule->getTaxCustomerClass(); - $productTaxClasses = $taxRule->getTaxProductClass(); - - $customerGroup = $this->objectManager->create('Magento\Customer\Model\Group')->load(1); - $customerGroup->setTaxClassId($customerTaxClasses[0]); - $customerGroup->save(); - - $address = $this->objectManager->create('Magento\Customer\Model\Address')->load(1); - $address->setRegionId($addressRegionId); - $address->save(); - - $product = $this->objectManager->create('Magento\Catalog\Model\Product')->load(1); - $product->setTaxClassId($productTaxClasses[0]); - $product->save(); - - $this->registry->register('product', $product); - $this->registry->register(RegistryConstants::CURRENT_CUSTOMER_ID, 1); - } -} - \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Email/Controller/Adminhtml/Email/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Email/Controller/Adminhtml/Email/TemplateTest.php new file mode 100644 index 0000000000000..63d751517ac11 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Email/Controller/Adminhtml/Email/TemplateTest.php @@ -0,0 +1,46 @@ +_objectManager->get('Magento\Framework\Data\Form\FormKey'); + $post = array( + 'form_key' => $formKey->getFormKey(), + 'code' => 'customer_password_forgot_email_template' + ); + $this->getRequest()->setPost($post); + $this->dispatch('backend/admin/email_template/defaultTemplate/?isAjax=true'); + $this->assertContains( + '"template_type":2,"template_subject":"Password Reset Confirmation for {{var customer.name}}"', + $this->getResponse()->getBody() + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php index dd4e283c96ce2..10b7c01f09462 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php @@ -55,6 +55,7 @@ public function testViewDirective() /** * @magentoConfigFixture current_store web/unsecure/base_link_url http://example.com/ + * @magentoConfigFixture admin_store web/unsecure/base_link_url http://example.com/ */ public function testStoreDirective() { @@ -67,6 +68,12 @@ public function testStoreDirective() array('{{store url="translation/ajax/index"}}', 'store', ' url="translation/ajax/index"') ); $this->assertStringMatchesFormat('http://example.com/%stranslation/ajax/index/', $url); + + $this->_model->setStoreId(0); + $url = $this->_model->storeDirective( + array('{{store url="translation/ajax/index"}}', 'store', ' url="translation/ajax/index"') + ); + $this->assertStringMatchesFormat('http://example.com/index.php/backend/translation/ajax/index/%A', $url); } public function testEscapehtmlDirective() diff --git a/dev/tests/integration/testsuite/Magento/Framework/Code/GeneratorTest.php b/dev/tests/integration/testsuite/Magento/Framework/Code/GeneratorTest.php index 992a1c3cda21b..694d96ac0a9ed 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Code/GeneratorTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Code/GeneratorTest.php @@ -73,7 +73,7 @@ protected function setUp() ); $generationDirectory = $this->varDirectory->getAbsolutePath('generation'); - \Magento\Framework\Autoload\IncludePath::addIncludePath($generationDirectory); + (new \Magento\Framework\Autoload\IncludePath())->addIncludePath($generationDirectory); $this->_ioObject = new \Magento\Framework\Code\Generator\Io( new \Magento\Framework\Filesystem\Driver\File(), diff --git a/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php b/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php index ef6b3a4c4b286..4e9ac039a4ceb 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php @@ -177,11 +177,13 @@ public function testConfigureProductToAddAction() $this->assertContains('>Test Configurable', $body); $this->assertContains('"code":"test_configurable","label":"Test Configurable"', $body); $this->assertContains( - '"label":"Option 1","price":"5","oldPrice":"5","inclTaxPrice":"5","exclTaxPrice":"5","products":[', + '"label":"Option 1","price":"5","oldPrice":"5",'. + '"inclTaxPrice":"5","exclTaxPrice":"5","products":[', $body ); $this->assertContains( - '"label":"Option 2","price":"5","oldPrice":"5","inclTaxPrice":"5","exclTaxPrice":"5","products":[', + '"label":"Option 2","price":"5","oldPrice":"5",'. + '"inclTaxPrice":"5","exclTaxPrice":"5","products":[', $body ); $this->assertContains('"basePrice":"100","oldPrice":"100","productId":"1","chooseText":"Choose an Option..."', diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php index 6e2f3816c5856..3fb1e77a6e11e 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php @@ -37,8 +37,10 @@ public function testViewFilesFromModulesView() * @param string $file */ function ($application, $file) { - \Magento\TestFramework\Helper\Bootstrap::getInstance() - ->loadArea($application); + if ($application != 'base') { + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea($application); + } \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Framework\View\DesignInterface') ->setDefaultDesignTheme(); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/TemplateFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/TemplateFilesTest.php index c69a2f08034db..6d6aa9363c730 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/TemplateFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/TemplateFilesTest.php @@ -132,7 +132,6 @@ protected function _getLayoutTemplates($layoutXml) $templates[] = array($module, (string)$template, $parent[0]->asXml()); } break; - case 'addPriceBlockType': case 'addInformationRenderer': case 'addMergeSettingsBlockType': $blockType = $action[0]->xpath('block'); diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/ItemsTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/ItemsTest.php index 35aa967405182..4dfccfbb740cb 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/ItemsTest.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/Wishlist/ItemsTest.php @@ -30,21 +30,25 @@ class ItemsTest extends \PHPUnit_Framework_TestCase { public function testGetColumns() { - $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $layout = $objectManager->get( 'Magento\Framework\View\LayoutInterface' ); $block = $layout->addBlock('Magento\Wishlist\Block\Customer\Wishlist\Items', 'test'); $child = $this->getMock( - 'Magento\Framework\View\Element\Text', + 'Magento\Wishlist\Block\Customer\Wishlist\Item\Column', array('isEnabled'), - array( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Framework\View\Element\Context' - ) - ) + array($objectManager->get('Magento\Framework\View\Element\Context')), + '', + false ); $child->expects($this->any())->method('isEnabled')->will($this->returnValue(true)); $layout->addBlock($child, 'child', 'test'); - $this->assertSame(array($child), $block->getColumns()); + $expected = $child->getType(); + $columns = $block->getColumns(); + $this->assertNotEmpty($columns); + foreach ($columns as $column) { + $this->assertSame($expected, $column->getType()); + } } } diff --git a/dev/tests/js/jsTestDriverOrder.php b/dev/tests/js/jsTestDriverOrder.php index 74060e4964468..956bbe3ced9ad 100644 --- a/dev/tests/js/jsTestDriverOrder.php +++ b/dev/tests/js/jsTestDriverOrder.php @@ -32,7 +32,7 @@ '/pub/lib/jquery/jquery-1.8.2.js', '/pub/lib/jquery/jquery-ui-1.9.2.js', '/pub/lib/jquery/jquery.cookie.js', - '/pub/lib/headjs/head.load.min.js', + '/pub/lib/headjs/head.min.js', '/pub/lib/mage/mage.js', '/pub/lib/mage/decorate.js', '/pub/lib/jquery/jquery.validate.js', diff --git a/dev/tests/js/pj b/dev/tests/js/pj deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/dev/tests/js/run_js_tests.php b/dev/tests/js/run_js_tests.php index f2b2fee92e987..a3aa9d9c04699 100644 --- a/dev/tests/js/run_js_tests.php +++ b/dev/tests/js/run_js_tests.php @@ -28,7 +28,7 @@ define('RELATIVE_APP_ROOT', '../../..'); require __DIR__ . '/../../../app/autoload.php'; -\Magento\Framework\Autoload\IncludePath::addIncludePath(realpath(RELATIVE_APP_ROOT . '/lib')); +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath(realpath(RELATIVE_APP_ROOT . '/lib')); $userConfig = normalize('jsTestDriver.php'); $defaultConfig = normalize('jsTestDriver.php.dist'); diff --git a/dev/tests/performance/framework/bootstrap.php b/dev/tests/performance/framework/bootstrap.php index dcaaa6aed4e85..17da9b3516764 100644 --- a/dev/tests/performance/framework/bootstrap.php +++ b/dev/tests/performance/framework/bootstrap.php @@ -30,7 +30,7 @@ $magentoBaseDir = realpath($testsBaseDir . '/../../../'); require_once "{$magentoBaseDir}/app/bootstrap.php"; -\Magento\Framework\Autoload\IncludePath::addIncludePath("{$testsBaseDir}/framework"); +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath("{$testsBaseDir}/framework"); $bootstrap = new \Magento\TestFramework\Performance\Bootstrap($testsBaseDir, $magentoBaseDir); $bootstrap->cleanupReports(); diff --git a/dev/tests/performance/framework/tests/unit/framework/bootstrap.php b/dev/tests/performance/framework/tests/unit/framework/bootstrap.php index 6ccf62ff29a67..1d2ca91d37ad5 100644 --- a/dev/tests/performance/framework/tests/unit/framework/bootstrap.php +++ b/dev/tests/performance/framework/tests/unit/framework/bootstrap.php @@ -27,4 +27,4 @@ $magentoBaseDir = realpath(__DIR__ . '/../../../../../../../'); require_once "{$magentoBaseDir}/app/bootstrap.php"; -\Magento\Framework\Autoload\IncludePath::addIncludePath("{$magentoBaseDir}/dev/tests/performance/framework"); +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath("{$magentoBaseDir}/dev/tests/performance/framework"); diff --git a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer.php b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer.php index 7dee29cdf763c..8d2e932729d10 100644 --- a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer.php +++ b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer.php @@ -131,6 +131,7 @@ function ($item) { ob_start(); $result = $this->wrapper->process(); ob_end_clean(); + return $result; } diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/AggregateInvoker.php b/dev/tests/static/framework/Magento/TestFramework/Utility/AggregateInvoker.php index b7a4520be8d5e..20660aa1a9afc 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Utility/AggregateInvoker.php +++ b/dev/tests/static/framework/Magento/TestFramework/Utility/AggregateInvoker.php @@ -47,7 +47,7 @@ class AggregateInvoker * @param \PHPUnit_Framework_TestCase $testCase * @param array $options */ - public function __construct(\PHPUnit_Framework_TestCase $testCase, array $options = array()) + public function __construct($testCase, array $options = array()) { $this->_testCase = $testCase; $this->_options = $options + $this->_options; diff --git a/dev/tests/static/framework/Magento/TestFramework/Utility/Classes.php b/dev/tests/static/framework/Magento/TestFramework/Utility/Classes.php index 8cb3b8d193c4c..c58107e1939da 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Utility/Classes.php +++ b/dev/tests/static/framework/Magento/TestFramework/Utility/Classes.php @@ -185,7 +185,7 @@ public static function collectLayoutClasses(\SimpleXMLElement $xml) self::getXmlNodeValues( $xml, '/layout//action/attributeType | /layout//action[@method="addTab"]/content - | /layout//action[@method="addPriceBlockType" or @method="addMergeSettingsBlockType" + | /layout//action[@method="addMergeSettingsBlockType" or @method="addInformationRenderer" or @method="addDatabaseBlock"]/*[2] | /layout//action[@method="setMassactionBlockName"]/name diff --git a/dev/tests/static/framework/bootstrap.php b/dev/tests/static/framework/bootstrap.php index 359d1b8ec6f73..94d0a49d4775e 100644 --- a/dev/tests/static/framework/bootstrap.php +++ b/dev/tests/static/framework/bootstrap.php @@ -27,7 +27,9 @@ define('BP', realpath(__DIR__ . '/../../../../')); require BP . '/app/autoload.php'; -\Magento\Framework\Autoload\IncludePath::addIncludePath(array(__DIR__, dirname(__DIR__) . '/testsuite', BP . '/lib')); +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath( + array(__DIR__, dirname(__DIR__) . '/testsuite', BP . '/lib') +); \Magento\TestFramework\Utility\Files::setInstance(new \Magento\TestFramework\Utility\Files(BP)); function tool_autoloader($className) diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/AggregateInvokerTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/AggregateInvokerTest.php index b656a314ec3fa..45b18aadb3e70 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/AggregateInvokerTest.php +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Utility/AggregateInvokerTest.php @@ -37,7 +37,10 @@ class AggregateInvokerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_testCase = $this->getMock('PHPUnit_Framework_TestCase'); + $this->_testCase = $this->getMock( + 'PHPUnit_Framework_Test', + ['run', 'count', 'fail', 'markTestIncomplete', 'markTestSkipped'] + ); $this->_invoker = new AggregateInvoker($this->_testCase, array()); } @@ -90,7 +93,7 @@ public function callbackDataProvider() ), array( 'Passed: 0, Failed: 0, Incomplete: 0, Skipped: 1.', - 'markTestCkipped', + 'markTestSkipped', 'PHPUnit_Framework_SkippedTestError' ) ); diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php index 751593e15fee9..0c58af64dbf56 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php @@ -463,6 +463,7 @@ protected function removeSpecialCases($badClasses, $file, $contents, $namespaceP '/downloader/lib/', '/dev/tools/', '/dev/tests/api-functional/framework/', + '/dev/tests/functional/', '/dev/tests/integration/framework/', '/dev/tests/integration/framework/tests/unit/testsuite/', '/dev/tests/integration/testsuite/', diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php index 053a7a76edd48..b5a6bb53af64a 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php @@ -82,7 +82,7 @@ protected function setUp() $this->_generationDir = $this->_tmpDir . '/generation'; $this->_compilationDir = $this->_tmpDir . '/di'; - \Magento\Framework\Autoload\IncludePath::addIncludePath( + (new \Magento\Framework\Autoload\IncludePath())->addIncludePath( array($basePath . '/app/code', $basePath . '/lib', $this->_generationDir) ); diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/HandlesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/HandlesTest.php index 1a9b579fb200b..442cf40479694 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/HandlesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Layout/HandlesTest.php @@ -43,9 +43,9 @@ function ($layoutFile) { $issues = array(); $node = simplexml_load_file($layoutFile); $label = $node['label']; - $design_abstraction = $node['design_abstraction']; + $designAbstraction = $node['design_abstraction']; if (!$label) { - if ($design_abstraction) { + if ($designAbstraction) { $issues[] = 'Attribute "design_abstraction" is defined, but "label" is not'; } } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt index 490babd93d688..a5472f82ecf55 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt @@ -19,6 +19,9 @@ dev/tests/integration/testsuite/Magento/Test/Tools/I18n/Code/Dictionary/_files/s dev/tests/integration/testsuite/Magento/Test/Tools/I18n/Code/Dictionary/_files/source/app/code/Magento/SecondModule/Model/Model.php dev/tests/integration/testsuite/Magento/Test/Tools/I18n/Code/Dictionary/_files/source/unused/Model.php dev/tests/integration/testsuite/Magento/Test/Tools/I18n/Code/Dictionary/_files/source/app/code/Magento/FirstModule/Helper/Helper.php +dev/tests/static/framework/PHP/CodeSniffer/Standards/Zend/Sniffs/Debug/CodeAnalyzerSniff.php +dev/tests/static/framework/PHP/CodeSniffer/Standards/Zend/Sniffs/Files/ClosingTagSniff.php +dev/tests/static/framework/PHP/CodeSniffer/Standards/Zend/Sniffs/NamingConventions/ValidVariableNameSniff.php dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest/phpmd/input/coupling.php dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest/phpmd/input/cyclomatic_complexity.php dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest/phpmd/input/descendant_count.php diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt index 25f6a53b45afd..4b71dd41ec0fc 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt @@ -32,3 +32,4 @@ TestSuite DbTest Model1 Model3 +\Magento\Framework\Error\Processor diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php index 2db32dc0ab6ae..095c485b3ee82 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php @@ -263,7 +263,6 @@ public function getAllowedActionNodeMethods() 'addDatabaseBlock', 'addInputTypeTemplate', 'addNotice', - 'addPriceBlockType', 'addReportTypeOption', 'addTab', 'addTabAfter', diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index 169d402d0afe6..0314b7739748e 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -2399,6 +2399,8 @@ ['Magento\Backend\Model\Resource\Translate', 'Magento\Translation\Model\Resource\Translate'], ['Magento\Backend\Model\Resource\Translate\String', 'Magento\Translation\Model\Resource\String'], ['Magento\Core\Model\Layout', 'Magento\Framework\View\Layout'], + ['Magento\Catalog\Block\Product\Price\Template'], + ['Magento\Bundle\Block\Catalog\Product\View'], ['Magento\Backup\Archive\Tar', 'Magento\Framework\Backup\Archive\Tar'], ['Magento\Backup\Db\BackupDbInterface', 'Magento\Framework\Backup\Db\BackupDbInterface'], ['Magento\Backup\Db\BackupFactory', 'Magento\Framework\Backup\Db\BackupFactory'], diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php index e3225da0afa98..a794a000b55b2 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php @@ -599,4 +599,14 @@ array('CONFIG_KEY_LOCALE', 'Magento\Framework\Translate'), array('CONFIG_KEY_SCOPE', 'Magento\Framework\Translate'), array('CONFIG_KEY_DESIGN_THEME', 'Magento\Framework\Translate'), + array( + 'XML_NODE_MAX_INDEX_COUNT', + 'Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction', + 'Magento\Catalog\Model\Indexer\Product\Flat\FlatTableBuilder' + ), + array( + 'ATTRIBUTES_CHUNK_SIZE', + 'Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction', + 'Magento\Catalog\Model\Indexer\Product\Flat\Action\Indexer' + ), ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index 919d33e33acef..c90ca1dd917bf 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -1665,4 +1665,22 @@ ['setCustomer', 'Magento\Checkout\Model\Session', 'Magento\Checkout\Model\Session::setCustomerData'], ['getPersistentName', 'Magento\Persistent\Helper\Data'], ['getCustomerDataObject', 'Magento\Persistent\Helper\Session'], + ['getFlatTableName', 'Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction'], + ['deleteProductsFromStore', 'Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction'], + ['getPriceHtml', 'Magento\Rss\Block\Catalog\AbstractCatalog'], + ['_getPriceBlock', 'Magento\Rss\Block\Catalog\AbstractCatalog'], + ['_construct', 'Magento\Catalog\Block\Product\Widget\NewWidget'], + ['_getPriceBlock', 'Magento\Catalog\Block\Product\AbstractProduct'], + ['_getPriceBlockTemplate', 'Magento\Catalog\Block\Product\AbstractProduct'], + ['_preparePriceRenderer', 'Magento\Catalog\Block\Product\AbstractProduct'], + ['addPriceBlock', 'Magento\Catalog\Block\Product\AbstractProduct'], + ['getTierPriceHtml', 'Magento\Catalog\Block\Product\AbstractProduct'], + ['_prepareLayout', 'Magento\Catalog\Block\Product\AbstractProduct'], + ['getTierPriceHtml', 'Magento\GroupedProduct\Block\Product\View\Type\Grouped'], + ['_construct', 'Magento\Reports\Block\Product\Widget\Viewed\Item'], + ['addPriceBlockType', 'Magento\Rss\Block\Wishlist'], + ['getTierPriceTemplate', 'Magento\Catalog\Block\Product\AbstractProduct'], + ['getTierPrices', 'Magento\Catalog\Block\Product\AbstractProduct'], + ['getTierPrices', 'Magento\Catalog\Block\Product\Price'], + ['processTierPrices', 'Magento\Weee\Helper\Data'], ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php index 505951cccdf87..cfde7648766ff 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php @@ -338,4 +338,6 @@ ['_layout', 'Magento\Install\App\Action\Plugin\Design'], ['_layout', 'Magento\Framework\View\DesignLoader'], ['_area', 'Magento\Framework\View\Layout'], + ['_coreData', '\Magento\Rss\Block\Catalog\Special', 'priceCurrency'], + ['_tierPriceDefaultTemplate', 'Magento\Catalog\Block\Product\AbstractProduct'], ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml index 0a5d039febdc8..d9e414c4f0199 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml @@ -43,6 +43,7 @@ secure_base_url}}js/ secure_base_url}}skin/ secure_base_url}}media/ + head.js overriden retrive @@ -82,5 +83,37 @@ dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php overriden + + app/code/Magento/Paypal/view/frontend/express/shortcut.phtml + head.js + + + app/code/Magento/Bundle/view/adminhtml/product/edit/bundle.phtml + head.js + + + app/code/Magento/Webapi/view/adminhtml/integration/activate/permissions/tab/webapi.phtml + head.js + + + app/code/Magento/Install/view/install/ + head.js + + + app/code/Magento/GiftCard/view/adminhtml/catalog/product/composite/fieldset/giftcard.phtml + head.js + + + app/code/Magento/GiftRegistry/view/adminhtml/edit/attributes.phtml + head.js + + + app/code/Magento/GiftRegistry/view/adminhtml/edit/type/select.phtml + head.js + + + pub/lib/mage/mage.js + head.js + diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/whitelist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/whitelist/common.txt index 899db1d40995b..7ec547860ac64 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/whitelist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/whitelist/common.txt @@ -1,9 +1,10 @@ # Files or directories that are included into php code sniffer analysis # Glob patterns are supported # -app/ -dev/ +app +dev +downloader/app/Magento +downloader/lib/Magento index.php lib/Magento -downloader/lib/Magento -downloader/app/Magento +pub diff --git a/dev/tests/unit/framework/Magento/TestFramework/Listener/GarbageCleanup.php b/dev/tests/unit/framework/Magento/TestFramework/Listener/GarbageCleanup.php index 57ca7b524a7d5..53a5ad52df9a7 100644 --- a/dev/tests/unit/framework/Magento/TestFramework/Listener/GarbageCleanup.php +++ b/dev/tests/unit/framework/Magento/TestFramework/Listener/GarbageCleanup.php @@ -59,6 +59,15 @@ public function addIncompleteTest(\PHPUnit_Framework_Test $test, \Exception $e, { } + /** + * {@inheritdoc} + * @SuppressWarnings(PHPMD.ShortVariable) + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function addRiskyTest(\PHPUnit_Framework_Test $test, \Exception $e, $time) + { + } + /** * {@inheritdoc} * @SuppressWarnings(PHPMD.ShortVariable) diff --git a/dev/tests/unit/framework/bootstrap.php b/dev/tests/unit/framework/bootstrap.php index 146844c585325..3cf244db15708 100644 --- a/dev/tests/unit/framework/bootstrap.php +++ b/dev/tests/unit/framework/bootstrap.php @@ -29,7 +29,7 @@ require BP . '/app/functions.php'; require BP . '/app/autoload.php'; -\Magento\Framework\Autoload\IncludePath::addIncludePath( +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath( array( __DIR__, realpath(__DIR__ . '/../testsuite'), diff --git a/dev/tests/unit/framework/tests/unit/framework/bootstrap.php b/dev/tests/unit/framework/tests/unit/framework/bootstrap.php index 4fbac1ae7414c..5a8075bd3ea07 100644 --- a/dev/tests/unit/framework/tests/unit/framework/bootstrap.php +++ b/dev/tests/unit/framework/tests/unit/framework/bootstrap.php @@ -27,6 +27,6 @@ $rootDir = realpath(__DIR__ . '/../../../../../../..'); require __DIR__ . '/../../../../../../../app/autoload.php'; -\Magento\Framework\Autoload\IncludePath::addIncludePath( +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath( array($rootDir . '/lib/', $rootDir . '/dev/tests/unit/framework/', $rootDir . '/app/code/', $rootDir . '/app') ); diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Block/Catalog/Product/View/Type/BundleTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Block/Catalog/Product/View/Type/BundleTest.php index 07e1d0974e7b2..863c33277bf9d 100644 --- a/dev/tests/unit/testsuite/Magento/Bundle/Block/Catalog/Product/View/Type/BundleTest.php +++ b/dev/tests/unit/testsuite/Magento/Bundle/Block/Catalog/Product/View/Type/BundleTest.php @@ -59,13 +59,12 @@ public function testGetOptionHtml() $optionBlock = $this->getMock( '\Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option\Checkbox', - array('setOption', 'toHtml', 'getPriceBlockTypes'), + array('setOption', 'toHtml'), array(), '', false ); $optionBlock->expects($this->any())->method('setOption')->will($this->returnValue($optionBlock)); - $optionBlock->expects($this->any())->method('getPriceBlockTypes')->will($this->returnValue(array())); $optionBlock->expects($this->any())->method('toHtml')->will($this->returnValue('option html')); $layout = $this->getMock( 'Magento\Framework\View\Layout', diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Adjustment/CalculatorTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Adjustment/CalculatorTest.php index ac3c56e5dfed2..10a3b219d1637 100644 --- a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Adjustment/CalculatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Adjustment/CalculatorTest.php @@ -71,7 +71,10 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->saleableItem = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); + $this->saleableItem = $this->getMockBuilder('Magento\Catalog\Model\Product') + ->setMethods(['getPriceInfo', 'getPriceType', '__wakeup']) + ->disableOriginalConstructor() + ->getMock(); $priceInfo = $this->getMock('Magento\Framework\Pricing\PriceInfoInterface', [], [], '', true); $priceInfo->expects($this->any())->method('getPrice')->will($this->returnCallback(function ($type) { if (!isset($this->priceMocks[$type])) { @@ -90,15 +93,15 @@ protected function setUp() $factoryCallback = $this->returnCallback(function () { list(, $selectionMock) = func_get_args(); - $bundlePrice = $this->getMockBuilder('\Magento\Bundle\Pricing\Price\BundleSelectionPriceInterface') + $bundlePrice = $this->getMockBuilder('Magento\Bundle\Pricing\Price\BundleSelectionPrice') ->setMethods(['getAmount']) + ->disableOriginalConstructor() ->getMock(); $bundlePrice->expects($this->any())->method('getAmount') ->will($this->returnValue($selectionMock->getAmountMock())); return $bundlePrice; }); $this->selectionFactory->expects($this->any())->method('create')->will($factoryCallback); - $this->model = new Calculator($this->baseCalculator, $this->amountFactory, $this->selectionFactory); } @@ -122,11 +125,11 @@ public function testGetterAmount($amountForBundle, $optionList, $expectedResult) } $price = $this->getMock('Magento\Bundle\Pricing\Price\BundleOptionPrice', [], [], '', false); $price->expects($this->atLeastOnce())->method('getOptions')->will($this->returnValue($options)); - $this->priceMocks[Price\BundleOptionPriceInterface::PRICE_TYPE_BUNDLE_OPTION] = $price; + $this->priceMocks[Price\BundleOptionPrice::PRICE_CODE] = $price; // Price type of saleable items $this->saleableItem->expects($this->any())->method('getPriceType')->will($this->returnValue( - ProductPrice::PRICE_TYPE_FIXED + ProductPrice::PRICE_TYPE_DYNAMIC )); $this->amountFactory->expects($this->atLeastOnce())->method('create') @@ -210,7 +213,10 @@ public function dataProviderForGetterAmount() 'case with getting maximum amount' => $this->getCaseWithMaxAmount(), // third case without saleable items - 'case without saleable items' => $this->getCaseWithoutSaleableItems() + 'case without saleable items' => $this->getCaseWithoutSaleableItems(), + + // fourth case without require options + 'case without required options' => $this->getCaseMinAmountWithoutRequiredOptions(), ]; } @@ -390,4 +396,82 @@ protected function getCaseWithoutSaleableItems() ] ]; } + + /** + * Array for data provider dataProviderForGetterAmount for case 'case without required options' + * + * @return array + */ + protected function getCaseMinAmountWithoutRequiredOptions() + { + return [ + 'amountForBundle' => [ + 'adjustmentsAmounts' => [], + 'amount' => null + ], + 'optionList' => [ + // first option + [ + 'isMultiSelection' => false, + 'data' => [ + 'title' => 'test option 1', + 'default_title' => 'test option 1', + 'type' => 'select', + 'option_id' => '1', + 'position' => '0', + 'required' => '0', + ], + 'selections' => [ + 'first product selection' => [ + 'data' => ['price' => 20.], + 'amount' => [ + 'adjustmentsAmounts' => ['tax' => 8], + 'amount' => 8 + ] + ], + 'second product selection' => [ + 'data' => ['price' => 30.], + 'amount' => [ + 'adjustmentsAmounts' => ['tax' => 10], + 'amount' => 12 + ] + ], + ] + ], + // second option + [ + 'isMultiSelection' => false, + 'data' => [ + 'title' => 'test option 2', + 'default_title' => 'test option 2', + 'type' => 'select', + 'option_id' => '2', + 'position' => '1', + 'required' => '0', + ], + 'selections' => [ + 'first product selection' => [ + 'data' => ['price' => 25.], + 'amount' => [ + 'adjustmentsAmounts' => ['tax' => 8], + 'amount' => 9 + ] + ], + 'second product selection' => [ + 'data' => ['price' => 35.], + 'amount' => [ + 'adjustmentsAmounts' => ['tax' => 10], + 'amount' => 10 + ] + ], + ] + ] + ], + 'expectedResult' => [ + 'isMinAmount' => true, + 'fullAmount' => 8., + 'adjustments' => ['tax' => 8] + ] + ]; + } } diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BasePriceTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BasePriceTest.php index 87fd8fc893774..e74eb2e392014 100644 --- a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BasePriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BasePriceTest.php @@ -64,13 +64,13 @@ public function setUp() $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->model = $objectHelper->getObject('Magento\Bundle\Pricing\Price\BasePrice', [ - 'salableItem' => $this->saleable, + 'saleableItem' => $this->saleable, 'quantity' => $this->quantity ]); } /** - * @covers \Magento\Bundle\Pricing\Price\BasePrice::applyDiscount + * @covers \Magento\Bundle\Pricing\Price\BasePrice::calculateBaseValue * @covers \Magento\Bundle\Pricing\Price\BasePrice::getValue */ public function testGetValue() @@ -83,7 +83,7 @@ public function testGetValue() $pricesIncludedInBase = []; foreach ($priceValues as $priceValue) { - $price = $this->getMock('Magento\Framework\Pricing\Price\PriceInterface'); + $price = $this->getMock('Magento\Catalog\Pricing\Price\RegularPrice', [], [], '', false); $price->expects($this->atLeastOnce()) ->method('getValue') ->will($this->returnValue($priceValue)); @@ -91,7 +91,7 @@ public function testGetValue() } $this->priceInfo->expects($this->once()) - ->method('getPricesIncludedInBase') + ->method('getPrices') ->will($this->returnValue($pricesIncludedInBase)); $tearPrice = $this->getMock('Magento\Framework\Pricing\Price\PriceInterface'); @@ -112,9 +112,9 @@ public function testGetValue() $this->priceInfo->expects($this->any()) ->method('getPrice') ->will($this->returnValueMap([ - [CatalogPrice\TierPriceInterface::PRICE_TYPE_TIER, $this->quantity, $tearPrice], - [CatalogPrice\GroupPriceInterface::PRICE_TYPE_GROUP, $this->quantity, $groupPrice], - [CatalogPrice\SpecialPriceInterface::PRICE_TYPE_SPECIAL, $this->quantity, $specialPrice], + [CatalogPrice\TierPrice::PRICE_CODE, $this->quantity, $tearPrice], + [CatalogPrice\GroupPrice::PRICE_CODE, $this->quantity, $groupPrice], + [CatalogPrice\SpecialPrice::PRICE_CODE, $this->quantity, $specialPrice], ])); $this->assertEquals($result, $this->model->getValue()); diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BundleOptionPriceTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BundleOptionPriceTest.php new file mode 100644 index 0000000000000..b0c0d288b64b3 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BundleOptionPriceTest.php @@ -0,0 +1,400 @@ +priceInfoMock = $this->getMock('Magento\Framework\Pricing\PriceInfo\Base', [], [], '', false); + $this->saleableItemMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); + $this->saleableItemMock->expects($this->once()) + ->method('getPriceInfo') + ->will($this->returnValue($this->priceInfoMock)); + + $this->saleableItemMock->expects($this->once()) + ->method('setQty') + ->will($this->returnSelf()); + + $this->selectionFactoryMock = $this->getMockBuilder('Magento\Bundle\Pricing\Price\BundleSelectionFactory') + ->disableOriginalConstructor() + ->getMock(); + $this->amountFactory = $this->getMock('Magento\Framework\Pricing\Amount\AmountFactory', [], [], '', false); + $factoryCallback = $this->returnCallback( + function ($fullAmount, $adjustments) { + return $this->createAmountMock(['amount' => $fullAmount, 'adjustmentAmounts' => $adjustments]); + } + ); + $this->amountFactory->expects($this->any())->method('create')->will($factoryCallback); + $this->baseCalculator = $this->getMock('Magento\Framework\Pricing\Adjustment\Calculator', [], [], '', false); + $this->bundleCalculatorMock = $this->getMockBuilder('Magento\Bundle\Pricing\Adjustment\Calculator') + ->setConstructorArgs([$this->baseCalculator, $this->amountFactory, $this->selectionFactoryMock]) + ->setMethods(['getOptionsAmount']) + ->getMock(); + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->bundleOptionPrice = $this->objectManagerHelper->getObject( + 'Magento\Bundle\Pricing\Price\BundleOptionPrice', + [ + 'saleableItem' => $this->saleableItemMock, + 'quantity' => 1., + 'calculator' => $this->bundleCalculatorMock, + 'bundleSelectionFactory' => $this->selectionFactoryMock + ] + ); + } + + /** + * @dataProvider getOptionsDataProvider + */ + public function testGetOptions($selectionCollection) + { + $this->prepareOptionMocks($selectionCollection); + $this->assertSame($selectionCollection, $this->bundleOptionPrice->getOptions()); + $this->assertSame($selectionCollection, $this->bundleOptionPrice->getOptions()); + } + + /** + * @param array $selectionCollection + * @return void + */ + protected function prepareOptionMocks($selectionCollection) + { + $this->saleableItemMock->expects($this->atLeastOnce()) + ->method('getStoreId') + ->will($this->returnValue(1)); + + $priceTypeMock = $this->getMock('Magento\Bundle\Model\Product\Type', [], [], '', false); + $priceTypeMock->expects($this->atLeastOnce()) + ->method('setStoreFilter') + ->with($this->equalTo(1), $this->equalTo($this->saleableItemMock)) + ->will($this->returnSelf()); + + $optionIds = ['41', '55']; + $priceTypeMock->expects($this->atLeastOnce()) + ->method('getOptionsIds') + ->with($this->equalTo($this->saleableItemMock)) + ->will($this->returnValue($optionIds)); + + $priceTypeMock->expects($this->atLeastOnce()) + ->method('getSelectionsCollection') + ->with($this->equalTo($optionIds), $this->equalTo($this->saleableItemMock)) + ->will($this->returnValue($selectionCollection)); + + $collection = $this->getMock('Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false); + $collection->expects($this->atLeastOnce()) + ->method('appendSelections') + ->with($this->equalTo($selectionCollection), $this->equalTo(false), $this->equalTo(false)) + ->will($this->returnValue($selectionCollection)); + + $priceTypeMock->expects($this->atLeastOnce()) + ->method('getOptionsCollection') + ->with($this->equalTo($this->saleableItemMock)) + ->will($this->returnValue($collection)); + + $this->saleableItemMock->expects($this->atLeastOnce()) + ->method('getTypeInstance') + ->will($this->returnValue($priceTypeMock)); + } + + public function getOptionsDataProvider() + { + return [ + ['1', '2'] + ]; + } + + /** + * @param float $selectionQty + * @param float|bool $selectionAmount + * @dataProvider selectionAmountDataProvider + */ + public function testGetOptionSelectionAmount($selectionQty, $selectionAmount) + { + $selection = $this->getMock('Magento\Catalog\Model\Product', ['getSelectionQty', '__wakeup'], [], '', false); + $selection->expects($this->once()) + ->method('getSelectionQty') + ->will($this->returnValue($selectionQty)); + $priceMock = $this->getMock('Magento\Bundle\Pricing\Price\BundleSelectionPrice', [], [], '', false); + $priceMock->expects($this->once()) + ->method('getAmount') + ->will($this->returnValue($selectionAmount)); + $this->selectionFactoryMock->expects($this->once()) + ->method('create') + ->with($this->equalTo($this->saleableItemMock), $this->equalTo($selection), $this->equalTo($selectionQty)) + ->will($this->returnValue($priceMock)); + $this->assertSame($selectionAmount, $this->bundleOptionPrice->getOptionSelectionAmount($selection)); + } + + /** + * @return array + */ + public function selectionAmountDataProvider() + { + return [ + [1., 50.5], + [2.2, false] + ]; + } + + public function testGetAmount() + { + $amountMock = $this->getMock('Magento\Framework\Pricing\Amount\AmountInterface'); + $this->bundleCalculatorMock->expects($this->once()) + ->method('getOptionsAmount') + ->with($this->equalTo($this->saleableItemMock)) + ->will($this->returnValue($amountMock)); + $this->assertSame($amountMock, $this->bundleOptionPrice->getAmount()); + } + + /** + * Create amount mock + * + * @param array $amountData + * @return \Magento\Framework\Pricing\Amount\Base|\PHPUnit_Framework_MockObject_MockObject + */ + protected function createAmountMock($amountData) + { + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Pricing\Amount\Base $amount */ + $amount = $this->getMock('Magento\Framework\Pricing\Amount\Base', [], [], '', false); + $amount->expects($this->any())->method('getAdjustmentAmounts')->will( + $this->returnValue(isset($amountData['adjustmentAmounts']) ? $amountData['adjustmentAmounts'] : []) + ); + $amount->expects($this->any())->method('getValue')->will($this->returnValue($amountData['amount'])); + return $amount; + } + + /** + * Create option mock + * + * @param array $optionData + * @return \Magento\Bundle\Model\Option|\PHPUnit_Framework_MockObject_MockObject + */ + protected function createOptionMock($optionData) + { + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Bundle\Model\Option $option */ + $option = $this->getMock('Magento\Bundle\Model\Option', ['isMultiSelection', '__wakeup'], [], '', false); + $option->expects($this->any())->method('isMultiSelection') + ->will($this->returnValue($optionData['isMultiSelection'])); + $selections = []; + foreach ($optionData['selections'] as $selectionData) { + $selections[] = $this->createSelectionMock($selectionData); + } + $option->setData($optionData['data']); + $option->setData('selections', $selections); + return $option; + } + + /** + * Create selection product mock + * + * @param array $selectionData + * @return \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject + */ + protected function createSelectionMock($selectionData) + { + $selection = $this->getMockBuilder('Magento\Catalog\Model\Product') + ->setMethods(['isSalable', 'getAmount', 'getSelectionQty', '__wakeup']) + ->disableOriginalConstructor() + ->getMock(); + // All items are saleable + $selection->expects($this->any())->method('isSalable')->will($this->returnValue(true)); + $selection->setData($selectionData['data']); + $amountMock = $this->createAmountMock($selectionData['amount']); + $selection->expects($this->any())->method('getAmount')->will($this->returnValue($amountMock)); + return $selection; + } + + /** + * @dataProvider getTestDataForCalculation + */ + public function testCalculation($optionList, $expected) + { + $storeId = 1; + $this->saleableItemMock->expects($this->any())->method('getStoreId')->will($this->returnValue($storeId)); + $this->selectionFactoryMock->expects($this->any())->method('create')->will($this->returnArgument(1)); + + $this->baseCalculator->expects($this->atLeastOnce())->method('getAmount') + ->will($this->returnValue($this->createAmountMock(['amount' => 0.]))); + + $options = []; + foreach ($optionList as $optionData) { + $options[] = $this->createOptionMock($optionData); + } + /** @var \PHPUnit_Framework_MockObject_MockObject $optionsCollection */ + $optionsCollection = $this->getMock('Magento\Bundle\Model\Resource\Option\Collection', [], [], '', false); + $optionsCollection->expects($this->atLeastOnce())->method('appendSelections')->will($this->returnSelf()); + $optionsCollection->expects($this->atLeastOnce())->method('getIterator') + ->will($this->returnValue(new \ArrayIterator($options))); + + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Product\Type\AbstractType $typeMock */ + $typeMock = $this->getMock('Magento\Bundle\Model\Product\Type', [], [], '', false); + $typeMock->expects($this->any())->method('setStoreFilter')->with($storeId, $this->saleableItemMock); + $typeMock->expects($this->any())->method('getOptionsCollection')->with($this->saleableItemMock) + ->will($this->returnValue($optionsCollection)); + $this->saleableItemMock->expects($this->any())->method('getTypeInstance')->will($this->returnValue($typeMock)); + + $this->assertEquals($expected['min'], $this->bundleOptionPrice->getValue()); + $this->assertEquals($expected['max'], $this->bundleOptionPrice->getMaxValue()); + } + + /** + * @return array + */ + public function getTestDataForCalculation() + { + return [ + 'first case' => [ + 'optionList' => [ + // first option with single choice of product + [ + 'isMultiSelection' => false, + 'data' => [ + 'title' => 'test option 1', + 'default_title' => 'test option 1', + 'type' => 'select', + 'option_id' => '1', + 'position' => '0', + 'required' => '1', + ], + 'selections' => [ + [ + 'data' => ['price' => 70.], + 'amount' => ['amount' => 70] + ], + [ + 'data' => ['price' => 80.], + 'amount' => ['amount' => 80] + ], + [ + 'data' => ['price' => 50.], + 'amount' => ['amount' => 50] + ] + ] + ], + // second not required option + [ + 'isMultiSelection' => false, + 'data' => [ + 'title' => 'test option 2', + 'default_title' => 'test option 2', + 'type' => 'select', + 'option_id' => '2', + 'position' => '1', + 'required' => '0', + ], + 'selections' => [ + [ + 'data' => ['value' => 20.], + 'amount' => ['amount' => 20] + ] + ] + ], + // third with multi-selection + [ + 'isMultiSelection' => true, + 'data' => [ + 'title' => 'test option 3', + 'default_title' => 'test option 3', + 'type' => 'select', + 'option_id' => '3', + 'position' => '2', + 'required' => '1', + ], + 'selections' => [ + [ + 'data' => ['price' => 40.], + 'amount' => ['amount' => 40] + ], + [ + 'data' => ['price' => 20.], + 'amount' => ['amount' => 20] + ], + [ + 'data' => ['price' => 60.], + 'amount' => ['amount' => 60] + ], + ] + ], + // fourth without selections + [ + 'isMultiSelection' => true, + 'data' => [ + 'title' => 'test option 3', + 'default_title' => 'test option 3', + 'type' => 'select', + 'option_id' => '4', + 'position' => '3', + 'required' => '1', + ], + 'selections' => [] + ], + ], + 'expected' => ['min' => 70, 'max' => 220] + ] + ]; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BundleSelectionFactoryTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BundleSelectionFactoryTest.php index e933d44975cef..ab6a66deb7a37 100644 --- a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BundleSelectionFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BundleSelectionFactoryTest.php @@ -45,8 +45,8 @@ class BundleSelectionFactoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->bundleMock = $this->getMock('Magento\Framework\Pricing\Object\SaleableInterface'); - $this->selectionMock = $this->getMock('Magento\Framework\Pricing\Object\SaleableInterface'); + $this->bundleMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); + $this->selectionMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); $this->objectManagerMock = $this->getMock('Magento\Framework\ObjectManager'); @@ -61,7 +61,7 @@ protected function setUp() public function testCreate() { - $result = $this->getMock('Magento\Bundle\Pricing\Price\BundleSelectionPriceInterface'); + $result = $this->getMock('Magento\Bundle\Pricing\Price\BundleSelectionPrice', [], [], '', false); $this->objectManagerMock->expects($this->once()) ->method('create') ->with( @@ -70,7 +70,7 @@ public function testCreate() [ 'test' => 'some value', 'bundleProduct' => $this->bundleMock, - 'salableItem' => $this->selectionMock, + 'saleableItem' => $this->selectionMock, 'quantity' => 2. ] ) @@ -96,7 +96,7 @@ public function testCreateException() [ 'test' => 'some value', 'bundleProduct' => $this->bundleMock, - 'salableItem' => $this->selectionMock, + 'saleableItem' => $this->selectionMock, 'quantity' => 2. ] ) diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BundleSelectionPriceTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BundleSelectionPriceTest.php index 8bcf2ae9ea970..c878000fdd252 100644 --- a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BundleSelectionPriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BundleSelectionPriceTest.php @@ -126,14 +126,14 @@ protected function prepare() public function getPriceCallback($priceType) { switch ($priceType) { - case CatalogPrice\BasePrice::PRICE_TYPE_BASE_PRICE: + case CatalogPrice\BasePrice::PRICE_CODE: $this->basePriceMock = $this->getMock('Magento\Bundle\Pricing\Price\BasePrice', [], [], '', false); $this->basePriceMock->expects($this->once()) - ->method('applyDiscount') + ->method('calculateBaseValue') ->with($this->expectedResult) ->will($this->returnArgument(0)); return $this->basePriceMock; - case CatalogPrice\FinalPriceInterface::PRICE_TYPE_FINAL: + case CatalogPrice\FinalPrice::PRICE_CODE: $this->finalPriceMock = $this->getMock( 'Magento\Catalog\Pricing\Price\FinalPrice', [], @@ -145,7 +145,7 @@ public function getPriceCallback($priceType) ->method('getValue') ->will($this->returnValue($this->finalPriceValue)); return $this->finalPriceMock; - case CatalogPrice\RegularPrice::PRICE_TYPE_PRICE_DEFAULT: + case CatalogPrice\RegularPrice::PRICE_CODE: $this->regularPriceMock = $this->getMock( 'Magento\Catalog\Pricing\Price\RegularPrice', [], @@ -215,7 +215,7 @@ public function testGetValue($bundlePriceType, $selectionData, $expectedResult) $this->bundleSelectionPrice = $this->objectManagerHelper->getObject( 'Magento\Bundle\Pricing\Price\BundleSelectionPrice', [ - 'salableItem' => $this->saleableInterfaceMock, + 'saleableItem' => $this->saleableInterfaceMock, 'quantity' => $this->quantity, 'calculator' => $this->calculatorInterfaceMock, 'bundleProduct' => $this->productMock, diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/FinalPriceTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/FinalPriceTest.php index 6eca9f3929cd7..f1e4daf947cca 100644 --- a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/FinalPriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/FinalPriceTest.php @@ -60,7 +60,7 @@ class FinalPriceTest extends \PHPUnit_Framework_TestCase */ protected function prepareMock() { - $this->saleableInterfaceMock = $this->getMock('Magento\Framework\Pricing\Object\SaleableInterface'); + $this->saleableInterfaceMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); $this->bundleCalculatorMock = $this->getMock('Magento\Bundle\Pricing\Adjustment\BundleCalculatorInterface'); $this->basePriceMock = $this->getMock('Magento\Bundle\Pricing\Price\BasePrice', [], [], '', false); @@ -72,12 +72,13 @@ protected function prepareMock() ->disableOriginalConstructor() ->getMock(); - $this->priceInfoMock = $this->getMock('\Magento\Framework\Pricing\PriceInfoInterface'); + $this->priceInfoMock = $this->getMock('\Magento\Framework\Pricing\PriceInfo\Base', [], [], '', false); + $this->priceInfoMock->expects($this->atLeastOnce()) ->method('getPrice') ->will($this->returnValueMap([ - [\Magento\Catalog\Pricing\Price\BasePrice::PRICE_TYPE_BASE_PRICE, null, $this->basePriceMock], - [BundleOptionPriceInterface::PRICE_TYPE_BUNDLE_OPTION, $this->quantity, $this->bundleOptionMock] + [\Magento\Catalog\Pricing\Price\BasePrice::PRICE_CODE, $this->basePriceMock], + [BundleOptionPrice::PRICE_CODE, $this->quantity, $this->bundleOptionMock] ])); $this->saleableInterfaceMock->expects($this->once()) @@ -85,13 +86,10 @@ protected function prepareMock() ->will($this->returnValue($this->priceInfoMock)); $this->objectManagerHelper = new ObjectManagerHelper($this); - $this->finalPrice = $this->objectManagerHelper->getObject( - 'Magento\Bundle\Pricing\Price\FinalPrice', - [ - 'salableItem' => $this->saleableInterfaceMock, - 'quantity' => $this->quantity, - 'calculator' => $this->bundleCalculatorMock - ] + $this->finalPrice = new \Magento\Bundle\Pricing\Price\FinalPrice( + $this->saleableInterfaceMock, + $this->quantity, + $this->bundleCalculatorMock ); } @@ -107,7 +105,7 @@ public function testGetValue($baseAmount, $discountValue, $result) ->method('getValue') ->will($this->returnValue($optionsValue)); - $this->basePriceMock->expects($this->once())->method('applyDiscount') + $this->basePriceMock->expects($this->once())->method('calculateBaseValue') ->with($this->equalTo($optionsValue)) ->will($this->returnValue($discountValue)); diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/GroupPriceTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/GroupPriceTest.php index 08bbf7794567a..ce72d34bea88a 100644 --- a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/GroupPriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/GroupPriceTest.php @@ -58,7 +58,7 @@ public function setUp() $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->model = $objectHelper->getObject('Magento\Bundle\Pricing\Price\GroupPrice', [ - 'salableItem' => $this->saleable + 'saleableItem' => $this->saleable ]); } @@ -85,7 +85,7 @@ public function testGetValue($basePrice, $storedGroupPrice, $value) $price = $this->getMock('Magento\Framework\Pricing\Price\PriceInterface'); $this->priceInfo->expects($this->once()) ->method('getPrice') - ->with(\Magento\Catalog\Pricing\Price\BasePrice::PRICE_TYPE_BASE_PRICE, null) + ->with(\Magento\Catalog\Pricing\Price\BasePrice::PRICE_CODE) ->will($this->returnValue($price)); $price->expects($this->once()) ->method('getValue') diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/SpecialPriceTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/SpecialPriceTest.php index 7f701ca511553..df83f0af3584b 100644 --- a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/SpecialPriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/SpecialPriceTest.php @@ -63,7 +63,7 @@ public function setUp() $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->model = $objectHelper->getObject('Magento\Bundle\Pricing\Price\SpecialPrice', [ - 'salableItem' => $this->saleable, + 'saleableItem' => $this->saleable, 'localeDate' => $this->localeDate ]); } @@ -106,7 +106,7 @@ public function testGetValue($basePrice, $specialPrice, $isScopeDateInInterval, $price = $this->getMock('Magento\Framework\Pricing\Price\PriceInterface'); $this->priceInfo->expects($this->once()) ->method('getPrice') - ->with(\Magento\Catalog\Pricing\Price\BasePrice::PRICE_TYPE_BASE_PRICE, null) + ->with(\Magento\Catalog\Pricing\Price\BasePrice::PRICE_CODE) ->will($this->returnValue($price)); $price->expects($this->once()) ->method('getValue') @@ -123,9 +123,9 @@ public function testGetValue($basePrice, $specialPrice, $isScopeDateInInterval, public function getValueDataProvider() { return array( - ['basePrice' => 100, 'specialPrice' => 40, 'isScopeDateInInterval' => true, 'value' => 60], - ['basePrice' => 75, 'specialPrice' => 40, 'isScopeDateInInterval' => true, 'value' => 45], - ['basePrice' => 75, 'specialPrice' => 40, 'isScopeDateInInterval' => false, 'value' => false], + ['basePrice' => 100, 'specialPrice' => 40, 'isScopeDateInInterval' => true, 'value' => 60], + ['basePrice' => 75, 'specialPrice' => 40, 'isScopeDateInInterval' => true, 'value' => 45], + ['basePrice' => 75, 'specialPrice' => 40, 'isScopeDateInInterval' => false, 'value' => false], ); } } diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/TierPriceTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/TierPriceTest.php index 50261155e18ae..516dcc4679aa3 100644 --- a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/TierPriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/TierPriceTest.php @@ -69,7 +69,7 @@ protected function setUp() $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->model = $objectHelper->getObject('Magento\Bundle\Pricing\Price\TierPrice', [ - 'salableItem' => $this->product, + 'saleableItem' => $this->product, 'calculator' => $this->calculator ]); } @@ -80,7 +80,7 @@ protected function setUp() */ public function testGetterTierPriceList($tierPrices, $basePrice, $expectedResult) { - $this->product->setData(TierPrice::PRICE_TYPE_TIER, $tierPrices); + $this->product->setData(TierPrice::PRICE_CODE, $tierPrices); $price = $this->getMock('Magento\Framework\Pricing\Price\PriceInterface'); $price->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Render/FinalPriceBoxTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Render/FinalPriceBoxTest.php index 946774a100a4e..8de3e597e9005 100644 --- a/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Render/FinalPriceBoxTest.php +++ b/dev/tests/unit/testsuite/Magento/Bundle/Pricing/Render/FinalPriceBoxTest.php @@ -66,7 +66,7 @@ public function testShowRangePrice($value, $maxValue, $result) $priceInfo->expects($this->atLeastOnce()) ->method('getPrice') - ->with(Price\BundleOptionPriceInterface::PRICE_TYPE_BUNDLE_OPTION) + ->with(Price\BundleOptionPrice::PRICE_CODE) ->will($this->returnValue($optionPrice)); $optionPrice->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/EraserTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/EraserTest.php new file mode 100644 index 0000000000000..f21da8f4874c7 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/EraserTest.php @@ -0,0 +1,109 @@ +getMock('Magento\Framework\App\Resource', array(), array(), '', false); + $this->connection = $this->getMock('Magento\Framework\DB\Adapter\AdapterInterface'); + $resource->expects($this->any())->method('getConnection')->will($this->returnValue($this->connection)); + $this->indexerHelper = $this->getMock( + 'Magento\Catalog\Helper\Product\Flat\Indexer', + array(), + array(), '', false + ); + $this->indexerHelper->expects($this->any())->method('getTable')->will($this->returnArgument(0)); + $this->indexerHelper->expects($this->any())->method('getFlatTableName')->will($this->returnValueMap(array( + array(1, 'store_1_flat'), + array(2, 'store_2_flat'), + ))); + + $this->storeManager = $this->getMock('Magento\Store\Model\StoreManagerInterface'); + $this->model = new \Magento\Catalog\Model\Indexer\Product\Flat\Action\Eraser( + $resource, + $this->indexerHelper, + $this->storeManager + ); + } + + public function testRemoveDeletedProducts() + { + $productsToDeleteIds = array(1, 2); + $select = $this->getMock('\Magento\Framework\Db\Select', array(), array(), '', false); + $select->expects($this->once())->method('from')->with('catalog_product_entity')->will($this->returnSelf()); + $select->expects($this->once())->method('where')->with('entity_id IN(?)', $productsToDeleteIds) + ->will($this->returnSelf()); + $products = array(array('entity_id' => 2)); + $statement = $this->getMock('\Zend_Db_Statement_Interface'); + $statement->expects($this->once())->method('fetchAll')->will($this->returnValue($products)); + $this->connection->expects($this->once())->method('query')->with($select) + ->will($this->returnValue($statement)); + $this->connection->expects($this->once())->method('select')->will($this->returnValue($select)); + $this->connection->expects($this->once())->method('delete') + ->with('store_1_flat', array('entity_id IN(?)' => array(1))); + + $this->model->removeDeletedProducts($productsToDeleteIds, 1); + } + + public function testDeleteProductsFromStoreForAllStores() + { + $store1 = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); + $store1->expects($this->any())->method('getId')->will($this->returnValue(1)); + $store2 = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); + $store2->expects($this->any())->method('getId')->will($this->returnValue(2)); + $this->storeManager->expects($this->once())->method('getStores') + ->will($this->returnValue(array($store1, $store2))); + $this->connection->expects($this->at(0))->method('delete') + ->with('store_1_flat', array('entity_id IN(?)' => array(1))); + $this->connection->expects($this->at(1))->method('delete') + ->with('store_2_flat', array('entity_id IN(?)' => array(1))); + + $this->model->deleteProductsFromStore(1); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php index 7587adbf284f7..dc6779516c57c 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php @@ -31,22 +31,105 @@ class RowTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Catalog\Model\Indexer\Product\Flat\Action\Rows + * @var \Magento\Catalog\Model\Indexer\Product\Flat\Action\Row */ - protected $_model; + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManager; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $store; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productIndexerHelper; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $resource; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $connection; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $flatItemWriter; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $flatItemEraser; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $flatTableBuilder; public function setUp() { $objectManager = new ObjectManager($this); - $this->_model = $objectManager->getObject('Magento\Catalog\Model\Indexer\Product\Flat\Action\Row'); + + $this->connection = $this->getMock('\Magento\Framework\DB\Adapter\AdapterInterface'); + $this->resource = $this->getMock('Magento\Framework\App\Resource', array(), array(), '', false); + $this->resource->expects($this->any())->method('getConnection') + ->with('default') + ->will($this->returnValue($this->connection)); + $this->storeManager = $this->getMock('Magento\Store\Model\StoreManagerInterface'); + $this->store = $this->getMock('Magento\Store\Model\Store', array(), array(), '', false); + $this->store->expects($this->any())->method('getId')->will($this->returnValue('store_id_1')); + $this->storeManager->expects($this->any())->method('getStores')->will($this->returnValue(array($this->store))); + $this->productIndexerHelper = $this->getMock( + 'Magento\Catalog\Helper\Product\Flat\Indexer', array(), array(), '', false + ); + $this->flatItemEraser = $this->getMock( + '\Magento\Catalog\Model\Indexer\Product\Flat\Action\Eraser', array(), array(), '', false + ); + $this->flatItemWriter = $this->getMock( + '\Magento\Catalog\Model\Indexer\Product\Flat\Action\Indexer', array(), array(), '', false + ); + $this->flatTableBuilder = $this->getMock( + '\Magento\Catalog\Model\Indexer\Product\Flat\FlatTableBuilder', array(), array(), '', false + ); + + $this->model = $objectManager->getObject('Magento\Catalog\Model\Indexer\Product\Flat\Action\Row', array( + 'resource' => $this->resource, + 'storeManager' => $this->storeManager, + 'productHelper' => $this->productIndexerHelper, + 'flatItemEraser' => $this->flatItemEraser, + 'flatItemWriter' => $this->flatItemWriter, + 'flatTableBuilder' => $this->flatTableBuilder + )); } /** * @expectedException \Magento\Framework\Model\Exception * @expectedExceptionMessage Could not rebuild index for undefined product */ - public function testEmptyId() + public function testExecuteWithEmptyId() { - $this->_model->execute(null); + $this->model->execute(null); + } + + public function testExecuteWithNonExistingFlatTablesCreatesTables() + { + $this->productIndexerHelper->expects($this->any())->method('getFlatTableName') + ->will($this->returnValue('store_flat_table')); + $this->connection->expects($this->any())->method('isTableExists')->with('store_flat_table') + ->will($this->returnValue(false)); + $this->flatItemEraser->expects($this->never())->method('removeDeletedProducts'); + $this->flatTableBuilder->expects($this->once())->method('build')->with('store_id_1', array('product_id_1')); + $this->flatItemWriter->expects($this->once())->method('write')->with('store_id_1', 'product_id_1'); + $this->model->execute('product_id_1'); } } + diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/Type/FileTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/Type/FileTest.php new file mode 100644 index 0000000000000..d8eb55266ac30 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/Type/FileTest.php @@ -0,0 +1,114 @@ +objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->rootDirectory = $this->getMockBuilder('Magento\Framework\Filesystem\Directory\ReadInterface') + ->disableOriginalConstructor() + ->setMethods(['isFile', 'isReadable', 'getAbsolutePath']) + ->getMockForAbstractClass(); + + $this->coreFileStorageDatabase = $this->getMock( + 'Magento\Core\Helper\File\Storage\Database', + ['copyFile'], + [], + '', + false + ); + } + + /** + * @return \Magento\Catalog\Model\Product\Option\Type\File + */ + protected function getFileObject() + { + return $this->objectManager->getObject( + 'Magento\Catalog\Model\Product\Option\Type\File', + [ + 'saleableItem' => $this->rootDirectory, + 'priceCurrency' => $this->coreFileStorageDatabase + ] + ); + } + + public function testCopyQuoteToOrder() + { + $optionMock = $this->getMockBuilder( + 'Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface' + )->disableOriginalConstructor()->setMethods(['getValue'])->getMockForAbstractClass(); + + $quotePath = '/quote/path/path/uploaded.file'; + $orderPath = '/order/path/path/uploaded.file'; + + $optionMock->expects($this->any()) + ->method('getValue') + ->will($this->returnValue(['quote_path' => $quotePath, 'order_path' => $orderPath])); + + $this->rootDirectory->expects($this->any()) + ->method('isFile') + ->with($this->equalTo($quotePath)) + ->will($this->returnValue(true)); + + $this->rootDirectory->expects($this->any()) + ->method('isReadable') + ->with($this->equalTo($quotePath)) + ->will($this->returnValue(true)); + + $this->rootDirectory->expects($this->any()) + ->method('getAbsolutePath') + ->will($this->returnValue('/file.path')); + + $this->coreFileStorageDatabase->expects($this->any()) + ->method('copyFile') + ->will($this->returnValue('true')); + + $fileObject = $this->getFileObject(); + $fileObject->setData('configuration_item_option', $optionMock); + + $this->assertInstanceOf( + 'Magento\Catalog\Model\Product\Option\Type\File', + $fileObject->copyQuoteToOrder() + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php index 8672f4cbbdbbe..ad23bbc4e9fa4 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php @@ -253,4 +253,13 @@ public function testReloadPriceInfo() $this->assertEquals($this->_priceInfoMock, $this->model->getPriceInfo()); $this->assertEquals($this->_priceInfoMock, $this->model->reloadPriceInfo()); } + + /** + * Test for get qty + */ + public function testGetQty() + { + $this->model->setQty(1); + $this->assertEquals(1, $this->model->getQty()); + } } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/BasePriceTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/BasePriceTest.php index a8255cd56ce73..b0f87ecaccd1a 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/BasePriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/BasePriceTest.php @@ -41,7 +41,7 @@ class BasePriceTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject */ - protected $salableItemMock; + protected $saleableItemMock; /** * @var \Magento\Framework\Pricing\Adjustment\Calculator @@ -74,14 +74,14 @@ class BasePriceTest extends \PHPUnit_Framework_TestCase public function setUp() { $qty = 1; - $this->salableItemMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); + $this->saleableItemMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); $this->priceInfoMock = $this->getMock('Magento\Framework\Pricing\PriceInfo\Base', [], [], '', false); $this->regularPriceMock = $this->getMock('Magento\Catalog\Pricing\Price\RegularPrice', [], [], '', false); $this->groupPriceMock = $this->getMock('Magento\Catalog\Pricing\Price\GroupPrice', [], [], '', false); $this->specialPriceMock= $this->getMock('Magento\Catalog\Pricing\Price\SpecialPrice', [], [], '', false); $this->calculatorMock = $this->getMock('Magento\Framework\Pricing\Adjustment\Calculator', [], [], '', false); - $this->salableItemMock->expects($this->once()) + $this->saleableItemMock->expects($this->once()) ->method('getPriceInfo') ->will($this->returnValue($this->priceInfoMock)); $this->prices = [ @@ -89,7 +89,7 @@ public function setUp() 'group_price' => $this->groupPriceMock, 'special_price' => $this->specialPriceMock ]; - $this->basePrice = new BasePrice($this->salableItemMock, $qty, $this->calculatorMock); + $this->basePrice = new BasePrice($this->saleableItemMock, $qty, $this->calculatorMock); } /** @@ -99,15 +99,15 @@ public function testGetValue() { $specialPriceValue = 77; $this->priceInfoMock->expects($this->once()) - ->method('getPricesIncludedInBase') + ->method('getPrices') ->will($this->returnValue($this->prices)); - $this->regularPriceMock->expects($this->exactly(2)) + $this->regularPriceMock->expects($this->exactly(3)) ->method('getValue') ->will($this->returnValue(100)); - $this->groupPriceMock->expects($this->once()) + $this->groupPriceMock->expects($this->exactly(2)) ->method('getValue') ->will($this->returnValue(99)); - $this->specialPriceMock->expects($this->once()) + $this->specialPriceMock->expects($this->exactly(2)) ->method('getValue') ->will($this->returnValue($specialPriceValue)); $this->assertSame($specialPriceValue, $this->basePrice->getValue()); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/OptionPriceTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/CustomOptionPriceTest.php similarity index 75% rename from dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/OptionPriceTest.php rename to dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/CustomOptionPriceTest.php index cad83d025ba33..01940100fe92f 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/OptionPriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/CustomOptionPriceTest.php @@ -31,10 +31,10 @@ /** * Class OptionPriceTest */ -class OptionPriceTest extends \PHPUnit_Framework_TestCase +class CustomOptionPriceTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Catalog\Pricing\Price\OptionPrice + * @var \Magento\Catalog\Pricing\Price\CustomOptionPrice */ protected $object; @@ -107,11 +107,74 @@ protected function setUp() } /** - * Return value + * Test getValue() */ public function testGetValue() { + $price = 100; + $minPrice = 10; $optionId = 1; + $type = 'select'; + + $optionValueMax = $this->getOptionValueMock($price); + $optionValueMin = $this->getOptionValueMock($minPrice); + + $optionItemMock = $this->getMockBuilder('Magento\Catalog\Model\Product\Option') + ->disableOriginalConstructor() + ->setMethods(['getValues', '__wakeup', 'getIsRequire', 'getId', 'getType']) + ->getMock(); + $optionItemMock->expects($this->once()) + ->method('getId') + ->will($this->returnValue($optionId)); + $optionItemMock->expects($this->once()) + ->method('getType') + ->will($this->returnValue($type)); + $optionItemMock->expects($this->once()) + ->method('getIsRequire') + ->will($this->returnValue(true)); + $optionItemMock->expects($this->any()) + ->method('getValues') + ->will($this->returnValue([$optionValueMax, $optionValueMin])); + $options = [$optionItemMock]; + $this->product->expects($this->once()) + ->method('getOptions') + ->will($this->returnValue($options)); + + $result = $this->object->getValue(); + $this->assertCount(1, $result); + $this->assertArrayHasKey('option_id', $result[0]); + $this->assertArrayHasKey('type', $result[0]); + $this->assertArrayHasKey('min', $result[0]); + $this->assertEquals($minPrice, $result[0]['min']); + } + + /** + * @param int $price + * @return \PHPUnit_Framework_MockObject_MockObject + */ + protected function getOptionValueMock($price) + { + $optionValueMock = $this->getMockBuilder('Magento\Catalog\Model\Product\Option\Value') + ->disableOriginalConstructor() + ->setMethods(['getPriceType', 'getPrice', 'getId', '__wakeup']) + ->getMock(); + $optionValueMock->expects($this->once()) + ->method('getPriceType') + ->will($this->returnValue('percent')); + $optionValueMock->expects($this->once()) + ->method('getPrice') + ->with($this->equalTo(true)) + ->will($this->returnValue($price)); + return $optionValueMock; + } + + /** + * Test getSelectedOptions() + */ + public function testGetSelectedOptions() + { + $optionId1 = 1; + $optionId2 = 2; $optionValue = 10; $optionType = 'select'; $optionValueMock = $this->getMockBuilder('Magento\Catalog\Model\Product\Option\DefaultType') @@ -141,7 +204,7 @@ public function testGetValue() ->will($this->returnValue($optionValue)); $optionMock->expects($this->at(0)) ->method('getId') - ->will($this->returnValue($optionId)); + ->will($this->returnValue($optionId1)); $optionMock->expects($this->once()) ->method('getType') ->will($this->returnValue($optionType)); @@ -152,19 +215,21 @@ public function testGetValue() $optionValueMock->expects($this->once()) ->method('getValue') ->will($this->returnValue($optionValue)); - $optionIds = new \Magento\Framework\Object(['value' => '1']); + $optionIds = new \Magento\Framework\Object(['value' => '1,2']); - $customOptions = ['option_ids' => $optionIds, 'option_1' => $optionValueMock]; + $customOptions = ['option_ids' => $optionIds, 'option_1' => $optionValueMock, 'option_2' => null]; $this->product->setCustomOptions($customOptions); - $this->product->expects($this->once()) + $this->product->expects($this->at(0)) ->method('getOptionById') - ->with($this->equalTo($optionId)) + ->with($this->equalTo($optionId1)) ->will($this->returnValue($optionMock)); - $result = $this->object->getValue(); - $this->equalTo($optionValue, $result); + $this->product->expects($this->at(1)) + ->method('getOptionById') + ->with($this->equalTo($optionId2)) + ->will($this->returnValue(null)); // Return from cache - $result = $this->object->getValue(); + $result = $this->object->getSelectedOptions(); $this->equalTo($optionValue, $result); } @@ -186,17 +251,7 @@ public function testGetOptions() ->method('getAmount') ->will($this->returnValue($this->amount)); - $optionValueMock = $this->getMockBuilder('Magento\Catalog\Model\Product\Option\Value') - ->disableOriginalConstructor() - ->setMethods(['getPriceType', 'getPrice', 'getId', '__wakeup']) - ->getMock(); - $optionValueMock->expects($this->once()) - ->method('getPriceType') - ->will($this->returnValue('percent')); - $optionValueMock->expects($this->once()) - ->method('getPrice') - ->with($this->equalTo(true)) - ->will($this->returnValue($price)); + $optionValueMock = $this->getOptionValueMock($price); $optionValueMock->expects($this->once()) ->method('getId') ->will($this->returnValue($id)); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/FinalPriceTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/FinalPriceTest.php index 123a108585e88..efad3b08029f3 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/FinalPriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/FinalPriceTest.php @@ -59,7 +59,13 @@ class FinalPriceTest extends \PHPUnit_Framework_TestCase public function setUp() { $this->saleableMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); - $this->priceInfoMock = $this->getMockForAbstractClass('Magento\Framework\Pricing\PriceInfoInterface'); + $this->priceInfoMock = $this->basePriceMock = $this->getMock( + 'Magento\Framework\Pricing\PriceInfo\Base', + [], + [], + '', + false + ); $this->basePriceMock = $this->getMock( 'Magento\Catalog\Pricing\Price\BasePrice', [], @@ -68,16 +74,21 @@ public function setUp() false ); + $this->calculatorMock = $this->getMock( + 'Magento\Framework\Pricing\Adjustment\Calculator', + [], + [], + '', + false + ); + $this->saleableMock->expects($this->once()) ->method('getPriceInfo') ->will($this->returnValue($this->priceInfoMock)); $this->priceInfoMock->expects($this->once()) ->method('getPrice') - ->with($this->equalTo(\Magento\Catalog\Pricing\Price\BasePrice::PRICE_TYPE_BASE_PRICE)) + ->with($this->equalTo(\Magento\Catalog\Pricing\Price\BasePrice::PRICE_CODE)) ->will($this->returnValue($this->basePriceMock)); - $this->calculatorMock = $this->getMockBuilder('Magento\Framework\Pricing\Adjustment\Calculator') - ->disableOriginalConstructor() - ->getMock(); $this->model = new \Magento\Catalog\Pricing\Price\FinalPrice($this->saleableMock, 1, $this->calculatorMock); } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/GroupPriceTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/GroupPriceTest.php index 82c225547fd3e..cc3ac4c83a844 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/GroupPriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/GroupPriceTest.php @@ -48,12 +48,12 @@ public function setUp() */ public function testGroupPrice($groupPrice, $customerGroup, $expected) { - $salableItemMock = $this->prepareSalableItem($groupPrice); - $sessionMock = $this->prepareSession($salableItemMock, $customerGroup); + $saleableItemMock = $this->prepareSaleableItem($groupPrice); + $sessionMock = $this->prepareSession($saleableItemMock, $customerGroup); $groupPriceModel = $this->objectManager->getObject( 'Magento\Catalog\Pricing\Price\GroupPrice', [ - 'salableItem' => $salableItemMock, + 'saleableItem' => $saleableItemMock, 'customerSession' => $sessionMock ] ); @@ -61,18 +61,18 @@ public function testGroupPrice($groupPrice, $customerGroup, $expected) } /** - * @param \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Product $salableItemMock + * @param \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Product $saleableItemMock * @param int $customerGroup * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Customer\Model\Session */ - protected function prepareSession($salableItemMock, $customerGroup) + protected function prepareSession($saleableItemMock, $customerGroup) { $session = $this->getMock('Magento\Customer\Model\Session', ['getCustomerGroupId'], [], '', false); $session->expects($this->any()) ->method('getCustomerGroupId') ->will($this->returnValue($customerGroup)); - $salableItemMock->expects($this->any()) + $saleableItemMock->expects($this->any()) ->method('getCustomerGroupId') ->will($this->returnValue(false)); @@ -90,21 +90,24 @@ public function testGroupPriceNonExist($groupPrice, $expected) $groupPriceModel = $this->objectManager->getObject( 'Magento\Catalog\Pricing\Price\GroupPrice', [ - 'salableItem' => $this->prepareSalableItem($groupPrice), + 'saleableItem' => $this->prepareSaleableItem($groupPrice), 'customerSession' => $this->getMock('Magento\Customer\Model\Session', [], [], '', false) ] ); $this->assertEquals($expected, $groupPriceModel->getValue()); + + //Verify that storedGroupPrice is cached + $this->assertEquals($expected, $groupPriceModel->getValue()); } /** * @param array|null $groupPrice * @return \PHPUnit_Framework_MockObject_MockObject */ - protected function prepareSalableItem($groupPrice) + protected function prepareSaleableItem($groupPrice) { - $salableItemMock = $this->getMock( + $saleableItemMock = $this->getMock( 'Magento\Catalog\Model\Product', ['getCustomerGroupId', 'getData', 'getPrice', 'getPriceInfo', 'getResource', '__wakeup'], [], @@ -112,17 +115,17 @@ protected function prepareSalableItem($groupPrice) false ); - $salableItemMock->expects($this->at(1)) + $saleableItemMock->expects($this->at(1)) ->method('getData') ->will($this->returnValue(null)); - $salableItemMock->expects($this->at(2)) + $saleableItemMock->expects($this->at(2)) ->method('getData') ->will($this->returnValue($groupPrice)); - $salableItemMock->expects($this->any()) + $saleableItemMock->expects($this->any()) ->method('getResource') - ->will($this->returnValue($this->prepareSalableItemResource())); + ->will($this->returnValue($this->prepareSaleableItemResource())); $priceInfo = $this->getMockBuilder( 'Magento\Framework\Pricing\PriceInfoInterface' @@ -132,17 +135,17 @@ protected function prepareSalableItem($groupPrice) ->method('getAdjustments') ->will($this->returnValue([])); - $salableItemMock->expects($this->any()) + $saleableItemMock->expects($this->any()) ->method('getPriceInfo') ->will($this->returnValue($priceInfo)); - return $salableItemMock; + return $saleableItemMock; } /** * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Resource\Product */ - protected function prepareSalableItemResource() + protected function prepareSaleableItemResource() { $resourceMock = $this->getMockBuilder( 'Magento\Catalog\Model\Resource\Product' diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/RegularPriceTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/RegularPriceTest.php index 3a5e51b77435d..ae59eb1825332 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/RegularPriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/RegularPriceTest.php @@ -39,18 +39,13 @@ class RegularPriceTest extends \PHPUnit_Framework_TestCase */ protected $priceInfoMock; - /** - * @var \Magento\Framework\Pricing\Amount\Base|\PHPUnit_Framework_MockObject_MockObject - */ - protected $amountMock; - /** * @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject */ - protected $salableItemMock; + protected $saleableItemMock; /** - * @var \Magento\Framework\Pricing\Adjustment\Calculator + * @var \Magento\Framework\Pricing\Adjustment\Calculator|\PHPUnit_Framework_MockObject_MockObject */ protected $calculatorMock; @@ -60,15 +55,15 @@ class RegularPriceTest extends \PHPUnit_Framework_TestCase protected function setUp() { $qty = 1; - $this->salableItemMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); + $this->saleableItemMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); $this->priceInfoMock = $this->getMock('Magento\Framework\Pricing\PriceInfo\Base', [], [], '', false); $this->amountMock = $this->getMock('Magento\Framework\Pricing\Amount', [], [], '', false); $this->calculatorMock = $this->getMock('Magento\Framework\Pricing\Adjustment\Calculator', [], [], '', false); - $this->salableItemMock->expects($this->once()) + $this->saleableItemMock->expects($this->once()) ->method('getPriceInfo') ->will($this->returnValue($this->priceInfoMock)); - $this->regularPrice = new RegularPrice($this->salableItemMock, $qty, $this->calculatorMock); + $this->regularPrice = new RegularPrice($this->saleableItemMock, $qty, $this->calculatorMock); } /** @@ -79,7 +74,7 @@ protected function setUp() */ public function testGetValue($price) { - $this->salableItemMock->expects($this->once()) + $this->saleableItemMock->expects($this->once()) ->method('getPrice') ->will($this->returnValue($price)); $this->assertEquals($price, $this->regularPrice->getValue()); @@ -109,7 +104,7 @@ public function testGetAmount() ->method('getAmount') ->with($this->equalTo($priceValue)) ->will($this->returnValue($amountValue)); - $this->salableItemMock->expects($this->once()) + $this->saleableItemMock->expects($this->once()) ->method('getPrice') ->will($this->returnValue($priceValue)); @@ -119,8 +114,8 @@ public function testGetAmount() /** * Test method getPriceType */ - public function testGetPriceType() + public function testGetPriceCode() { - $this->assertEquals(RegularPrice::PRICE_TYPE_PRICE_DEFAULT, $this->regularPrice->getPriceType()); + $this->assertEquals(RegularPrice::PRICE_CODE, $this->regularPrice->getPriceCode()); } } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/SpecialPriceTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/SpecialPriceTest.php index 9ae61efe3e02a..ba406d5cbf30b 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/SpecialPriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/SpecialPriceTest.php @@ -48,7 +48,7 @@ public function testGetValue($isValidInterval, $specialPrice, $expected) $specialPriceModel = $this->objectManager->getObject( 'Magento\Catalog\Pricing\Price\SpecialPrice', [ - 'salableItem' => $this->prepareSalebleItem($specialPrice), + 'saleableItem' => $this->prepareSaleableItem($specialPrice), 'localeDate' => $this->prepareLocaleDate($isValidInterval) ] ); @@ -60,9 +60,9 @@ public function testGetValue($isValidInterval, $specialPrice, $expected) * @param float $specialPrice * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Product */ - protected function prepareSalebleItem($specialPrice) + protected function prepareSaleableItem($specialPrice) { - $salableItemMock = $this->getMock( + $saleableItemMock = $this->getMock( 'Magento\Catalog\Model\Product', ['getSpecialPrice', 'getPriceInfo', 'getStore', '__wakeup'], [], @@ -70,7 +70,7 @@ protected function prepareSalebleItem($specialPrice) false ); - $salableItemMock->expects($this->any()) + $saleableItemMock->expects($this->any()) ->method('getSpecialPrice') ->will($this->returnValue($specialPrice)); @@ -82,11 +82,11 @@ protected function prepareSalebleItem($specialPrice) ->method('getAdjustments') ->will($this->returnValue([])); - $salableItemMock->expects($this->any()) + $saleableItemMock->expects($this->any()) ->method('getPriceInfo') ->will($this->returnValue($priceInfo)); - return $salableItemMock; + return $saleableItemMock; } /** diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/TierPriceTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/TierPriceTest.php index c8ca757b05cbd..d578dd0a4498e 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/TierPriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Price/TierPriceTest.php @@ -105,7 +105,7 @@ protected function setUp() */ public function testBaseInitialization($tierPrices, $expectedValue) { - $this->product->setData(TierPrice::PRICE_TYPE_TIER, $tierPrices); + $this->product->setData(TierPrice::PRICE_CODE, $tierPrices); $this->assertEquals($expectedValue, $this->model->getValue()); } @@ -158,7 +158,7 @@ public function testGetterStoredTierPrices() $attributeMock->expects($this->once())->method('getBackend')->will($this->returnValue($backendMock)); $productResource = $this->getMock('Magento\Catalog\Model\Resource\Product', [], [], '', false); - $productResource->expects($this->once())->method('getAttribute')->with(TierPrice::PRICE_TYPE_TIER) + $productResource->expects($this->once())->method('getAttribute')->with(TierPrice::PRICE_CODE) ->will($this->returnValue($attributeMock)); $this->product->expects($this->once())->method('getResource')->will($this->returnValue($productResource)); @@ -179,7 +179,7 @@ public function testGetterStoredTierPrices() */ public function testGetterTierPriceList($tierPrices, $basePrice, $expectedResult) { - $this->product->setData(TierPrice::PRICE_TYPE_TIER, $tierPrices); + $this->product->setData(TierPrice::PRICE_CODE, $tierPrices); $price = $this->getMock('Magento\Framework\Pricing\Price\PriceInterface', [], [], '', false); $price->expects($this->any())->method('getValue')->will($this->returnValue($basePrice)); @@ -268,16 +268,21 @@ public function providerForGetterTierPriceList() */ public function testGetSavePercent($basePrice, $tierPrice, $savedPercent) { + $priceAmount = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface'); + $priceAmount->expects($this->once()) + ->method('getBaseAmount') + ->will($this->returnValue($basePrice)); + $price = $this->getMock('Magento\Framework\Pricing\Price\PriceInterface'); $price->expects($this->any()) - ->method('getValue') - ->will($this->returnValue($basePrice)); + ->method('getAmount') + ->will($this->returnValue($priceAmount)); $this->priceInfo->expects($this->atLeastOnce()) ->method('getPrice') ->will($this->returnValue($price)); - $amount = $this->getMock('Magento\Framework\Pricing\Amount\AmountInterface'); + $amount = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface'); $amount->expects($this->atLeastOnce()) ->method('getBaseAmount') ->will($this->returnValue($tierPrice)); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Render/FinalPriceBoxTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Render/FinalPriceBoxTest.php index 1560127a30b44..a452910afa836 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Render/FinalPriceBoxTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Render/FinalPriceBoxTest.php @@ -76,26 +76,8 @@ class FinalPriceBoxTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->product = $this->getMockForAbstractClass( - 'Magento\Framework\Pricing\Object\SaleableInterface', - [], - '', - true, - true, - true, - ['getPriceInfo', '__wakeup'] - ); - - $this->priceType = $this->getMockBuilder('Magento\Catalog\Pricing\Price\MsrpPrice') - ->disableOriginalConstructor() - ->setMethods(['isShowPriceOnGesture', 'getMsrpPriceMessage', 'canApplyMsrp']) - ->getMock(); - - $this->priceInfo = $this->getMockBuilder('Magento\Framework\Pricing\PriceInfo') - ->disableOriginalConstructor() - ->setMethods(['getPrice']) - ->getMock(); - + $this->product = $this->getMock('Magento\Catalog\Model\Product', ['getPriceInfo', '__wakeup'], [], '', false); + $this->priceInfo = $this->getMock('Magento\Framework\Pricing\PriceInfo', ['getPrice'], [], '', false); $this->product->expects($this->any()) ->method('getPriceInfo') ->will($this->returnValue($this->priceInfo)); @@ -107,7 +89,6 @@ protected function setUp() $this->priceBox = $this->getMock('Magento\Framework\Pricing\Render\PriceBox', [], [], '', false); $this->logger = $this->getMock('Magento\Framework\Logger', [], [], '', false); - $this->layout->expects($this->any()) ->method('getBlock') ->will($this->returnValue($this->priceBox)); @@ -136,8 +117,8 @@ protected function setUp() $this->price = $this->getMock('Magento\Framework\Pricing\Price\PriceInterface'); $this->price->expects($this->any()) - ->method('getPriceType') - ->will($this->returnValue(\Magento\Catalog\Pricing\Price\FinalPriceInterface::PRICE_TYPE_FINAL)); + ->method('getPriceCode') + ->will($this->returnValue(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)); $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $this->object = $objectManager->getObject( @@ -153,12 +134,13 @@ protected function setUp() public function testRenderMsrpDisabled() { + $priceType = $this->getMock('Magento\Catalog\Pricing\Price\MsrpPrice', [], [], '', false); $this->priceInfo->expects($this->once()) ->method('getPrice') ->with($this->equalTo('msrp_price')) - ->will($this->returnValue($this->priceType)); + ->will($this->returnValue($priceType)); - $this->priceType->expects($this->any()) + $priceType->expects($this->any()) ->method('canApplyMsrp') ->with($this->equalTo($this->product)) ->will($this->returnValue(false)); @@ -173,12 +155,13 @@ public function testRenderMsrpDisabled() public function testRenderMsrpEnabled() { + $priceType = $this->getMock('Magento\Catalog\Pricing\Price\MsrpPrice', [], [], '', false); $this->priceInfo->expects($this->once()) ->method('getPrice') ->with($this->equalTo('msrp_price')) - ->will($this->returnValue($this->priceType)); + ->will($this->returnValue($priceType)); - $this->priceType->expects($this->any()) + $priceType->expects($this->any()) ->method('canApplyMsrp') ->with($this->equalTo($this->product)) ->will($this->returnValue(true)); @@ -218,4 +201,124 @@ public function testRenderMsrpNotRegisteredException() //assert css_selector $this->assertRegExp('/[final_price]/', $result); } + + public function testRenderAmountMinimal() + { + $priceType = $this->getMock('Magento\Catalog\Pricing\Price\FinalPrice', [], [], '', false); + $amount = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface'); + $priceId = 'price_id'; + $html = 'html'; + $this->object->setData('price_id', $priceId); + + $arguments = [ + 'display_label' => __('As low as:'), + 'price_id' => $priceId, + 'include_container' => false, + 'skip_adjustments' => true + ]; + + $amountRender = $this->getMock('Magento\Framework\Pricing\Render\Amount', ['toHtml'], [], '', false); + $amountRender->expects($this->once()) + ->method('toHtml') + ->will($this->returnValue($html)); + + $this->priceInfo->expects($this->once()) + ->method('getPrice') + ->with(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE) + ->will($this->returnValue($priceType)); + + $priceType->expects($this->once()) + ->method('getMinimalPrice') + ->will($this->returnValue($amount)); + + $this->rendererPool->expects($this->once()) + ->method('createAmountRender') + ->with($amount, $this->product, $this->price, $arguments) + ->will($this->returnValue($amountRender)); + + $this->assertEquals($html, $this->object->renderAmountMinimal()); + } + + /** + * @dataProvider hasSpecialPriceProvider + * @param float $regularPrice + * @param float $finalPrice + * @param bool $expectedResult + */ + public function testHasSpecialPrice($regularPrice, $finalPrice, $expectedResult) + { + $regularPriceType = $this->getMock('Magento\Catalog\Pricing\Price\RegularPrice', [], [], '', false); + $finalPriceType = $this->getMock('Magento\Catalog\Pricing\Price\FinalPrice', [], [], '', false); + $regularPriceAmount = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface'); + $finalPriceAmount = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface'); + + $regularPriceAmount->expects($this->once()) + ->method('getValue') + ->will($this->returnValue($regularPrice)); + $finalPriceAmount->expects($this->once()) + ->method('getValue') + ->will($this->returnValue($finalPrice)); + + $regularPriceType->expects($this->once()) + ->method('getAmount') + ->will($this->returnValue($regularPriceAmount)); + $finalPriceType->expects($this->once()) + ->method('getAmount') + ->will($this->returnValue($finalPriceAmount)); + + $this->priceInfo->expects($this->at(0)) + ->method('getPrice') + ->with(\Magento\Catalog\Pricing\Price\RegularPrice::PRICE_CODE) + ->will($this->returnValue($regularPriceType)); + $this->priceInfo->expects($this->at(1)) + ->method('getPrice') + ->with(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE) + ->will($this->returnValue($finalPriceType)); + + $this->assertEquals($expectedResult, $this->object->hasSpecialPrice()); + } + + public function hasSpecialPriceProvider() + { + return [ + [10.0, 20.0, false], + [20.0, 10.0, true], + [10.0, 10.0, false] + ]; + } + + public function testShowMinimalPrice() + { + $finalPrice = 10.0; + $minimalPrice = 5.0; + $displayMininmalPrice = 2.0; + + $this->object->setDisplayMinimalPrice($displayMininmalPrice); + + $finalPriceType = $this->getMock('Magento\Catalog\Pricing\Price\FinalPrice', [], [], '', false); + + $finalPriceAmount = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface'); + $minimalPriceAmount = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface'); + + $finalPriceAmount->expects($this->once()) + ->method('getValue') + ->will($this->returnValue($finalPrice)); + $minimalPriceAmount->expects($this->once()) + ->method('getValue') + ->will($this->returnValue($minimalPrice)); + + $finalPriceType->expects($this->at(0)) + ->method('getAmount') + ->will($this->returnValue($finalPriceAmount)); + $finalPriceType->expects($this->at(1)) + ->method('getMinimalPrice') + ->will($this->returnValue($minimalPriceAmount)); + + $this->priceInfo->expects($this->once()) + ->method('getPrice') + ->with(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE) + ->will($this->returnValue($finalPriceType)); + + $this->assertTrue($this->object->showMinimalPrice()); + } } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Render/PriceBoxTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Render/PriceBoxTest.php index b54ab9c06dfb3..cbe05f08d4ed0 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Render/PriceBoxTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/Render/PriceBoxTest.php @@ -100,15 +100,7 @@ public function testGetRandomString() */ public function testGetCanDisplayQty($typeCode, $expected) { - $product = $this->getMockForAbstractClass( - 'Magento\Framework\Pricing\Object\SaleableInterface', - [], - '', - true, - true, - true, - ['getTypeId'] - ); + $product = $this->getMock('Magento\Catalog\Model\Product', ['getTypeId', '__wakeup'], [], '', false); $product->expects($this->once()) ->method('getTypeId') diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/RenderTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/RenderTest.php index 7caa25db78f95..9a0b6ab7cb690 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Pricing/RenderTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Pricing/RenderTest.php @@ -104,12 +104,14 @@ public function testToHtmlProductFromRegistry() ->with($this->equalTo('product')) ->will($this->returnValue($product)); + $arguments = $this->object->getData(); + $arguments['render_block'] = $this->object; $this->pricingRenderBlock->expects($this->any()) ->method('render') ->with( $this->equalTo('test_price_type_code'), $this->equalTo($product), - $this->equalTo($this->object->getData()) + $this->equalTo($arguments) ) ->will($this->returnValue($expectedValue)); @@ -127,12 +129,14 @@ public function testToHtmlProductFromParentBlock() $block = $this->getMock('Magento\Framework\Pricing\Render', ['getProductItem', 'render'], [], '', false); + $arguments = $this->object->getData(); + $arguments['render_block'] = $this->object; $block->expects($this->any()) ->method('render') ->with( $this->equalTo('test_price_type_code'), $this->equalTo($product), - $this->equalTo($this->object->getData()) + $this->equalTo($arguments) ) ->will($this->returnValue($expectedValue)); diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Pricing/Price/CatalogRulePriceTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Pricing/Price/CatalogRulePriceTest.php index f4a117e4e5836..c250bb5a68a8e 100644 --- a/dev/tests/unit/testsuite/Magento/CatalogRule/Pricing/Price/CatalogRulePriceTest.php +++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Pricing/Price/CatalogRulePriceTest.php @@ -39,7 +39,7 @@ class CatalogRulePriceTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Framework\Pricing\Object\SaleableInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $salableItemMock; + protected $saleableItemMock; /** * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject @@ -91,7 +91,7 @@ class CatalogRulePriceTest extends \PHPUnit_Framework_TestCase */ public function setUp() { - $this->salableItemMock = $this->getMock( + $this->saleableItemMock = $this->getMock( 'Magento\Catalog\Model\Product', ['getId', '__wakeup', 'getPriceInfo'], [], @@ -142,7 +142,7 @@ public function setUp() $this->priceInfoMock->expects($this->any()) ->method('getAdjustments') ->will($this->returnValue([])); - $this->salableItemMock->expects($this->any()) + $this->saleableItemMock->expects($this->any()) ->method('getPriceInfo') ->will($this->returnValue($this->priceInfoMock)); @@ -155,7 +155,7 @@ public function setUp() ->getMock(); $qty = 1; $this->object = new CatalogRulePrice( - $this->salableItemMock, + $this->saleableItemMock, $qty, $this->calculator, $this->dataTimeMock, @@ -194,7 +194,7 @@ public function testGetValue() $this->catalogRuleResourceMock->expects($this->once()) ->method('getRulePrice') ->will($this->returnValue($expectedValue)); - $this->salableItemMock->expects($this->any()) + $this->saleableItemMock->expects($this->any()) ->method('getId') ->will($this->returnValue($productId)); diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php index 9bce90138f1bb..367b79744714c 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php @@ -30,20 +30,39 @@ class RendererTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Catalog\Helper\Image|\PHPUnit_Framework_MockObject_MockObject */ + /** + * @var \Magento\Catalog\Helper\Image|\PHPUnit_Framework_MockObject_MockObject + */ protected $_imageHelper; - /** @var Renderer */ + /** + * @var Renderer + */ protected $_renderer; + /** + * @var \Magento\View\LayoutInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $layout; + protected function setUp() { parent::setUp(); $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->_imageHelper = $this->getMock('Magento\Catalog\Helper\Image', array(), array(), '', false); + $this->layout = $this->getMock('Magento\Framework\View\LayoutInterface'); + + $context = $this->getMockBuilder('Magento\Framework\View\Element\Template\Context') + ->disableOriginalConstructor() + ->getMock(); + $context->expects($this->once()) + ->method('getLayout') + ->will($this->returnValue($this->layout)); + $this->_renderer = $objectManagerHelper->getObject( 'Magento\Checkout\Block\Cart\Item\Renderer', - array('imageHelper' => $this->_imageHelper) + array('imageHelper' => $this->_imageHelper, 'context' => $context) ); } @@ -110,4 +129,39 @@ public function testGetIdentitiesFromEmptyItem() { $this->assertEmpty($this->_renderer->getIdentities()); } + + /** + * @covers \Magento\Checkout\Block\Cart\Item\Renderer::getProductPriceHtml + * @covers \Magento\Checkout\Block\Cart\Item\Renderer::getPriceRender + */ + public function testGetProductPriceHtml() + { + $priceHtml = 'some price html'; + $product = $this->getMockBuilder('Magento\Catalog\Model\Product') + ->disableOriginalConstructor() + ->getMock(); + + $priceRender = $this->getMockBuilder('Magento\Framework\Pricing\Render') + ->disableOriginalConstructor() + ->getMock(); + + $this->layout->expects($this->atLeastOnce()) + ->method('getBlock') + ->with('product.price.render.default') + ->will($this->returnValue($priceRender)); + + $priceRender->expects($this->once()) + ->method('render') + ->with( + \Magento\Catalog\Pricing\Price\ConfiguredPriceInterface::CONFIGURED_PRICE_CODE, + $product, + [ + 'include_container' => true, + 'display_minimal_price' => true, + 'zone' => \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST + ] + )->will($this->returnValue($priceHtml)); + + $this->assertEquals($priceHtml, $this->_renderer->getProductPriceHtml($product)); + } } diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php index 6d94596ae1e68..d1adc7cb5b258 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php @@ -300,7 +300,13 @@ public function testFormatPrice() { $price = 5.5; $quoteMock = $this->getMock('\Magento\Sales\Model\Quote', array(), array(), '', false); - $storeMock = $this->getMock('\Magento\Core\Model\Store', array('formatPrice'), array(), '', false); + $storeMock = $this->getMock( + 'Magento\Store\Model\Store', + array('formatPrice', '__wakeup'), + array(), + '', + false + ); $this->_checkoutSession->expects($this->once())->method('getQuote')->will($this->returnValue($quoteMock)); $quoteMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock)); $storeMock->expects($this->once())->method('formatPrice')->will($this->returnValue('5.5')); @@ -311,7 +317,13 @@ public function testConvertPrice() { $price = 5.5; $quoteMock = $this->getMock('\Magento\Sales\Model\Quote', array(), array(), '', false); - $storeMock = $this->getMock('\Magento\Core\Model\Store', array('convertPrice'), array(), '', false); + $storeMock = $this->getMock( + 'Magento\Store\Model\Store', + array('convertPrice', '__wakeup'), + array(), + '', + false + ); $this->_checkoutSession->expects($this->once())->method('getQuote')->will($this->returnValue($quoteMock)); $quoteMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock)); $storeMock->expects($this->once())->method('convertPrice')->will($this->returnValue('5.5')); @@ -373,7 +385,13 @@ public function testGetPriceInclTaxWithoutTax() '\Magento\Checkout\Helper\Data', ['storeManager' => $storeManager] ); - $storeMock = $this->getMock('Magento\Core\Model\Store', array('roundPrice'), array(), '', false); + $storeMock = $this->getMock( + 'Magento\Store\Model\Store', + array('roundPrice', '__wakeup'), + array(), + '', + false + ); $itemMock = $this->getMock( 'Magento\Framework\Object', array('getPriceInclTax', 'getQty', 'getTaxAmount', 'getDiscountTaxCompensation', 'getRowTotal'), @@ -434,7 +452,13 @@ public function testGetBasePriceInclTaxWithoutQty() ); $itemMock = $this->getMock('Magento\Framework\Object', array('getQty'), array(), '', false); $itemMock->expects($this->once())->method('getQty'); - $storeMock = $this->getMock('Magento\Core\Model\Store', array('roundPrice'), array(), '', false); + $storeMock = $this->getMock( + 'Magento\Store\Model\Store', + array('roundPrice', '__wakeup'), + array(), + '', + false + ); $storeManager->expects($this->once())->method('getStore')->will($this->returnValue($storeMock)); $storeMock->expects($this->once())->method('roundPrice'); $helper->getPriceInclTax($itemMock); @@ -451,7 +475,13 @@ public function testGetBasePriceInclTax() $itemMock = $this->getMock('Magento\Framework\Object', array('getQty', 'getQtyOrdered'), array(), '', false); $itemMock->expects($this->once())->method('getQty')->will($this->returnValue(false)); $itemMock->expects($this->exactly(2))->method('getQtyOrdered')->will($this->returnValue(5.5)); - $storeMock = $this->getMock('Magento\Core\Model\Store', array('roundPrice'), array(), '', false); + $storeMock = $this->getMock( + 'Magento\Store\Model\Store', + array('roundPrice', '__wakeup'), + array(), + '', + false + ); $storeManager->expects($this->once())->method('getStore')->will($this->returnValue($storeMock)); $storeMock->expects($this->once())->method('roundPrice'); $helper->getBasePriceInclTax($itemMock); diff --git a/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Pricing/Price/AttributePriceTest.php b/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Pricing/Price/AttributePriceTest.php new file mode 100644 index 0000000000000..059b5d0d50fbd --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Pricing/Price/AttributePriceTest.php @@ -0,0 +1,392 @@ +saleableItemMock = $this->getMock( + 'Magento\Catalog\Model\Product', + [ + 'getTypeInstance', + 'setParentId', + 'hasPreconfiguredValues', + 'getPreconfiguredValues', + '__wakeup', + 'getPriceInfo' + ], + [], + '', + false + ); + $this->priceInfoMock = $this->getMock('Magento\Framework\Pricing\PriceInfo\Base', [], [], '', false); + $this->amountMock = $this->getMock('Magento\Framework\Pricing\Amount\Base', [], [], '', false); + $this->calculatorMock = $this->getMock('Magento\Framework\Pricing\Adjustment\Calculator', [], [], '', false); + $this->regularPriceMock = $this->getMock('Magento\Catalog\Pricing\Price\RegularPrice', [], [], '', false); + $this->priceModifier = $this->getMock( + 'Magento\Catalog\Model\Product\PriceModifierInterface', + [], + [], + '', + false + ); + $this->storeManagerMock = $this->getMock('Magento\Store\Model\StoreManager', ['getStore'], [], '', false); + $this->attributeMock = $this->getMock( + 'Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\Attribute', + [], + [], + '', + false + ); + $this->attribute = new AttributePrice( + $this->saleableItemMock, + $qty, + $this->calculatorMock, + $this->priceModifier, + $this->storeManagerMock + ); + } + + public function testInstanceOf() + { + $qty = 100; + $object = new AttributePrice( + $this->saleableItemMock, + $qty, + $this->calculatorMock, + $this->priceModifier, + $this->storeManagerMock + ); + $this->assertInstanceOf('Magento\ConfigurableProduct\Pricing\Price\AttributePrice', $object); + } + + public function testPrepareJsonAttributes() + { + $options = []; + $attributeId = 1; + $attributeCode = 'test_attribute'; + $attributeLabel = 'Test'; + $pricingValue = 100; + $amount = 120; + $modifiedValue = 140; + $valueIndex = 2; + $optionId = 1; + $expected = [ + 'priceOptions' => + [ + $attributeId => + [ + 'id' => $attributeId, + 'code' => $attributeCode, + 'label' => $attributeLabel, + 'options' => + [ + 0 => + [ + 'id' => $valueIndex, + 'label' => $attributeLabel, + 'price' => $modifiedValue, + 'oldPrice' => $modifiedValue, + 'inclTaxPrice' => $modifiedValue, + 'exclTaxPrice' => $pricingValue, + 'products' => [] + ], + ], + ], + ], + 'defaultValues' => + [ + $attributeId => $optionId, + ], + ]; + $attributePrices = [ + [ + 'is_percent' => false, + 'pricing_value' => $pricingValue, + 'value_index' => $valueIndex, + 'label' => $attributeLabel + ] + ]; + + $configurableAttributes = [ + $this->getAttributeMock($attributeId, $attributeCode, $attributeLabel, $attributePrices) + ]; + $configuredValueMock = $this->getMockBuilder('Magento\Framework\Object') + ->disableOriginalConstructor() + ->getMock(); + $configuredValueMock->expects($this->any()) + ->method('getData') + ->will($this->returnValue($optionId)); + + $configurableProduct = $this->getMockBuilder('Magento\ConfigurableProduct\Model\Product\Type\Configurable') + ->disableOriginalConstructor() + ->getMock(); + $configurableProduct->expects($this->once()) + ->method('getConfigurableAttributes') + ->with($this->equalTo($this->saleableItemMock)) + ->will($this->returnValue($configurableAttributes)); + $this->saleableItemMock->expects($this->once()) + ->method('getTypeInstance') + ->will($this->returnValue($configurableProduct)); + $this->saleableItemMock->expects($this->any()) + ->method('setParentId'); + $this->saleableItemMock->expects($this->any()) + ->method('hasPreconfiguredValues') + ->will($this->returnValue(true)); + $this->saleableItemMock->expects($this->any()) + ->method('getPreconfiguredValues') + ->will($this->returnValue($configuredValueMock)); + + $this->priceModifier->expects($this->once()) + ->method('modifyPrice') + ->with($this->equalTo($pricingValue), $this->equalTo($this->saleableItemMock)) + ->will($this->returnValue($amount)); + $this->calculatorMock->expects($this->any()) + ->method('getAmount') + ->will($this->returnValue($this->getModifiedAmountMock($modifiedValue, $pricingValue))); + $storeMock = $this->getMockBuilder('Magento\Store\Model\Store') + ->disableOriginalConstructor() + ->getMock(); + $storeMock->expects($this->once()) + ->method('convertPrice') + ->with($this->equalTo($modifiedValue)) + ->will($this->returnArgument(0)); + + $this->storeManagerMock->expects($this->any()) + ->method('getStore') + ->will($this->returnValue($storeMock)); + + $result = $this->attribute->prepareAttributes($options); + $this->assertEquals($expected, $result); + } + + protected function getModifiedAmountMock($modifiedValue, $pricingValue) + { + $modifiedAmountMock = $this->getMockBuilder('Magento\Framework\Pricing\Amount\Base') + ->disableOriginalConstructor() + ->getMock(); + $modifiedAmountMock->expects($this->any()) + ->method('getValue') + ->will($this->returnValue($modifiedValue)); + $modifiedAmountMock->expects($this->once()) + ->method('getBaseAmount') + ->will($this->returnValue($pricingValue)); + + return $modifiedAmountMock; + } + + protected function getAttributeMock($attributeId, $attributeCode, $attributeLabel, $attributePrices) + { + $productAttributeMock = $this->getMockBuilder('Magento\Catalog\Model\Entity\Attribute') + ->disableOriginalConstructor() + ->setMethods(['getLabel', '__wakeup', 'getAttributeCode', 'getId', 'getAttributeLabel']) + ->getMock(); + $productAttributeMock->expects($this->once()) + ->method('getId') + ->will($this->returnValue($attributeId)); + $productAttributeMock->expects($this->once()) + ->method('getAttributeCode') + ->will($this->returnValue($attributeCode)); + $attributeMock = $this->getMockBuilder('Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute') + ->disableOriginalConstructor() + ->setMethods(['getProductAttribute', '__wakeup', 'getLabel', 'getPrices']) + ->getMock(); + $attributeMock->expects($this->once()) + ->method('getProductAttribute') + ->will($this->returnValue($productAttributeMock)); + $attributeMock->expects($this->once()) + ->method('getLabel') + ->will($this->returnValue($attributeLabel)); + $attributeMock->expects($this->once()) + ->method('getPrices') + ->will($this->returnValue($attributePrices)); + + return $attributeMock; + } + + /** + * test method testGetOptionValueModified with option is_percent = true + */ + public function testGetOptionValueModifiedIsPercent() + { + $finalPriceMock = $this->getMock('Magento\Catalog\Pricing\Price\RegularPrice', [], [], '', false); + $this->saleableItemMock->expects($this->once()) + ->method('getPriceInfo') + ->will($this->returnValue($this->priceInfoMock)); + $this->saleableItemMock->expects($this->once()) + ->method('setParentId') + ->with($this->equalTo(true)) + ->will($this->returnValue($this->returnSelf())); + $this->priceInfoMock->expects($this->once()) + ->method('getPrice') + ->with($this->equalTo(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)) + ->will($this->returnValue($finalPriceMock)); + $finalPriceMock->expects($this->once()) + ->method('getValue') + ->will($this->returnValue(50)); + $this->priceModifier->expects($this->once()) + ->method('modifyPrice') + ->with($this->equalTo(50), $this->equalTo($this->saleableItemMock)) + ->will($this->returnValue(55)); + $this->calculatorMock->expects($this->once()) + ->method('getAmount') + ->with( + $this->equalTo(55), + $this->equalTo($this->saleableItemMock), + $this->equalTo(\Magento\Weee\Pricing\Adjustment::ADJUSTMENT_CODE) + ) + ->will($this->returnValue(57.55)); + $this->assertEquals( + 57.55, + $this->attribute->getOptionValueModified( + [ + 'is_percent' => true, + 'pricing_value' => 100 + ] + ) + ); + } + + /** + * test method testGetOptionValueModified with option is_percent = false + */ + public function testGetOptionValueModifiedIsNotPercent() + { + $this->saleableItemMock->expects($this->once()) + ->method('setParentId') + ->with($this->equalTo(true)) + ->will($this->returnValue($this->returnSelf())); + $this->priceModifier->expects($this->once()) + ->method('modifyPrice') + ->with($this->equalTo(77.33), $this->equalTo($this->saleableItemMock)) + ->will($this->returnValue(77.67)); + $this->calculatorMock->expects($this->once()) + ->method('getAmount') + ->with( + $this->equalTo(77.67), + $this->equalTo($this->saleableItemMock), + $this->equalTo(\Magento\Weee\Pricing\Adjustment::ADJUSTMENT_CODE) + ) + ->will($this->returnValue(80.99)); + $this->assertEquals( + 80.99, + $this->attribute->getOptionValueModified( + [ + 'is_percent' => false, + 'pricing_value' => 77.33 + ] + ) + ); + } + + /** + * test for method getTaxConfig + */ + public function testGetTaxConfig() + { + $expectedTaxConfig = [ + 'includeTax' => false, + 'showIncludeTax' => false, + 'showBothPrices' => false, + 'defaultTax' => 0, + 'currentTax' => 0, + 'inclTaxTitle' => __('Incl. Tax') + ]; + $this->assertEquals($expectedTaxConfig, $this->attribute->getTaxConfig()); + } + + /** + * test for method prepareAdjustmentConfig + */ + public function testPrepareAdjustmentConfig() + { + $expectedAdjustmentConfig = [ + 'includeTax' => false, + 'showIncludeTax' => false, + 'showBothPrices' => false, + 'defaultTax' => 0, + 'currentTax' => 0, + 'inclTaxTitle' => __('Incl. Tax'), + 'product' => $this->saleableItemMock + ]; + $this->assertEquals($expectedAdjustmentConfig, $this->attribute->prepareAdjustmentConfig()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/DbTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/DbTest.php index 4264246795903..794fdf862de77 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/DbTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/DbTest.php @@ -60,11 +60,13 @@ public function testConvertConfigParams() $notFullJob = array('schedule' => ''); $source = array( 'crontab' => array( - 'jobs' => array( - 'job_name_1' => $fullJob, - 'job_name_2' => $nullJob, - 'job_name_3' => $notFullJob, - 'job_name_4' => array() + 'default' => array( + 'jobs' => array( + 'job_name_1' => $fullJob, + 'job_name_2' => $nullJob, + 'job_name_3' => $notFullJob, + 'job_name_4' => array() + ) ) ) ); @@ -100,11 +102,13 @@ public function testConvertRunConfig() $source = array( 'crontab' => array( - 'jobs' => array( - 'job_name_1' => $runFullJob, - 'job_name_2' => $runNoMethodJob, - 'job_name_3' => $runEmptyMethodJob, - 'job_name_4' => $runNoModelJob + 'default' => array( + 'jobs' => array( + 'job_name_1' => $runFullJob, + 'job_name_2' => $runNoMethodJob, + 'job_name_3' => $runEmptyMethodJob, + 'job_name_4' => $runNoModelJob + ) ) ) ); diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/XmlTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/XmlTest.php index 33cdb08097c76..433cf5274db86 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/XmlTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Converter/XmlTest.php @@ -63,22 +63,28 @@ public function testConvertNoElements() */ public function testConvert() { - $expected = array( - 'default' => array( - 'job1' => array( + $expected = [ + 'default' => [ + 'job1' => [ 'name' => 'job1', 'schedule' => '30 2 * * *', 'instance' => 'Model1', 'method' => 'method1' - ), - 'job2' => array( + ], + 'job2' => [ 'name' => 'job2', 'schedule' => '* * * * *', 'instance' => 'Model2', 'method' => 'method2' - ) - ) - ); + ], + 'job3' => [ + 'name' => 'job3', + 'instance' => 'Model3', + 'method' => 'method3', + 'config_path' => 'some/config/path' + ], + ] + ]; $xmlFile = __DIR__ . '/../_files/crontab_valid.xml'; $dom = new \DOMDocument(); diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/DbTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/DbTest.php index 88d8ba2384e8d..0333af3c71ff0 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/DbTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/Reader/DbTest.php @@ -61,7 +61,7 @@ public function testGet() { $job1 = array('schedule' => array('cron_expr' => '* * * * *')); $job2 = array('schedule' => array('cron_expr' => '1 1 1 1 1')); - $data = array('crontab' => array('jobs' => array('job1' => $job1, 'job2' => $job2))); + $data = array('crontab' => array('default' => array('jobs' => array('job1' => $job1, 'job2' => $job2)))); $this->_defaultReader->expects($this->once())->method('read')->will($this->returnValue($data)); $expected = array( 'job1' => array('schedule' => $job1['schedule']['cron_expr']), diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/XsdTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/XsdTest.php index b6f5f439a4810..d9f3f62d189b3 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/XsdTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/XsdTest.php @@ -94,7 +94,8 @@ public function invalidXmlFileDataProvider() "Element 'job': The attribute 'name' is required but missing.\n", "Element 'job': The attribute 'instance' is required but missing.\n", "Element 'job': The attribute 'method' is required but missing.\n", - "Element 'wrongSchedule': This element is not expected. Expected is ( schedule ).\n" + "Element 'wrongSchedule': This element is not expected." . + " Expected is one of ( schedule, config_path ).\n" ) ), array( diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/_files/crontab_valid.xml b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/_files/crontab_valid.xml index ec1a8651c9f6a..156d8a7b7c768 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/Config/_files/crontab_valid.xml +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/Config/_files/crontab_valid.xml @@ -31,5 +31,8 @@ * * * * * + + some/config/path + diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php index 1259545eac9dd..dd205c5293df7 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php @@ -509,15 +509,24 @@ public function testDispatchNotGenerate() public function testDispatchGenerate() { $jobConfig = array( - 'test_group' => array('test_job1' => array('instance' => 'CronJob', 'method' => 'execute')) + 'test_group' => array( + 'default' => array( + 'test_job1' => array( + 'instance' => 'CronJob', + 'method' => 'execute' + ) + ) + ) ); $this->_config->expects($this->at(0))->method('getJobs')->will($this->returnValue($jobConfig)); $jobs = array( 'test_group' => array( - 'job1' => array('config_path' => 'test/path'), - 'job2' => array('schedule' => ''), - 'job3' => array('schedule' => '* * * * *') + 'default' => array( + 'job1' => array('config_path' => 'test/path'), + 'job2' => array('schedule' => ''), + 'job3' => array('schedule' => '* * * * *') + ) ) ); $this->_config->expects($this->at(1))->method('getJobs')->will($this->returnValue($jobs)); diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/ImportExport/Import/AddressTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/ImportExport/Import/AddressTest.php index 2b37358377c04..34a8a9ec9ea7c 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/ImportExport/Import/AddressTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/ImportExport/Import/AddressTest.php @@ -590,8 +590,8 @@ public function testValidateRowForUpdate(array $rowData, array $errors, $isValid * Test Address::validateRow() * with 2 rows with identical PKs in case when add/update behavior is performed * - * @covers Address::validateRow - * @covers Address::_validateRowForUpdate + * @covers \Magento\Customer\Model\ImportExport\Import\Address::validateRow + * @covers \Magento\Customer\Model\ImportExport\Import\Address::_validateRowForUpdate */ public function testValidateRowForUpdateDuplicateRows() { @@ -640,7 +640,7 @@ public function testValidateRowForUpdateDuplicateRows() /** * Test Address::validateRow() with delete action * - * @covers Address::validateRow + * @covers \Magento\Customer\Model\ImportExport\Import\Address::validateRow * @dataProvider validateRowForDeleteDataProvider * * @param array $rowData @@ -689,7 +689,7 @@ public function testGetDefaultAddressAttributeMapping() /** * Test if correct methods are invoked according to different custom behaviours * - * @covers Address::_importData + * @covers \Magento\Customer\Model\ImportExport\Import\Address::_importData */ public function testImportDataWithCustomBehaviour() { diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Resource/GroupTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Resource/GroupTest.php new file mode 100644 index 0000000000000..43edbaf3021ff --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Resource/GroupTest.php @@ -0,0 +1,96 @@ +resource = $this->getMock('Magento\Framework\App\Resource', [], [], '', false); + $this->customerHelper = $this->getMock('Magento\Customer\Helper\Data', [], [], '', false); + $this->customersFactory = $this->getMock( + 'Magento\Customer\Model\Resource\Customer\CollectionFactory', + ['create'], + [], + '', + false + ); + $this->groupModel = $this->getMock('Magento\Customer\Model\Group', [], [], '', false); + + $this->groupResourceModel = (new ObjectManagerHelper($this))->getObject( + 'Magento\Customer\Model\Resource\Group', + [ + 'resource' => $this->resource, + 'customerData' => $this->customerHelper, + 'customersFactory' => $this->customersFactory, + ] + ); + } + + public function testDelete() + { + $dbAdapter = $this->getMock('Magento\Framework\DB\Adapter\AdapterInterface'); + $this->resource->expects($this->once())->method('getConnection')->will($this->returnValue($dbAdapter)); + + $customer = $this->getMock( + 'Magento\Customer\Model\Customer', + ['__wakeup', 'load', 'getId', 'getStoreId', 'setGroupId', 'save'], + [], + '', + false + ); + $customerId = 1; + $customer->expects($this->once())->method('getId')->will($this->returnValue($customerId)); + $customer->expects($this->once())->method('load')->with($customerId)->will($this->returnSelf()); + $defaultCustomerGroup = 1; + $this->customerHelper->expects($this->once())->method('getDefaultCustomerGroupId') + ->will($this->returnValue($defaultCustomerGroup)); + $customer->expects($this->once())->method('setGroupId')->with($defaultCustomerGroup); + $customerCollection = $this->getMock('Magento\Customer\Model\Resource\Customer\Collection', [], [], '', false); + $customerCollection->expects($this->once())->method('addAttributeToFilter')->will($this->returnSelf()); + $customerCollection->expects($this->once())->method('load')->will($this->returnValue([$customer])); + $this->customersFactory->expects($this->once())->method('create') + ->will($this->returnValue($customerCollection)); + + $this->groupResourceModel->delete($this->groupModel); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Resource/ImportExport/Import/CustomerComposite/DataTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Resource/ImportExport/Import/CustomerComposite/DataTest.php index 3adc1cd18eafe..8d26ec7788268 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/Resource/ImportExport/Import/CustomerComposite/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Resource/ImportExport/Import/CustomerComposite/DataTest.php @@ -100,9 +100,9 @@ protected function _getDependencies($entityType, $bunchData) } /** - * @covers Data::getNextBunch - * @covers Data::_prepareRow - * @covers Data::_prepareAddressRowData + * @covers \Magento\Customer\Model\Resource\ImportExport\Import\CustomerComposite\Data::getNextBunch + * @covers \Magento\Customer\Model\Resource\ImportExport\Import\CustomerComposite\Data::_prepareRow + * @covers \Magento\Customer\Model\Resource\ImportExport\Import\CustomerComposite\Data::_prepareAddressRowData * * @dataProvider getNextBunchDataProvider * @param string $entityType diff --git a/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php b/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php index 1acc44b96dfd9..6f8827fe42416 100644 --- a/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php +++ b/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php @@ -227,10 +227,10 @@ public function prepareShippingLabelContentExceptionDataProvider() $filesPath . 'response_shipping_label.xml' ); unset( - $empty->AirwayBillNumber, - $empty->LabelImage, - $billingNumberOnly->LabelImage, - $outputImageOnly->AirwayBillNumber + $empty->{'AirwayBillNumber'}, + $empty->{'LabelImage'}, + $billingNumberOnly->{'LabelImage'}, + $outputImageOnly->{'AirwayBillNumber'} ); return array(array($empty), array($billingNumberOnly), array($outputImageOnly)); @@ -258,8 +258,10 @@ public function testCollectRates() $this->returnValue(file_get_contents(__DIR__ . '/_files/success_dhl_response_rates.xml')) ); // for setRequest - $request_params = include __DIR__ . '/_files/rates_request_data_dhl.php'; - $request = $this->_helper->getObject('Magento\Sales\Model\Quote\Address\RateRequest', $request_params); + $request = $this->_helper->getObject( + 'Magento\Sales\Model\Quote\Address\RateRequest', + require __DIR__ . '/_files/rates_request_data_dhl.php' + ); $this->assertNotEmpty($this->_model->collectRates($request)->getAllRates()); } } diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Block/Catalog/Product/LinksTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Block/Catalog/Product/LinksTest.php index 536cba245166b..5aee86121e173 100644 --- a/dev/tests/unit/testsuite/Magento/Downloadable/Block/Catalog/Product/LinksTest.php +++ b/dev/tests/unit/testsuite/Magento/Downloadable/Block/Catalog/Product/LinksTest.php @@ -24,33 +24,23 @@ namespace Magento\Downloadable\Block\Catalog\Product; +use Magento\Catalog\Pricing\Price\FinalPrice; +use Magento\Catalog\Pricing\Price\RegularPrice; + /** * Tests Magento\Downloadable\Block\Catalog\Product\Links */ class LinksTest extends \PHPUnit_Framework_TestCase { - /** @var \Magento\Downloadable\Block\Catalog\Product\Links */ - protected $linksBlock; - - /** - * @var \Magento\Downloadable\Model\Link|\PHPUnit_Framework_MockObject_MockObject - */ - protected $linkMock; - /** - * @var \Magento\Downloadable\Pricing\Price\LinkPrice|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Downloadable\Block\Catalog\Product\Links */ - protected $linkPriceMock; - - /** - * @var \Magento\Framework\Pricing\Amount\Base|\PHPUnit_Framework_MockObject_MockObject - */ - protected $amountMock; + protected $linksBlock; /** * @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject */ - protected $salableItemMock; + protected $productMock; /** * @var \Magento\Framework\Pricing\PriceInfoInterface|\PHPUnit_Framework_MockObject_MockObject @@ -62,49 +52,58 @@ class LinksTest extends \PHPUnit_Framework_TestCase */ protected $layout; + /** + * @var \Magento\Core\Helper\Data | \PHPUnit_Framework_MockObject_MockObject + */ + protected $coreHelper; + public function setUp() { $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $contextMock = $this->getMock('Magento\Catalog\Block\Product\Context', [], [], '', false, false); - - $this->priceInfoMock = $this->getMock('Magento\Framework\Pricing\PriceInfo\Base', [], [], '', false); - $this->linkPriceMock = $this->getMock('Magento\Downloadable\Pricing\Price\LinkPrice', [], [], '', false); - $this->salableItemMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); - $this->amountMock = $this->getMock('Magento\Framework\Pricing\Amount\Base', [], [], '', false); - $this->linkMock = $this->getMock('Magento\Downloadable\Model\Link', [], [], '', false); $this->layout = $this->getMock('Magento\Framework\View\Layout', [], [], '', false); + $contextMock = $this->getMock('Magento\Catalog\Block\Product\Context', [], [], '', false, false); $contextMock->expects($this->once()) ->method('getLayout') ->will($this->returnValue($this->layout)); - $data = [ - 'product' => $this->salableItemMock - ]; + $this->priceInfoMock = $this->getMock('Magento\Framework\Pricing\PriceInfo\Base', [], [], '', false); + $this->productMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); + $this->productMock->expects($this->any()) + ->method('getPriceInfo') + ->will($this->returnValue($this->priceInfoMock)); + $this->coreHelper = $this->getMock('Magento\Core\Helper\Data', [], [], '', false); $this->linksBlock = $objectManager->getObject( 'Magento\Downloadable\Block\Catalog\Product\Links', [ 'context' => $contextMock, - 'data' => $data + 'coreData' => $this->coreHelper, + 'data' => [ + 'product' => $this->productMock + ] ] ); } public function testGetLinkPrice() { + $linkPriceMock = $this->getMock('Magento\Downloadable\Pricing\Price\LinkPrice', [], [], '', false); + $amountMock = $this->getMock('Magento\Framework\Pricing\Amount\Base', [], [], '', false); + $linkMock = $this->getMock('Magento\Downloadable\Model\Link', [], [], '', false); + $priceCode = 'link_price'; $arguments = []; $expectedHtml = 'some html'; - $this->salableItemMock->expects($this->any()) + $this->productMock->expects($this->any()) ->method('getPriceInfo') ->will($this->returnValue($this->priceInfoMock)); $this->priceInfoMock->expects($this->any()) ->method('getPrice') ->with($this->equalTo($priceCode)) - ->will($this->returnValue($this->linkPriceMock)); - $this->linkPriceMock->expects($this->any()) + ->will($this->returnValue($linkPriceMock)); + $linkPriceMock->expects($this->any()) ->method('getLinkAmount') - ->with($this->linkMock) - ->will($this->returnValue($this->amountMock)); + ->with($linkMock) + ->will($this->returnValue($amountMock)); $priceBoxMock = $this->getMock('Magento\Framework\Pricing\Render', ['renderAmount'], [], '', false, false); @@ -115,11 +114,122 @@ public function testGetLinkPrice() $priceBoxMock->expects($this->once()) ->method('renderAmount') - ->with($this->amountMock, $this->linkPriceMock, $this->salableItemMock, $arguments) + ->with($amountMock, $linkPriceMock, $this->productMock, $arguments) ->will($this->returnValue($expectedHtml)); - $result = $this->linksBlock->getLinkPrice($this->linkMock); + $result = $this->linksBlock->getLinkPrice($linkMock); $this->assertEquals($expectedHtml, $result); } + + public function testGetJsonConfig() + { + $regularPrice = 11.; + $finalPrice = 10.; + $price = 5.; + $oldPrice = 4.; + + $linkPrice = 3.; + $linkIncludeTaxPrice = 4.; + $linkExcludeTaxPrice = 3.; + + $linkId = 42; + + $config = [ + 'price' => $price, + 'oldPrice' => $oldPrice, + 'links' => [ + $linkId => [ + 'price' => $linkPrice, + 'oldPrice' => $linkPrice, + 'inclTaxPrice' => $linkIncludeTaxPrice, + 'exclTaxPrice' => $linkExcludeTaxPrice + ] + ] + ]; + + $linkAmountMock = $this->getMock('Magento\Framework\Pricing\Amount\Base', [], [], '', false); + $linkAmountMock->expects($this->once()) + ->method('getValue') + ->will($this->returnValue($linkIncludeTaxPrice)); + $linkAmountMock->expects($this->once()) + ->method('getBaseAmount') + ->will($this->returnValue($linkExcludeTaxPrice)); + + $amountMock = $this->getMock('Magento\Framework\Pricing\Amount\Base', [], [], '', false); + $amountMock->expects($this->once()) + ->method('getValue') + ->will($this->returnValue($finalPrice)); + + $typeInstanceMock = $this->getMock('Magento\Catalog\Model\Product\Type\Simple', ['getLinks'], [], '', false); + $typeInstanceMock->expects($this->once()) + ->method('getLinks') + ->will($this->returnValue([$this->getLinkMock($linkPrice, $linkId)])); + $this->productMock->expects($this->once()) + ->method('getTypeInstance') + ->will($this->returnValue($typeInstanceMock)); + + $regularPriceMock = $this->getMock('Magento\Catalog\Pricing\Price\RegularPrice', [], [], '', false); + $regularPriceMock->expects($this->once()) + ->method('getValue') + ->will($this->returnValue($regularPrice)); + + $finalPriceMock = $this->getMock('Magento\Catalog\Pricing\Price\FinalPrice', [], [], '', false); + $finalPriceMock->expects($this->at(0)) + ->method('getAmount') + ->will($this->returnValue($amountMock)); + $finalPriceMock->expects($this->at(1)) + ->method('getCustomAmount') + ->with($linkPrice) + ->will($this->returnValue($linkAmountMock)); + + $this->coreHelper->expects($this->at(0)) + ->method('currency') + ->with($finalPrice, false, false) + ->will($this->returnValue($price)); + $this->coreHelper->expects($this->at(1)) + ->method('currency') + ->with($regularPrice, false, false) + ->will($this->returnValue($oldPrice)); + $this->coreHelper->expects($this->at(2)) + ->method('currency') + ->with($linkPrice, false, false) + ->will($this->returnValue($linkPrice)); + $this->coreHelper->expects($this->at(3)) + ->method('currency') + ->with($linkIncludeTaxPrice, false, false) + ->will($this->returnValue($linkIncludeTaxPrice)); + $this->coreHelper->expects($this->at(4)) + ->method('currency') + ->with($linkExcludeTaxPrice, false, false) + ->will($this->returnValue($linkExcludeTaxPrice)); + + $this->priceInfoMock->expects($this->at(0)) + ->method('getPrice') + ->with(FinalPrice::PRICE_CODE) + ->will($this->returnValue($finalPriceMock)); + $this->priceInfoMock->expects($this->at(1)) + ->method('getPrice') + ->with(RegularPrice::PRICE_CODE) + ->will($this->returnValue($regularPriceMock)); + $this->priceInfoMock->expects($this->at(2)) + ->method('getPrice') + ->with(FinalPrice::PRICE_CODE) + ->will($this->returnValue($finalPriceMock)); + + $this->assertEquals(json_encode($config), $this->linksBlock->getJsonConfig()); + } + + protected function getLinkMock($linkPrice, $linkId) + { + $linkMock = $this->getMock('Magento\Downloadable\Model\Link', ['getPrice', 'getId', '__wakeup'], [], '', false); + $linkMock->expects($this->any()) + ->method('getPrice') + ->will($this->returnValue($linkPrice)); + $linkMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue($linkId)); + + return $linkMock; + } } \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Pricing/Price/LinkPriceTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Pricing/Price/LinkPriceTest.php index 722bee8f5bf62..f1ce804d416dd 100644 --- a/dev/tests/unit/testsuite/Magento/Downloadable/Pricing/Price/LinkPriceTest.php +++ b/dev/tests/unit/testsuite/Magento/Downloadable/Pricing/Price/LinkPriceTest.php @@ -43,7 +43,7 @@ class LinkPriceTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject */ - protected $salableItemMock; + protected $saleableItemMock; /** * @var \Magento\Framework\Pricing\Adjustment\Calculator|\PHPUnit_Framework_MockObject_MockObject @@ -60,7 +60,7 @@ class LinkPriceTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->salableItemMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); + $this->saleableItemMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); $this->amountMock = $this->getMock('Magento\Framework\Pricing\Amount\Base', [], [], '', false); $this->calculatorMock = $this->getMock('Magento\Framework\Pricing\Adjustment\Calculator', [], [], '', false); $this->linkMock = $this->getMock( @@ -71,7 +71,7 @@ protected function setUp() false ); - $this->linkPrice = new LinkPrice($this->salableItemMock, 1, $this->calculatorMock); + $this->linkPrice = new LinkPrice($this->saleableItemMock, 1, $this->calculatorMock); } public function testGetLinkAmount() @@ -83,10 +83,10 @@ public function testGetLinkAmount() ->will($this->returnValue($amount)); $this->linkMock->expects($this->once()) ->method('getProduct') - ->will($this->returnValue($this->salableItemMock)); + ->will($this->returnValue($this->saleableItemMock)); $this->calculatorMock->expects($this->once()) ->method('getAmount') - ->with($amount, $this->equalTo($this->salableItemMock)) + ->with($amount, $this->equalTo($this->saleableItemMock)) ->will($this->returnValue($amount)); $result = $this->linkPrice->getLinkAmount($this->linkMock); diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php index 19784443b00cb..57c901065980c 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php @@ -410,17 +410,6 @@ protected function _getAttributeMock($attributeData) return $attribute; } - /** - * @param \Magento\Eav\Model\Attribute\Data\AbstractData $dataModel - * @return \PHPUnit_Framework_MockObject_MockObject - */ - protected function _getFactoryMock($dataModel) - { - $factory = $this->getMockBuilder('Magento\Eav\Model\Attribute\Data')->setMethods(array('factory'))->getMock(); - $factory::staticExpects($this->once())->method('factory')->will($this->returnValue($dataModel)); - return $factory; - } - /** * @param boolean $returnValue * @param string|null $argument diff --git a/dev/tests/unit/testsuite/Magento/Framework/Autoload/IncludePathTest.php b/dev/tests/unit/testsuite/Magento/Framework/Autoload/IncludePathTest.php index e4e3b56b9754c..6ff364f46ada6 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Autoload/IncludePathTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Autoload/IncludePathTest.php @@ -47,9 +47,9 @@ protected function tearDown() */ public function testGetFile($class, $expectedValue) { - $this->assertFalse(\Magento\Framework\Autoload\IncludePath::getFile($class)); - \Magento\Framework\Autoload\IncludePath::addIncludePath(__DIR__ . '/_files'); - $this->assertEquals($expectedValue, \Magento\Framework\Autoload\IncludePath::getFile($class)); + $this->assertFalse((new \Magento\Framework\Autoload\IncludePath())->getFile($class)); + (new \Magento\Framework\Autoload\IncludePath())->addIncludePath(__DIR__ . '/_files'); + $this->assertEquals($expectedValue, (new \Magento\Framework\Autoload\IncludePath())->getFile($class)); } /** @@ -75,7 +75,7 @@ public function testAddIncludePath($fixturePath, $prepend, $expectedIncludePath) { $expectedIncludePath = str_replace('%include_path%', get_include_path(), $expectedIncludePath); $this->assertNotEquals($expectedIncludePath, get_include_path()); - \Magento\Framework\Autoload\IncludePath::addIncludePath($fixturePath, $prepend); + (new \Magento\Framework\Autoload\IncludePath())->addIncludePath($fixturePath, $prepend); $this->assertEquals($expectedIncludePath, get_include_path()); } @@ -105,9 +105,9 @@ public function addIncludePathDataProvider() */ public function testLoad($class, $expectedValue) { - \Magento\Framework\Autoload\IncludePath::addIncludePath(__DIR__ . '/_files'); + (new \Magento\Framework\Autoload\IncludePath())->addIncludePath(__DIR__ . '/_files'); $this->assertFalse(class_exists($class, false)); - \Magento\Framework\Autoload\IncludePath::load($class); + (new \Magento\Framework\Autoload\IncludePath())->load($class); if ($expectedValue) { $this->assertTrue(class_exists($class, false)); } else { diff --git a/dev/tests/unit/testsuite/Magento/Framework/Cache/Frontend/Adapter/ZendTest.php b/dev/tests/unit/testsuite/Magento/Framework/Cache/Frontend/Adapter/ZendTest.php index 31ea472efbe80..c8ef9bfce1c00 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Cache/Frontend/Adapter/ZendTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Cache/Frontend/Adapter/ZendTest.php @@ -52,7 +52,7 @@ public function testProxyMethod($method, $params, $expectedParams, $expectedResu /** * @return array */ - public static function proxyMethodDataProvider() + public function proxyMethodDataProvider() { return array( 'test' => array('test', array('record_id'), array('RECORD_ID'), 111), @@ -86,7 +86,7 @@ public static function proxyMethodDataProvider() 'getBackend', array(), array(), - \PHPUnit_Framework_MockObject_Generator::getMock('Zend_Cache_Backend') + $this->getMock('Zend_Cache_Backend') ) ); } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Cache/Frontend/Decorator/BareTest.php b/dev/tests/unit/testsuite/Magento/Framework/Cache/Frontend/Decorator/BareTest.php index 7b27fe097f47e..c0811a6b72ccc 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Cache/Frontend/Decorator/BareTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Cache/Frontend/Decorator/BareTest.php @@ -44,7 +44,7 @@ public function testProxyMethod($method, $params, $expectedResult) /** * @return array */ - public static function proxyMethodDataProvider() + public function proxyMethodDataProvider() { return array( array('test', array('record_id'), 111), @@ -52,8 +52,8 @@ public static function proxyMethodDataProvider() array('save', array('record_value', 'record_id', array('tag'), 555), true), array('remove', array('record_id'), true), array('clean', array(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('tag')), true), - array('getBackend', array(), \PHPUnit_Framework_MockObject_Generator::getMock('Zend_Cache_Backend')), - array('getLowLevelFrontend', array(), \PHPUnit_Framework_MockObject_Generator::getMock('Zend_Cache_Core')) + array('getBackend', array(), $this->getMock('Zend_Cache_Backend')), + array('getLowLevelFrontend', array(), $this->getMock('Zend_Cache_Core')) ); } } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Cache/Frontend/Decorator/ProfilerTest.php b/dev/tests/unit/testsuite/Magento/Framework/Cache/Frontend/Decorator/ProfilerTest.php index 557ed00b74fa8..f7b281bec7177 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Cache/Frontend/Decorator/ProfilerTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Cache/Frontend/Decorator/ProfilerTest.php @@ -77,10 +77,10 @@ public function testProxyMethod( /** * @return array */ - public static function proxyMethodDataProvider() + public function proxyMethodDataProvider() { $backend = new \Zend_Cache_Backend_BlackHole(); - $adaptee = \PHPUnit_Framework_MockObject_Generator::getMock('Zend_Cache_Core', array(), array(), '', false); + $adaptee = $this->getMock('Zend_Cache_Core', array(), array(), '', false); $lowLevelFrontend = new \Magento\Framework\Cache\Frontend\Adapter\Zend($adaptee); return array( diff --git a/dev/tests/unit/testsuite/Magento/Framework/Code/Generator/EntityAbstractTest.php b/dev/tests/unit/testsuite/Magento/Framework/Code/Generator/EntityAbstractTest.php index c86b2c41a2961..a3007f30184dc 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Code/Generator/EntityAbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Code/Generator/EntityAbstractTest.php @@ -299,7 +299,7 @@ protected function _prepareMocksForValidateData( $this->returnValue(self::RESULT_DIRECTORY) ); - $autoloader->staticExpects( + $autoloader->expects( $this->at(0) )->method( 'getFile' @@ -309,7 +309,7 @@ protected function _prepareMocksForValidateData( $this->returnValue($classExistsFirst) ); if ($classExistsFirst) { - $autoloader->staticExpects( + $autoloader->expects( $this->at(1) )->method( 'getFile' @@ -324,7 +324,7 @@ protected function _prepareMocksForValidateData( if ($classExistsFirst) { $expectedInvocations = 2; } - $autoloader->staticExpects($this->exactly($expectedInvocations))->method('getFile'); + $autoloader->expects($this->exactly($expectedInvocations))->method('getFile'); $expectedInvocations = 1; if (!$classExistsFirst || $classExistsSecond) { diff --git a/dev/tests/unit/testsuite/Magento/Framework/Code/Generator/IoTest.php b/dev/tests/unit/testsuite/Magento/Framework/Code/Generator/IoTest.php index 78427a49813bb..581576c6a1e9f 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Code/Generator/IoTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Code/Generator/IoTest.php @@ -82,7 +82,7 @@ protected function setUp() '', false ); - $this->_autoLoaderMock->staticExpects( + $this->_autoLoaderMock->expects( $this->any() )->method( 'getFilePath' diff --git a/dev/tests/unit/testsuite/Magento/Framework/Code/GeneratorTest.php b/dev/tests/unit/testsuite/Magento/Framework/Code/GeneratorTest.php index 2ba5c38285807..da89941b30f51 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Code/GeneratorTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Code/GeneratorTest.php @@ -102,8 +102,8 @@ public function testGetGeneratedEntities() */ public function testGenerateClass($className, $entityType) { - $this->_autoloader->staticExpects( - $this->once() + $this->_autoloader->expects( + $this->any() )->method( 'getFile' )->with( @@ -130,7 +130,7 @@ public function testGenerateClass($className, $entityType) */ public function testGenerateClassWithExistName($className, $entityType) { - $this->_autoloader->staticExpects( + $this->_autoloader->expects( $this->once() )->method( 'getFile' @@ -158,7 +158,7 @@ public function testGenerateClassWithExistName($className, $entityType) public function testGenerateClassWithWrongName() { - $this->_autoloader->staticExpects($this->never())->method('getFile'); + $this->_autoloader->expects($this->never())->method('getFile'); $this->_model = new \Magento\Framework\Code\Generator($this->_autoloader, $this->_ioObjectMock); @@ -173,7 +173,7 @@ public function testGenerateClassWithWrongName() */ public function testGenerateClassWithError() { - $this->_autoloader->staticExpects($this->once())->method('getFile')->will($this->returnValue(false)); + $this->_autoloader->expects($this->once())->method('getFile')->will($this->returnValue(false)); $this->_model = new \Magento\Framework\Code\Generator( $this->_autoloader, diff --git a/dev/tests/unit/testsuite/Magento/Framework/DB/Adapter/Pdo/MysqlTest.php b/dev/tests/unit/testsuite/Magento/Framework/DB/Adapter/Pdo/MysqlTest.php index b9b0ecffda319..5f6b5300fc7da 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/DB/Adapter/Pdo/MysqlTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/DB/Adapter/Pdo/MysqlTest.php @@ -93,8 +93,6 @@ protected function setUp() } /** - * Test result for bigint - * * @dataProvider bigintResultProvider */ public function testPrepareColumnValueForBigint($value, $expectedResult) @@ -124,12 +122,12 @@ public function bigintResultProvider() array(2147483647 + 1, '2147483648'), array(9223372036854775807 + 1, '9223372036854775808'), array(9223372036854775807, '9223372036854775807'), - array(9223372036854775807.3423424234, '9223372036854775807'), - array(2147483647 * pow(10, 10)+12, '21474836470000000012'), + array(9223372036854775807.3423424234, '9223372036854775808'), + array(2147483647 * pow(10, 10)+12, '21474836470000001024'), array(9223372036854775807 * pow(10, 10)+12, '92233720368547758080000000000'), array((0.099999999999999999999999995+0.2+0.3+0.4+0.5)*10, '15'), - array('21474836470000000012', '21474836470000000012'), - array(0x5468792130ABCDEF, '6082244480221302255') + array('21474836470000000012', '21474836470000001024'), + array(0x5468792130ABCDEF, '6082244480221302255'), ); } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/AbstractElementTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/AbstractElementTest.php new file mode 100644 index 0000000000000..90d887b2cd525 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/AbstractElementTest.php @@ -0,0 +1,667 @@ +_factoryMock = $this->getMock( + 'Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false + ); + $this->_collectionFactoryMock = $this->getMock( + 'Magento\Framework\Data\Form\Element\CollectionFactory', array(), array(), '', false + ); + $this->_escaperMock = $this->getMock('Magento\Framework\Escaper', array(), array(), '', false); + + $this->_model = $this->getMockForAbstractClass('Magento\Framework\Data\Form\Element\AbstractElement', array( + $this->_factoryMock, + $this->_collectionFactoryMock, + $this->_escaperMock + )); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::addElement() + */ + public function testAddElement() + { + $elementId = 11; + $elementMock = $this->getMockForAbstractClass( + 'Magento\Framework\Data\Form\Element\AbstractElement', array(), '', false, true, true, array('getId') + ); + $elementMock->expects($this->once()) + ->method('getId') + ->will($this->returnValue($elementId)); + + $formMock = $this->getMock( + 'Magento\Framework\Data\Form\AbstractForm', + array('checkElementId', 'addElementToCollection'), + array(), + '', + false + ); + $formMock->expects($this->once()) + ->method('checkElementId') + ->with($elementId); + $formMock->expects($this->once()) + ->method('addElementToCollection') + ->with($elementMock); + + $collectionMock = $this->getMock('Magento\Framework\Data\Form\Element\Collection', array(), array(), '', false); + + $this->_collectionFactoryMock->expects($this->any()) + ->method('create') + ->will($this->returnValue($collectionMock)); + + $this->_model->setForm($formMock); + $this->_model->addElement($elementMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getHtmlId() + */ + public function testGetHtmlId() + { + $htmlIdPrefix = '--'; + $htmlIdSuffix = ']]'; + $htmlId = 'some_id'; + + $formMock = $this->getMock( + 'Magento\Framework\Data\Form\AbstractForm', array('getHtmlIdPrefix', 'getHtmlIdSuffix'), array(), '', false + ); + $formMock->expects($this->any()) + ->method('getHtmlIdPrefix') + ->will($this->returnValue($htmlIdPrefix)); + $formMock->expects($this->any()) + ->method('getHtmlIdSuffix') + ->will($this->returnValue($htmlIdSuffix)); + + $this->_model->setId($htmlId); + $this->_model->setForm($formMock); + $this->assertEquals($htmlIdPrefix . $htmlId . $htmlIdSuffix, $this->_model->getHtmlId()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getName() + */ + public function testGetNameWithoutSuffix() + { + $formMock = $this->getMock( + 'Magento\Framework\Data\Form\AbstractForm', + array('getFieldNameSuffix', 'addSuffixToName'), + array(), + '', + false + ); + $formMock->expects($this->any()) + ->method('getFieldNameSuffix') + ->will($this->returnValue(null)); + $formMock->expects($this->never()) + ->method('addSuffixToName'); + + $this->_model->setForm($formMock); + $this->_model->getName(); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getName() + */ + public function testGetNameWithSuffix() + { + $returnValue = 'some_value'; + + $formMock = $this->getMock( + 'Magento\Framework\Data\Form\AbstractForm', + array('getFieldNameSuffix', 'addSuffixToName'), + array(), + '', + false + ); + $formMock->expects($this->once()) + ->method('getFieldNameSuffix') + ->will($this->returnValue(true)); + $formMock->expects($this->once()) + ->method('addSuffixToName') + ->will($this->returnValue($returnValue)); + + $this->_model->setForm($formMock); + + $this->assertEquals($returnValue, $this->_model->getName()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::removeField() + */ + public function testRemoveField() + { + $elementId = 'element_id'; + + $formMock = $this->getMock( + 'Magento\Framework\Data\Form\AbstractForm', array('removeField'), array(), '', false + ); + $formMock->expects($this->once()) + ->method('removeField') + ->with($elementId); + + $collectionMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\Collection', array('remove'), array(), '', false + ); + $collectionMock->expects($this->once()) + ->method('remove') + ->with($elementId); + + $this->_collectionFactoryMock->expects($this->any()) + ->method('create') + ->will($this->returnValue($collectionMock)); + + $this->_model->setForm($formMock); + $this->_model->removeField($elementId); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getHtmlAttributes() + */ + public function testGetHtmlAttributes() + { + $htmlAttributes = array( + 'type', + 'title', + 'class', + 'style', + 'onclick', + 'onchange', + 'disabled', + 'readonly', + 'tabindex', + 'placeholder' + ); + $this->assertEquals($htmlAttributes, $this->_model->getHtmlAttributes()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::addClass() + */ + public function testAddClass() + { + $oldClass = 'old_class'; + $newClass = 'new_class'; + $this->_model->addClass($oldClass); + $this->_model->addClass($newClass); + + $this->assertEquals(' ' . $oldClass . ' ' . $newClass, $this->_model->getClass()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::removeClass() + */ + public function testRemoveClass() + { + $oldClass = 'old_class'; + $newClass = 'new_class'; + $oneMoreClass = 'some_class'; + $this->_model->addClass($oldClass); + $this->_model->addClass($oneMoreClass); + $this->_model->addClass($newClass); + + $this->_model->removeClass($oneMoreClass); + + $this->assertEquals(' ' . $oldClass . ' ' . $newClass, $this->_model->getClass()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getEscapedValue() + */ + public function testGetEscapedValueWithoutFilter() + { + $this->_model->setValue('my \'quoted\' string'); + $this->assertEquals( + '<a href="#hash_tag">my \'quoted\' string</a>', $this->_model->getEscapedValue() + ); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getEscapedValue() + */ + public function testGetEscapedValueWithFilter() + { + $value = 'my \'quoted\' string'; + $expectedValue = '<a href="#hash_tag">my \'quoted\' string</a>'; + + $filterMock = $this->getMock('Magento\Framework\Object', array('filter'), array(), '', false); + $filterMock->expects($this->once()) + ->method('filter') + ->with($value) + ->will($this->returnArgument(0)); + + $this->_model->setValueFilter($filterMock); + $this->_model->setValue($value); + $this->assertEquals($expectedValue, $this->_model->getEscapedValue()); + } + + /** + * @param array $initialData + * @param string $expectedValue + * @dataProvider getElementHtmlDataProvider + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getElementHtml() + */ + public function testGetElementHtml(array $initialData, $expectedValue) + { + $this->_model->setForm( + $this->getMock('Magento\Framework\Data\Form\AbstractForm', array(), array(), '', false) + ); + + $this->_model->setData($initialData); + $this->assertEquals($expectedValue, $this->_model->getElementHtml()); + } + + /** + * @param array $initialData + * @param string $expectedValue + * @dataProvider getLabelHtmlDataProvider + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getLabelHtml() + */ + public function testGetLabelHtml(array $initialData, $expectedValue) + { + $idSuffix = isset($initialData['id_suffix']) ? $initialData['id_suffix'] : null; + $this->_model->setData($initialData); + $this->_model->setForm( + $this->getMock('Magento\Framework\Data\Form\AbstractForm', array(), array(), '', false) + ); + $this->assertEquals($expectedValue, $this->_model->getLabelHtml($idSuffix)); + } + + /** + * @param array $initialData + * @param string $expectedValue + * @dataProvider testGetDefaultHtmlDataProvider + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getDefaultHtml() + */ + public function testGetDefaultHtml(array $initialData, $expectedValue) + { + $this->_model->setData($initialData); + $this->_model->setForm( + $this->getMock('Magento\Framework\Data\Form\AbstractForm', array(), array(), '', false) + ); + $this->assertEquals($expectedValue, $this->_model->getDefaultHtml()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getHtml() + */ + public function testGetHtmlWithoutRenderer() + { + $this->_model->setRequired(true); + $this->_model->setForm( + $this->getMock('Magento\Framework\Data\Form\AbstractForm', array(), array(), '', false) + ); + $expectedHtml = '' . "\n" + . '' . "\n"; + + $this->assertEquals($expectedHtml, $this->_model->getHtml()); + $this->assertEquals(' required-entry', $this->_model->getClass()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getHtml() + */ + public function testGetHtmlWithRenderer() + { + $this->_model->setRequired(true); + + $expectedHtml = 'some-html'; + + $rendererMock = $this->getMockForAbstractClass( + 'Magento\Framework\Data\Form\Element\Renderer\RendererInterface' + ); + $rendererMock->expects($this->once()) + ->method('render') + ->with($this->_model) + ->will($this->returnValue($expectedHtml)); + $this->_model->setRenderer($rendererMock); + + $this->assertEquals($expectedHtml, $this->_model->getHtml()); + $this->assertEquals(' required-entry', $this->_model->getClass()); + } + + /** + * @param array $initialData + * @param string $expectedValue + * @dataProvider serializeDataProvider + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::serialize() + */ + public function testSerialize(array $initialData, $expectedValue) + { + $attributes = array(); + if (isset($initialData['attributes'])) { + $attributes = $initialData['attributes']; + unset($initialData['attributes']); + } + $this->_model->setData($initialData); + $this->assertEquals($expectedValue, $this->_model->serialize($attributes)); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getHtmlContainerId() + */ + public function testGetHtmlContainerIdWithoutId() + { + $this->_model->setForm( + $this->getMock('Magento\Framework\Data\Form\AbstractForm', array(), array(), '', false) + ); + $this->assertEquals('', $this->_model->getHtmlContainerId()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getHtmlContainerId() + */ + public function testGetHtmlContainerIdWithContainerId() + { + $containerId = 'some-id'; + $this->_model->setContainerId($containerId); + $this->_model->setForm( + $this->getMock('Magento\Framework\Data\Form\AbstractForm', array(), array(), '', false) + ); + $this->assertEquals($containerId, $this->_model->getHtmlContainerId()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getHtmlContainerId() + */ + public function testGetHtmlContainerIdWithFieldContainerIdPrefix() + { + $id = 'id'; + $prefix = 'prefix_'; + $formMock = $this->getMock( + 'Magento\Framework\Data\Form\AbstractForm', array('getFieldContainerIdPrefix'), array(), '', false + ); + $formMock->expects($this->once()) + ->method('getFieldContainerIdPrefix') + ->will($this->returnValue($prefix)); + + $this->_model->setId($id); + $this->_model->setForm($formMock); + $this->assertEquals($prefix . $id, $this->_model->getHtmlContainerId()); + } + + /** + * @param array $initialData + * @param string $expectedValue + * @dataProvider addElementValuesDataProvider + * @covers \Magento\Framework\Data\Form\Element\AbstractElement::addElementValues() + */ + public function testAddElementValues(array $initialData, $expectedValue) + { + $this->_escaperMock->expects($this->any()) + ->method('escapeHtml') + ->will($this->returnArgument(0)); + $this->_model->setValues($initialData['initial_values']); + $this->_model->addElementValues($initialData['add_values'], $initialData['overwrite']); + + $this->assertEquals($expectedValue, $this->_model->getValues()); + } + + /** + * @return array + */ + public function addElementValuesDataProvider() + { + return array( + array( + array( + 'initial_values' => array( + 'key_1' => 'value_1', + 'key_2' => 'value_2', + 'key_3' => 'value_3' + ), + 'add_values' => array( + 'key_1' => 'value_4', + 'key_2' => 'value_5', + 'key_3' => 'value_6', + 'key_4' => 'value_7' + ), + 'overwrite' => false + ), + array( + 'key_1' => 'value_1', + 'key_2' => 'value_2', + 'key_3' => 'value_3', + 'key_4' => 'value_7' + ) + ), + array( + array( + 'initial_values' => array( + 'key_1' => 'value_1', + 'key_2' => 'value_2', + 'key_3' => 'value_3' + ), + 'add_values' => array( + 'key_1' => 'value_4', + 'key_2' => 'value_5', + 'key_3' => 'value_6', + 'key_4' => 'value_7' + ), + 'overwrite' => true + ), + array( + 'key_1' => 'value_4', + 'key_2' => 'value_5', + 'key_3' => 'value_6', + 'key_4' => 'value_7' + ) + ) + ); + } + + /** + * @return array + */ + public function serializeDataProvider() + { + return array( + array( + array(), + '' + ), + array( + array( + 'attributes' => array('disabled'), + 'disabled' => true + ), + 'disabled="disabled"' + ), + array( + array( + 'attributes' => array('checked'), + 'checked' => true + ), + 'checked="checked"' + ), + array( + array( + 'data-locked' => 1, + 'attributes' => array('attribute_1') + ), + 'data-locked="1"' + ) + ); + } + + /** + * @return array + */ + public function testGetDefaultHtmlDataProvider() + { + return array( + array( + array(), + '' . "\n" + . '' . "\n" + ), + array( + array('default_html' => 'some default html'), + 'some default html' + ), + array( + array( + 'label' => 'some label', + 'html_id' => 'html-id', + 'name' => 'some-name', + 'value' => 'some-value', + ), + '' . "\n" + . '' . "\n" + . '' + . '' . "\n" + ), + array( + array( + 'label' => 'some label', + 'html_id' => 'html-id', + 'name' => 'some-name', + 'value' => 'some-value', + 'no_span' => true + ), + '' . "\n" + . '' + ), + ); + } + + /** + * @return array + */ + public function getLabelHtmlDataProvider() + { + return array( + array( + array(), + '' + ), + array( + array( + 'id_suffix' => 'suffix' + ), + '' + ), + array( + array( + 'label' => 'some-label', + 'html_id' => 'some-html-id' + ), + '' . "\n" + ), + array( + array( + 'id_suffix' => 'suffix', + 'label' => 'some-label', + 'html_id' => 'some-html-id' + ), + '' . "\n" + ), + ); + } + + /** + * @return array + */ + public function getElementHtmlDataProvider() + { + return array( + array( + array(), + '' + ), + array( + array( + 'html_id' => 'html-id', + 'name' => 'some-name', + 'value' => 'some-value' + ), + '' + ), + array( + array( + 'html_id' => 'html-id', + 'name' => 'some-name', + 'value' => 'some-value', + 'before_element_html' => 'some-html' + ), + '' + . '' + ), + array( + array( + 'html_id' => 'html-id', + 'name' => 'some-name', + 'value' => 'some-value', + 'after_element_js' => 'some-js' + ), + 'some-js' + ), + array( + array( + 'html_id' => 'html-id', + 'name' => 'some-name', + 'value' => 'some-value', + 'after_element_html' => 'some-html' + ), + '' + . '' + ) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ButtonTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ButtonTest.php new file mode 100644 index 0000000000000..0c2f46961d4a0 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ButtonTest.php @@ -0,0 +1,100 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_model = new \Magento\Framework\Data\Form\Element\Button( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + $formMock = new \Magento\Framework\Object(); + $formMock->getHtmlIdPrefix('id_prefix'); + $formMock->getHtmlIdPrefix('id_suffix'); + $this->_model->setForm($formMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Button::__construct + */ + public function testConstruct() + { + $this->assertEquals('button', $this->_model->getType()); + $this->assertEquals('textfield', $this->_model->getExtType()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Button::getHtmlAttributes + */ + public function testGetHtmlAttributes() + { + $this->assertEmpty( + array_diff( + array( + 'type', + 'title', + 'class', + 'style', + 'onclick', + 'onchange', + 'disabled', + 'readonly', + 'tabindex', + 'placeholder', + 'data-mage-init' + ), + $this->_model->getHtmlAttributes() + ) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/CheckboxTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/CheckboxTest.php new file mode 100644 index 0000000000000..55a59efde5307 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/CheckboxTest.php @@ -0,0 +1,102 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_model = new \Magento\Framework\Data\Form\Element\Checkbox( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + $formMock = new \Magento\Framework\Object(); + $formMock->getHtmlIdPrefix('id_prefix'); + $formMock->getHtmlIdPrefix('id_suffix'); + $this->_model->setForm($formMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Checkbox::__construct + */ + public function testConstruct() + { + $this->assertEquals('checkbox', $this->_model->getType()); + $this->assertEquals('checkbox', $this->_model->getExtType()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Checkbox::getHtmlAttributes + */ + public function testGetHtmlAttributes() + { + $this->assertEmpty( + array_diff( + array('type', 'title', 'class', 'style', 'checked', 'onclick', 'onchange', 'disabled', 'tabindex'), + $this->_model->getHtmlAttributes() + ) + ); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Checkbox::getElementHtml + */ + public function testGetElementHtml() + { + $this->_model->setIsChecked(false); + $html = $this->_model->getElementHtml(); + $this->assertContains('type="checkbox"', $html); + $this->assertNotContains('checked="checked"', $html); + $this->_model->setIsChecked(true); + $html = $this->_model->getElementHtml(); + $this->assertContains('checked="checked"', $html); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/CollectionFactoryTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/CollectionFactoryTest.php new file mode 100644 index 0000000000000..e540ae0705b62 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/CollectionFactoryTest.php @@ -0,0 +1,66 @@ +getMock( + 'Magento\Framework\ObjectManager\ObjectManager', + array('create'), + array(), + '', + false + ); + $collectionMock = $this->getMock('Magento\Framework\Data\Form\Element\Collection', array(), array(), '', false); + $objectManagerMock->expects($this->once())->method('create')->will($this->returnValue($collectionMock)); + $this->_model = new \Magento\Framework\Data\Form\Element\CollectionFactory($objectManagerMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\CollectionFactory::create + */ + public function testCreate() + { + $this->assertInstanceOf('Magento\Framework\Data\Form\Element\Collection', $this->_model->create(array())); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ColumnTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ColumnTest.php new file mode 100644 index 0000000000000..1bd1ffd22ca57 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ColumnTest.php @@ -0,0 +1,74 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_model = new \Magento\Framework\Data\Form\Element\Column( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + $formMock = new \Magento\Framework\Object(); + $formMock->getHtmlIdPrefix('id_prefix'); + $formMock->getHtmlIdPrefix('id_suffix'); + $this->_model->setForm($formMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Column::__construct + */ + public function testConstruct() + { + $this->assertEquals('column', $this->_model->getType()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/FileTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/FileTest.php new file mode 100644 index 0000000000000..f86b85923986f --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/FileTest.php @@ -0,0 +1,75 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_model = new \Magento\Framework\Data\Form\Element\File( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + $formMock = new \Magento\Framework\Object(); + $formMock->getHtmlIdPrefix('id_prefix'); + $formMock->getHtmlIdPrefix('id_suffix'); + $this->_model->setForm($formMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\File::__construct + */ + public function testConstruct() + { + $this->assertEquals('file', $this->_model->getType()); + $this->assertEquals('file', $this->_model->getExtType()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/HiddenTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/HiddenTest.php new file mode 100644 index 0000000000000..010c282bc2515 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/HiddenTest.php @@ -0,0 +1,87 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_model = new \Magento\Framework\Data\Form\Element\Hidden( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + $formMock = new \Magento\Framework\Object(); + $formMock->getHtmlIdPrefix('id_prefix'); + $formMock->getHtmlIdPrefix('id_suffix'); + $this->_model->setForm($formMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Hidden::__construct + */ + public function testConstruct() + { + $this->assertEquals('hidden', $this->_model->getType()); + $this->assertEquals('hiddenfield', $this->_model->getExtType()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Hidden::getDefaultHtml + */ + public function testGetDefaultHtml() + { + $html = $this->_model->getDefaultHtml(); + $this->assertContains('assertContains('type="hidden"', $html); + $this->_model->setDefaultHtml('testhtml'); + $this->assertEquals('testhtml', $this->_model->getDefaultHtml()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ImageTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ImageTest.php new file mode 100644 index 0000000000000..5a739a696a980 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ImageTest.php @@ -0,0 +1,113 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $urlBuilderMock = $this->getMock('\Magento\Framework\Url', array(), array(), '', false); + $this->_image = new \Magento\Framework\Data\Form\Element\Image( + $factoryMock, + $collectionFactoryMock, + $escaperMock, + $urlBuilderMock + ); + $formMock = new \Magento\Framework\Object(); + $formMock->getHtmlIdPrefix('id_prefix'); + $formMock->getHtmlIdPrefix('id_suffix'); + $this->_image->setForm($formMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Image::__construct + */ + public function testConstruct() + { + $this->assertEquals('file', $this->_image->getType()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Image::getName + */ + public function testGetName() + { + $this->_image->setName('image_name'); + $this->assertEquals('image_name', $this->_image->getName()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Image::getElementHtml + */ + public function testGetElementHtmlWithoutValue() + { + $html = $this->_image->getElementHtml(); + $this->assertContains('class="input-file"', $html); + $this->assertContains('assertContains('type="file"', $html); + $this->assertContains('value=""', $html); + $this->assertNotContains('', $html); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Image::getElementHtml + */ + public function testGetElementHtmlWithValue() + { + $this->_image->setValue('test_value'); + $html = $this->_image->getElementHtml(); + $this->assertContains('class="input-file"', $html); + $this->assertContains('assertContains('type="file"', $html); + $this->assertContains('value="test_value"', $html); + $this->assertContains('assertContains('getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_imagefile = new \Magento\Framework\Data\Form\Element\Imagefile( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Imagefile::__construct + */ + public function testConstruct() + { + $this->assertEquals('file', $this->_imagefile->getType()); + $this->assertEquals('imagefile', $this->_imagefile->getExtType()); + $this->assertFalse($this->_imagefile->getAutosubmit()); + $this->assertFalse($this->_imagefile->getData('autoSubmit')); + + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/LabelTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/LabelTest.php new file mode 100644 index 0000000000000..82f3889a59082 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/LabelTest.php @@ -0,0 +1,83 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_label = new \Magento\Framework\Data\Form\Element\Label( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Label::__construct + */ + public function testConstruct() + { + $this->assertEquals('label', $this->_label->getType()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Label::getElementHtml + */ + public function testGetElementHtml() + { + $this->_label->setValue('Label Text'); + $html = $this->_label->getElementHtml(); + $this->assertContains("
Label Text", $html); + $this->_label->setBold(true); + $html = $this->_label->getElementHtml(); + $this->assertContains("
Label Text", $html); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/LinkTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/LinkTest.php new file mode 100644 index 0000000000000..25760cabb5dda --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/LinkTest.php @@ -0,0 +1,134 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_link = new \Magento\Framework\Data\Form\Element\Link( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + $formMock = new \Magento\Framework\Object(); + $formMock->getHtmlIdPrefix('id_prefix'); + $formMock->getHtmlIdPrefix('id_suffix'); + $this->_link->setForm($formMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Link::__construct + */ + public function testConstruct() + { + $this->assertEquals('link', $this->_link->getType()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Link::getElementHtml + */ + public function testGetElementHtml() + { + $this->_link->setBeforeElementHtml('link_before'); + $this->_link->setAfterElementHtml('link_after'); + $this->_link->setId('link_id'); + $this->_link->setData('ui_id', 'ui_id'); + $this->_link->setValue('Link Text'); + $html = $this->_link->getElementHtml(); + $this->assertEquals( + "link_beforeLink Text\nlink_after", + $html + ); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Link::getHtmlAttributes + */ + public function testGetHtmlAttributes() + { + $this->assertEmpty( + array_diff( + array( + 'charset', + 'coords', + 'href', + 'hreflang', + 'rel', + 'rev', + 'name', + 'shape', + 'target', + 'accesskey', + 'class', + 'dir', + 'lang', + 'style', + 'tabindex', + 'title', + 'xml:lang', + 'onblur', + 'onclick', + 'ondblclick', + 'onfocus', + 'onmousedown', + 'onmousemove', + 'onmouseout', + 'onmouseover', + 'onmouseup', + 'onkeydown', + 'onkeypress', + 'onkeyup' + ), + $this->_link->getHtmlAttributes() + ) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/NoteTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/NoteTest.php new file mode 100644 index 0000000000000..0375358e9f258 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/NoteTest.php @@ -0,0 +1,91 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_model = new \Magento\Framework\Data\Form\Element\Note( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + $formMock = new \Magento\Framework\Object(); + $formMock->getHtmlIdPrefix('id_prefix'); + $formMock->getHtmlIdPrefix('id_suffix'); + $this->_model->setForm($formMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Note::__construct + */ + public function testConstruct() + { + $this->assertEquals('note', $this->_model->getType()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Note::getElementHtml + */ + public function testGetElementHtml() + { + $this->_model->setBeforeElementHtml('note_before'); + $this->_model->setAfterElementHtml('note_after'); + $this->_model->setId('note_id'); + $this->_model->setData('ui_id', 'ui_id'); + $this->_model->setValue('Note Text'); + $html = $this->_model->getElementHtml(); + $this->assertEquals( + "note_before
note_after", + $html + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ObscureTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ObscureTest.php new file mode 100644 index 0000000000000..222a99818236f --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ObscureTest.php @@ -0,0 +1,111 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_model = new \Magento\Framework\Data\Form\Element\Obscure( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + $formMock = new \Magento\Framework\Object(); + $formMock->getHtmlIdPrefix('id_prefix'); + $formMock->getHtmlIdPrefix('id_suffix'); + $this->_model->setForm($formMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Obscure::__construct + */ + public function testConstruct() + { + $this->assertEquals('password', $this->_model->getType()); + $this->assertEquals('textfield', $this->_model->getExtType()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Obscure::getEscapedValue + */ + public function testGetEscapedValue() + { + $this->_model->setValue('Obscure Text'); + $this->assertContains('value="******"', $this->_model->getElementHtml()); + $this->_model->setValue(''); + $this->assertContains('value=""', $this->_model->getElementHtml()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Obscure::getHtmlAttributes + */ + public function testGetHtmlAttributes() + { + $this->assertEmpty( + array_diff( + array( + 'type', + 'title', + 'class', + 'style', + 'onclick', + 'onchange', + 'onkeyup', + 'disabled', + 'readonly', + 'maxlength', + 'tabindex' + ), + $this->_model->getHtmlAttributes() + ) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/PasswordTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/PasswordTest.php new file mode 100644 index 0000000000000..4656dea84408a --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/PasswordTest.php @@ -0,0 +1,85 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_model = new \Magento\Framework\Data\Form\Element\Obscure( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + $formMock = new \Magento\Framework\Object(); + $formMock->getHtmlIdPrefix('id_prefix'); + $formMock->getHtmlIdPrefix('id_suffix'); + $this->_model->setForm($formMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Password::__construct + */ + public function testConstruct() + { + $this->assertEquals('password', $this->_model->getType()); + $this->assertEquals('textfield', $this->_model->getExtType()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Password::getHtml + */ + public function testGetHtml() + { + $html = $this->_model->getHtml(); + $this->assertContains('type="password"', $html); + $this->assertTrue(preg_match('/class=\".*input-text.*\"/i', $html) > 0); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/RadioTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/RadioTest.php new file mode 100644 index 0000000000000..a06171e64c76e --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/RadioTest.php @@ -0,0 +1,75 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_model = new \Magento\Framework\Data\Form\Element\Radio( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + $formMock = new \Magento\Framework\Object(); + $formMock->getHtmlIdPrefix('id_prefix'); + $formMock->getHtmlIdPrefix('id_suffix'); + $this->_model->setForm($formMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Radio::__construct + */ + public function testConstruct() + { + $this->assertEquals('radio', $this->_model->getType()); + $this->assertEquals('radio', $this->_model->getExtType()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ResetTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ResetTest.php new file mode 100644 index 0000000000000..a4860a0302b7f --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/ResetTest.php @@ -0,0 +1,75 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_model = new \Magento\Framework\Data\Form\Element\Reset( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + $formMock = new \Magento\Framework\Object(); + $formMock->getHtmlIdPrefix('id_prefix'); + $formMock->getHtmlIdPrefix('id_suffix'); + $this->_model->setForm($formMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Reset::__construct + */ + public function testConstruct() + { + $this->assertEquals('text', $this->_model->getType()); + $this->assertEquals('textfield', $this->_model->getExtType()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/SubmitTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/SubmitTest.php new file mode 100644 index 0000000000000..b9f84bd30716d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/SubmitTest.php @@ -0,0 +1,85 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_model = new \Magento\Framework\Data\Form\Element\Submit( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + $formMock = new \Magento\Framework\Object(); + $formMock->getHtmlIdPrefix('id_prefix'); + $formMock->getHtmlIdPrefix('id_suffix'); + $this->_model->setForm($formMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Submit::__construct + */ + public function testConstruct() + { + $this->assertEquals('submit', $this->_model->getType()); + $this->assertEquals('submit', $this->_model->getExtType()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Submit::getHtml + */ + public function testGetHtml() + { + $html = $this->_model->getHtml(); + $this->assertContains('type="submit"', $html); + $this->assertTrue(preg_match('/class=\".*submit.*\"/i', $html) > 0); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/TextTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/TextTest.php new file mode 100644 index 0000000000000..0a986e750677f --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/TextTest.php @@ -0,0 +1,111 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_model = new \Magento\Framework\Data\Form\Element\Text( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + $formMock = new \Magento\Framework\Object(); + $formMock->getHtmlIdPrefix('id_prefix'); + $formMock->getHtmlIdPrefix('id_suffix'); + $this->_model->setForm($formMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Text::__construct + */ + public function testConstruct() + { + $this->assertEquals('text', $this->_model->getType()); + $this->assertEquals('textfield', $this->_model->getExtType()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Text::getHtml + */ + public function testGetHtml() + { + $html = $this->_model->getHtml(); + $this->assertContains('type="text"', $html); + $this->assertTrue(preg_match('/class=\".*input-text.*\"/i', $html) > 0); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Text::getHtmlAttributes + */ + public function testGetHtmlAttributes() + { + $this->assertEmpty( + array_diff( + array( + 'type', + 'title', + 'class', + 'style', + 'onclick', + 'onchange', + 'onkeyup', + 'disabled', + 'readonly', + 'maxlength', + 'tabindex', + 'placeholder' + ), + $this->_model->getHtmlAttributes() + ) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/TextareaTest.php b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/TextareaTest.php new file mode 100644 index 0000000000000..f00acd6e1de92 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Data/Form/Element/TextareaTest.php @@ -0,0 +1,114 @@ +getMock('\Magento\Framework\Data\Form\Element\Factory', array(), array(), '', false); + $collectionFactoryMock = $this->getMock( + '\Magento\Framework\Data\Form\Element\CollectionFactory', + array(), + array(), + '', + false + ); + $escaperMock = $this->getMock('\Magento\Framework\Escaper', array(), array(), '', false); + $this->_model = new \Magento\Framework\Data\Form\Element\Textarea( + $factoryMock, + $collectionFactoryMock, + $escaperMock + ); + $formMock = new \Magento\Framework\Object(); + $formMock->getHtmlIdPrefix('id_prefix'); + $formMock->getHtmlIdPrefix('id_suffix'); + $this->_model->setForm($formMock); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Textarea::__construct + */ + public function testConstruct() + { + $this->assertEquals('textarea', $this->_model->getType()); + $this->assertEquals('textarea', $this->_model->getExtType()); + $this->assertEquals(2, $this->_model->getRows()); + $this->assertEquals(15, $this->_model->getCols()); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Textarea::getElementHtml + */ + public function testGetElementHtml() + { + $html = $this->_model->getElementHtml(); + $this->assertContains('', $html); + $this->assertContains('rows="2"', $html); + $this->assertContains('cols="15"', $html); + $this->assertTrue(preg_match('/class=\".*textarea.*\"/i', $html) > 0); + } + + /** + * @covers \Magento\Framework\Data\Form\Element\Textarea::getHtmlAttributes + */ + public function testGetHtmlAttributes() + { + $this->assertEmpty( + array_diff( + array( + 'title', + 'class', + 'style', + 'onclick', + 'onchange', + 'rows', + 'cols', + 'readonly', + 'disabled', + 'onkeyup', + 'tabindex' + ), + $this->_model->getHtmlAttributes() + ) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/CalculatorTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/CalculatorTest.php index 0b48e4bb7eda5..f5a00d6421363 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/CalculatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/CalculatorTest.php @@ -18,6 +18,9 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing + * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -48,6 +51,12 @@ public function setUp() $this->model = new \Magento\Framework\Pricing\Adjustment\Calculator($this->amountFactoryMock); } + public function tearDown() + { + $this->model = null; + $this->amountFactoryMock = null; + } + /** * Test getAmount() */ @@ -58,10 +67,10 @@ public function testGetAmount() $newAmount = 15; $taxAdjustmentCode = 'tax'; $weeeAdjustmentCode = 'weee'; - $adjust = 5; + $adjustment = 5; $expectedAdjustments = [ - $taxAdjustmentCode => $adjust, - $weeeAdjustmentCode => $adjust + $taxAdjustmentCode => $adjustment, + $weeeAdjustmentCode => $adjustment ]; $productMock = $this->getMockBuilder('Magento\Catalog\Model\Product') @@ -81,7 +90,7 @@ public function testGetAmount() $taxAdjustmentMock->expects($this->once()) ->method('extractAdjustment') ->with($this->equalTo($amount), $this->equalTo($productMock)) - ->will($this->returnValue($adjust)); + ->will($this->returnValue($adjustment)); $weeeAdjustmentMock = $this->getMockBuilder('Magento\Weee\Pricing\Adjustment') ->disableOriginalConstructor() @@ -126,4 +135,73 @@ public function testGetAmount() $result = $this->model->getAmount($amount, $productMock); $this->assertInstanceOf('Magento\Framework\Pricing\Amount\AmountInterface', $result); } + + public function testGetAmountExclude() + { + $amount = 10; + $taxAdjustmentCode = 'tax'; + $weeeAdjustmentCode = 'weee'; + $adjustment = 5; + $expectedAdjustments = []; + + $productMock = $this->getMockBuilder('Magento\Catalog\Model\Product') + ->disableOriginalConstructor() + ->setMethods(['getPriceInfo', '__wakeup']) + ->getMock(); + + $taxAdjustmentMock = $this->getMockBuilder('Magento\Tax\Pricing\Adjustment') + ->disableOriginalConstructor() + ->getMock(); + $taxAdjustmentMock->expects($this->once()) + ->method('getAdjustmentCode') + ->will($this->returnValue($taxAdjustmentCode)); + $taxAdjustmentMock->expects($this->once()) + ->method('isIncludedInBasePrice') + ->will($this->returnValue(true)); + $taxAdjustmentMock->expects($this->once()) + ->method('extractAdjustment') + ->with($this->equalTo($amount), $this->equalTo($productMock)) + ->will($this->returnValue($adjustment)); + + $weeeAdjustmentMock = $this->getMockBuilder('Magento\Weee\Pricing\Adjustment') + ->disableOriginalConstructor() + ->getMock(); + $weeeAdjustmentMock->expects($this->once()) + ->method('getAdjustmentCode') + ->will($this->returnValue($weeeAdjustmentCode)); + $weeeAdjustmentMock->expects($this->once()) + ->method('isIncludedInBasePrice') + ->will($this->returnValue(false)); + $weeeAdjustmentMock->expects($this->once()) + ->method('isIncludedInDisplayPrice') + ->with($this->equalTo($productMock)) + ->will($this->returnValue(true)); + $weeeAdjustmentMock->expects($this->never()) + ->method('applyAdjustment'); + + $adjustments = [$taxAdjustmentMock, $weeeAdjustmentMock]; + + $priceInfoMock = $this->getMockBuilder('\Magento\Framework\Pricing\PriceInfoInterface') + ->disableOriginalConstructor() + //->setMethods(['getPriceInfo']) + ->getMock(); + $priceInfoMock->expects($this->any()) + ->method('getAdjustments') + ->will($this->returnValue($adjustments)); + + $productMock->expects($this->any()) + ->method('getPriceInfo') + ->will($this->returnValue($priceInfoMock)); + + $amountBaseMock = $this->getMockBuilder('Magento\Framework\Pricing\Amount\Base') + ->disableOriginalConstructor() + ->getMock(); + + $this->amountFactoryMock->expects($this->once()) + ->method('create') + ->with($this->equalTo($amount), $this->equalTo($expectedAdjustments)) + ->will($this->returnValue($amountBaseMock)); + $result = $this->model->getAmount($amount, $productMock, true); + $this->assertInstanceOf('Magento\Framework\Pricing\Amount\AmountInterface', $result); + } } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/CollectionTest.php index 0ed7b9423a5e5..53b12cafda2ec 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/CollectionTest.php @@ -18,6 +18,9 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing + * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/FactoryTest.php index 147567a255242..93bfb30ad02e8 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/FactoryTest.php @@ -18,6 +18,9 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing + * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -69,8 +72,8 @@ protected function prepareObjectManager($adjustmentInterface) { $objectManager = $this->getMock( 'Magento\Framework\ObjectManager\ObjectManager', - array('create'), - array(), + ['create'], + [], '', false ); diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/PoolTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/PoolTest.php index 9bfe424bbb63f..00d2b79593ecf 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/PoolTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Adjustment/PoolTest.php @@ -18,6 +18,9 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing + * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -40,7 +43,7 @@ public function setUp() 'adj5' => ['className' => 'adj5_class'], ]; - /** @var $adjustmentFactory \Magento\Framework\Pricing\Adjustment\Factory */ + /** @var Factory|\PHPUnit_Framework_MockObject_MockObject $adjustmentFactory */ $adjustmentFactory = $this->getMockBuilder('Magento\Framework\Pricing\Adjustment\Factory') ->disableOriginalConstructor() ->setMethods(['create']) diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Amount/BaseTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Amount/BaseTest.php index ab82450311845..9adc6ec6b044b 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Amount/BaseTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Amount/BaseTest.php @@ -18,6 +18,9 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing + * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/AbstractPriceTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/AbstractPriceTest.php new file mode 100644 index 0000000000000..d478d29d4a905 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/AbstractPriceTest.php @@ -0,0 +1,127 @@ +saleableItemMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); + $this->priceInfoMock = $this->getMock('Magento\Framework\Pricing\PriceInfo\Base', [], [], '', false); + $this->amountMock = $this->getMock('Magento\Framework\Pricing\Amount', [], [], '', false); + $this->calculatorMock = $this->getMock('Magento\Framework\Pricing\Adjustment\Calculator', [], [], '', false); + + $this->saleableItemMock->expects($this->once()) + ->method('getPriceInfo') + ->will($this->returnValue($this->priceInfoMock)); + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->price = $objectManager->getObject( + 'Magento\Framework\Pricing\Price\Stub', + [ + 'saleableItem' => $this->saleableItemMock, + 'quantity' => $qty, + 'calculator' => $this->calculatorMock + ] + ); + } + + /** + * Test method testGetDisplayValue + */ + public function testGetAmount() + { + $priceValue = $this->price->getValue(); + $amountValue = 88; + $this->calculatorMock->expects($this->once()) + ->method('getAmount') + ->with($this->equalTo($priceValue)) + ->will($this->returnValue($amountValue)); + $this->assertEquals($amountValue, $this->price->getAmount()); + } + + /** + * Test method getPriceType + */ + public function testGetPriceCode() + { + $this->assertEquals(AbstractPrice::PRICE_CODE, $this->price->getPriceCode()); + } + + public function testGetCustomAmount() + { + $exclude = false; + $amount = 21.0; + $customAmount = 42.0; + $this->calculatorMock->expects($this->once()) + ->method('getAmount') + ->with($amount, $this->saleableItemMock, $exclude) + ->will($this->returnValue($customAmount)); + + $this->assertEquals($customAmount, $this->price->getCustomAmount($amount, $exclude)); + } + + public function testGetCustomAmountDefault() + { + $customAmount = 42.0; + $this->calculatorMock->expects($this->once()) + ->method('getAmount') + ->with($this->price->getValue(), $this->saleableItemMock, null) + ->will($this->returnValue($customAmount)); + + $this->assertEquals($customAmount, $this->price->getCustomAmount()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/CollectionTest.php new file mode 100644 index 0000000000000..e1252270c6fc8 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/CollectionTest.php @@ -0,0 +1,121 @@ +pool = new Pool( + [ + 'regular_price' => 'RegularPrice', + 'special_price' => 'SpecialPrice', + 'group_price' => 'GroupPrice' + ] + ); + + $this->saleableItemMock = $this->getMockForAbstractClass('Magento\Framework\Pricing\Object\SaleableInterface'); + $this->priceMock = $this->getMockForAbstractClass('Magento\Framework\Pricing\Price\PriceInterface'); + $this->factoryMock = $this->getMock('Magento\Framework\Pricing\Price\Factory', [], [], '', false); + + $this->collection = new Collection( + $this->saleableItemMock, + $this->factoryMock, + $this->pool, + $this->quantity + ); + } + + /** + * Test get method + */ + public function testGet() + { + $this->factoryMock->expects($this->once()) + ->method('create') + ->with( + $this->equalTo($this->saleableItemMock), + $this->equalTo('RegularPrice'), + $this->quantity + ) + ->will($this->returnValue($this->priceMock)); + $this->assertEquals($this->priceMock, $this->collection->get('regular_price')); + } + + /** + * Test current method + */ + public function testCurrent() + { + $this->factoryMock->expects($this->once()) + ->method('create') + ->with( + $this->equalTo($this->saleableItemMock), + $this->equalTo($this->pool->current()), + $this->quantity + ) + ->will($this->returnValue($this->priceMock)); + $this->assertEquals($this->priceMock, $this->collection->current()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/FactoryTest.php index 382c8e23835e4..89a315563bf8e 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/FactoryTest.php @@ -18,6 +18,9 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing + * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -56,41 +59,40 @@ public function testCreate() $quantity = 2.2; $className = 'Magento\Framework\Pricing\Price\PriceInterface'; $priceMock = $this->getMock($className); - $salableItem = $this->getMock('Magento\Framework\Pricing\Object\SaleableInterface'); + $saleableItem = $this->getMock('Magento\Framework\Pricing\Object\SaleableInterface'); $arguments = []; - $argumentsResult = array_merge($arguments, ['salableItem' => $salableItem, 'quantity' => $quantity]); + $argumentsResult = array_merge($arguments, ['saleableItem' => $saleableItem, 'quantity' => $quantity]); $this->objectManagerMock->expects($this->once()) ->method('create') ->with($className, $argumentsResult) ->will($this->returnValue($priceMock)); - $this->assertEquals($priceMock, $this->model->create($salableItem, $className, $quantity, $arguments)); + $this->assertEquals($priceMock, $this->model->create($saleableItem, $className, $quantity, $arguments)); } + /** + * @codingStandardsIgnoreStart + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Magento\Framework\Pricing\PriceInfo\Base doesn't implement \Magento\Framework\Pricing\Price\PriceInterface + * @codingStandardsIgnoreEnd + */ public function testCreateWithException() { - $this->setExpectedException( - 'InvalidArgumentException', - sprintf( - 'Magento\Framework\Pricing\PriceInfo\Base doesn\'t implement %s', - '\Magento\Framework\Pricing\Price\PriceInterface' - ) - ); $quantity = 2.2; $className = 'Magento\Framework\Pricing\PriceInfo\Base'; $priceMock = $this->getMockBuilder($className)->disableOriginalConstructor()->getMock(); - $salableItem = $this->getMock('Magento\Framework\Pricing\Object\SaleableInterface'); + $saleableItem = $this->getMock('Magento\Framework\Pricing\Object\SaleableInterface'); $arguments = []; - $argumentsResult = array_merge($arguments, ['salableItem' => $salableItem, 'quantity' => $quantity]); + $argumentsResult = array_merge($arguments, ['saleableItem' => $saleableItem, 'quantity' => $quantity]); $this->objectManagerMock->expects($this->once()) ->method('create') ->with($className, $argumentsResult) ->will($this->returnValue($priceMock)); - $this->model->create($salableItem, $className, $quantity, $arguments); + $this->model->create($saleableItem, $className, $quantity, $arguments); } } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/PoolTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/PoolTest.php new file mode 100644 index 0000000000000..6858599eac02d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/PoolTest.php @@ -0,0 +1,120 @@ +prices = [ + 'regular_price' => 'RegularPrice', + 'special_price' => 'SpecialPrice' + ]; + $this->target = [ + 'group_price' => 'TargetGroupPrice', + 'regular_price' => 'TargetRegularPrice' + ]; + $this->targetPool = new Pool($this->target); + $this->pool = new Pool($this->prices, $this->targetPool); + } + + /** + * test mergedConfiguration + */ + public function testMergedConfiguration() + { + $expected = new Pool([ + 'regular_price' => 'RegularPrice', + 'special_price' => 'SpecialPrice', + 'group_price' => 'TargetGroupPrice' + ]); + $this->assertEquals($expected, $this->pool); + } + + /** + * Test get method + */ + public function testGet() + { + $this->assertEquals('RegularPrice', $this->pool->get('regular_price')); + $this->assertEquals('SpecialPrice', $this->pool->get('special_price')); + $this->assertEquals('TargetGroupPrice', $this->pool->get('group_price')); + } + + /** + * Test abilities of ArrayAccess interface + */ + public function testArrayAccess() + { + $this->assertEquals('RegularPrice', $this->pool['regular_price']); + $this->assertEquals('SpecialPrice', $this->pool['special_price']); + $this->assertEquals('TargetGroupPrice', $this->pool['group_price']); + $this->pool['fake_price'] = 'FakePrice'; + $this->assertEquals('FakePrice', $this->pool['fake_price']); + $this->assertTrue(isset($this->pool['fake_price'])); + unset($this->pool['fake_price']); + $this->assertFalse(isset($this->pool['fake_price'])); + $this->assertNull($this->pool['fake_price']); + } + + /** + * Test abilities of Iterator interface + */ + public function testIterator() + { + foreach ($this->pool as $code => $class) { + $this->assertEquals($this->pool[$code], $class); + } + } +} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/Stub.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/Stub.php new file mode 100644 index 0000000000000..2be7d1988ea57 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Price/Stub.php @@ -0,0 +1,46 @@ +priceFactory = $this->getMockBuilder('Magento\Framework\Pricing\Price\Factory') - ->disableOriginalConstructor() - ->getMock(); - - $this->metadata = array( - FinalPriceInterface::PRICE_TYPE_FINAL => ['class' => 'Class\For\FinalPrice'], - GroupPriceInterface::PRICE_TYPE_GROUP => ['class' => 'Class\For\GroupPrice'], - SpecialPriceInterface::PRICE_TYPE_SPECIAL => ['class' => 'Class\For\SpecialPrice'] - ); - - $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->model = $objectManager->getObject('Magento\Framework\Pricing\PriceComposite', array( - 'priceFactory' => $this->priceFactory, - 'metadata' => $this->metadata - )); - } - - public function testGetPriceCodes() - { - $expectedCodes = [ - FinalPriceInterface::PRICE_TYPE_FINAL, - GroupPriceInterface::PRICE_TYPE_GROUP, - SpecialPriceInterface::PRICE_TYPE_SPECIAL - ]; - $this->assertEquals($expectedCodes, $this->model->getPriceCodes()); - } - - public function testGetMetadata() - { - $this->assertEquals($this->metadata, $this->model->getMetadata()); - } - - public function testCreatePriceObject() - { - $saleable = $this->getMock('Magento\Framework\Pricing\Object\SaleableInterface'); - $priceCode = FinalPriceInterface::PRICE_TYPE_FINAL; - $quantity = 2.4; - - $price = $this->getMock('Magento\Framework\Pricing\Price\PriceInterface'); - - $this->priceFactory->expects($this->once()) - ->method('create') - ->with($saleable, $this->metadata[$priceCode]['class'], $quantity) - ->will($this->returnValue($price)); - - $this->assertEquals($price, $this->model->createPriceObject($saleable, $priceCode, $quantity)); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage wrong_price is not registered in prices list - */ - public function testCreatePriceObjectWithException() - { - $saleable = $this->getMock('Magento\Framework\Pricing\Object\SaleableInterface'); - $priceCode = 'wrong_price'; - $quantity = 2.4; - - $this->model->createPriceObject($saleable, $priceCode, $quantity); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/PriceInfo/BaseTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/PriceInfo/BaseTest.php index 5491e1780b0c0..10af59566adb4 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Pricing/PriceInfo/BaseTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/PriceInfo/BaseTest.php @@ -18,6 +18,9 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing + * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -30,14 +33,9 @@ class BaseTest extends \PHPUnit_Framework_TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Pricing\Object\SaleableInterface + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Pricing\Price\Collection */ - protected $saleableItem; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Pricing\PriceComposite - */ - protected $prices; + protected $priceCollection; /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Pricing\Adjustment\Collection @@ -45,24 +43,13 @@ class BaseTest extends \PHPUnit_Framework_TestCase protected $adjustmentCollection; /** - * @var float - */ - protected $quantity; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Pricing\Amount\AmountFactory - */ - protected $amountFactory; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|Base + * @var Base */ protected $model; public function setUp() { - $this->saleableItem = $this->getMock('Magento\Framework\Pricing\Object\SaleableInterface', [], [], '', false); - $this->prices = $this->getMock('Magento\Framework\Pricing\PriceComposite', [], [], '', false); + $this->priceCollection = $this->getMock('Magento\Framework\Pricing\Price\Collection', [], [], '', false); $this->adjustmentCollection = $this->getMock( 'Magento\Framework\Pricing\Adjustment\Collection', [], @@ -70,50 +57,35 @@ public function setUp() '', false ); - $this->amountFactory = $this->getMock('Magento\Framework\Pricing\Amount\AmountFactory', [], [], '', false); - $this->quantity = 3.; - $this->model = new Base( - $this->saleableItem, - $this->prices, - $this->adjustmentCollection, - $this->amountFactory, - $this->quantity - ); + $this->model = new Base($this->priceCollection, $this->adjustmentCollection); } /** - * @covers \Magento\Framework\Pricing\PriceInfo\Base::__construct - * @covers \Magento\Framework\Pricing\PriceInfo\Base::initPrices - * @covers \Magento\Framework\Pricing\PriceInfo\Base::getPrices + * test method getPrices() */ public function testGetPrices() { - $this->prices->expects($this->once()) - ->method('getPriceCodes') - ->will($this->returnValue(['test1', 'test2'])); - $this->prices->expects($this->at(1))->method('createPriceObject') - ->with($this->saleableItem, 'test1', $this->quantity)->will($this->returnValue('1')); - $this->prices->expects($this->at(2))->method('createPriceObject') - ->with($this->saleableItem, 'test2', $this->quantity)->will($this->returnValue('2')); - $this->assertEquals(['test1' => '1', 'test2' => '2'], $this->model->getPrices()); + $this->assertEquals($this->priceCollection, $this->model->getPrices()); } /** - * @covers \Magento\Framework\Pricing\PriceInfo\Base::__construct - * @covers \Magento\Framework\Pricing\PriceInfo\Base::getPrice + * @param $entryParams + * @param $createCount * @dataProvider providerGetPrice */ public function testGetPrice($entryParams, $createCount) { - list($priceCode, $quantity) = array_values(reset($entryParams)); - $this->prices->expects($this->exactly($createCount))->method('createPriceObject') - ->with($this->saleableItem, $priceCode, $quantity ? : $this->quantity)->will( - $this->returnValue('basePrice') - ); + $priceCode = current(array_values(reset($entryParams))); + + $this->priceCollection + ->expects($this->exactly($createCount)) + ->method('get') + ->with($this->equalTo($priceCode)) + ->will($this->returnValue('basePrice')); foreach ($entryParams as $params) { - list($priceCode, $quantity) = array_values($params); - $this->assertEquals('basePrice', $this->model->getPrice($priceCode, $quantity)); + list($priceCode) = array_values($params); + $this->assertEquals('basePrice', $this->model->getPrice($priceCode)); } } @@ -127,20 +99,20 @@ public function providerGetPrice() return [ 'case with empty quantity' => [ 'entryParams' => [ - ['priceCode' => 'testCode', 'quantity' => null] + ['priceCode' => 'testCode'] ], 'createCount' => 1 ], 'case with existing price' => [ 'entryParams' => [ - ['priceCode' => 'testCode', 'quantity' => null], - ['priceCode' => 'testCode', 'quantity' => null] + ['priceCode' => 'testCode'], + ['priceCode' => 'testCode'] ], - 'createCount' => 1 + 'createCount' => 2 ], 'case with quantity' => [ 'entryParams' => [ - ['priceCode' => 'testCode', 'quantity' => 2.] + ['priceCode' => 'testCode'] ], 'createCount' => 1 ], @@ -166,28 +138,4 @@ public function testGetAdjustment() ->will($this->returnValue('adjustment')); $this->assertEquals('adjustment', $this->model->getAdjustment('test1')); } - - /** - * @covers \Magento\Framework\Pricing\PriceInfo\Base::getPricesIncludedInBase - */ - public function testGetPricesIncludedInBase() - { - $this->prices->expects($this->once()) - ->method('getMetadata') - ->will( - $this->returnValue( - [ - 'test1' => ['class' => 'class1', 'include_in_base_price' => false], - 'test2' => ['class' => 'class2', 'include_in_base_price' => true] - ] - ) - ); - - $priceModelMock = $this->getMock('Magento\Catalog\Pricing\Price\SpecialPrice', [], [], '', false); - $priceModelMock->expects($this->once())->method('getValue')->will($this->returnValue(2.5)); - $this->prices->expects($this->at(1))->method('createPriceObject') - ->with($this->saleableItem, 'test2', $this->quantity)->will($this->returnValue($priceModelMock)); - - $this->assertSame([$priceModelMock], $this->model->getPricesIncludedInBase()); - } } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/PriceInfo/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/PriceInfo/FactoryTest.php index 47c03f501aa2e..3952b8f797515 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Pricing/PriceInfo/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/PriceInfo/FactoryTest.php @@ -18,115 +18,158 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing + * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\Framework\Pricing\PriceInfo; +use Magento\Framework\Pricing\PriceInfo\Factory; + /** * Test class for \Magento\Framework\Pricing\PriceInfo\Factory */ class FactoryTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\TestFramework\Helper\ObjectManager + * @var \Magento\Framework\ObjectManager\ObjectManager|\PHPUnit_Framework_MockObject_MockObject */ - protected $objectManager; - - public function setUp() - { - $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - } + protected $objectManagerMock; /** - * @dataProvider priceInfoClassesProvider + * @var array */ - public function testCreate($types, $type, $expected) - { - $priceInfoFactory = $this->preparePriceInfoFactory( - $expected, - $types - ); + protected $types; - $productMock = $this->getMock( - 'Magento\Catalog\Model\Product', - ['getTypeId', 'getQty', '__wakeup'], - [], - '', - false - ); - - $productMock->expects($this->any()) - ->method('getTypeId') - ->will($this->returnValue($type)); + /** + * @var \Magento\Framework\Pricing\PriceInfo\Factory + */ + protected $factory; - $productMock->expects($this->any()) - ->method('getQty') - ->will($this->returnValue(1)); + /** + * @var \Magento\Framework\Pricing\Price\Collection|\PHPUnit_Framework_MockObject_MockObject + */ + protected $pricesMock; - $this->assertInstanceOf( - $expected, - $priceInfoFactory->create($productMock) - ); - } + /** + * @var \Magento\Framework\Pricing\Object\SaleableInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $saleableItemMock; /** - * @param string $priceInfoInterface - * @param array $types - * @return object + * @var \Magento\Framework\Pricing\PriceInfoInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected function preparePriceInfoFactory($priceInfoInterface, $types = []) - { - return $this->objectManager->getObject( - 'Magento\Framework\Pricing\PriceInfo\Factory', - [ - 'types' => $types, - 'objectManager' => $this->prepareObjectManager($priceInfoInterface) - ] - ); - } + protected $priceInfoMock; /** - * @param string $priceInfoInterface - * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\ObjectManager\ObjectManager + * SetUp test */ - protected function prepareObjectManager($priceInfoInterface) + public function setUp() { - $objectManager = $this->getMock('Magento\Framework\ObjectManager\ObjectManager', ['create'], [], '', false); - $objectManager->expects($this->any()) - ->method('create') - ->will($this->returnValue($this->getMockForAbstractClass($priceInfoInterface))); - return $objectManager; + $this->objectManagerMock = $this->getMock( + 'Magento\Framework\ObjectManager\ObjectManager', + [], + [], + '', + false + ); + $this->pricesMock = $this->getMock( + 'Magento\Framework\Pricing\Price\Collection', + [], + [], + '', + false + ); + $this->saleableItemMock = $this->getMockForAbstractClass( + 'Magento\Framework\Pricing\Object\SaleableInterface', + [], + '', + false, + true, + true, + ['getQty'] + ); + $this->priceInfoMock = $this->getMockForAbstractClass( + 'Magento\Framework\Pricing\PriceInfoInterface', + [], + '', + false, + true, + true, + [] + ); + $this->types = [ + 'default' => [ + 'infoClass' => 'Price\PriceInfo\Default', + 'prices' => 'Price\Collection\Default' + ], + 'configurable' => [ + 'infoClass' => 'Price\PriceInfo\Configurable', + 'prices' => 'Price\Collection\Configurable' + ], + ]; + $this->factory = new Factory($this->types, $this->objectManagerMock); } - /** - * @return array - */ - public function priceInfoClassesProvider() + public function createPriceInfoDataProvider() { return [ [ - ['new_type' => 'Magento\Framework\Pricing\PriceInfo\Base'], - 'new_type', - 'Magento\Framework\Pricing\PriceInfoInterface' + 'simple', + 1, + 'Price\PriceInfo\Default', + 'Price\Collection\Default' ], [ - [], - 'unknown', - 'Magento\Framework\Pricing\PriceInfoInterface' + 'configurable', + 2, + 'Price\PriceInfo\Configurable', + 'Price\Collection\Configurable' ] ]; } /** - * @expectedException \InvalidArgumentException + * @param $typeId + * @param $quantity + * @param $infoClass + * @param $prices + * @dataProvider createPriceInfoDataProvider */ - public function testCreateWithException() + public function testCreate($typeId, $quantity, $infoClass, $prices) { - $invalidPriceInfoInterface = 'Magento\Framework\Object'; - $priceInfoFactory = $this->preparePriceInfoFactory($invalidPriceInfoInterface); - $priceInfoFactory->create( - $this->getMock('Magento\Catalog\Model\Product', ['__wakeup'], [], '', false) - ); + $this->saleableItemMock->expects($this->once()) + ->method('getTypeId') + ->will($this->returnValue($typeId)); + $this->saleableItemMock->expects($this->once()) + ->method('getQty') + ->will($this->returnValue($quantity)); + + $this->objectManagerMock->expects($this->exactly(2)) + ->method('create') + ->will($this->returnValueMap( + [ + [ + $prices, + [ + 'saleableItem' => $this->saleableItemMock, + 'quantity' => $quantity + ], + $this->pricesMock + ], + [ + $infoClass, + [ + 'saleableItem' => $this->saleableItemMock, + 'quantity' => $quantity, + 'prices' => $this->pricesMock + ], + $this->priceInfoMock + ] + ] + )); + $this->assertEquals($this->priceInfoMock, $this->factory->create($this->saleableItemMock, [])); } } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/AbstractAdjustmentTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/AbstractAdjustmentTest.php index 8d2319099a380..2ab2ea9ca0209 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/AbstractAdjustmentTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/AbstractAdjustmentTest.php @@ -18,6 +18,9 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing + * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,26 +32,36 @@ class AbstractAdjustmentTest extends \PHPUnit_Framework_TestCase { /** - * @var Amount + * @var AbstractAdjustment | \PHPUnit_Framework_MockObject_MockObject */ protected $model; /** - * @var \Magento\Framework\Pricing\PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Pricing\PriceCurrencyInterface | \PHPUnit_Framework_MockObject_MockObject */ protected $priceCurrency; + /** + * @var array + */ + protected $data; + public function setUp() { $this->priceCurrency = $this->getMock('Magento\Framework\Pricing\PriceCurrencyInterface'); + $this->data = ['argument_one' => 1]; $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $constructorArgs = $objectManager->getConstructArguments( 'Magento\Framework\Pricing\Render\AbstractAdjustment', - array('priceCurrency' => $this->priceCurrency) + array( + 'priceCurrency' => $this->priceCurrency, + 'data' => $this->data + ) ); $this->model = $this->getMockBuilder('Magento\Framework\Pricing\Render\AbstractAdjustment') ->setConstructorArgs($constructorArgs) + ->setMethods(['getData', 'setData', 'apply']) ->getMockForAbstractClass(); } @@ -67,4 +80,122 @@ public function testConvertAndFormatCurrency() $this->assertEquals($result, $this->model->convertAndFormatCurrency($amount, $includeContainer, $precision)); } + + public function testRender() + { + $amountRender = $this->getMock('Magento\Framework\Pricing\Render\Amount', [], [], '', false); + $arguments = ['argument_two' => 2]; + $mergedArguments = ['argument_one' => 1, 'argument_two' => 2]; + + $this->model->expects($this->at(0)) + ->method('getData') + ->will($this->returnValue($this->data)); + $this->model->expects($this->at(1)) + ->method('setData') + ->with($mergedArguments); + $this->model->expects($this->at(2)) + ->method('apply'); + $this->model->expects($this->at(3)) + ->method('setData') + ->with($this->data); + + $this->model->render($amountRender, $arguments); + } + + public function testGetAmountRender() + { + $amountRender = $this->getMock('Magento\Framework\Pricing\Render\Amount', [], [], '', false); + $this->model->expects($this->at(0)) + ->method('getData') + ->will($this->returnValue($this->data)); + $this->model->render($amountRender); + $this->assertEquals($amountRender, $this->model->getAmountRender()); + } + + public function testGetPriceType() + { + $amountRender = $this->getMock('Magento\Framework\Pricing\Render\Amount', [], [], '', false); + $price = $this->getMockForAbstractClass('Magento\Framework\Pricing\Price\PriceInterface'); + $sealableItem = $this->getMockForAbstractClass('Magento\Framework\Pricing\Object\SaleableInterface'); + $priceInfo = $this->getMock('Magento\Framework\Pricing\PriceInfo\Base', [], [], '', false); + $priceCode = 'regular_price'; + + $amountRender->expects($this->once()) + ->method('getSaleableItem') + ->will($this->returnValue($sealableItem)); + $sealableItem->expects($this->once()) + ->method('getPriceInfo') + ->will($this->returnValue($priceInfo)); + $priceInfo->expects($this->once()) + ->method('getPrice') + ->with($priceCode) + ->will($this->returnValue($price)); + + $this->model->expects($this->at(0)) + ->method('getData') + ->will($this->returnValue($this->data)); + $this->model->render($amountRender); + $this->assertEquals($price, $this->model->getPriceType($priceCode)); + } + + public function testGetPrice() + { + $price = 100; + $amountRender = $this->getMock('Magento\Framework\Pricing\Render\Amount', [], [], '', false); + $amountRender->expects($this->once()) + ->method('getPrice') + ->with() + ->will($this->returnValue($price)); + + $this->model->expects($this->at(0)) + ->method('getData') + ->will($this->returnValue($this->data)); + $this->model->render($amountRender); + $this->assertEquals($price, $this->model->getPrice()); + } + + public function testGetSealableItem() + { + $sealableItem = $this->getMockForAbstractClass('Magento\Framework\Pricing\Object\SaleableInterface'); + $amountRender = $this->getMock('Magento\Framework\Pricing\Render\Amount', [], [], '', false); + $amountRender->expects($this->once()) + ->method('getSaleableItem') + ->with() + ->will($this->returnValue($sealableItem)); + + $this->model->expects($this->at(0)) + ->method('getData') + ->will($this->returnValue($this->data)); + $this->model->render($amountRender); + $this->assertEquals($sealableItem, $this->model->getSaleableItem()); + } + + public function testGetAdjustment() + { + $amountRender = $this->getMock('Magento\Framework\Pricing\Render\Amount', [], [], '', false); + $adjustment = $this->getMockForAbstractClass('Magento\Framework\Pricing\Adjustment\AdjustmentInterface'); + $sealableItem = $this->getMockForAbstractClass('Magento\Framework\Pricing\Object\SaleableInterface'); + $priceInfo = $this->getMock('Magento\Framework\Pricing\PriceInfo\Base', [], [], '', false); + $adjustmentCode = 'tax'; + + $amountRender->expects($this->once()) + ->method('getSaleableItem') + ->will($this->returnValue($sealableItem)); + $sealableItem->expects($this->once()) + ->method('getPriceInfo') + ->will($this->returnValue($priceInfo)); + $priceInfo->expects($this->once()) + ->method('getAdjustment') + ->with($adjustmentCode) + ->will($this->returnValue($adjustment)); + + $this->model->expects($this->at(0)) + ->method('getData') + ->will($this->returnValue($this->data)); + $this->model->expects($this->once()) + ->method('getAdjustmentCode') + ->will($this->returnValue($adjustmentCode)); + $this->model->render($amountRender); + $this->assertEquals($adjustment, $this->model->getAdjustment()); + } } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/AmountTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/AmountTest.php index 949c0c05588c9..fc6ac2d63ee91 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/AmountTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/AmountTest.php @@ -18,6 +18,9 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing + * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -56,6 +59,11 @@ class AmountTest extends \PHPUnit_Framework_TestCase */ protected $saleableItemMock; + /** + * @var \Magento\Framework\Pricing\Amount\AmountInterface | \PHPUnit_Framework_MockObject_MockObject + */ + protected $amount; + /** * @var PriceInterface|\PHPUnit_Framework_MockObject_MockObject */ @@ -87,6 +95,9 @@ public function setUp() ); $this->layout = $this->getMock('Magento\Framework\View\Layout', [], [], '', false); + $this->amount = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface'); + $this->saleableItemMock = $this->getMockForAbstractClass('Magento\Framework\Pricing\Object\SaleableInterface'); + $this->priceMock = $this->getMockForAbstractClass('Magento\Framework\Pricing\Price\PriceInterface'); $eventManager = $this->getMock('Magento\Framework\Event\ManagerStub', [], [], '', false); $config = $this->getMock('Magento\Store\Model\Store\Config', [], [], '', false); @@ -112,7 +123,10 @@ public function setUp() [ 'context' => $context, 'priceCurrency' => $this->priceCurrency, - 'rendererPool' => $this->rendererPool + 'rendererPool' => $this->rendererPool, + 'amount' => $this->amount, + 'saleableItem' => $this->saleableItemMock, + 'price' => $this->priceMock ] ); } @@ -133,16 +147,116 @@ public function testConvertAndFormatCurrency() $this->assertEquals($result, $this->model->convertAndFormatCurrency($amount, $includeContainer, $precision)); } + /** + * Test case for getAdjustmentRenders method through toHtml() + */ + public function testToHtmlSkipAdjustments() + { + $this->model->setData('skip_adjustments', true); + $this->rendererPool->expects($this->never()) + ->method('getAdjustmentRenders'); + + $this->model->toHtml(); + } + /** * Test case for getAdjustmentRenders method through toHtml() */ public function testToHtmlGetAdjustmentRenders() { - $adjustmentRender = []; + $data = ['key1' => 'data1', 'css_classes' => 'class1 class2']; + $expectedData = [ + 'key1' => 'data1', + 'css_classes' => 'class1 class2', + 'module_name' => null, + 'adjustment_css_classes' => 'class1 class2 render1 render2' + ]; + + $this->model->setData($data); + + $adjustmentRender1 = $this->getAdjustmentRenderMock($expectedData); + $adjustmentRender2 = $this->getAdjustmentRenderMock($expectedData); + $adjustmentRenders = ['render1' => $adjustmentRender1, 'render2' => $adjustmentRender2]; + $this->rendererPool->expects($this->once()) + ->method('getAdjustmentRenders') + ->will($this->returnValue($adjustmentRenders)); + + $this->model->toHtml(); + } + + public function testGetDisplayValueExiting() + { + $displayValue = 5.99; + $this->model->setDisplayValue($displayValue); + $this->assertEquals($displayValue, $this->model->getDisplayValue()); + } + + public function testGetDisplayValue() + { + $amountValue = 100.99; + $this->amount->expects($this->once()) + ->method('getValue') + ->will($this->returnValue($amountValue)); + $this->assertEquals($amountValue, $this->model->getDisplayValue()); + } + + public function testGetAmount() + { + $this->assertEquals($this->amount, $this->model->getAmount()); + } + + public function testGetSealableItem() + { + $this->assertEquals($this->saleableItemMock, $this->model->getSaleableItem()); + } + + public function testGetPrice() + { + $this->assertEquals($this->priceMock, $this->model->getPrice()); + } + + public function testAdjustmentsHtml() + { + $adjustmentHtml1 = 'adjustment_1_html'; + $adjustmentHtml2 = 'adjustment_2_html'; + $data = ['key1' => 'data1', 'css_classes' => 'class1 class2']; + $expectedData = [ + 'key1' => 'data1', + 'css_classes' => 'class1 class2', + 'module_name' => null, + 'adjustment_css_classes' => 'class1 class2 render1 render2' + ]; + + $this->model->setData($data); + + $this->assertFalse($this->model->hasAdjustmentsHtml()); + + $adjustmentRender1 = $this->getAdjustmentRenderMock($expectedData, $adjustmentHtml1, 'adjustment_code1'); + $adjustmentRender2 = $this->getAdjustmentRenderMock($expectedData, $adjustmentHtml2, 'adjustment_code2'); + $adjustmentRenders = ['render1' => $adjustmentRender1, 'render2' => $adjustmentRender2]; $this->rendererPool->expects($this->once()) ->method('getAdjustmentRenders') - ->will($this->returnValue($adjustmentRender)); + ->will($this->returnValue($adjustmentRenders)); $this->model->toHtml(); + + $this->assertTrue($this->model->hasAdjustmentsHtml()); + + $this->assertEquals($adjustmentHtml1 . $adjustmentHtml2, $this->model->getAdjustmentsHtml()); + } + + protected function getAdjustmentRenderMock($data = [], $html = '', $code = 'adjustment_code') + { + $adjustmentRender = $this->getMockForAbstractClass( + 'Magento\Framework\Pricing\Render\AdjustmentRenderInterface' + ); + $adjustmentRender->expects($this->once()) + ->method('render') + ->with($this->model, $data) + ->will($this->returnValue($html)); + $adjustmentRender->expects($this->any()) + ->method('getAdjustmentCode') + ->will($this->returnValue($code)); + return $adjustmentRender; } } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/LayoutTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/LayoutTest.php index f209c01f15918..4174071558f4f 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/LayoutTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/LayoutTest.php @@ -18,6 +18,9 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing + * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/PriceBoxTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/PriceBoxTest.php index 0a5371a40a862..b754207575375 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/PriceBoxTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/PriceBoxTest.php @@ -18,6 +18,9 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing + * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -103,15 +106,15 @@ public function setUp() /** * @param array $data - * @param string $priceType + * @param string $priceCode * @param array $cssClasses * @dataProvider toHtmlDataProvider */ - public function testToHtml($data, $priceType, $cssClasses) + public function testToHtml($data, $priceCode, $cssClasses) { $this->price->expects($this->once()) - ->method('getPriceType') - ->will($this->returnValue($priceType)); + ->method('getPriceCode') + ->will($this->returnValue($priceCode)); $priceBox = $this->objectManager->getObject('Magento\Framework\Pricing\Render\PriceBox', array( 'context' => $this->context, @@ -129,12 +132,12 @@ public function toHtmlDataProvider() return array( array( 'data' => [], - 'price_type' => 'test_price', + 'price_code' => 'test_price', 'css_classes' => 'price-test_price' ), array( 'data' => ['css_classes' => 'some_css_class'], - 'price_type' => 'test_price', + 'price_code' => 'test_price', 'css_classes' => 'some_css_class price-test_price' )); } @@ -152,21 +155,20 @@ public function testGetPrice() public function testGetPriceType() { $priceCode = 'test_price'; - $quantity = 1.; $price = $this->getMock('Magento\Framework\Pricing\Price\PriceInterface'); $priceInfo = $this->getMock('Magento\Framework\Pricing\PriceInfoInterface'); $priceInfo->expects($this->once()) ->method('getPrice') - ->with($priceCode, $quantity) + ->with($priceCode) ->will($this->returnValue($price)); $this->saleable->expects($this->once()) ->method('getPriceInfo') ->will($this->returnValue($priceInfo)); - $this->assertEquals($price, $this->model->getPriceType($priceCode, $quantity)); + $this->assertEquals($price, $this->model->getPriceType($priceCode)); } public function testRenderAmount() @@ -190,4 +192,59 @@ public function testRenderAmount() $this->assertEquals($resultHtml, $this->model->renderAmount($amount, $arguments)); } + + public function testGetPriceIdHasDataPriceId() + { + $priceId = 'data_price_id'; + $this->model->setData('price_id', $priceId); + $this->assertEquals($priceId, $this->model->getPriceId()); + } + + /** + * @dataProvider getPriceIdProvider + * @param string $prefix + * @param string $suffix + * @param string $defaultPrefix + * @param string $defaultSuffix + */ + public function testGetPriceId($prefix, $suffix, $defaultPrefix, $defaultSuffix) + { + $priceId = 'price_id'; + $this->saleable->expects($this->once()) + ->method('getId') + ->will($this->returnValue($priceId)); + + if (!empty($prefix)) { + $this->model->setData('price_id_prefix', $prefix); + $expectedPriceId = $prefix . $priceId; + } else { + $expectedPriceId = $defaultPrefix . $priceId; + } + if (!empty($suffix)) { + $this->model->setData('price_id_suffix', $suffix); + $expectedPriceId = $expectedPriceId . $suffix; + } else { + $expectedPriceId = $expectedPriceId . $defaultSuffix; + } + + $this->assertEquals($expectedPriceId, $this->model->getPriceId($defaultPrefix, $defaultSuffix)); + } + + public function getPriceIdProvider() + { + return [ + ['prefix', 'suffix', 'default_prefix', 'default_suffix'], + ['prefix', 'suffix', 'default_prefix', ''], + ['prefix', 'suffix', '', 'default_suffix'], + ['prefix', '', 'default_prefix', 'default_suffix'], + ['', 'suffix', 'default_prefix', 'default_suffix'], + ['', '', 'default_prefix', 'default_suffix'], + ['prefix', 'suffix', '', ''] + ]; + } + + public function testGetRendererPool() + { + $this->assertEquals($this->rendererPool, $this->model->getRendererPool()); + } } diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/RendererPoolTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/RendererPoolTest.php index e066f510368a1..5d584727f4909 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/RendererPoolTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/Render/RendererPoolTest.php @@ -18,6 +18,9 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing + * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -273,7 +276,7 @@ public function testCreateAmountRenderNoAmountClass() ->method('getTypeId') ->will($this->returnValue($type)); $this->priceMock->expects($this->once()) - ->method('getPriceType') + ->method('getPriceCode') ->will($this->returnValue($priceCode)); $testedClass = $this->createTestedEntity($data); @@ -311,7 +314,7 @@ public function testCreateAmountRenderNotAmountInterface() ->method('getTypeId') ->will($this->returnValue($type)); $this->priceMock->expects($this->once()) - ->method('getPriceType') + ->method('getPriceCode') ->will($this->returnValue($priceCode)); $contextMock = $this->getMockBuilder('Magento\Framework\View\Element\Template\Context') @@ -366,7 +369,7 @@ public function testCreateAmountRender() ->method('getTypeId') ->will($this->returnValue($type)); $this->priceMock->expects($this->once()) - ->method('getPriceType') + ->method('getPriceCode') ->will($this->returnValue($priceCode)); $blockMock = $this->getMockBuilder('Magento\Framework\Pricing\Render\Amount') @@ -407,7 +410,7 @@ public function testGetAdjustmentRendersNoRenderClass() ->method('getTypeId') ->will($this->returnValue($typeId)); $this->priceMock->expects($this->once()) - ->method('getPriceType') + ->method('getPriceCode') ->will($this->returnValue($priceCode)); $code = 'test_code'; @@ -433,7 +436,7 @@ public function testGetAdjustmentRendersNoRenderTemplate() ->method('getTypeId') ->will($this->returnValue($typeId)); $this->priceMock->expects($this->once()) - ->method('getPriceType') + ->method('getPriceCode') ->will($this->returnValue($priceCode)); $code = 'test_code'; @@ -482,7 +485,7 @@ public function testGetAdjustmentRenders() ->method('getTypeId') ->will($this->returnValue($typeId)); $this->priceMock->expects($this->once()) - ->method('getPriceType') + ->method('getPriceCode') ->will($this->returnValue($priceCode)); $blockMock = $this->getMockBuilder('Magento\Framework\View\Element\Template') @@ -535,7 +538,7 @@ public function testGetAmountRenderBlockTemplateNoTemplate() ->method('getTypeId') ->will($this->returnValue($type)); $this->priceMock->expects($this->once()) - ->method('getPriceType') + ->method('getPriceCode') ->will($this->returnValue($priceCode)); $blockMock = $this->getMockBuilder('Magento\Framework\Pricing\Render\Amount') diff --git a/dev/tests/unit/testsuite/Magento/Framework/Pricing/RenderTest.php b/dev/tests/unit/testsuite/Magento/Framework/Pricing/RenderTest.php index 5bcae14ab0b03..49f234f22efa9 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/Pricing/RenderTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/Pricing/RenderTest.php @@ -18,6 +18,9 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing + * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -218,4 +221,18 @@ public function testAmountRender() $result = $this->model->renderAmount($this->amount, $this->price, $this->saleableItem, $arguments); $this->assertEquals($expectedResult, $result); } + + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage Wrong Price Rendering layout configuration. Factory block is missed + */ + public function testAmountRenderNoRenderPool() + { + $this->priceLayout->expects($this->once()) + ->method('getBlock') + ->with('render.product.prices') + ->will($this->returnValue(false)); + + $this->model->renderAmount($this->amount, $this->price, $this->saleableItem); + } } diff --git a/dev/tests/unit/testsuite/Magento/Framework/ProfilerTest.php b/dev/tests/unit/testsuite/Magento/Framework/ProfilerTest.php index c3f65d50af350..e965ede1037c7 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/ProfilerTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/ProfilerTest.php @@ -217,7 +217,7 @@ public function testTags() public function testClearTimer() { $driver = $this->_getDriverMock(); - $driver->expects($this->once())->method('clear')->with('timer'); + $driver->expects($this->at(0))->method('clear')->with('timer'); \Magento\Framework\Profiler::add($driver); \Magento\Framework\Profiler::clear('timer'); diff --git a/dev/tests/unit/testsuite/Magento/Framework/View/Design/Fallback/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Framework/View/Design/Fallback/FactoryTest.php index e4a76de7c7cd1..6d82b49df06c1 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/View/Design/Fallback/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/View/Design/Fallback/FactoryTest.php @@ -161,7 +161,8 @@ public function createFileRuleGetPatternDirsDataProvider() array( '/area/current_theme_path/namespace_module', '/area/parent_theme_path/namespace_module', - '/namespace/module/view/area' + '/namespace/module/view/area', + '/namespace/module/view/base' ) ), 'non-modular' => array( @@ -214,7 +215,8 @@ public function createViewFileRuleGetPatternDirsDataProvider() '/area/parent_theme_path/i18n/en_US/namespace_module', '/area/parent_theme_path/namespace_module', '/namespace/module/view/area/i18n/en_US', - '/namespace/module/view/area' + '/namespace/module/view/area', + '/namespace/module/view/base' ) ), 'modular non-localized' => array( @@ -222,7 +224,8 @@ public function createViewFileRuleGetPatternDirsDataProvider() array( '/area/current_theme_path/namespace_module', '/area/parent_theme_path/namespace_module', - '/namespace/module/view/area' + '/namespace/module/view/area', + '/namespace/module/view/base' ) ), 'non-modular localized' => array( diff --git a/dev/tests/unit/testsuite/Magento/Framework/View/Design/FileResolution/Strategy/Fallback/CachingProxyTest.php b/dev/tests/unit/testsuite/Magento/Framework/View/Design/FileResolution/Strategy/Fallback/CachingProxyTest.php index b3a532f370f01..372c5b1c378db 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/View/Design/FileResolution/Strategy/Fallback/CachingProxyTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/View/Design/FileResolution/Strategy/Fallback/CachingProxyTest.php @@ -87,7 +87,7 @@ protected function setUp() false ); - $this->themeModel = \PHPUnit_Framework_MockObject_Generator::getMock( + $this->themeModel = $this->getMock( 'Magento\Core\Model\Theme', array(), array(), @@ -206,9 +206,9 @@ public function testProxyMethods($method, $params, $expectedResult) * * @return array */ - public static function proxyMethodsDataProvider() + public function proxyMethodsDataProvider() { - $themeModel = \PHPUnit_Framework_MockObject_Generator::getMock( + $themeModel = $this->getMock( 'Magento\Core\Model\Theme', array(), array(), diff --git a/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/FactoryTest.php index 873f336384ebd..ce8e6177f68f8 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/FactoryTest.php @@ -45,16 +45,21 @@ public function testCreate() { $theme = $this->getMockForAbstractClass('Magento\Framework\View\Design\ThemeInterface'); $file = new \Magento\Framework\View\Layout\File(__FILE__, 'Fixture_Module', $theme); - $this->_objectManager->expects( - $this->once() - )->method( - 'create' - )->with( - 'Magento\Framework\View\Layout\File', - $this->identicalTo(array('filename' => __FILE__, 'module' => 'Fixture_Module', 'theme' => $theme)) - )->will( - $this->returnValue($file) - ); - $this->assertSame($file, $this->_model->create(__FILE__, 'Fixture_Module', $theme)); + $isBase = true; + $this->_objectManager->expects($this->once()) + ->method('create') + ->with( + 'Magento\Framework\View\Layout\File', + $this->identicalTo( + array( + 'filename' => __FILE__, + 'module' => 'Fixture_Module', + 'theme' => $theme, + 'isBase' => $isBase + ) + ) + ) + ->will($this->returnValue($file)); + $this->assertSame($file, $this->_model->create(__FILE__, 'Fixture_Module', $theme, $isBase)); } } diff --git a/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/Source/BaseTest.php b/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/Source/BaseTest.php index 070735b2fdc3d..2857d02078d86 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/Source/BaseTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/Source/BaseTest.php @@ -21,107 +21,111 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Framework\View\Layout\File\Source; -use Magento\Framework\Filesystem\Directory\Read; -use Magento\Framework\View\Layout\File\Factory; +namespace Magento\Framework\View\Layout\File\Source; +/** + * Class for testing Magento\View\Layout\File\Source\Base + */ class BaseTest extends \PHPUnit_Framework_TestCase { /** - * @var Base + * @var \Magento\Framework\View\Layout\File\Source\Base|\PHPUnit_Framework_MockObject_MockObject */ - private $model; + protected $class; /** - * @var Read | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Filesystem\Directory\ReadInterface|\PHPUnit_Framework_MockObject_MockObject */ - private $directory; + protected $modulesDirectoryMock; /** - * @var Factory | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\View\Layout\File\Factory|\PHPUnit_Framework_MockObject_MockObject */ - private $fileFactory; + protected $fileFactoryMock; - protected function setUp() + /** + * Set up mocks + */ + public function setUp() { - $this->directory = $this->getMock('Magento\Framework\Filesystem\Directory\Read', array(), array(), '', false); - $filesystem = $this->getMock( + $filesystemMock = $this->getMock( 'Magento\Framework\App\Filesystem', - array('getDirectoryRead', '__wakeup'), - array(), + ['getDirectoryRead', 'getAbsolutePath'], + [], '', false ); - $filesystem->expects( - $this->once() - )->method( - 'getDirectoryRead' - )->with( - \Magento\Framework\App\Filesystem::MODULES_DIR - )->will( - $this->returnValue($this->directory) + $this->fileFactoryMock = $this->getMock('Magento\Framework\View\Layout\File\Factory', [], [], '', false); + $this->modulesDirectoryMock = $this->getMock( + 'Magento\Framework\Filesystem\Directory\ReadInterface', + [], + [], + '', + false ); - $this->fileFactory = $this->getMock('Magento\Framework\View\Layout\File\Factory', array(), array(), '', false); - $this->model = new Base($filesystem, $this->fileFactory); + $filesystemMock->expects($this->once()) + ->method('getDirectoryRead') + ->will($this->returnValue($this->modulesDirectoryMock)); + + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->class = $objectManager->getObject( + 'Magento\Framework\View\Layout\File\Source\Base', + [ + 'filesystem' => $filesystemMock, + 'fileFactory' => $this->fileFactoryMock + ] + ); } /** - * @param array $files - * @param string $filePath - * - * @dataProvider dataProvider + * Test for method getFiles */ - public function testGetFiles($files, $filePath) + public function testGetFiles() { - $theme = $this->getMockForAbstractClass('Magento\Framework\View\Design\ThemeInterface'); - $theme->expects($this->once())->method('getArea')->will($this->returnValue('area')); + $fileName = 'somefile.xml'; + $fileRightPath = '/namespace/module/view/base/layout/' . $fileName; + $themeFileRightPath = '/namespace/module/view/area_code/layout/' . $fileName; + $fileWrongPath = '/namespace/module/view/' . $fileName; + $themeFileWrongPath = '/namespace/module/view/area_code/' . $fileName; + $areaCode = 'area_code'; + $sharedFiles = [ + $fileRightPath, + $fileWrongPath, + ]; + $themeFiles = [ + $themeFileRightPath, + $themeFileWrongPath, + ]; + $themeMock = $this->getMock('Magento\Framework\View\Design\ThemeInterface', [], [], '', false); - $handlePath = 'code/Module/%s/view/area/layout/%s.xml'; - $returnKeys = array(); - foreach ($files as $file) { - $returnKeys[] = sprintf($handlePath, $file['module'], $file['handle']); - } + $this->modulesDirectoryMock->expects($this->any()) + ->method('search') + ->will($this->returnValueMap( + [ + ["*/*/view/base/layout/*.xml", null, $sharedFiles], + ["*/*/view/$areaCode/layout/*.xml", null, $themeFiles], + ] + )); + $this->modulesDirectoryMock->expects($this->any()) + ->method('getAbsolutePath') + ->will($this->returnArgument(0)); + $themeMock->expects($this->once()) + ->method('getArea') + ->will($this->returnValue($areaCode)); - $this->directory->expects($this->once())->method('search')->will($this->returnValue($returnKeys)); - $this->directory->expects($this->any())->method('getAbsolutePath')->will($this->returnArgument(0)); + $this->fileFactoryMock->expects($this->at(0)) + ->method('create') + ->with($this->equalTo($fileRightPath), $this->equalTo('namespace_module')) + ->will($this->returnValue($fileRightPath)); + $this->fileFactoryMock->expects($this->at(1)) + ->method('create') + ->with($this->equalTo($themeFileRightPath), $this->equalTo('namespace_module')) + ->will($this->returnValue($themeFileRightPath)); - $checkResult = array(); - foreach ($files as $key => $file) { - $moduleName = 'Module_' . $file['module']; - $checkResult[$key] = new \Magento\Framework\View\Layout\File($file['handle'] . '.xml', $moduleName, $theme); - - $this->fileFactory->expects( - $this->at($key) - )->method( - 'create' - )->with( - sprintf($handlePath, $file['module'], $file['handle']), - $moduleName - )->will( - $this->returnValue($checkResult[$key]) - ); - } - - $this->assertSame($checkResult, $this->model->getFiles($theme, $filePath)); - } - - /** - * @return array - */ - public function dataProvider() - { - return array( - array( - array( - array('handle' => '1', 'module' => 'One'), - array('handle' => '2', 'module' => 'One'), - array('handle' => '3', 'module' => 'Two') - ), - '*' - ), - array(array(array('handle' => 'preset/4', 'module' => 'Four')), 'preset/4') - ); + $expected = [$fileRightPath, $themeFileRightPath]; + $result = $this->class->getFiles($themeMock); + $this->assertEquals($expected, $result); } } diff --git a/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/Source/Override/BaseTest.php b/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/Source/Override/BaseTest.php index da3be7dd3ed42..f1bb3872e3610 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/Source/Override/BaseTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/Source/Override/BaseTest.php @@ -89,16 +89,10 @@ public function testGetFiles($files, $filePath) $checkResult = array(); foreach ($files as $key => $file) { $checkResult[$key] = new \Magento\Framework\View\Layout\File($file['handle'] . '.xml', $file['module']); - $this->fileFactory->expects( - $this->at($key) - )->method( - 'create' - )->with( - sprintf($handlePath, $file['module'], $file['handle']), - $file['module'] - )->will( - $this->returnValue($checkResult[$key]) - ); + $this->fileFactory->expects($this->at($key)) + ->method('create') + ->with(sprintf($handlePath, $file['module'], $file['handle']), $file['module']) + ->will($this->returnValue($checkResult[$key])); } $this->assertSame($checkResult, $this->model->getFiles($theme, $filePath)); diff --git a/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/Source/Override/ThemeTest.php b/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/Source/Override/ThemeTest.php index e43c5e86708d4..660b29e300724 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/Source/Override/ThemeTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/View/Layout/File/Source/Override/ThemeTest.php @@ -86,18 +86,16 @@ public function testGetFiles() $fileOne = new \Magento\Framework\View\Layout\File('1.xml', 'Module_One', $parentTheme); $fileTwo = new \Magento\Framework\View\Layout\File('2.xml', 'Module_Two', $grandparentTheme); - $this->_fileFactory->expects( - $this->exactly(2) - )->method( - 'create' - )->will( - $this->returnValueMap( - array( - array($filePathOne, 'Module_One', $parentTheme, $fileOne), - array($filePathTwo, 'Module_Two', $grandparentTheme, $fileTwo) + $this->_fileFactory->expects($this->exactly(2)) + ->method('create') + ->will( + $this->returnValueMap( + array( + array($filePathOne, 'Module_One', $parentTheme, false, $fileOne), + array($filePathTwo, 'Module_Two', $grandparentTheme, false, $fileTwo) + ) ) - ) - ); + ); $this->assertSame(array($fileOne, $fileTwo), $this->_model->getFiles($theme)); } diff --git a/dev/tests/unit/testsuite/Magento/Framework/View/Layout/FileTest.php b/dev/tests/unit/testsuite/Magento/Framework/View/Layout/FileTest.php index 008f9a4f389e7..88ff925e86358 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/View/Layout/FileTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/View/Layout/FileTest.php @@ -38,7 +38,7 @@ class FileTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_theme = $this->getMockForAbstractClass('Magento\Framework\View\Design\ThemeInterface'); - $this->_model = new \Magento\Framework\View\Layout\File(__FILE__, 'Fixture_TestModule', $this->_theme); + $this->_model = new \Magento\Framework\View\Layout\File(__FILE__, 'Fixture_TestModule', $this->_theme, true); } public function testGetFilename() @@ -65,7 +65,7 @@ public function testGetFileIdentifier() { $this->_theme->expects($this->once())->method('getFullPath')->will($this->returnValue('theme_name')); $this->assertSame( - 'theme:theme_name|module:Fixture_TestModule|file:FileTest.php', + 'base|theme:theme_name|module:Fixture_TestModule|file:FileTest.php', $this->_model->getFileIdentifier() ); } diff --git a/dev/tests/unit/testsuite/Magento/Framework/View/UrlTest.php b/dev/tests/unit/testsuite/Magento/Framework/View/UrlTest.php index afab68b1f2336..94d43aa651729 100644 --- a/dev/tests/unit/testsuite/Magento/Framework/View/UrlTest.php +++ b/dev/tests/unit/testsuite/Magento/Framework/View/UrlTest.php @@ -119,9 +119,9 @@ public function testGetViewFileUrlProductionMode($themeModel) /** * @return array */ - public static function getViewFileUrlProductionModeDataProvider() + public function getViewFileUrlProductionModeDataProvider() { - $usualTheme = \PHPUnit_Framework_MockObject_Generator::getMock( + $usualTheme = $this->getMock( 'Magento\Framework\View\Design\ThemeInterface', array(), array(), diff --git a/dev/tests/unit/testsuite/Magento/GoogleAdwords/Model/Config/Source/LanguageTest.php b/dev/tests/unit/testsuite/Magento/GoogleAdwords/Model/Config/Source/LanguageTest.php deleted file mode 100644 index fb03364a428cc..0000000000000 --- a/dev/tests/unit/testsuite/Magento/GoogleAdwords/Model/Config/Source/LanguageTest.php +++ /dev/null @@ -1,190 +0,0 @@ -_helperMock = $this->getMock('Magento\GoogleAdwords\Helper\Data', array(), array(), '', false); - $this->_localeMock = $this->getMock('Zend_Locale', array(), array(), '', false); - $this->_localeModelMock = $this->getMock( - 'Magento\Framework\Locale\ResolverInterface', - array(), - array(), - '', - false - ); - $this->_localeModelMock->expects( - $this->once() - )->method( - 'getLocale' - )->will( - $this->returnValue($this->_localeMock) - ); - $this->_uppercaseFilterMock = $this->getMock( - 'Magento\GoogleAdwords\Model\Filter\UppercaseTitle', - array(), - array(), - '', - false - ); - - $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_model = $objectManager->getObject( - 'Magento\GoogleAdwords\Model\Config\Source\Language', - array( - 'localeResolver' => $this->_localeModelMock, - 'helper' => $this->_helperMock, - 'uppercaseFilter' => $this->_uppercaseFilterMock - ) - ); - } - - public function testToOptionArray() - { - $languageCodes = array('languageCode1', 'languageCode2'); - $langToLocalesMap = array('languageCode1' => 'localeCode1', 'languageCode2' => 'localeCode2'); - $expectedLanguages = array( - array( - 'value' => 'languageCode1', - 'label' => 'TranslationForSpecifiedLanguage1 / translationForDefaultLanguage1 (languageCode1)' - ), - array( - 'value' => 'languageCode2', - 'label' => 'TranslationForSpecifiedLanguage2 / translationForDefaultLanguage2 (languageCode2)' - ) - ); - - $this->_helperMock->expects( - $this->once() - )->method( - 'getLanguageCodes' - )->will( - $this->returnValue($languageCodes) - ); - $this->_helperMock->expects($this->atLeastOnce())->method('convertLanguageCodeToLocaleCode')->will( - $this->returnCallback( - function ($languageCode) use ($langToLocalesMap) { - return $langToLocalesMap[$languageCode]; - } - ) - ); - - $localeMock = $this->_localeMock; - $localeMock::staticExpects( - $this->at(0) - )->method( - 'getTranslation' - )->with( - 'localeCode1', - 'language', - 'languageCode1' - )->will( - $this->returnValue('translationForSpecifiedLanguage1') - ); - - $localeMock::staticExpects( - $this->at(1) - )->method( - 'getTranslation' - )->with( - 'localeCode1', - 'language' - )->will( - $this->returnValue('translationForDefaultLanguage1') - ); - - $localeMock::staticExpects( - $this->at(2) - )->method( - 'getTranslation' - )->with( - 'localeCode2', - 'language', - 'languageCode2' - )->will( - $this->returnValue('translationForSpecifiedLanguage2') - ); - - $localeMock::staticExpects( - $this->at(3) - )->method( - 'getTranslation' - )->with( - 'localeCode2', - 'language' - )->will( - $this->returnValue('translationForDefaultLanguage2') - ); - - $this->_uppercaseFilterMock->expects( - $this->at(0) - )->method( - 'filter' - )->with( - 'translationForSpecifiedLanguage1' - )->will( - $this->returnValue('TranslationForSpecifiedLanguage1') - ); - - $this->_uppercaseFilterMock->expects( - $this->at(1) - )->method( - 'filter' - )->with( - 'translationForSpecifiedLanguage2' - )->will( - $this->returnValue('TranslationForSpecifiedLanguage2') - ); - - $this->assertEquals($expectedLanguages, $this->_model->toOptionArray()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/View/Type/GroupedTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/View/Type/GroupedTest.php index 34f79e375a1c5..9beb7e0ff88bc 100644 --- a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/View/Type/GroupedTest.php +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/View/Type/GroupedTest.php @@ -45,16 +45,6 @@ class GroupedTest extends \PHPUnit_Framework_TestCase */ protected $configuredValueMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $blockMock; - - /** - * @var string - */ - protected $defaultTemplate = 'product/view/tierprices.phtml'; - protected function setUp() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); @@ -88,23 +78,11 @@ protected function setUp() '', false ); - // mocks for getTierPriceHtml method - $methods = array( - 'setTemplate', - 'setProduct', - 'setListClass', - 'setShowDetailedPrice', - 'setCanDisplayQty', - 'toHtml' - ); - $this->blockMock = $this->getMock('Magento\Catalog\Block\Product\Price', $methods, array(), '', false); $layout = $this->getMock('Magento\Framework\View\LayoutInterface'); - $layout->expects($this->any())->method('createBlock')->will($this->returnValue($this->blockMock)); $this->groupedView = $helper->getObject( 'Magento\GroupedProduct\Block\Product\View\Type\Grouped', array( - 'data' => array('product' => $this->productMock, 'tier_price_template' => $this->defaultTemplate), - 'priceBlockTypes' => array('product_id' => array('block' => $this->blockMock)), + 'data' => array('product' => $this->productMock), 'layout' => $layout ) ); @@ -184,64 +162,4 @@ public function testSetPreconfiguredValueIfSuperGroupNotExist() $this->groupedView->setPreconfiguredValue(); } - /** - * @param null|PHPUnit_Framework_MockObject_MockObject $price - * @dataProvider getTierPriceHtmlDataProvider - */ - public function testGetTierPriceHtml($price) - { - $this->productMock->expects($this->any())->method('getTypeId')->will($this->returnValue('product_id')); - $this->blockMock->expects( - $this->once() - )->method( - 'setTemplate' - )->with( - $this->defaultTemplate - )->will( - $this->returnValue($this->blockMock) - ); - $this->blockMock->expects( - $this->once() - )->method( - 'setProduct' - )->with( - $this->productMock - )->will( - $this->returnValue($this->blockMock) - ); - $this->blockMock->expects( - $this->once() - )->method( - 'setListClass' - )->with( - 'tier prices grouped items' - )->will( - $this->returnValue($this->blockMock) - ); - $this->blockMock->expects( - $this->once() - )->method( - 'setShowDetailedPrice' - )->with( - false - )->will( - $this->returnValue($this->blockMock) - ); - $this->blockMock->expects( - $this->once() - )->method( - 'setCanDisplayQty' - )->with( - false - )->will( - $this->returnValue($this->blockMock) - ); - $this->blockMock->expects($this->once())->method('toHtml')->will($this->returnValue('expected')); - $this->assertEquals('expected', $this->groupedView->getTierPriceHtml($price)); - } - - public function getTierPriceHtmlDataProvider() - { - return array('if_use_default_value_for_method' => array(null), 'if_pice_exist' => array($this->productMock)); - } } diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Pricing/Price/FinalPriceTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Pricing/Price/FinalPriceTest.php index a0d8f021457bf..59e72c8710e23 100644 --- a/dev/tests/unit/testsuite/Magento/GroupedProduct/Pricing/Price/FinalPriceTest.php +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Pricing/Price/FinalPriceTest.php @@ -34,93 +34,101 @@ class FinalPriceTest extends \PHPUnit_Framework_TestCase */ protected $finalPrice; - /** - * @var \Magento\GroupedProduct\Model\Product\Type\Grouped|\PHPUnit_Framework_MockObject_MockObject - */ - protected $typeInstanceMock; - /** * @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject */ - protected $salableItemMock; + protected $saleableItemMock; /** * @var \Magento\Framework\Pricing\Adjustment\Calculator|\PHPUnit_Framework_MockObject_MockObject */ protected $calculatorMock; - /** - * @var \Magento\Framework\Pricing\PriceInfo\Base|\PHPUnit_Framework_MockObject_MockObject - */ - protected $priceInfoMock; - - /** - * @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject - */ - protected $productMock; - - /** - * @var \Magento\Framework\Pricing\Amount\AmountInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $amountMock; - - /** - * @var \Magento\Catalog\Pricing\Price\FinalPrice|\PHPUnit_Framework_MockObject_MockObject - */ - protected $priceTypeMock; - /** * Setup */ public function setUp() { - $this->salableItemMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); - $this->productMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); - $this->amountMock = $this->getMock('Magento\Framework\Pricing\Amount\Base', [], [], '', false); + $this->saleableItemMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); $this->calculatorMock = $this->getMock('Magento\Framework\Pricing\Adjustment\Calculator', [], [], '', false); - $this->priceInfoMock = $this->getMock('Magento\Framework\Pricing\PriceInfo\Base', [], [], '', false); - $this->typeInstanceMock = $this->getMock('Magento\GroupedProduct\Model\Product\Type\Grouped', - [], [], '', false); - $this->priceTypeMock = $this->getMock('Magento\Catalog\Pricing\Price\FinalPrice', [], [], '', false); $this->finalPrice = new \Magento\GroupedProduct\Pricing\Price\FinalPrice ( - $this->salableItemMock, + $this->saleableItemMock, + null, $this->calculatorMock ); } public function testGetMinProduct() { - $valueMap = [ - [90], - [70] - ]; - $this->salableItemMock->expects($this->once()) + $product1 = $this->getProductMock(10); + $product2 = $this->getProductMock(20); + + $typeInstanceMock = $this->getMock( + 'Magento\GroupedProduct\Model\Product\Type\Grouped', + [], + [], + '', + false + ); + $typeInstanceMock->expects($this->once()) + ->method('getAssociatedProducts') + ->with($this->equalTo($this->saleableItemMock)) + ->will($this->returnValue([$product1, $product2])); + + $this->saleableItemMock->expects($this->once()) ->method('getTypeInstance') - ->will($this->returnValue($this->typeInstanceMock)); + ->will($this->returnValue($typeInstanceMock)); + + $this->assertEquals($product1, $this->finalPrice->getMinProduct()); + } - $this->typeInstanceMock->expects($this->once()) + public function testGetValue() + { + $product1 = $this->getProductMock(10); + $product2 = $this->getProductMock(20); + + $typeInstanceMock = $this->getMock( + 'Magento\GroupedProduct\Model\Product\Type\Grouped', + [], + [], + '', + false + ); + $typeInstanceMock->expects($this->once()) ->method('getAssociatedProducts') - ->with($this->equalTo($this->salableItemMock)) - ->will($this->returnValue([$this->productMock, $this->productMock])); + ->with($this->equalTo($this->saleableItemMock)) + ->will($this->returnValue([$product1, $product2])); - $this->productMock->expects($this->exactly(2)) - ->method('setQty') - ->with($this->equalTo(\Magento\Framework\Pricing\PriceInfoInterface::PRODUCT_QUANTITY_DEFAULT)); + $this->saleableItemMock->expects($this->once()) + ->method('getTypeInstance') + ->will($this->returnValue($typeInstanceMock)); - $this->productMock->expects($this->exactly(2)) - ->method('getPriceInfo') - ->will($this->returnValue($this->priceInfoMock)); + $this->assertEquals(10, $this->finalPrice->getValue()); + } - $this->priceInfoMock->expects($this->exactly(2)) + protected function getProductMock($price) + { + $priceTypeMock = $this->getMock('Magento\Catalog\Pricing\Price\FinalPrice', [], [], '', false); + $priceTypeMock->expects($this->any()) + ->method('getValue') + ->will($this->returnValue($price)); + + $priceInfoMock = $this->getMock('Magento\Framework\Pricing\PriceInfo\Base', [], [], '', false); + $priceInfoMock->expects($this->any()) ->method('getPrice') - ->with($this->equalTo(\Magento\Catalog\Pricing\Price\FinalPriceInterface::PRICE_TYPE_FINAL)) - ->will($this->returnValue($this->priceTypeMock)); + ->with($this->equalTo(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)) + ->will($this->returnValue($priceTypeMock)); - $this->priceTypeMock->expects($this->exactly(2)) - ->method('getValue') - ->will($this->returnValueMap($valueMap)); - $this->assertEquals($this->finalPrice->getMinProduct(), $this->productMock); + $productMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); + $productMock->expects($this->any()) + ->method('setQty') + ->with($this->equalTo(\Magento\Framework\Pricing\PriceInfoInterface::PRODUCT_QUANTITY_DEFAULT)); + $productMock->expects($this->any()) + ->method('getPriceInfo') + ->will($this->returnValue($priceInfoMock)); + + return $productMock; } } diff --git a/dev/tests/unit/testsuite/Magento/PageCache/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/PageCache/Model/ObserverTest.php index ea6301b5cf1d8..a24398ce6f406 100644 --- a/dev/tests/unit/testsuite/Magento/PageCache/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/PageCache/Model/ObserverTest.php @@ -110,7 +110,7 @@ public function setUp() false, true, true, - array('getTtl', 'isScopePrivate', 'getNameInLayout', 'getUrl') + array('getData', 'isScopePrivate', 'getNameInLayout', 'getUrl') ); $this->_transport = new \Magento\Framework\Object(array('output' => 'test output html')); $this->_observerObject = $this->getMock('\Magento\Store\Model\Store', array(), array(), '', false); @@ -158,14 +158,13 @@ public function testProcessLayoutRenderElement( ); if ($varnishIsEnabled) { - $this->_blockMock->setTtl($blockTtl); - $this->_blockMock->expects( - $this->any() - )->method( - 'getUrl' - )->will( - $this->returnValue('page_cache/block/wrapesi/with/handles/and/other/stuff') - ); + $this->_blockMock->expects($this->once()) + ->method('getData') + ->with('ttl') + ->will($this->returnValue($blockTtl)); + $this->_blockMock->expects($this->any()) + ->method('getUrl') + ->will($this->returnValue('page_cache/block/wrapesi/with/handles/and/other/stuff')); } if ($scopeIsPrivate) { $this->_blockMock->expects( diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Model/IpnTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Model/IpnTest.php index 5fd842f57db4e..4f34b2077d6c3 100644 --- a/dev/tests/unit/testsuite/Magento/Paypal/Model/IpnTest.php +++ b/dev/tests/unit/testsuite/Magento/Paypal/Model/IpnTest.php @@ -96,6 +96,9 @@ public function testLegacyRegisterPaymentAuthorization() $testMethod = new \ReflectionMethod('Magento\Paypal\Model\Ipn', '_registerPaymentAuthorization'); $testMethod->setAccessible(true); + $this->markTestIncomplete( + 'MAGETWO-23755: "Fatal error: Using $this when not in object context" is observed under PHPUnit4' + ); $testMethod->invoke($this->_ipn); } diff --git a/dev/tests/unit/testsuite/Magento/Rss/Block/Catalog/CategoryTest.php b/dev/tests/unit/testsuite/Magento/Rss/Block/Catalog/CategoryTest.php new file mode 100644 index 0000000000000..4ecf1663791d8 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Rss/Block/Catalog/CategoryTest.php @@ -0,0 +1,147 @@ +getMock('Magento\Framework\View\Element\Template\Context', [], [], '', false); + $this->imageHelperMock = $this->getMock('Magento\Catalog\Helper\Image', [], [], '', false); + $eventManagerMock = $this->getMock('Magento\Framework\Event\ManagerInterface', [], [], '', false); + $requestMock = $this->getMock('Magento\Framework\App\RequestInterface', [], [], '', false); + + $templateContextMock->expects($this->once()) + ->method('getEventManager') + ->will($this->returnValue($eventManagerMock)); + $templateContextMock->expects($this->once()) + ->method('getRequest') + ->will($this->returnValue($requestMock)); + + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->block = $objectManager->getObject( + 'Magento\Rss\Block\Catalog\Category', + [ + 'context' => $templateContextMock, + 'imageHelper' => $this->imageHelperMock, + ] + ); + } + + /** + * Test for method addNewItemXmlCallback + */ + public function testAddNewItemXmlCallback() + { + $priceHtmlForTest = '
Price is 10 for example
'; + $productMock = $this->getMock( + 'Magento\Catalog\Model\Product', + ['getProductUrl', 'getDescription', 'getAllowedInRss', 'getName', '__wakeup'], + [], + '', + false + ); + $rssObjMock = $this->getMock('Magento\Rss\Model\Rss', [], [], '', false); + $layoutMock = $this->getMockForAbstractClass( + 'Magento\Framework\View\LayoutInterface', + [], + '', + true, + true, + true, + ['getBlock'] + ); + $priceRendererMock = $this->getMock('Magento\Framework\Pricing\Render', ['render'], [], '', false); + $productTitle = 'Product title'; + $productUrl = 'Product Url'; + $imgThumbSrc = 'http://source-for-thumbnail'; + $productDescription = 'Product description'; + $description = '
' . + $productDescription . $priceHtmlForTest . '
'; + + $productMock->expects($this->exactly(2)) + ->method('getProductUrl') + ->will($this->returnValue($productUrl)); + $productMock->expects($this->once()) + ->method('getDescription') + ->will($this->returnValue($productDescription)); + $productMock->expects($this->any()) + ->method('getAllowedInRss') + ->will($this->returnValue(true)); + $productMock->expects($this->once()) + ->method('getName') + ->will($this->returnValue($productTitle)); + $this->imageHelperMock->expects($this->once()) + ->method('init') + ->will($this->returnSelf()); + $this->imageHelperMock->expects($this->once()) + ->method('resize') + ->will($this->returnValue($imgThumbSrc)); + $layoutMock->expects($this->once()) + ->method('getBlock') + ->will($this->returnValue($priceRendererMock)); + $priceRendererMock->expects($this->once()) + ->method('render') + ->will($this->returnValue($priceHtmlForTest)); + + $expectedData = [ + 'title' => $productTitle, + 'link' => $productUrl, + 'description' => $description + ]; + $rssObjMock->expects($this->once()) + ->method('_addEntry') + ->with($expectedData) + ->will($this->returnSelf()); + + + $args = [ + 'product' => $productMock, + 'rssObj' => $rssObjMock + ]; + + $this->block->setLayout($layoutMock); + $this->assertNull($this->block->addNewItemXmlCallback($args)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Rss/Block/Catalog/NewCatalogTest.php b/dev/tests/unit/testsuite/Magento/Rss/Block/Catalog/NewCatalogTest.php new file mode 100644 index 0000000000000..bb580235022a2 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Rss/Block/Catalog/NewCatalogTest.php @@ -0,0 +1,149 @@ +getMock('Magento\Framework\View\Element\Template\Context', [], [], '', false); + $this->imageHelperMock = $this->getMock('Magento\Catalog\Helper\Image', [], [], '', false); + + $eventManagerMock = $this->getMock('Magento\Framework\Event\ManagerInterface', [], [], '', false); + $requestMock = $this->getMock('Magento\Framework\App\RequestInterface', [], [], '', false); + + $templateContextMock->expects($this->once()) + ->method('getEventManager') + ->will($this->returnValue($eventManagerMock)); + $templateContextMock->expects($this->once()) + ->method('getRequest') + ->will($this->returnValue($requestMock)); + + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->block = $objectManager->getObject( + 'Magento\Rss\Block\Catalog\NewCatalog', + [ + 'context' => $templateContextMock, + 'imageHelper' => $this->imageHelperMock, + ] + ); + } + + /** + * Test for method addNewItemXmlCallback + */ + public function testAddNewItemXmlCallback() + { + $priceHtmlForTest = '
Price is 10 for example
'; + $productMock = $this->getMock( + 'Magento\Catalog\Model\Product', + ['getProductUrl', 'getDescription', 'getAllowedInRss', 'getName', '__wakeup'], + [], + '', + false + ); + $rssObjMock = $this->getMock('Magento\Rss\Model\Rss', [], [], '', false); + $layoutMock = $this->getMockForAbstractClass( + 'Magento\Framework\View\LayoutInterface', + [], + '', + true, + true, + true, + ['getBlock'] + ); + $priceRendererMock = $this->getMock('Magento\Framework\Pricing\Render', ['render'], [], '', false); + $productTitle = 'Product title'; + $productUrl = 'Product Url'; + $imgThumbSrc = 'http://source-for-thumbnail'; + $productDescription = 'Product description'; + $description = '
' . + $productDescription . $priceHtmlForTest . '
'; + + $productMock->expects($this->exactly(2)) + ->method('getProductUrl') + ->will($this->returnValue($productUrl)); + $productMock->expects($this->once()) + ->method('getDescription') + ->will($this->returnValue($productDescription)); + $productMock->expects($this->any()) + ->method('getAllowedInRss') + ->will($this->returnValue(true)); + $productMock->expects($this->once()) + ->method('getName') + ->will($this->returnValue($productTitle)); + $this->imageHelperMock->expects($this->once()) + ->method('init') + ->will($this->returnSelf()); + $this->imageHelperMock->expects($this->once()) + ->method('resize') + ->will($this->returnValue($imgThumbSrc)); + $layoutMock->expects($this->once()) + ->method('getBlock') + ->will($this->returnValue($priceRendererMock)); + $priceRendererMock->expects($this->once()) + ->method('render') + ->will($this->returnValue($priceHtmlForTest)); + + $expectedData = [ + 'title' => $productTitle, + 'link' => $productUrl, + 'description' => $description + ]; + $rssObjMock->expects($this->once()) + ->method('_addEntry') + ->with($expectedData) + ->will($this->returnSelf()); + + + $args = [ + 'product' => $productMock, + 'rssObj' => $rssObjMock, + 'row' => '' + ]; + + $this->block->setLayout($layoutMock); + $this->assertNull($this->block->addNewItemXmlCallback($args)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Rss/Block/Catalog/SpecialTest.php b/dev/tests/unit/testsuite/Magento/Rss/Block/Catalog/SpecialTest.php new file mode 100644 index 0000000000000..bb3d6b308a7c7 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Rss/Block/Catalog/SpecialTest.php @@ -0,0 +1,271 @@ +getMock('Magento\Framework\View\Element\Template\Context', [], [], '', false); + $this->catalogHelperMock = $this->getMock('Magento\Catalog\Helper\Data', [], [], '', false); + $this->priceCurrencyMock = $this->getMockForAbstractClass( + 'Magento\Framework\Pricing\PriceCurrencyInterface', + [], + '', + true, + true, + true, + ['convertAndFormat'] + ); + $this->rssFactoryMock = $this->getMock('Magento\Rss\Model\RssFactory', ['create'], [], '', false); + $this->productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', ['create'], [], '', false); + $this->resourceIteratorMock = $this->getMock('Magento\Framework\Model\Resource\Iterator', [], [], '', false); + $this->imageHelperMock = $this->getMock('Magento\Catalog\Helper\Image', [], [], '', false); + + $eventManagerMock = $this->getMock('Magento\Framework\Event\ManagerInterface', [], [], '', false); + $requestMock = $this->getMock('Magento\Framework\App\RequestInterface', [], [], '', false); + $storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface'); + $urlBuilderMock = $this->getMock('Magento\Framework\UrlInterface', [], [], '', false); + $this->storeMock = $this->getMock('Magento\Store\Model\Store', [], [], '', false); + $scopeConfigMock = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface', [], [], '', false); + $cacheStateMock = $this->getMock('Magento\Framework\App\Cache\StateInterface', [], [], '', false); + + $templateContextMock->expects($this->any()) + ->method('getRequest') + ->will($this->returnValue($requestMock)); + $templateContextMock->expects($this->any()) + ->method('getScopeConfig') + ->will($this->returnValue($scopeConfigMock)); + $templateContextMock->expects($this->any()) + ->method('getCacheState') + ->will($this->returnValue($cacheStateMock)); + $templateContextMock->expects($this->any()) + ->method('getEventManager') + ->will($this->returnValue($eventManagerMock)); + $templateContextMock->expects($this->any()) + ->method('getUrlBuilder') + ->will($this->returnValue($urlBuilderMock)); + $templateContextMock->expects($this->any()) + ->method('getStoreManager') + ->will($this->returnValue($storeManagerMock)); + $storeManagerMock->expects($this->any()) + ->method('getStore') + ->will($this->returnValue($this->storeMock)); + $this->storeMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(0)); + + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->block = $objectManager->getObject( + 'Magento\Rss\Block\Catalog\Special', + [ + 'context' => $templateContextMock, + 'catalogData' => $this->catalogHelperMock, + 'priceCurrency' => $this->priceCurrencyMock, + 'productFactory' => $this->productFactoryMock, + 'rssFactory' => $this->rssFactoryMock, + 'resourceIterator' => $this->resourceIteratorMock, + 'imageHelper' => $this->imageHelperMock, + ] + ); + } + + /** + * Test for method _toHtml + * + * @return void + */ + public function testToHtml() + { + $productMock = $this->getMock( + 'Magento\Catalog\Model\Product', + ['getProductUrl', 'getDescription', 'getAllowedPriceInRss', 'getName', '__wakeup', 'getResourceCollection'], + [], + '', + false + ); + $productCollectionMock = $this->getMock( + 'Magento\Catalog\Model\Resource\Product\CollectionFactory', + ['addPriceDataFieldFilter', 'addPriceData', 'addAttributeToSelect', 'addAttributeToSort', 'getSelect'], + [], + '', + false + ); + $rssObjMock = $this->getMock('Magento\Rss\Model\Rss', [], [], '', false); + $productUrl = 'Product Url'; + $imgThumbSrc = 'http://source-for-thumbnail'; + $productTitle = 'Product title'; + $basePriceFormatted = '$10.00'; + $finalPriceFormatted = '$20.00'; + $productDescription = '' . + '' . + '

Price: ' . $basePriceFormatted . ' Special Price: ' . + $finalPriceFormatted . '

'; + $expectedData = [ + 'title' => $productTitle, + 'link' => $productUrl, + 'description' => $productDescription + ]; + $expectedResult = new \Magento\Framework\Object(['rss_feed' => 'Feed of the rss']); + + $this->addMocks(); + $this->productFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($productMock)); + $productMock->expects($this->once()) + ->method('getResourceCollection') + ->will($this->returnValue($productCollectionMock)); + $productCollectionMock->expects($this->once()) + ->method('addPriceDataFieldFilter') + ->will($this->returnSelf()); + $productCollectionMock->expects($this->once()) + ->method('addPriceData') + ->will($this->returnSelf()); + $productCollectionMock->expects($this->once()) + ->method('addAttributeToSelect') + ->will($this->returnSelf()); + $productCollectionMock->expects($this->once()) + ->method('addAttributeToSort') + ->will($this->returnSelf()); + $this->rssFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($rssObjMock)); + $productMock->expects($this->exactly(2)) + ->method('getProductUrl') + ->will($this->returnValue($productUrl)); + $this->imageHelperMock->expects($this->once()) + ->method('resize') + ->will($this->returnValue($imgThumbSrc)); + $productMock->expects($this->any()) + ->method('getAllowedPriceInRss') + ->will($this->returnValue(true)); + $productMock->expects($this->once()) + ->method('getName') + ->will($this->returnValue($productTitle)); + $this->priceCurrencyMock->expects($this->exactly(2)) + ->method('convertAndFormat') + ->will($this->returnValueMap( + [ + [10, true, PriceCurrencyInterface::DEFAULT_PRECISION, null, null, $basePriceFormatted], + [20, true, PriceCurrencyInterface::DEFAULT_PRECISION, null, null, $finalPriceFormatted], + ] + ) + ); + $rssObjMock->expects($this->once()) + ->method('_addEntry') + ->with($expectedData) + ->will($this->returnSelf()); + $rssObjMock->expects($this->once()) + ->method('createRssXml') + ->will($this->returnValue($expectedResult)); + $this->assertEquals($expectedResult, $this->block->toHtml()); + } + + /** + * Additional function to break up mocks initialization + * + * @return void + */ + protected function addMocks() + { + + $resIteratorcallback = function () { + $arguments = func_get_args(); + $arguments[2]['results'] = [ + ['use_special' => false, 'price' => 10, 'final_price' => 20] + ]; + }; + + $this->storeMock->expects($this->once()) + ->method('getWebsiteId') + ->will($this->returnValue(0)); + $this->storeMock->expects($this->once()) + ->method('getFrontendName') + ->will($this->returnValue('store name')); + + $this->catalogHelperMock->expects($this->once()) + ->method('canApplyMsrp') + ->will($this->returnValue(false)); + $this->resourceIteratorMock->expects($this->once()) + ->method('walk') + ->will($this->returnCallback($resIteratorcallback)); + $this->imageHelperMock->expects($this->once()) + ->method('init') + ->will($this->returnSelf()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Rss/Block/WishlistTest.php b/dev/tests/unit/testsuite/Magento/Rss/Block/WishlistTest.php new file mode 100644 index 0000000000000..55fc7279aaef6 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Rss/Block/WishlistTest.php @@ -0,0 +1,404 @@ +getMock('Magento\Catalog\Block\Product\Context', [], [], '', false); + $this->coreHelperMock = $this->getMock('Magento\Core\Helper\Data', [], [], '', false); + $this->catalogOutputMock = $this->getMock('Magento\Catalog\Helper\Output', [], [], '', false); + $wishlistFactoryMock = $this->getMock('Magento\Wishlist\Model\WishlistFactory', [], [], '', false); + $this->rssFactoryMock = $this->getMock('Magento\Rss\Model\RssFactory', ['create'], [], '', false); + $eventManagerMock = $this->getMock('Magento\Framework\Event\ManagerInterface', [], [], '', false); + $cacheStateMock = $this->getMock('Magento\Framework\App\Cache\StateInterface', [], [], '', false); + $this->productFactoryMock = $this->getMock( + 'Magento\Catalog\Model\ProductFactory', + ['create', '__wakeup'], + [], + '', + false + ); + $this->wishlistHelperMock = $this->getMock( + 'Magento\Wishlist\Helper\Data', + ['getWishlist', 'getCustomer', 'getCustomerName'], + [], + '', + false + ); + $this->urlBuilderMock = $this->getMockForAbstractClass( + 'Magento\Framework\UrlInterface', + [], + '', + true, + true, + true, + ['getUrl'] + ); + $this->storeConfigMock = $this->getMockForAbstractClass( + 'Magento\Framework\App\Config\ScopeConfigInterface', + [], + '', + true, + true, + true, + ['getConfig'] + ); + $this->imageHelperMock = $this->getMock('Magento\Catalog\Helper\Image', [], [], '', false); + + $templateContextMock->expects($this->once()) + ->method('getEventManager') + ->will($this->returnValue($eventManagerMock)); + $templateContextMock->expects($this->once()) + ->method('getCacheState') + ->will($this->returnValue($cacheStateMock)); + $templateContextMock->expects($this->once()) + ->method('getImageHelper') + ->will($this->returnValue($this->imageHelperMock)); + $templateContextMock->expects($this->once()) + ->method('getWishlistHelper') + ->will($this->returnValue($this->wishlistHelperMock)); + $templateContextMock->expects($this->once()) + ->method('getScopeConfig') + ->will($this->returnValue($this->storeConfigMock)); + $templateContextMock->expects($this->once()) + ->method('getUrlBuilder') + ->will($this->returnValue($this->urlBuilderMock)); + + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->block = $objectManager->getObject( + 'Magento\Rss\Block\Wishlist', + [ + 'context' => $templateContextMock, + 'productFactory' => $this->productFactoryMock, + 'coreData' => $this->coreHelperMock, + 'wishlistFactory' => $wishlistFactoryMock, + 'rssFactory' => $this->rssFactoryMock, + 'outputHelper' => $this->catalogOutputMock + ] + ); + } + + /** + * Test for method _toHtml + */ + public function testToHtml() + { + $wishlistId = 1; + $customerName = 'Customer Name'; + $title = "$customerName's Wishlist"; + $rssObjMock = $this->getMock('Magento\Rss\Model\Rss', [], [], '', false); + $wishlistModelMock = $this->getMock( + 'Magento\Wishlist\Model\Wishlist', + ['getId', '__wakeup', 'getCustomerId', 'getItemCollection'], + [], + '', + false + ); + $customerServiceMock = $this->getMock('Magento\Customer\Service\V1\Data\Customer', [], [], '', false); + $wishlistSharingUrl = 'wishlist/shared/index/1'; + $locale = 'en_US'; + $productUrl = 'http://product.url/'; + $productName = 'Product name'; + $expectedHeaders = [ + 'title' => $title, + 'description' => $title, + 'link' => $wishlistSharingUrl, + 'charset' => 'UTF-8', + 'language' => $locale + ]; + + + $this->rssFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($rssObjMock)); + $this->wishlistHelperMock->expects($this->once()) + ->method('getWishlist') + ->will($this->returnValue($wishlistModelMock)); + $this->wishlistHelperMock->expects($this->once()) + ->method('getCustomer') + ->will($this->returnValue($customerServiceMock)); + $this->wishlistHelperMock->expects($this->once()) + ->method('getCustomerName') + ->will($this->returnValue($customerName)); + $wishlistModelMock->expects($this->once()) + ->method('getId') + ->will($this->returnValue($wishlistId)); + $this->urlBuilderMock->expects($this->once()) + ->method('getUrl') + ->will($this->returnValue($wishlistSharingUrl)); + $this->storeConfigMock->expects($this->any()) + ->method('getValue') + ->will($this->returnValueMap( + [ + [ + 'advanced/modules_disable_output/Magento_Rss', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null, + null + ], + [ + 'general/locale/code', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + null, + $locale + ] + ] + ) + ); + + $staticArgs = [ + 'productName' => $productName, + 'productUrl' => $productUrl + ]; + $description = $this->processWishlistItemDescription($wishlistModelMock, $staticArgs); + $expectedEntry = [ + 'title' => $productName, + 'link' => $productUrl, + 'description' => $description + ]; + $rssString = ''; + + $rssObjMock->expects($this->once()) + ->method('_addHeader') + ->with($expectedHeaders) + ->will($this->returnSelf()); + $rssObjMock->expects($this->once()) + ->method('_addEntry') + ->with($expectedEntry); + $rssObjMock->expects($this->once()) + ->method('createRssXml') + ->will($this->returnValue($rssString)); + + $this->assertEquals($rssString, $this->block->toHtml()); + } + + /** + * Additional function to process forming description for wishlist item + * + * @param \Magento\Wishlist\Model\Wishlist $wishlistModelMock + * @param array $staticArgs + * @return string + */ + protected function processWishlistItemDescription($wishlistModelMock, $staticArgs) + { + $imgThumbSrc = 'http://source-for-thumbnail'; + $priceHtmlForTest = '
Price is 10 for example
'; + $productDescription = 'Product description'; + $productShortDescription = 'Product short description'; + + $wishlistItem = $this->getMock('Magento\Wishlist\Model\Item', [], [], '', false); + $wishlistItemsCollection = [ + $wishlistItem + ]; + $productMock = $this->getMock( + 'Magento\Catalog\Model\Product', + [ + 'getAllowedInRss', + 'getAllowedPriceInRss', + 'getDescription', + 'getShortDescription', + 'getName', + 'getVisibleInSiteVisibilities', + 'getUrlModel', + '__wakeup' + ], + [], + '', + false + ); + $urlModelMock = $this->getMock('Magento\Catalog\Model\Product\Url', [], [], '', false); + $layoutMock = $this->getMockForAbstractClass( + 'Magento\Framework\View\LayoutInterface', + [], + '', + true, + true, + true, + ['getBlock'] + ); + + $wishlistModelMock->expects($this->once()) + ->method('getItemCollection') + ->will($this->returnValue($wishlistItemsCollection)); + $wishlistItem->expects($this->once()) + ->method('getProduct') + ->will($this->returnValue($productMock)); + $productMock->expects($this->once()) + ->method('getUrlModel') + ->will($this->returnValue($urlModelMock)); + $productMock->expects($this->once()) + ->method('getAllowedPriceInRss') + ->will($this->returnValue($urlModelMock)); + $urlModelMock->expects($this->once()) + ->method('getUrl') + ->will($this->returnValue($staticArgs['productUrl'])); + $productMock->expects($this->once()) + ->method('getName') + ->will($this->returnValue($staticArgs['productName'])); + $productMock->expects($this->once()) + ->method('getAllowedInRss') + ->will($this->returnValue(true)); + $productMock->expects($this->once()) + ->method('getVisibleInSiteVisibilities') + ->will($this->returnValue(true)); + $this->imageHelperMock->expects($this->once()) + ->method('init') + ->will($this->returnSelf()); + $this->imageHelperMock->expects($this->once()) + ->method('resize') + ->will($this->returnValue($imgThumbSrc)); + $priceRendererMock = $this->getMock('Magento\Framework\Pricing\Render', ['render'], [], '', false); + + $layoutMock->expects($this->once()) + ->method('getBlock') + ->will($this->returnValue($priceRendererMock)); + $priceRendererMock->expects($this->once()) + ->method('render') + ->will($this->returnValue($priceHtmlForTest)); + $productMock->expects($this->any()) + ->method('getDescription') + ->will($this->returnValue($productDescription)); + $productMock->expects($this->any()) + ->method('getShortDescription') + ->will($this->returnValue($productShortDescription)); + $this->catalogOutputMock->expects($this->any()) + ->method('productAttribute') + ->will($this->returnArgument(1)); + + $this->block->setLayout($layoutMock); + $description = '
' . + $productShortDescription . '

' . $priceHtmlForTest . '

Comment: ' . $productDescription . '

' . + '

'; + + return $description; + } + + /** + * Test for method _toHtml for the case, when wishlist is absent + */ + public function testToHtmlWithoutWishlist() + { + $url = 'http://base.url/index'; + $rssString = 'Some empty xml'; + $rssObjMock = $this->getMock('Magento\Rss\Model\Rss', [], [], '', false); + $customerServiceMock = $this->getMock('Magento\Customer\Service\V1\Data\Customer', [], [], '', false); + $wishlistModelMock = $this->getMock( + 'Magento\Wishlist\Model\Wishlist', + ['getId', '__wakeup', 'getCustomerId'], + [], + '', + false + ); + $expectedHeaders = [ + 'title' => __('We cannot retrieve the wish list.'), + 'description' => __('We cannot retrieve the wish list.'), + 'link' => $url, + 'charset' => 'UTF-8' + ]; + + $this->rssFactoryMock->expects($this->once()) + ->method('create') + ->will($this->returnValue($rssObjMock)); + $this->wishlistHelperMock->expects($this->once()) + ->method('getWishlist') + ->will($this->returnValue($wishlistModelMock)); + $wishlistModelMock->expects($this->once()) + ->method('getId') + ->will($this->returnValue(false)); + $this->urlBuilderMock->expects($this->once()) + ->method('getUrl') + ->will($this->returnValue($url)); + $this->wishlistHelperMock->expects($this->once()) + ->method('getCustomer') + ->will($this->returnValue($customerServiceMock)); + $rssObjMock->expects($this->once()) + ->method('_addHeader') + ->with($expectedHeaders) + ->will($this->returnSelf()); + $rssObjMock->expects($this->once()) + ->method('createRssXml') + ->will($this->returnValue($rssString)); + + $this->assertEquals($rssString, $this->block->toHtml()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/OrderTest.php b/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/OrderTest.php index db247adb1ffb6..afb5d98498f7e 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/OrderTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/OrderTest.php @@ -79,16 +79,32 @@ public function setUp() $this->getMock('\Magento\Framework\App\Action\Title', array('__wakeup', 'add'), array(), '', false); $viewMock = $this->getMockForAbstractClass('\Magento\Framework\App\ViewInterface'); + /** + * @TODO: + * - Methods of object under test MUST NOT be mocked + * - Protected properties MUST NOT be set from outside, inject via context passed to constructor instead + */ $this->_controllerMock = $this->getMockBuilder( - '\Magento\Sales\Controller\Adminhtml\Stub\Order' + '\Magento\Sales\Controller\Adminhtml\Order' )->disableOriginalConstructor()->setMethods( array('__wakeup', '_initOrder', '_initAction', '__', 'renderLayout', '_redirect') )->getMock(); $this->_controllerMock->expects($this->any())->method('__')->will($this->returnArgument(0)); - $this->_controllerMock->_title = $titleMock; - $this->_controllerMock->_view = $viewMock; - $this->_controllerMock->messageManager = $this->_messageMock; + $reflectionProperty = new \ReflectionProperty('\Magento\Sales\Controller\Adminhtml\Order', '_title'); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($this->_controllerMock, $titleMock); + $reflectionProperty->setAccessible(false); + + $reflectionProperty = new \ReflectionProperty('\Magento\Sales\Controller\Adminhtml\Order', '_view'); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($this->_controllerMock, $viewMock); + $reflectionProperty->setAccessible(false); + + $reflectionProperty = new \ReflectionProperty('\Magento\Sales\Controller\Adminhtml\Order', 'messageManager'); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($this->_controllerMock, $this->_messageMock); + $reflectionProperty->setAccessible(false); } /** diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Quote/ItemTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Quote/ItemTest.php index 73bc9bc7ab8b0..c9e41f6ce4b4c 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Quote/ItemTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Quote/ItemTest.php @@ -36,12 +36,12 @@ class ItemTest extends \PHPUnit_Framework_TestCase private $localeFormat; /** - * @var \Magento\Model\Context + * @var \Magento\Framework\Model\Context */ private $modelContext; /** - * @var \Magento\Event\ManagerInterface + * @var \Magento\Framework\Event\ManagerInterface */ private $eventDispatcher; @@ -81,7 +81,7 @@ protected function setUp() ->setMethods(['getEventDispatcher']) ->getMock(); - $this->eventDispatcher = $this->getMockBuilder('Magento\Event\ManagerInterface') + $this->eventDispatcher = $this->getMockBuilder('Magento\Framework\Event\ManagerInterface') ->disableOriginalConstructor() ->setMethods(['dispatch']) ->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Store/Model/Storage/DbTest.php b/dev/tests/unit/testsuite/Magento/Store/Model/Storage/DbTest.php index 01ffe65308f64..5afae729e73fc 100644 --- a/dev/tests/unit/testsuite/Magento/Store/Model/Storage/DbTest.php +++ b/dev/tests/unit/testsuite/Magento/Store/Model/Storage/DbTest.php @@ -190,7 +190,7 @@ protected function prepareMockForReinit() $websiteCode = 'website_code'; $groupId = 1; $storeId = 1; - $storeCode = \Magento\Store\Model\Store::DEFAULT_CODE; + $storeCode = 'store_code'; $websiteCollection = $this->getMock('\Magento\Store\Model\Resource\Website\Collection', array(), array(), '', false, false); $websiteCollection->expects($this->any())->method('setLoadDefault')->with(true); @@ -266,7 +266,6 @@ public function testGetStoreGetDefaulStore() $this->prepareMockForReinit(); $this->_model->reinitStores(); $this->assertSame($this->_storeMock, $this->_model->getStore(true)); - } public function testReinitStores() @@ -294,7 +293,7 @@ public function testGetStores() $this->_model->reinitStores(); $this->assertSame($expected, $this->_model->getStores()); - $expected = array(\Magento\Store\Model\Store::DEFAULT_CODE => $this->_storeMock); + $expected = array('store_code' => $this->_storeMock); $this->assertSame($expected, $this->_model->getStores(false, true)); } diff --git a/dev/tests/unit/testsuite/Magento/Tax/Pricing/AdjustmentTest.php b/dev/tests/unit/testsuite/Magento/Tax/Pricing/AdjustmentTest.php index ff9dd0242fd2e..74ea74b8a9059 100644 --- a/dev/tests/unit/testsuite/Magento/Tax/Pricing/AdjustmentTest.php +++ b/dev/tests/unit/testsuite/Magento/Tax/Pricing/AdjustmentTest.php @@ -24,49 +24,46 @@ namespace Magento\Tax\Pricing; -use Magento\Tax\Helper\Data as TaxHelper; use Magento\Framework\Pricing\Object\SaleableInterface; class AdjustmentTest extends \PHPUnit_Framework_TestCase { + /** + * @var Adjustment + */ + protected $adjustment; + + /** + * @var \Magento\Tax\Helper\Data | \PHPUnit_Framework_MockObject_MockObject + */ + protected $taxHelper; + + /** + * @var int + */ + protected $sortOrder = 5; + + public function setUp() + { + $this->taxHelper = $this->getMock('Magento\Tax\Helper\Data', [], [], '', false); + $this->adjustment = new Adjustment($this->taxHelper, $this->sortOrder); + } + public function testGetAdjustmentCode() { - // Instantiate/mock objects - /** @var TaxHelper $taxHelper */ - $taxHelper = $this->getMockBuilder('Magento\Tax\Helper\Data')->disableOriginalConstructor() - ->setMethods(array()) - ->getMock(); - $model = new Adjustment($taxHelper); - - // Run tested method - $code = $model->getAdjustmentCode(); - - // Check expectations - $this->assertNotEmpty($code); + $this->assertEquals(Adjustment::ADJUSTMENT_CODE, $this->adjustment->getAdjustmentCode()); } /** - * @param bool $isPriceIncludesTax + * @param bool $expectedResult * @dataProvider isIncludedInBasePriceDataProvider */ - public function testIsIncludedInBasePrice($isPriceIncludesTax) + public function testIsIncludedInBasePrice($expectedResult) { - // Instantiate/mock objects - /** @var TaxHelper|\PHPUnit_Framework_MockObject_MockObject $taxHelper */ - $taxHelper = $this->getMockBuilder('Magento\Tax\Helper\Data')->disableOriginalConstructor() - ->setMethods(array('priceIncludesTax')) - ->getMock(); - $model = new Adjustment($taxHelper); - - // Avoid execution of irrelevant functionality - $taxHelper->expects($this->any())->method('priceIncludesTax')->will($this->returnValue($isPriceIncludesTax)); - - // Run tested method - $result = $model->isIncludedInBasePrice(); - - // Check expectations - $this->assertInternalType('bool', $result); - $this->assertEquals($isPriceIncludesTax, $result); + $this->taxHelper->expects($this->once()) + ->method('priceIncludesTax') + ->will($this->returnValue($expectedResult)); + $this->assertEquals($expectedResult, $this->adjustment->isIncludedInBasePrice()); } public function isIncludedInBasePriceDataProvider() @@ -79,27 +76,16 @@ public function isIncludedInBasePriceDataProvider() */ public function testIsIncludedInDisplayPrice($displayPriceIncludingTax, $displayBothPrices, $expectedResult) { - // Instantiate/mock objects - /** @var TaxHelper|\PHPUnit_Framework_MockObject_MockObject $taxHelper */ - $taxHelper = $this->getMockBuilder('Magento\Tax\Helper\Data')->disableOriginalConstructor() - ->setMethods(array('displayPriceIncludingTax', 'displayBothPrices')) - ->getMock(); - - // Avoid execution of irrelevant functionality - $taxHelper->expects($this->any()) + $this->taxHelper->expects($this->once()) ->method('displayPriceIncludingTax') ->will($this->returnValue($displayPriceIncludingTax)); - $taxHelper->expects($this->any()) - ->method('displayBothPrices') - ->will($this->returnValue($displayBothPrices)); + if (!$displayPriceIncludingTax) { + $this->taxHelper->expects($this->once()) + ->method('displayBothPrices') + ->will($this->returnValue($displayBothPrices)); + } - $model = new Adjustment($taxHelper); - // Run tested method - $result = $model->isIncludedInDisplayPrice(); - - // Check expectations - $this->assertInternalType('bool', $result); - $this->assertEquals($expectedResult, $result); + $this->assertEquals($expectedResult, $this->adjustment->isIncludedInDisplayPrice()); } /** @@ -124,30 +110,17 @@ public function isIncludedInDisplayPriceDataProvider() */ public function testExtractAdjustment($isPriceIncludesTax, $amount, $price, $expectedResult) { - // Instantiate/mock objects - /** @var TaxHelper|\PHPUnit_Framework_MockObject_MockObject $taxHelper */ - $taxHelper = $this->getMockBuilder('Magento\Tax\Helper\Data')->disableOriginalConstructor() - ->setMethods(array('priceIncludesTax', 'getPrice')) - ->getMock(); - /** @var SaleableInterface|\PHPUnit_Framework_MockObject_MockObject $taxHelper */ - $object = $this->getMockBuilder('Magento\Framework\Pricing\Object\SaleableInterface')->getMock(); - $model = new Adjustment($taxHelper); + $object = $this->getMockForAbstractClass('Magento\Framework\Pricing\Object\SaleableInterface'); - // Avoid execution of irrelevant functionality - $taxHelper->expects($this->any()) + $this->taxHelper->expects($this->any()) ->method('priceIncludesTax') ->will($this->returnValue($isPriceIncludesTax)); - $taxHelper->expects($this->any()) + $this->taxHelper->expects($this->any()) ->method('getPrice') ->with($object, $amount) ->will($this->returnValue($price)); - // Run tested method - $result = $model->extractAdjustment($amount, $object); - - // Check expectations - $this->assertInternalType('float', $result); - $this->assertEquals($expectedResult, $result); + $this->assertEquals($expectedResult, $this->adjustment->extractAdjustment($amount, $object)); } public function extractAdjustmentDataProvider() @@ -169,30 +142,17 @@ public function extractAdjustmentDataProvider() */ public function testApplyAdjustment($isPriceIncludesTax, $amount, $price, $expectedResult) { - // Instantiate/mock objects - /** @var TaxHelper|\PHPUnit_Framework_MockObject_MockObject $taxHelper */ - $taxHelper = $this->getMockBuilder('Magento\Tax\Helper\Data')->disableOriginalConstructor() - ->setMethods(array('priceIncludesTax', 'getPrice')) - ->getMock(); - /** @var SaleableInterface|\PHPUnit_Framework_MockObject_MockObject $taxHelper */ $object = $this->getMockBuilder('Magento\Framework\Pricing\Object\SaleableInterface')->getMock(); - $model = new Adjustment($taxHelper); - // Avoid execution of irrelevant functionality - $taxHelper->expects($this->any()) + $this->taxHelper->expects($this->any()) ->method('priceIncludesTax') ->will($this->returnValue($isPriceIncludesTax)); - $taxHelper->expects($this->any()) + $this->taxHelper->expects($this->any()) ->method('getPrice') ->with($object, $amount, !$isPriceIncludesTax) ->will($this->returnValue($price)); - // Run tested method - $result = $model->applyAdjustment($amount, $object); - - // Check expectations - $this->assertInternalType('float', $result); - $this->assertEquals($expectedResult, $result); + $this->assertEquals($expectedResult, $this->adjustment->applyAdjustment($amount, $object)); } /** @@ -207,20 +167,26 @@ public function applyAdjustmentDataProvider() ]; } - public function testIsExcludedWith() + /** + * @dataProvider isExcludedWithDataProvider + * @param string $adjustmentCode + * @param bool $expectedResult + */ + public function testIsExcludedWith($adjustmentCode, $expectedResult) { - $adjustmentCode = 'some_random_adjustment_code123'; - - // Instantiate/mock objects - /** @var TaxHelper|\PHPUnit_Framework_MockObject_MockObject $taxHelper */ - $taxHelper = $this->getMockBuilder('Magento\Tax\Helper\Data')->disableOriginalConstructor()->getMock(); - $model = new Adjustment($taxHelper); + $this->assertEquals($expectedResult, $this->adjustment->isExcludedWith($adjustmentCode)); + } - // Run tested method - $result = $model->isExcludedWith($adjustmentCode); + public function isExcludedWithDataProvider() + { + return [ + [Adjustment::ADJUSTMENT_CODE, true], + ['not_tax', false] + ]; + } - // Check expectations - $this->assertInternalType('bool', $result); - $this->assertFalse($result); + public function testGetSortOrder() + { + $this->assertEquals($this->sortOrder, $this->adjustment->getSortOrder()); } } diff --git a/dev/tests/unit/testsuite/Magento/Tax/Pricing/Price/Plugin/AttributePriceTest.php b/dev/tests/unit/testsuite/Magento/Tax/Pricing/Price/Plugin/AttributePriceTest.php new file mode 100644 index 0000000000000..106743426db35 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Tax/Pricing/Price/Plugin/AttributePriceTest.php @@ -0,0 +1,175 @@ +taxHelperMock = $this->getMock( + 'Magento\Tax\Helper\Data', + ['displayPriceIncludingTax', 'displayBothPrices'], + [], + '', + false, + false + ); + $this->calculationMock = $this->getMock( + 'Magento\Tax\Model\Calculation', + ['getRate', 'getRateRequest', '__wakeup'], + [], + '', + false, + false + ); + $this->productMock = $this->getMock( + 'Magento\Catalog\Model\Product', + ['__wakeup', 'getTaxClassId', 'getPriceInfo'], + [], + '', + false, + false + ); + $this->priceInfoMock = $this->getMock( + 'Magento\Framework\Pricing\PriceInfo\Base', + ['getAdjustment'], + [], + '', + false, + false + ); + $this->adjustmentMock = $this->getMock( + 'Magento\Tax\Pricing\Adjustment', + ['isIncludedInBasePrice'], + [], + '', + false, + false + ); + $this->rateRequestMock = $this->getMock( + 'Magento\Object', + ['setProductClassId', '__wakeup'], + [], + '', + false, + false + ); + $this->attributePriceMock = $this->getMock( + 'Magento\ConfigurableProduct\Pricing\Price\AttributePrice', + [], + [], + '', + false, + false + ); + + $this->plugin = new \Magento\Tax\Pricing\Price\Plugin\AttributePrice( + $this->taxHelperMock, + $this->calculationMock + ); + + + } + + /** + * test for method afterPrepareAdjustmentConfig + */ + public function testAfterPrepareAdjustmentConfig() + { + $this->productMock->expects($this->once()) + ->method('getTaxClassId') + ->will($this->returnValue('tax-class-id')); + $this->calculationMock->expects($this->exactly(2)) + ->method('getRateRequest') + ->will($this->returnValue($this->rateRequestMock)); + $this->calculationMock->expects($this->exactly(2)) + ->method('getRate') + ->with($this->equalTo($this->rateRequestMock)) + ->will($this->returnValue(99.10)); + $this->productMock->expects($this->once()) + ->method('getPriceInfo') + ->will($this->returnValue($this->priceInfoMock)); + $this->priceInfoMock->expects($this->once()) + ->method('getAdjustment') + ->with($this->equalTo(\Magento\Tax\Pricing\Adjustment::ADJUSTMENT_CODE)) + ->will($this->returnValue($this->adjustmentMock)); + $this->adjustmentMock->expects($this->once()) + ->method('isIncludedInBasePrice') + ->will($this->returnValue(true)); + $this->taxHelperMock->expects($this->once()) + ->method('displayPriceIncludingTax') + ->will($this->returnValue(true)); + $this->taxHelperMock->expects($this->once()) + ->method('displayBothPrices') + ->will($this->returnValue(true)); + + $expected = [ + 'product' => $this->productMock, + 'defaultTax' => 99.10, + 'currentTax' => 99.10, + 'includeTax' => true, + 'showIncludeTax' => true, + 'showBothPrices' => true + ]; + + $this->assertEquals($expected, $this->plugin->afterPrepareAdjustmentConfig($this->attributePriceMock, [ + 'product' => $this->productMock, + 'defaultTax' => 0, + 'currentTax' => 0 + ])); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Tax/Pricing/Render/AdjustmentTest.php b/dev/tests/unit/testsuite/Magento/Tax/Pricing/Render/AdjustmentTest.php index 1050a4d333398..34febddc00268 100644 --- a/dev/tests/unit/testsuite/Magento/Tax/Pricing/Render/AdjustmentTest.php +++ b/dev/tests/unit/testsuite/Magento/Tax/Pricing/Render/AdjustmentTest.php @@ -36,14 +36,14 @@ class AdjustmentTest extends \PHPUnit_Framework_TestCase /** * Price currency model mock * - * @var \Magento\Directory\Model\PriceCurrency + * @var \Magento\Directory\Model\PriceCurrency | \PHPUnit_Framework_MockObject_MockObject */ protected $priceCurrencyMock; /** * Price helper mock * - * @var \Magento\Tax\Helper\Data + * @var \Magento\Tax\Helper\Data | \PHPUnit_Framework_MockObject_MockObject */ protected $taxHelperMock; @@ -104,7 +104,7 @@ public function setUp() */ public function testGetAdjustmentCode() { - $this->assertEquals(\Magento\Tax\Pricing\Adjustment::CODE, $this->model->getAdjustmentCode()); + $this->assertEquals(\Magento\Tax\Pricing\Adjustment::ADJUSTMENT_CODE, $this->model->getAdjustmentCode()); } /** @@ -292,4 +292,93 @@ public function testDisplayPriceExcludingTax() $this->assertEquals($expectedResult, $result); } + + public function testGetHtmlExcluding() + { + $arguments = []; + $totalDisplayValue = 10.0; + $taxAdjustment = 2.0; + $displayValue = 8.0; + + $amountRender = $this->getMockForAbstractClass('Magento\Framework\Pricing\Render\AmountRenderInterface'); + $amountMock = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface'); + $amountMock->expects($this->once()) + ->method('getAdjustmentAmount') + ->with(\Magento\Tax\Pricing\Adjustment::ADJUSTMENT_CODE) + ->will($this->returnValue($taxAdjustment)); + + $this->taxHelperMock->expects($this->once()) + ->method('displayBothPrices') + ->will($this->returnValue(false)); + $this->taxHelperMock->expects($this->once()) + ->method('displayPriceExcludingTax') + ->will($this->returnValue(true)); + + $amountRender->expects($this->at(0)) + ->method('getDisplayValue') + ->will($this->returnValue($totalDisplayValue)); + $amountRender->expects($this->at(1)) + ->method('getAmount') + ->will($this->returnValue($amountMock)); + $amountRender->expects($this->at(2)) + ->method('setDisplayValue') + ->with($displayValue); + + $this->model->render($amountRender, $arguments); + } + + public function testGetHtmlBoth() + { + $arguments = []; + $totalDisplayValue = 10.0; + $taxAdjustment = 2.0; + $displayValue = 8.0; + $this->model->setZone(\Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW); + + $amountRender = $this->getMock( + 'Magento\Framework\Pricing\Render\Amount', + [ + 'setPriceDisplayLabel', + 'setPriceId', + 'getSaleableItem', + 'getDisplayValue', + 'getAmount', + 'setDisplayValue' + ], + [], + '', + false + ); + $amountMock = $this->getMockForAbstractClass('Magento\Framework\Pricing\Amount\AmountInterface'); + $amountMock->expects($this->once()) + ->method('getAdjustmentAmount') + ->with(\Magento\Tax\Pricing\Adjustment::ADJUSTMENT_CODE) + ->will($this->returnValue($taxAdjustment)); + $product = $this->getMockForAbstractClass('Magento\Framework\Pricing\Object\SaleableInterface'); + $product->expects($this->once()) + ->method('getId'); + + $this->taxHelperMock->expects($this->once()) + ->method('displayBothPrices') + ->will($this->returnValue(true)); + + $amountRender->expects($this->at(0)) + ->method('setPriceDisplayLabel'); + $amountRender->expects($this->at(1)) + ->method('getSaleableItem') + ->will($this->returnValue($product)); + $amountRender->expects($this->at(2)) + ->method('setPriceId'); + $amountRender->expects($this->at(3)) + ->method('getDisplayValue') + ->will($this->returnValue($totalDisplayValue)); + $amountRender->expects($this->at(4)) + ->method('getAmount') + ->will($this->returnValue($amountMock)); + $amountRender->expects($this->at(5)) + ->method('setDisplayValue') + ->with($displayValue); + + $this->model->render($amountRender, $arguments); + } } diff --git a/dev/tests/unit/testsuite/Magento/Usps/Model/CarrierTest.php b/dev/tests/unit/testsuite/Magento/Usps/Model/CarrierTest.php index 442dc5377519e..3c1021d7132f5 100644 --- a/dev/tests/unit/testsuite/Magento/Usps/Model/CarrierTest.php +++ b/dev/tests/unit/testsuite/Magento/Usps/Model/CarrierTest.php @@ -165,8 +165,10 @@ public function testCollectRates() $this->returnValue(file_get_contents(__DIR__ . '/_files/success_usps_response_rates.xml')) ); // for setRequest - $request_params = include __DIR__ . '/_files/rates_request_data.php'; - $request = $this->_helper->getObject('Magento\Sales\Model\Quote\Address\RateRequest', $request_params); + $request = $this->_helper->getObject( + 'Magento\Sales\Model\Quote\Address\RateRequest', + require __DIR__ . '/_files/rates_request_data.php' + ); $this->assertNotEmpty($this->_model->collectRates($request)->getAllRates()); } @@ -180,8 +182,10 @@ public function testReturnOfShipment() )->will( $this->returnValue(file_get_contents(__DIR__ . '/_files/success_usps_response_return_shipment.xml')) ); - $request_params = include __DIR__ . '/_files/return_shipment_request_data.php'; - $request = $this->_helper->getObject('Magento\Shipping\Model\Shipment\ReturnShipment', $request_params); + $request = $this->_helper->getObject( + 'Magento\Shipping\Model\Shipment\ReturnShipment', + require __DIR__ . '/_files/return_shipment_request_data.php' + ); $this->assertNotEmpty($this->_model->returnOfShipment($request)->getInfo()[0]['tracking_number']); } diff --git a/dev/tests/unit/testsuite/Magento/Weee/Pricing/AdjustmentTest.php b/dev/tests/unit/testsuite/Magento/Weee/Pricing/AdjustmentTest.php index 0edb70d9d4e37..9e711679a93b9 100644 --- a/dev/tests/unit/testsuite/Magento/Weee/Pricing/AdjustmentTest.php +++ b/dev/tests/unit/testsuite/Magento/Weee/Pricing/AdjustmentTest.php @@ -29,34 +29,35 @@ class AdjustmentTest extends \PHPUnit_Framework_TestCase { + /** + * @var Adjustment + */ + protected $adjustment; + + /** + * @var \Magento\Weee\Helper\Data | \PHPUnit_Framework_MockObject_MockObject + */ + protected $weeeHelper; + + /** + * @var int + */ + protected $sortOrder = 5; + + public function setUp() + { + $this->weeeHelper = $this->getMock('Magento\Weee\Helper\Data', [], [], '', false); + $this->adjustment = new Adjustment($this->weeeHelper, $this->sortOrder); + } + public function testGetAdjustmentCode() { - // Instantiate/mock objects - /** @var WeeeHelper $weeHelper */ - $weeHelper = $this->getMockBuilder('Magento\Weee\Helper\Data')->disableOriginalConstructor() - ->setMethods(array()) - ->getMock(); - $model = new Adjustment($weeHelper); - - // Run tested method - $code = $model->getAdjustmentCode(); - - // Check expectations - $this->assertNotEmpty($code); + $this->assertEquals(Adjustment::ADJUSTMENT_CODE, $this->adjustment->getAdjustmentCode()); } public function testIsIncludedInBasePrice() { - // Instantiate/mock objects - /** @var WeeeHelper|\PHPUnit_Framework_MockObject_MockObject $weeeHelper */ - $weeeHelper = $this->getMockBuilder('Magento\Weee\Helper\Data')->disableOriginalConstructor()->getMock(); - $model = new Adjustment($weeeHelper); - - // Run tested method - $result = $model->isIncludedInBasePrice(); - - // Check expectations - $this->assertInternalType('bool', $result); + $this->assertFalse($this->adjustment->isIncludedInBasePrice()); } /** @@ -64,34 +65,17 @@ public function testIsIncludedInBasePrice() */ public function testIsIncludedInDisplayPrice($expectedResult) { - // Instantiate/mock objects - /** @var WeeeHelper|\PHPUnit_Framework_MockObject_MockObject $weeeHelper */ - $weeeHelper = $this->getMockBuilder('Magento\Weee\Helper\Data')->disableOriginalConstructor() - ->setMethods(array('typeOfDisplay')) - ->getMock(); - $model = new Adjustment($weeeHelper); - - // Avoid execution of irrelevant functionality - $weeeHelper->expects($this->any()) + $displayTypes = [ + \Magento\Weee\Model\Tax::DISPLAY_INCL, + \Magento\Weee\Model\Tax::DISPLAY_INCL_DESCR, + \Magento\Weee\Model\Tax::DISPLAY_EXCL_DESCR_INCL + ]; + $this->weeeHelper->expects($this->any()) ->method('typeOfDisplay') - ->with( - $this->equalTo( - [ - \Magento\Weee\Model\Tax::DISPLAY_INCL, - \Magento\Weee\Model\Tax::DISPLAY_INCL_DESCR, - \Magento\Weee\Model\Tax::DISPLAY_EXCL_DESCR_INCL, - 4 - ] - ) - ) + ->with($displayTypes) ->will($this->returnValue($expectedResult)); - // Run tested method - $result = $model->isIncludedInDisplayPrice(); - - // Check expectations - $this->assertInternalType('bool', $result); - $this->assertEquals($expectedResult, $result); + $this->assertEquals($expectedResult, $this->adjustment->isIncludedInDisplayPrice()); } /** @@ -109,26 +93,14 @@ public function isIncludedInDisplayPriceDataProvider() */ public function testExtractAdjustment($amount, $expectedResult) { - // Instantiate/mock objects - /** @var WeeeHelper|\PHPUnit_Framework_MockObject_MockObject $weeeHelper */ - $weeeHelper = $this->getMockBuilder('Magento\Weee\Helper\Data')->disableOriginalConstructor() - ->setMethods(array('getAmount')) - ->getMock(); - /** @var SaleableInterface|\PHPUnit_Framework_MockObject_MockObject $saleableItem */ - $saleableItem = $this->getMockBuilder('Magento\Framework\Pricing\Object\SaleableInterface')->getMock(); - $model = new Adjustment($weeeHelper); - - // Avoid execution of irrelevant functionality - $weeeHelper->expects($this->any()) + $saleableItem = $this->getMockForAbstractClass('Magento\Framework\Pricing\Object\SaleableInterface'); + + $this->weeeHelper->expects($this->any()) ->method('getAmount') + ->with($saleableItem) ->will($this->returnValue($amount)); - // Run tested method - $result = $model->extractAdjustment('anything_here', $saleableItem); - - // Check expectations - $this->assertInternalType('float', $result); - $this->assertEquals($expectedResult, $result); + $this->assertEquals($expectedResult, $this->adjustment->extractAdjustment($amount, $saleableItem)); } /** @@ -150,26 +122,13 @@ public function extractAdjustmentDataProvider() */ public function testApplyAdjustment($amount, $amountOld, $expectedResult) { - // Instantiate/mock objects - /** @var WeeeHelper|\PHPUnit_Framework_MockObject_MockObject $weeeHelper */ - $weeeHelper = $this->getMockBuilder('Magento\Weee\Helper\Data')->disableOriginalConstructor() - ->setMethods(array('getAmount')) - ->getMock(); - /** @var SaleableInterface|\PHPUnit_Framework_MockObject_MockObject $taxHelper */ - $object = $this->getMockBuilder('Magento\Framework\Pricing\Object\SaleableInterface')->getMock(); - $model = new Adjustment($weeeHelper); - - // Avoid execution of irrelevant functionality - $weeeHelper->expects($this->any()) + $object = $this->getMockForAbstractClass('Magento\Framework\Pricing\Object\SaleableInterface'); + + $this->weeeHelper->expects($this->any()) ->method('getAmount') ->will($this->returnValue($amountOld)); - // Run tested method - $result = $model->applyAdjustment($amount, $object); - - // Check expectations - $this->assertInternalType('float', $result); - $this->assertEquals($expectedResult, $result); + $this->assertEquals($expectedResult, $this->adjustment->applyAdjustment($amount, $object)); } /** @@ -184,20 +143,44 @@ public function applyAdjustmentDataProvider() ]; } - public function testIsExcludedWith() + /** + * @dataProvider isExcludedWithDataProvider + * @param string $adjustmentCode + * @param bool $expectedResult + */ + public function testIsExcludedWith($adjustmentCode, $expectedResult) { - $adjustmentCode = 'some_random_adjustment_code123'; + $this->assertEquals($expectedResult, $this->adjustment->isExcludedWith($adjustmentCode)); + } - // Instantiate/mock objects - /** @var WeeeHelper|\PHPUnit_Framework_MockObject_MockObject $weeeHelper */ - $weeeHelper = $this->getMockBuilder('Magento\Weee\Helper\Data')->disableOriginalConstructor()->getMock(); - $model = new Adjustment($weeeHelper); + public function isExcludedWithDataProvider() + { + return [ + ['weee', true], + ['tax', true], + ['not_tax_and_not_weee', false] + ]; + } - // Run tested method - $result = $model->isExcludedWith($adjustmentCode); + /** + * @dataProvider getSortOrderProvider + * @param bool $isTaxable + * @param int $expectedResult + */ + public function testGetSortOrder($isTaxable, $expectedResult) + { + $this->weeeHelper->expects($this->any()) + ->method('isTaxable') + ->will($this->returnValue($isTaxable)); + + $this->assertEquals($expectedResult, $this->adjustment->getSortOrder()); + } - // Check expectations - $this->assertInternalType('bool', $result); - $this->assertFalse($result); + public function getSortOrderProvider() + { + return [ + [true, $this->sortOrder], + [false, -1] + ]; } } diff --git a/dev/tests/unit/testsuite/Magento/Weee/Pricing/Render/AdjustmentTest.php b/dev/tests/unit/testsuite/Magento/Weee/Pricing/Render/AdjustmentTest.php index 0b75a622ed690..ca5c52ed5b9f9 100644 --- a/dev/tests/unit/testsuite/Magento/Weee/Pricing/Render/AdjustmentTest.php +++ b/dev/tests/unit/testsuite/Magento/Weee/Pricing/Render/AdjustmentTest.php @@ -103,7 +103,7 @@ public function setUp() */ public function testGetAdjustmentCode() { - $this->assertEquals(\Magento\Weee\Pricing\Adjustment::CODE, $this->model->getAdjustmentCode()); + $this->assertEquals(\Magento\Weee\Pricing\Adjustment::ADJUSTMENT_CODE, $this->model->getAdjustmentCode()); } /** diff --git a/dev/tools/Magento/Tools/Dependency/generate/bootstrap.php b/dev/tools/Magento/Tools/Dependency/generate/bootstrap.php index feed42696b77a..88d4e6ed57b5d 100644 --- a/dev/tools/Magento/Tools/Dependency/generate/bootstrap.php +++ b/dev/tools/Magento/Tools/Dependency/generate/bootstrap.php @@ -25,10 +25,6 @@ define('BP', realpath(__DIR__ . '/../../../../../../') . '/'); require_once BP . 'app/autoload.php'; -\Magento\Framework\Autoload\IncludePath::addIncludePath( - array( - BP . 'dev/tests/static/framework', - BP . 'dev/tools', - BP . '/lib' - ) +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath( + array(BP . 'dev/tests/static/framework', BP . 'dev/tools', BP . '/lib') ); diff --git a/dev/tools/Magento/Tools/Di/compiler.php b/dev/tools/Magento/Tools/Di/compiler.php index 00ed524ed74fa..c9e9cfb26c423 100644 --- a/dev/tools/Magento/Tools/Di/compiler.php +++ b/dev/tools/Magento/Tools/Di/compiler.php @@ -49,7 +49,7 @@ $opt->parse(); $generationDir = $opt->getOption('generation') ? $opt->getOption('generation') : $rootDir . '/var/generation'; - \Magento\Framework\Autoload\IncludePath::addIncludePath($generationDir); + (new \Magento\Framework\Autoload\IncludePath())->addIncludePath($generationDir); $diDir = $opt->getOption('di') ? $opt->getOption('di') : $rootDir . '/var/di'; $compiledFile = $diDir . '/definitions.php'; diff --git a/dev/tools/Magento/Tools/Di/entity_generator.php b/dev/tools/Magento/Tools/Di/entity_generator.php index 9e04221f15668..84ab6640ec8fd 100644 --- a/dev/tools/Magento/Tools/Di/entity_generator.php +++ b/dev/tools/Magento/Tools/Di/entity_generator.php @@ -73,7 +73,7 @@ exit($example); } -\Magento\Framework\Autoload\IncludePath::addIncludePath($generationDir); +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath($generationDir); //reinit generator with correct generation path $io = new \Magento\Framework\Code\Generator\Io(new \Magento\Framework\Filesystem\Driver\File(), null, $generationDir); diff --git a/dev/tools/Magento/Tools/Layout/xmlUpdater.php b/dev/tools/Magento/Tools/Layout/xmlUpdater.php index 385577a07dd38..89c4522dd41ca 100644 --- a/dev/tools/Magento/Tools/Layout/xmlUpdater.php +++ b/dev/tools/Magento/Tools/Layout/xmlUpdater.php @@ -26,7 +26,7 @@ require_once $basePath . '/app/autoload.php'; require __DIR__ . '/Formatter.php'; -\Magento\Framework\Autoload\IncludePath::addIncludePath(array($basePath . '/lib')); +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath(array($basePath . '/lib')); try { $opt = new \Zend_Console_Getopt( diff --git a/dev/tools/Magento/Tools/Migration/Acl/db.php b/dev/tools/Magento/Tools/Migration/Acl/db.php index 85f3bdf94039e..abf7626b4b3cd 100644 --- a/dev/tools/Magento/Tools/Migration/Acl/db.php +++ b/dev/tools/Magento/Tools/Migration/Acl/db.php @@ -26,7 +26,7 @@ $rootDir = realpath(__DIR__ . '/../../../..'); require $rootDir . '/app/autoload.php'; -\Magento\Framework\Autoload\IncludePath::addIncludePath(array($rootDir . '/lib', $rootDir . '/dev')); +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath(array($rootDir . '/lib', $rootDir . '/dev')); $defaultReportFile = 'report.log'; try { diff --git a/dev/tools/Magento/Tools/Migration/system_config.php b/dev/tools/Magento/Tools/Migration/system_config.php index 0229cb8465ee1..0a75b4414ad64 100644 --- a/dev/tools/Magento/Tools/Migration/system_config.php +++ b/dev/tools/Magento/Tools/Migration/system_config.php @@ -23,7 +23,6 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - use Magento\Framework\Autoload\IncludePath; use Magento\Tools\Migration\System\Configuration\Formatter; use Magento\Tools\Migration\System\Configuration\Generator; @@ -40,7 +39,7 @@ $rootDir = realpath(__DIR__ . '../../../../../../'); require __DIR__ . '/../../../../../app/autoload.php'; -IncludePath::addIncludePath(array($rootDir . '/lib', $rootDir . '/dev/tools')); +(new IncludePath())->addIncludePath(array($rootDir . '/lib', $rootDir . '/dev')); $defaultReportFile = 'report.log'; try { diff --git a/dev/tools/Magento/Tools/View/generator.php b/dev/tools/Magento/Tools/View/generator.php index 6146d28c124c8..cc7d2193f934f 100644 --- a/dev/tools/Magento/Tools/View/generator.php +++ b/dev/tools/Magento/Tools/View/generator.php @@ -28,7 +28,7 @@ */ require __DIR__ . '/../../../../../app/bootstrap.php'; -\Magento\Framework\Autoload\IncludePath::addIncludePath(__DIR__ . '/../../../'); +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath(__DIR__ . '/../../../'); /** * Command line usage help diff --git a/dev/tools/bootstrap.php b/dev/tools/bootstrap.php index 7dc8a7ab85e48..851c4dd51fd19 100644 --- a/dev/tools/bootstrap.php +++ b/dev/tools/bootstrap.php @@ -23,7 +23,7 @@ */ require_once __DIR__ . '/../../app/autoload.php'; define('BP', __DIR__ . '/../..'); -\Magento\Framework\Autoload\IncludePath::addIncludePath( +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath( array( BP . '/app/code', BP . '/lib', diff --git a/dev/tools/layout/xml-updater.php b/dev/tools/layout/xml-updater.php index d8f78e3b800ec..6179cb4edb690 100644 --- a/dev/tools/layout/xml-updater.php +++ b/dev/tools/layout/xml-updater.php @@ -26,7 +26,7 @@ require_once $basePath . '/app/autoload.php'; require __DIR__ . '/Formatter.php'; -\Magento\Framework\Autoload\IncludePath::addIncludePath(array( +(new \Magento\Framework\Autoload\IncludePath())->addIncludePath(array( $basePath . '/lib', )); diff --git a/lib/Magento/Framework/App/Http.php b/lib/Magento/Framework/App/Http.php index 7b580f0c9b4e5..7048fd52ddfa2 100644 --- a/lib/Magento/Framework/App/Http.php +++ b/lib/Magento/Framework/App/Http.php @@ -144,7 +144,7 @@ public function launch() } } require_once $this->_filesystem->getPath(Filesystem::PUB_DIR) . '/errors/report.php'; - $processor = new \Error_Processor($this->_response); + $processor = new \Magento\Framework\Error\Processor($this->_response); $processor->saveReport($reportData); $this->_response = $processor->processReport(); } diff --git a/lib/Magento/Framework/App/ObjectManagerFactory.php b/lib/Magento/Framework/App/ObjectManagerFactory.php index 7e4db4d5e8539..583e8b40dcadf 100644 --- a/lib/Magento/Framework/App/ObjectManagerFactory.php +++ b/lib/Magento/Framework/App/ObjectManagerFactory.php @@ -73,7 +73,7 @@ public function create($rootDir, array $arguments, $useCompiled = true) ) ? $arguments[Filesystem::PARAM_APP_DIRS] : array(); $directoryList = new DirectoryList($rootDir, $directories); - \Magento\Framework\Autoload\IncludePath::addIncludePath( + (new \Magento\Framework\Autoload\IncludePath())->addIncludePath( array($directoryList->getDir(Filesystem::GENERATION_DIR)) ); diff --git a/lib/Magento/Framework/AppInterface.php b/lib/Magento/Framework/AppInterface.php index 27d31ec50a9c8..aa8866c27a151 100644 --- a/lib/Magento/Framework/AppInterface.php +++ b/lib/Magento/Framework/AppInterface.php @@ -35,7 +35,7 @@ interface AppInterface /** * Magento version */ - const VERSION = '2.0.0.0-dev75'; + const VERSION = '2.0.0.0-dev76'; /** * Launch application diff --git a/lib/Magento/Framework/Autoload/IncludePath.php b/lib/Magento/Framework/Autoload/IncludePath.php index 2fe513e6cafb1..9c01fcad1a052 100644 --- a/lib/Magento/Framework/Autoload/IncludePath.php +++ b/lib/Magento/Framework/Autoload/IncludePath.php @@ -38,9 +38,9 @@ class IncludePath * @param string $class * @return string|bool */ - public static function getFile($class) + public function getFile($class) { - $relativePath = self::getFilePath($class); + $relativePath = $this->getFilePath($class); return stream_resolve_include_path($relativePath); } @@ -51,7 +51,7 @@ public static function getFile($class) * @param string $class * @return string */ - public static function getFilePath($class) + public function getFilePath($class) { if (strpos($class, self::NS_SEPARATOR) !== false) { $class = ltrim(str_replace(self::NS_SEPARATOR, '_', $class), '_'); @@ -66,7 +66,7 @@ public static function getFilePath($class) * @param bool $prepend Whether to prepend paths or to append them * @return void */ - public static function addIncludePath($path, $prepend = true) + public function addIncludePath($path, $prepend = true) { $includePathExtra = implode(PATH_SEPARATOR, (array)$path); $includePath = get_include_path(); @@ -85,9 +85,9 @@ public static function addIncludePath($path, $prepend = true) * @param string $class * @return void */ - public static function load($class) + public function load($class) { - $file = self::getFile($class); + $file = $this->getFile($class); if ($file) { include $file; } diff --git a/lib/Magento/Framework/Code/Generator.php b/lib/Magento/Framework/Code/Generator.php index 9f0804de25ecf..058a23f7ed914 100644 --- a/lib/Magento/Framework/Code/Generator.php +++ b/lib/Magento/Framework/Code/Generator.php @@ -107,7 +107,7 @@ public function generateClass($className) // check if file already exists $autoloader = $this->_autoloader; - if ($autoloader::getFile($className)) { + if ($autoloader->getFile($className)) { return self::GENERATION_SKIP; } diff --git a/lib/Magento/Framework/Code/Generator/Autoloader.php b/lib/Magento/Framework/Code/Generator/Autoloader.php index e8701863f41d3..c98b83ac674f0 100644 --- a/lib/Magento/Framework/Code/Generator/Autoloader.php +++ b/lib/Magento/Framework/Code/Generator/Autoloader.php @@ -48,7 +48,7 @@ public function load($className) { if (!class_exists($className)) { if (\Magento\Framework\Code\Generator::GENERATION_SUCCESS === $this->_generator->generateClass($className)) { - \Magento\Framework\Autoload\IncludePath::load($className); + (new \Magento\Framework\Autoload\IncludePath())->load($className); } } } diff --git a/lib/Magento/Framework/Code/Generator/EntityAbstract.php b/lib/Magento/Framework/Code/Generator/EntityAbstract.php index c57eb698c7f2f..6f1cb6c1f62f8 100644 --- a/lib/Magento/Framework/Code/Generator/EntityAbstract.php +++ b/lib/Magento/Framework/Code/Generator/EntityAbstract.php @@ -288,13 +288,13 @@ protected function _validateData() $filePath = stream_resolve_include_path(str_replace('_', '/', $controllerPath) . '.php'); $isSourceClassValid = !empty($filePath); } else { - $isSourceClassValid = $autoloader::getFile($sourceClassName); + $isSourceClassValid = $autoloader->getFile($sourceClassName); } if (!$isSourceClassValid) { $this->_addError('Source class ' . $sourceClassName . ' doesn\'t exist.'); return false; - } elseif ($autoloader::getFile($resultClassName)) { + } elseif ($autoloader->getFile($resultClassName)) { $this->_addError('Result class ' . $resultClassName . ' already exists.'); return false; } elseif (!$this->_ioObject->makeGenerationDirectory()) { diff --git a/lib/Magento/Framework/Code/Generator/Io.php b/lib/Magento/Framework/Code/Generator/Io.php index 57ff61a71d0da..5f4e0c85fe39a 100644 --- a/lib/Magento/Framework/Code/Generator/Io.php +++ b/lib/Magento/Framework/Code/Generator/Io.php @@ -107,7 +107,7 @@ public function getResultFileDirectory($className) public function getResultFileName($className) { $autoloader = $this->_autoloader; - $resultFileName = $autoloader::getFilePath($className); + $resultFileName = $autoloader->getFilePath($className); return $this->_generationDirectory . $resultFileName; } diff --git a/lib/Magento/Framework/Data/Form/Element/Label.php b/lib/Magento/Framework/Data/Form/Element/Label.php index 94fda10b579c5..5308d0b3d1c2e 100644 --- a/lib/Magento/Framework/Data/Form/Element/Label.php +++ b/lib/Magento/Framework/Data/Form/Element/Label.php @@ -59,8 +59,7 @@ public function __construct( public function getElementHtml() { $html = $this->getBold() ? '
' : '
'; - $html .= $this->getEscapedValue(); - $html .= $this->getBold() ? '
' : '
'; + $html .= $this->getEscapedValue() . '
'; $html .= $this->getAfterElementHtml(); return $html; } diff --git a/lib/Magento/Framework/Data/Form/Element/Note.php b/lib/Magento/Framework/Data/Form/Element/Note.php index 91667b72ea96e..e4d7448632dd3 100644 --- a/lib/Magento/Framework/Data/Form/Element/Note.php +++ b/lib/Magento/Framework/Data/Form/Element/Note.php @@ -58,8 +58,13 @@ public function __construct( */ public function getElementHtml() { - $html = '
' . $this->getText() . '
'; - $html .= $this->getAfterElementHtml(); + $html = $this->getBeforeElementHtml() + . '
' + . $this->getText() + . '
' + . $this->getAfterElementHtml(); return $html; } } diff --git a/lib/Magento/Framework/Filesystem/File/ReadFactory.php b/lib/Magento/Framework/Filesystem/File/ReadFactory.php index 83860377a334d..c3cef19a6cfdd 100644 --- a/lib/Magento/Framework/Filesystem/File/ReadFactory.php +++ b/lib/Magento/Framework/Filesystem/File/ReadFactory.php @@ -50,7 +50,8 @@ public function __construct(\Magento\Framework\Filesystem\DriverFactory $driverF */ public function create($path, $protocol = null, DriverInterface $driver = null) { - $driver = $protocol ? $this->driverFactory->get($protocol, get_class($driver)) : $driver; + $driverClassName = is_null($driver) ? null : get_class($driver); + $driver = $protocol ? $this->driverFactory->get($protocol, $driverClassName) : $driver; return new \Magento\Framework\Filesystem\File\Read($path, $driver); } } diff --git a/lib/Magento/Framework/Less/File/Source/Base.php b/lib/Magento/Framework/Less/File/Source/Base.php index 42b50514f7227..2f03cd47f09f5 100644 --- a/lib/Magento/Framework/Less/File/Source/Base.php +++ b/lib/Magento/Framework/Less/File/Source/Base.php @@ -79,7 +79,7 @@ public function getFiles(ThemeInterface $theme, $filePath = '*') continue; } $moduleFull = "{$matches['namespace']}_{$matches['module']}"; - $result[] = $this->fileFactory->create($filename, $moduleFull, $theme); + $result[] = $this->fileFactory->create($filename, $moduleFull); } return $result; } diff --git a/lib/Magento/Framework/Less/File/Source/Theme.php b/lib/Magento/Framework/Less/File/Source/Theme.php index bf2f648195a9d..8f76b7c0fc0a3 100644 --- a/lib/Magento/Framework/Less/File/Source/Theme.php +++ b/lib/Magento/Framework/Less/File/Source/Theme.php @@ -75,7 +75,7 @@ public function getFiles(ThemeInterface $theme, $filePath = '*') if (!preg_match($pattern, $filename, $matches)) { continue; } - $result[] = $this->fileFactory->create($filename, $matches['moduleName'], $theme); + $result[] = $this->fileFactory->create($filename, $matches['moduleName']); } return $result; diff --git a/lib/Magento/Framework/Pricing/Adjustment/AdjustmentInterface.php b/lib/Magento/Framework/Pricing/Adjustment/AdjustmentInterface.php index a5398106eb74a..456c5ba99bfae 100644 --- a/lib/Magento/Framework/Pricing/Adjustment/AdjustmentInterface.php +++ b/lib/Magento/Framework/Pricing/Adjustment/AdjustmentInterface.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/lib/Magento/Framework/Pricing/Adjustment/Calculator.php b/lib/Magento/Framework/Pricing/Adjustment/Calculator.php index ae19f54451471..3c71b2e50f30e 100644 --- a/lib/Magento/Framework/Pricing/Adjustment/Calculator.php +++ b/lib/Magento/Framework/Pricing/Adjustment/Calculator.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -46,6 +48,9 @@ public function __construct(AmountFactory $amountFactory) } /** + * Retrieve Amount object based on given float amount, product and exclude option. + * It is possible to pass "true" or adjustment code to exclude all or specific adjustment from an amount. + * * @param float|string $amount * @param SaleableInterface $saleableItem * @param null|bool|string $exclude diff --git a/lib/Magento/Framework/Pricing/Adjustment/CalculatorInterface.php b/lib/Magento/Framework/Pricing/Adjustment/CalculatorInterface.php index c7dca4ea6afa8..1ce2dee55f85e 100644 --- a/lib/Magento/Framework/Pricing/Adjustment/CalculatorInterface.php +++ b/lib/Magento/Framework/Pricing/Adjustment/CalculatorInterface.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/lib/Magento/Framework/Pricing/Adjustment/Collection.php b/lib/Magento/Framework/Pricing/Adjustment/Collection.php index 7c0f33fdadbb0..7bc6a43b27e1b 100644 --- a/lib/Magento/Framework/Pricing/Adjustment/Collection.php +++ b/lib/Magento/Framework/Pricing/Adjustment/Collection.php @@ -18,14 +18,14 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\Framework\Pricing\Adjustment; -use Magento\Framework\Pricing\Adjustment\AdjustmentInterface; - /** * Adjustment collection model */ diff --git a/lib/Magento/Framework/Pricing/Adjustment/Factory.php b/lib/Magento/Framework/Pricing/Adjustment/Factory.php index 107a8d7f8b57b..8192001c7d411 100644 --- a/lib/Magento/Framework/Pricing/Adjustment/Factory.php +++ b/lib/Magento/Framework/Pricing/Adjustment/Factory.php @@ -56,12 +56,12 @@ public function __construct(\Magento\Framework\ObjectManager $objectManager) */ public function create($className, array $arguments = []) { - $price = $this->objectManager->create($className, $arguments); - if (!$price instanceof AdjustmentInterface) { + $adjustment = $this->objectManager->create($className, $arguments); + if (!$adjustment instanceof AdjustmentInterface) { throw new \InvalidArgumentException( $className . ' doesn\'t implement \Magento\Framework\Pricing\Adjustment\AdjustmentInterface' ); } - return $price; + return $adjustment; } } diff --git a/lib/Magento/Framework/Pricing/Adjustment/Pool.php b/lib/Magento/Framework/Pricing/Adjustment/Pool.php index dd6a7733b44ac..64d94aa307ebd 100644 --- a/lib/Magento/Framework/Pricing/Adjustment/Pool.php +++ b/lib/Magento/Framework/Pricing/Adjustment/Pool.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/lib/Magento/Framework/Pricing/Amount/AmountInterface.php b/lib/Magento/Framework/Pricing/Amount/AmountInterface.php index d8140403a2a13..c84698ac19d65 100644 --- a/lib/Magento/Framework/Pricing/Amount/AmountInterface.php +++ b/lib/Magento/Framework/Pricing/Amount/AmountInterface.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/lib/Magento/Framework/Pricing/Amount/Base.php b/lib/Magento/Framework/Pricing/Amount/Base.php index 02876f2c2b8ba..1b3b2f0bcfddc 100644 --- a/lib/Magento/Framework/Pricing/Amount/Base.php +++ b/lib/Magento/Framework/Pricing/Amount/Base.php @@ -173,11 +173,9 @@ protected function calculateAmounts() { $this->baseAmount = $this->amount; $this->totalAdjustmentAmount = 0.; - if ($this->adjustmentAmounts) { - foreach ($this->adjustmentAmounts as $amount) { - $this->baseAmount -= $amount; - $this->totalAdjustmentAmount += $amount; - } + foreach ($this->adjustmentAmounts as $amount) { + $this->baseAmount -= $amount; + $this->totalAdjustmentAmount += $amount; } } } diff --git a/lib/Magento/Framework/Pricing/Object/SaleableInterface.php b/lib/Magento/Framework/Pricing/Object/SaleableInterface.php index ab93e715a4c2f..5e9a6ac8fe36d 100644 --- a/lib/Magento/Framework/Pricing/Object/SaleableInterface.php +++ b/lib/Magento/Framework/Pricing/Object/SaleableInterface.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -25,28 +27,35 @@ namespace Magento\Framework\Pricing\Object; /** - * //@TODO Templates invoke methods that are not defined in the interface: - * getProductUrl(): - * /app\code\Magento\Catalog\view\frontend\product\price\final_price.phtml - * /app\code\Magento\Catalog\view\frontend\product\price\msrp_item.phtml - * - * getId() - /app\code\Magento\Catalog\view\frontend\product\price\final_price.phtml - * getMsrp() - /app\code\Magento\Catalog\view\frontend\product\price\msrp_item.phtml + * Interface SaleableInterface */ interface SaleableInterface { /** + * Returns PriceInfo container of saleable item + * * @return \Magento\Framework\Pricing\PriceInfoInterface */ public function getPriceInfo(); /** + * Returns type identifier of saleable item + * * @return string */ public function getTypeId(); /** + * Returns identifier of saleable item + * * @return int */ public function getId(); + + /** + * Returns quantity of saleable item + * + * @return float + */ + public function getQty(); } diff --git a/lib/Magento/Framework/Pricing/Price/AbstractPrice.php b/lib/Magento/Framework/Pricing/Price/AbstractPrice.php new file mode 100644 index 0000000000000..d00f8f38eb21b --- /dev/null +++ b/lib/Magento/Framework/Pricing/Price/AbstractPrice.php @@ -0,0 +1,134 @@ +product = $saleableItem; + $this->quantity = $quantity; + $this->calculator = $calculator; + $this->priceInfo = $saleableItem->getPriceInfo(); + } + + /** + * Get price value + * + * @return float|bool + */ + abstract public function getValue(); + + /** + * Get Price Amount object + * + * @return AmountInterface + */ + public function getAmount() + { + if (null === $this->amount) { + $this->amount = $this->calculator->getAmount($this->getValue(), $this->product); + } + return $this->amount; + } + + /** + * @param float $amount + * @param null|bool|string $exclude + * @return AmountInterface|bool|float + */ + public function getCustomAmount($amount = null, $exclude = null) + { + $amount = (null === $amount) ? $this->getValue() : $amount; + return $this->calculator->getAmount($amount, $this->product, $exclude); + } + + /** + * Get price type code + * + * @return string + */ + public function getPriceCode() + { + return static::PRICE_CODE; + } +} diff --git a/lib/Magento/Framework/Pricing/Price/BasePriceProviderInterface.php b/lib/Magento/Framework/Pricing/Price/BasePriceProviderInterface.php new file mode 100644 index 0000000000000..00634ae0f4840 --- /dev/null +++ b/lib/Magento/Framework/Pricing/Price/BasePriceProviderInterface.php @@ -0,0 +1,35 @@ +saleableItem = $saleableItem; + $this->priceFactory = $priceFactory; + $this->pool = $pool; + $this->quantity = $quantity; + } + + /** + * Reset the Collection to the first element + * + * @return mixed|void + */ + public function rewind() + { + return $this->pool->rewind(); + } + + /** + * Return the current element + * + * @return \Magento\Framework\Pricing\Price\PriceInterface + */ + public function current() + { + return $this->get($this->key()); + } + + /** + * Return the key of the current element + * + * @return string + */ + public function key() + { + return $this->pool->key(); + } + + /** + * Move forward to next element + * + * @return mixed|void + */ + public function next() + { + return $this->pool->next(); + } + + /** + * Checks if current position is valid + * + * @return bool + */ + public function valid() + { + return $this->pool->valid(); + } + + /** + * Returns price model by code + * + * @param string $code + * @return PriceInterface + */ + public function get($code) + { + return $this->priceFactory->create( + $this->saleableItem, + $this->pool[$code], + $this->quantity + ); + } +} diff --git a/lib/Magento/Framework/Pricing/Price/Factory.php b/lib/Magento/Framework/Pricing/Price/Factory.php index 0fb0056269c4d..22897b2d173da 100644 --- a/lib/Magento/Framework/Pricing/Price/Factory.php +++ b/lib/Magento/Framework/Pricing/Price/Factory.php @@ -51,16 +51,16 @@ public function __construct(\Magento\Framework\ObjectManager $objectManager) /** * Create Price object for particular product * - * @param SaleableInterface $salableItem + * @param SaleableInterface $saleableItem * @param string $className * @param float $quantity * @param array $arguments * @throws \InvalidArgumentException * @return \Magento\Framework\Pricing\Price\PriceInterface */ - public function create(SaleableInterface $salableItem, $className, $quantity, array $arguments = []) + public function create(SaleableInterface $saleableItem, $className, $quantity, array $arguments = []) { - $arguments['salableItem'] = $salableItem; + $arguments['saleableItem'] = $saleableItem; $arguments['quantity'] = $quantity; $price = $this->objectManager->create($className, $arguments); if (!$price instanceof PriceInterface) { diff --git a/lib/Magento/Framework/Pricing/Price/Pool.php b/lib/Magento/Framework/Pricing/Price/Pool.php new file mode 100644 index 0000000000000..c42c39a3873fa --- /dev/null +++ b/lib/Magento/Framework/Pricing/Price/Pool.php @@ -0,0 +1,162 @@ +prices = $prices; + foreach ($target ?: [] as $code => $class) { + if (empty($this->prices[$code])) { + $this->prices[$code] = $class; + } + } + } + + /** + * Reset the Collection to the first element + * + * @return mixed + */ + public function rewind() + { + return reset($this->prices); + } + + /** + * Return the current element + * + * @return mixed + */ + public function current() + { + return current($this->prices); + } + + /** + * Return the key of the current element + * + * @return string + */ + public function key() + { + return key($this->prices); + } + + /** + * Move forward to next element + * + * @return mixed + */ + public function next() + { + return next($this->prices); + } + + /** + * Checks if current position is valid + * + * @return bool + */ + public function valid() + { + return (bool)$this->key(); + } + + /** + * Returns price class by code + * + * @param string $code + * @return string + */ + public function get($code) + { + return $this->prices[$code]; + } + + /** + * The value to set. + * + * @param string $offset + * @param string $value + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->prices[] = $value; + } else { + $this->prices[$offset] = $value; + } + } + + /** + * The return value will be casted to boolean if non-boolean was returned. + * + * @param string $offset + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->prices[$offset]); + } + + /** + * The offset to unset. + * + * @param string $offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->prices[$offset]); + } + + /** + * The offset to retrieve. + * + * @param string $offset + * @return string + */ + public function offsetGet($offset) + { + return isset($this->prices[$offset]) ? $this->prices[$offset] : null; + } +} diff --git a/lib/Magento/Framework/Pricing/Price/PriceInterface.php b/lib/Magento/Framework/Pricing/Price/PriceInterface.php index f38b6973ae54c..066d65fd877a8 100644 --- a/lib/Magento/Framework/Pricing/Price/PriceInterface.php +++ b/lib/Magento/Framework/Pricing/Price/PriceInterface.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -36,7 +38,7 @@ interface PriceInterface * * @return string */ - public function getPriceType(); + public function getPriceCode(); /** * Get price value diff --git a/lib/Magento/Framework/Pricing/PriceComposite.php b/lib/Magento/Framework/Pricing/PriceComposite.php deleted file mode 100644 index e9a9f9b771e03..0000000000000 --- a/lib/Magento/Framework/Pricing/PriceComposite.php +++ /dev/null @@ -1,89 +0,0 @@ -priceFactory = $priceFactory; - $this->metadata = $metadata; - } - - /** - * @return array - */ - public function getPriceCodes() - { - return array_keys($this->metadata); - } - - /** - * Returns metadata for prices - * - * @return array - */ - public function getMetadata() - { - return $this->metadata; - } - - /** - * @param SaleableInterface $salableItem - * @param string $priceCode - * @param float $quantity - * @return PriceInterface - * @throws \InvalidArgumentException - */ - public function createPriceObject(SaleableInterface $salableItem, $priceCode, $quantity) - { - if (!isset($this->metadata[$priceCode])) { - throw new \InvalidArgumentException($priceCode . ' is not registered in prices list'); - } - $className = $this->metadata[$priceCode]['class']; - return $this->priceFactory->create($salableItem, $className, $quantity); - } -} diff --git a/lib/Magento/Framework/Pricing/PriceCurrencyInterface.php b/lib/Magento/Framework/Pricing/PriceCurrencyInterface.php index 621bc80d65da2..91a446753b3c7 100644 --- a/lib/Magento/Framework/Pricing/PriceCurrencyInterface.php +++ b/lib/Magento/Framework/Pricing/PriceCurrencyInterface.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/lib/Magento/Framework/Pricing/PriceInfo/Base.php b/lib/Magento/Framework/Pricing/PriceInfo/Base.php index 00e4645b03a94..18751c3f38923 100644 --- a/lib/Magento/Framework/Pricing/PriceInfo/Base.php +++ b/lib/Magento/Framework/Pricing/PriceInfo/Base.php @@ -24,33 +24,23 @@ namespace Magento\Framework\Pricing\PriceInfo; -use Magento\Framework\Pricing\Amount\AmountFactory; use Magento\Framework\Pricing\PriceInfoInterface; -use Magento\Framework\Pricing\PriceComposite; use Magento\Framework\Pricing\Price\PriceInterface; use Magento\Framework\Pricing\Adjustment\Collection; use Magento\Framework\Pricing\Adjustment\AdjustmentInterface; -use Magento\Framework\Pricing\Object\SaleableInterface; +use Magento\Framework\Pricing\Price\Collection as PriceCollection; /** + * Class Base * Price info base model + * @package Magento\Framework\Pricing\PriceInfo */ class Base implements PriceInfoInterface { /** - * @var SaleableInterface + * @var PriceCollection */ - protected $saleableItem; - - /** - * @var PriceComposite - */ - protected $prices; - - /** - * @var PriceInterface[] - */ - protected $priceInstances; + protected $priceCollection; /** * @var Collection @@ -58,85 +48,36 @@ class Base implements PriceInfoInterface protected $adjustmentCollection; /** - * @var float - */ - protected $quantity; - - /** - * @var AmountFactory - */ - protected $amountFactory; - - /** - * @param SaleableInterface $saleableItem - * @param PriceComposite $prices + * @param PriceCollection $prices * @param Collection $adjustmentCollection - * @param AmountFactory $amountFactory - * @param float $quantity */ public function __construct( - SaleableInterface $saleableItem, - PriceComposite $prices, - Collection $adjustmentCollection, - AmountFactory $amountFactory, - $quantity = self::PRODUCT_QUANTITY_DEFAULT + PriceCollection $prices, + Collection $adjustmentCollection ) { - $this->saleableItem = $saleableItem; - $this->prices = $prices; $this->adjustmentCollection = $adjustmentCollection; - $this->amountFactory = $amountFactory; - $this->quantity = $quantity; + $this->priceCollection = $prices; } /** - * @return PriceInterface[] + * Returns array of prices + * + * @return PriceCollection */ public function getPrices() { - // check if all prices initialized - $this->initPrices(); - return $this->priceInstances; + return $this->priceCollection; } /** - * Init price types + * Returns price by code * - * @return $this - */ - protected function initPrices() - { - $prices = $this->prices->getPriceCodes(); - foreach ($prices as $code) { - if (!isset($this->priceInstances[$code])) { - $this->priceInstances[$code] = $this->prices->createPriceObject( - $this->saleableItem, - $code, - $this->quantity - ); - } - } - return $this; - } - - /** * @param string $priceCode - * @param float|null $quantity * @return PriceInterface */ - public function getPrice($priceCode, $quantity = null) + public function getPrice($priceCode) { - if (!isset($this->priceInstances[$priceCode]) && $quantity === null) { - $this->priceInstances[$priceCode] = $this->prices->createPriceObject( - $this->saleableItem, - $priceCode, - $this->quantity - ); - return $this->priceInstances[$priceCode]; - } elseif (isset($this->priceInstances[$priceCode]) && $quantity === null) { - return $this->priceInstances[$priceCode]; - } else { - return $this->prices->createPriceObject($this->saleableItem, $priceCode, $quantity); - } + return $this->priceCollection->get($priceCode); } /** @@ -160,23 +101,4 @@ public function getAdjustment($adjustmentCode) { return $this->adjustmentCollection->getItemByCode($adjustmentCode); } - - /** - * Returns prices included in base price - * - * @return array - */ - public function getPricesIncludedInBase() - { - $prices = []; - foreach ($this->prices->getMetadata() as $code => $price) { - if (isset($price['include_in_base_price']) && $price['include_in_base_price']) { - $priceModel = $this->getPrice($code, $this->quantity); - if ($priceModel->getValue() !== false) { - $prices[] = $priceModel; - } - } - } - return $prices; - } } diff --git a/lib/Magento/Framework/Pricing/PriceInfo/Factory.php b/lib/Magento/Framework/Pricing/PriceInfo/Factory.php index 09ad85628bd75..753af9fb19a3b 100644 --- a/lib/Magento/Framework/Pricing/PriceInfo/Factory.php +++ b/lib/Magento/Framework/Pricing/PriceInfo/Factory.php @@ -27,6 +27,7 @@ */ namespace Magento\Framework\Pricing\PriceInfo; +use Magento\Framework\ObjectManager; use Magento\Framework\Pricing\Object\SaleableInterface; /** @@ -34,11 +35,6 @@ */ class Factory { - /** - * Default Price Info class - */ - const DEFAULT_PRICE_INFO_CLASS = 'Magento\Framework\Pricing\PriceInfoInterface'; - /** * List of Price Info classes by product types * @@ -49,7 +45,7 @@ class Factory /** * Object Manager * - * @var \Magento\Framework\ObjectManager + * @var ObjectManager */ protected $objectManager; @@ -59,8 +55,10 @@ class Factory * @param array $types * @param \Magento\Framework\ObjectManager $objectManager */ - public function __construct(array $types, \Magento\Framework\ObjectManager $objectManager) - { + public function __construct( + array $types, + ObjectManager $objectManager + ) { $this->types = $types; $this->objectManager = $objectManager; } @@ -76,19 +74,33 @@ public function __construct(array $types, \Magento\Framework\ObjectManager $obje public function create(SaleableInterface $saleableItem, array $arguments = []) { $type = $saleableItem->getTypeId(); - $className = isset($this->types[$type]) ? $this->types[$type] : self::DEFAULT_PRICE_INFO_CLASS; - $arguments['saleableItem'] = $saleableItem; - if ($saleableItem->getQty()) { - $arguments['quantity'] = $saleableItem->getQty(); + if (isset($this->types[$type]['infoClass'])) { + $priceInfo = $this->types[$type]['infoClass']; + } else { + $priceInfo = $this->types['default']['infoClass']; } - $priceInfo = $this->objectManager->create($className, $arguments); - if (!$priceInfo instanceof \Magento\Framework\Pricing\PriceInfoInterface) { - throw new \InvalidArgumentException( - $className . ' doesn\'t implement \Magento\Framework\Pricing\PriceInfoInterface' - ); + if (isset($this->types[$type]['prices'])) { + $priceCollection = $this->types[$type]['prices']; + } else { + $priceCollection = $this->types['default']['prices']; } - return $priceInfo; + + $arguments['saleableItem'] = $saleableItem; + $quantity = $saleableItem->getQty(); + if ($quantity) { + $arguments['quantity'] = $quantity; + } + + $arguments['prices'] = $this->objectManager->create( + $priceCollection, + [ + 'saleableItem' => $arguments['saleableItem'], + 'quantity' => $quantity + ] + ); + + return $this->objectManager->create($priceInfo, $arguments); } } diff --git a/lib/Magento/Framework/Pricing/PriceInfoInterface.php b/lib/Magento/Framework/Pricing/PriceInfoInterface.php index 7f29615106ad3..247b0cd9e7dfd 100644 --- a/lib/Magento/Framework/Pricing/PriceInfoInterface.php +++ b/lib/Magento/Framework/Pricing/PriceInfoInterface.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -38,30 +40,32 @@ interface PriceInfoInterface const PRODUCT_QUANTITY_DEFAULT = 1.; /** + * Returns array of prices + * * @return PriceInterface[] */ public function getPrices(); /** + * Returns price by code + * * @param string $priceCode - * @param float|null $quantity * @return PriceInterface */ - public function getPrice($priceCode, $quantity = null); + public function getPrice($priceCode); /** + * Get all registered adjustments + * * @return AdjustmentInterface[] */ public function getAdjustments(); /** + * Get adjustment by code + * * @param string $adjustmentCode * @return AdjustmentInterface */ public function getAdjustment($adjustmentCode); - - /** - * @return PriceInterface[] - */ - public function getPricesIncludedInBase(); } diff --git a/lib/Magento/Framework/Pricing/Render.php b/lib/Magento/Framework/Pricing/Render.php index 03f9efb022bfd..dbd6f5048b4ff 100644 --- a/lib/Magento/Framework/Pricing/Render.php +++ b/lib/Magento/Framework/Pricing/Render.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -113,14 +115,7 @@ public function render($priceCode, SaleableInterface $saleableItem, array $argum // obtain concrete Price Render $priceRender = $rendererPool->createPriceRender($priceCode, $saleableItem, $useArguments); - if ($priceRender) { - //@TODO PriceBoxRenderInterface does not contain toHtml() method - $result = $priceRender->toHtml(); - } else { - $result = ''; - } - // return rendered output - return $result; + return $priceRender->toHtml(); } /** @@ -149,12 +144,6 @@ public function renderAmount( // obtain concrete Amount Render $amountRender = $rendererPool->createAmountRender($amount, $saleableItem, $price, $useArguments); - if ($amountRender) { - $result = $amountRender->toHtml(); - } else { - $result = ''; - } - // return rendered output - return $result; + return $amountRender->toHtml(); } } diff --git a/lib/Magento/Framework/Pricing/Render/AbstractAdjustment.php b/lib/Magento/Framework/Pricing/Render/AbstractAdjustment.php index 6da9aeb97f030..3fe9d92e2c966 100644 --- a/lib/Magento/Framework/Pricing/Render/AbstractAdjustment.php +++ b/lib/Magento/Framework/Pricing/Render/AbstractAdjustment.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -63,7 +65,7 @@ public function __construct( /** * @param AmountRenderInterface $amountRender * @param array $arguments - * @return void + * @return string */ public function render(AmountRenderInterface $amountRender, array $arguments = []) { @@ -136,7 +138,7 @@ public function getAdjustment() } /** - * @return void + * @return string */ abstract protected function apply(); } diff --git a/lib/Magento/Framework/Pricing/Render/AdjustmentRenderInterface.php b/lib/Magento/Framework/Pricing/Render/AdjustmentRenderInterface.php index 24a38d99cd0d0..b263114a9614c 100644 --- a/lib/Magento/Framework/Pricing/Render/AdjustmentRenderInterface.php +++ b/lib/Magento/Framework/Pricing/Render/AdjustmentRenderInterface.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/lib/Magento/Framework/Pricing/Render/Amount.php b/lib/Magento/Framework/Pricing/Render/Amount.php index fd8e5d68b8402..0c48a14202478 100644 --- a/lib/Magento/Framework/Pricing/Render/Amount.php +++ b/lib/Magento/Framework/Pricing/Render/Amount.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -67,7 +69,7 @@ class Amount extends Template implements AmountRenderInterface protected $rendererPool; /** - * @var float + * @var AmountInterface */ protected $amount; @@ -152,16 +154,6 @@ public function getPrice() return $this->price; } - /** - * @param string $code - * @param string $html - * @return void - */ - public function addAdjustmentHtml($code, $html) - { - $this->adjustmentsHtml[$code] = $html; - } - /** * @return bool */ @@ -183,10 +175,9 @@ public function getAdjustmentsHtml() */ protected function _toHtml() { - // apply Price Adjustment Renders if available $adjustmentRenders = $this->getApplicableAdjustmentRenders(); if ($adjustmentRenders) { - $this->applyAdjustments($adjustmentRenders); + $this->adjustmentsHtml = $this->getAdjustments($adjustmentRenders); } $html = parent::_toHtml(); return $html; @@ -199,11 +190,7 @@ protected function _toHtml() */ protected function getApplicableAdjustmentRenders() { - if (!$this->hasSkipAdjustments()) { - return $this->getAdjustmentRenders(); - } else { - return []; - } + return (!$this->hasSkipAdjustments()) ? $this->getAdjustmentRenders() : []; } /** @@ -216,15 +203,20 @@ protected function getAdjustmentRenders() /** * @param AdjustmentRenderInterface[] $adjustmentRenders - * @return void + * @return array */ - protected function applyAdjustments($adjustmentRenders) + protected function getAdjustments($adjustmentRenders) { $this->setAdjustmentCssClasses($adjustmentRenders); $data = $this->getData(); + $adjustments = []; foreach ($adjustmentRenders as $adjustmentRender) { - $adjustmentRender->render($this, $data); + $html = $adjustmentRender->render($this, $data); + if (trim($html)) { + $adjustments[$adjustmentRender->getAdjustmentCode()] = $html; + } } + return $adjustments; } /** diff --git a/lib/Magento/Framework/Pricing/Render/AmountRenderInterface.php b/lib/Magento/Framework/Pricing/Render/AmountRenderInterface.php index 1bbf8a69bbdbc..87e60dc7a0ef1 100644 --- a/lib/Magento/Framework/Pricing/Render/AmountRenderInterface.php +++ b/lib/Magento/Framework/Pricing/Render/AmountRenderInterface.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -63,13 +65,6 @@ public function getSaleableItem(); */ public function getPrice(); - /** - * @param string $code - * @param string $html - * @return void - */ - public function addAdjustmentHtml($code, $html); - /** * @return string */ diff --git a/lib/Magento/Framework/Pricing/Render/Layout.php b/lib/Magento/Framework/Pricing/Render/Layout.php index 5c8b9662ce65e..08e0d2a988fcd 100644 --- a/lib/Magento/Framework/Pricing/Render/Layout.php +++ b/lib/Magento/Framework/Pricing/Render/Layout.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/lib/Magento/Framework/Pricing/Render/PriceBox.php b/lib/Magento/Framework/Pricing/Render/PriceBox.php index a7752d0fb850c..f068656ba3c9a 100644 --- a/lib/Magento/Framework/Pricing/Render/PriceBox.php +++ b/lib/Magento/Framework/Pricing/Render/PriceBox.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -78,7 +80,7 @@ public function __construct( protected function _toHtml() { $cssClasses = $this->hasData('css_classes') ? explode(' ', $this->getData('css_classes')) : []; - $cssClasses[] = 'price-' . $this->getPrice()->getPriceType(); + $cssClasses[] = 'price-' . $this->getPrice()->getPriceCode(); $this->setData('css_classes', implode(' ', $cssClasses)); return parent::_toHtml(); } @@ -88,7 +90,6 @@ protected function _toHtml() */ public function getSaleableItem() { - // @todo move to abstract pricing block return $this->saleableItem; } @@ -97,7 +98,6 @@ public function getSaleableItem() */ public function getPrice() { - // @todo move to abstract pricing block return $this->price; } @@ -114,16 +114,8 @@ public function getPriceId($defaultPrefix = null, $defaultSuffix = null) return $this->getData('price_id'); } $priceId = $this->saleableItem->getId(); - if ($this->hasData('price_id_prefix')) { - $prefix = $this->getData('price_id_prefix') . $priceId; - } else { - $prefix = $defaultPrefix; - } - if ($this->hasData('price_id_suffix')) { - $suffix = $this->getData('price_id_suffix'); - } else { - $suffix = $defaultSuffix; - } + $prefix = $this->hasData('price_id_prefix') ? $this->getData('price_id_prefix') : $defaultPrefix; + $suffix = $this->hasData('price_id_suffix') ? $this->getData('price_id_suffix') : $defaultSuffix; $priceId = $prefix . $priceId . $suffix; return $priceId; } @@ -132,12 +124,11 @@ public function getPriceId($defaultPrefix = null, $defaultSuffix = null) * Retrieve price object of given type and quantity * * @param string $priceCode - * @param float|null $quantity * @return PriceInterface */ - public function getPriceType($priceCode, $quantity = null) + public function getPriceType($priceCode) { - return $this->saleableItem->getPriceInfo()->getPrice($priceCode, $quantity); + return $this->saleableItem->getPriceInfo()->getPrice($priceCode); } /** diff --git a/lib/Magento/Framework/Pricing/Render/PriceBoxRenderInterface.php b/lib/Magento/Framework/Pricing/Render/PriceBoxRenderInterface.php index 9948e1672551b..0a5c98d87ec32 100644 --- a/lib/Magento/Framework/Pricing/Render/PriceBoxRenderInterface.php +++ b/lib/Magento/Framework/Pricing/Render/PriceBoxRenderInterface.php @@ -18,6 +18,8 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * + * @category Magento + * @package Magento_Pricing * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/lib/Magento/Framework/Pricing/Render/RendererPool.php b/lib/Magento/Framework/Pricing/Render/RendererPool.php index d7363e793cc1a..eb56815362d93 100644 --- a/lib/Magento/Framework/Pricing/Render/RendererPool.php +++ b/lib/Magento/Framework/Pricing/Render/RendererPool.php @@ -126,7 +126,7 @@ public function createAmountRender( $renderClassName = self::AMOUNT_RENDERER_DEFAULT; if ($price) { - $priceCode = $price->getPriceType(); + $priceCode = $price->getPriceCode(); // implement class resolving fallback $pattern = [ $type . '/prices/' . $priceCode . '/amount_render_class', @@ -172,7 +172,7 @@ public function createAmountRender( public function getAdjustmentRenders(SaleableInterface $saleableItem = null, PriceInterface $price = null) { $itemType = is_null($saleableItem) ? 'default' : $saleableItem->getTypeId(); - $priceType = is_null($price) ? 'default' : $price->getPriceType(); + $priceType = is_null($price) ? 'default' : $price->getPriceCode(); $fallbackPattern = [ "{$itemType}/adjustments/{$priceType}", diff --git a/lib/Magento/Framework/Url.php b/lib/Magento/Framework/Url.php index a25696eb57c3a..a87fac692ba8a 100644 --- a/lib/Magento/Framework/Url.php +++ b/lib/Magento/Framework/Url.php @@ -560,9 +560,8 @@ protected function _setRouteName($data) 'controller_name' )->unsetData( 'action_name' - )->unsetData( - 'secure' ); + $this->_queryParamsResolver->unsetData('secure'); return $this->setData('route_name', $data); } @@ -607,7 +606,8 @@ protected function _setControllerName($data) if ($this->_getData('controller_name') == $data) { return $this; } - $this->unsetData('route_path')->unsetData('action_name')->unsetData('secure'); + $this->unsetData('route_path')->unsetData('action_name'); + $this->_queryParamsResolver->unsetData('secure'); return $this->setData('controller_name', $data); } @@ -635,7 +635,9 @@ protected function _setActionName($data) return $this; } $this->unsetData('route_path'); - return $this->setData('action_name', $data)->unsetData('secure'); + $this->setData('action_name', $data); + $this->_queryParamsResolver->unsetData('secure'); + return $this; } /** diff --git a/lib/Magento/Framework/View/Design/Fallback/Factory.php b/lib/Magento/Framework/View/Design/Fallback/Factory.php index b3ce86e3aad25..34b815f43c7b1 100644 --- a/lib/Magento/Framework/View/Design/Fallback/Factory.php +++ b/lib/Magento/Framework/View/Design/Fallback/Factory.php @@ -79,7 +79,8 @@ public function createFileRule() new Composite( array( new Theme(new Simple("{$themesDir}///_")), - new Simple("{$modulesDir}///view/") + new Simple("{$modulesDir}///view/"), + new Simple("{$modulesDir}///view/base") ) ) ); @@ -123,7 +124,8 @@ public function createViewFileRule() ) ), new Simple("{$modulesDir}///view//i18n/", array('locale')), - new Simple("{$modulesDir}///view/") + new Simple("{$modulesDir}///view/"), + new Simple("{$modulesDir}///view/base") ) ) ); diff --git a/lib/Magento/Framework/View/Layout/File.php b/lib/Magento/Framework/View/Layout/File.php index 8f2c6388fcb20..7d4def29ba34f 100644 --- a/lib/Magento/Framework/View/Layout/File.php +++ b/lib/Magento/Framework/View/Layout/File.php @@ -51,6 +51,13 @@ class File */ protected $theme; + /** + * Base flag + * + * @var string + */ + protected $isBase; + /** * Identifier * @@ -64,12 +71,14 @@ class File * @param string $filename * @param string $module * @param ThemeInterface $theme + * @param bool $isBase */ - public function __construct($filename, $module, ThemeInterface $theme = null) + public function __construct($filename, $module, ThemeInterface $theme = null, $isBase = false) { $this->filename = $filename; $this->module = $module; $this->theme = $theme; + $this->isBase = $isBase; } /** @@ -130,8 +139,9 @@ public function isBase() public function getFileIdentifier() { if (null === $this->identifier) { - $theme = $this->getTheme() ? 'theme:' . $this->theme->getFullPath() : 'base'; - $this->identifier = $theme . '|module:' . $this->getModule() . '|file:' . $this->getName(); + $theme = $this->getTheme() ? ('|theme:' . $this->theme->getFullPath()) : ''; + $this->identifier = ($this->isBase ? 'base' : '') + . $theme . '|module:' . $this->getModule() . '|file:' . $this->getName(); } return $this->identifier; } diff --git a/lib/Magento/Framework/View/Layout/File/Factory.php b/lib/Magento/Framework/View/Layout/File/Factory.php index bae2b991fdcbe..cc5c65ab5d5c9 100644 --- a/lib/Magento/Framework/View/Layout/File/Factory.php +++ b/lib/Magento/Framework/View/Layout/File/Factory.php @@ -54,13 +54,14 @@ public function __construct(ObjectManager $objectManager) * @param string $filename * @param string $module * @param ThemeInterface|null $theme + * @param bool $isBase * @return \Magento\Framework\View\Layout\File */ - public function create($filename, $module, ThemeInterface $theme = null) + public function create($filename, $module, ThemeInterface $theme = null, $isBase = false) { return $this->objectManager->create( 'Magento\Framework\View\Layout\File', - array('filename' => $filename, 'module' => $module, 'theme' => $theme) + array('filename' => $filename, 'module' => $module, 'theme' => $theme, 'isBase' => $isBase) ); } } diff --git a/lib/Magento/Framework/View/Layout/File/Source/Base.php b/lib/Magento/Framework/View/Layout/File/Source/Base.php index ee0d12ddf939b..0a01eeab4125a 100644 --- a/lib/Magento/Framework/View/Layout/File/Source/Base.php +++ b/lib/Magento/Framework/View/Layout/File/Source/Base.php @@ -69,13 +69,24 @@ public function __construct(Filesystem $filesystem, Factory $fileFactory) */ public function getFiles(ThemeInterface $theme, $filePath = '*') { + $result = []; $namespace = $module = '*'; + $sharedFiles = $this->modulesDirectory->search("{$namespace}/{$module}/view/base/layout/{$filePath}.xml"); + + $filePathPtn = strtr(preg_quote($filePath), array('\*' => '[^/]+')); + $pattern = "#(?[^/]+)/(?[^/]+)/view/base/layout/" . $filePathPtn . "\.xml$#i"; + foreach ($sharedFiles as $file) { + $filename = $this->modulesDirectory->getAbsolutePath($file); + if (!preg_match($pattern, $filename, $matches)) { + continue; + } + $moduleFull = "{$matches['namespace']}_{$matches['module']}"; + $result[] = $this->fileFactory->create($filename, $moduleFull, null, true); + } $area = $theme->getArea(); - $files = $this->modulesDirectory->search("{$namespace}/{$module}/view/{$area}/layout/{$filePath}.xml"); - $result = array(); - $filePath = strtr(preg_quote($filePath), array('\*' => '[^/]+')); - $pattern = "#(?[^/]+)/(?[^/]+)/view/{$area}/layout/" . $filePath . "\.xml$#i"; - foreach ($files as $file) { + $themeFiles = $this->modulesDirectory->search("{$namespace}/{$module}/view/{$area}/layout/{$filePath}.xml"); + $pattern = "#(?[^/]+)/(?[^/]+)/view/{$area}/layout/" . $filePathPtn . "\.xml$#i"; + foreach ($themeFiles as $file) { $filename = $this->modulesDirectory->getAbsolutePath($file); if (!preg_match($pattern, $filename, $matches)) { continue; diff --git a/lib/Magento/Framework/View/Layout/PageType/Config/Converter.php b/lib/Magento/Framework/View/Layout/PageType/Config/Converter.php index c6d6838f1c51f..7761f12080f35 100644 --- a/lib/Magento/Framework/View/Layout/PageType/Config/Converter.php +++ b/lib/Magento/Framework/View/Layout/PageType/Config/Converter.php @@ -30,7 +30,7 @@ class Converter implements \Magento\Framework\Config\ConverterInterface */ public function convert($source) { - $page_types = array(); + $pageTypes = array(); $xpath = new \DOMXPath($source); /** @var $widget \DOMNode */ @@ -42,8 +42,8 @@ public function convert($source) $pageArray = array("id" => $id, "label" => $label); - $page_types[$id] = $pageArray; + $pageTypes[$id] = $pageArray; } - return $page_types; + return $pageTypes; } } diff --git a/pub/cron.php b/pub/cron.php index 0d9152273bcbd..659ceeeca74da 100644 --- a/pub/cron.php +++ b/pub/cron.php @@ -27,7 +27,6 @@ */ use Magento\Store\Model\StoreManager; - require dirname(__DIR__) . '/app/bootstrap.php'; umask(0); $params = array(StoreManager::PARAM_RUN_CODE => 'admin', \Magento\Store\Model\Store::CUSTOM_ENTRY_POINT_PARAM => true); diff --git a/pub/errors/404.php b/pub/errors/404.php index 369fd46b7aeac..5fc9c46f39861 100644 --- a/pub/errors/404.php +++ b/pub/errors/404.php @@ -27,7 +27,7 @@ require_once __DIR__ . '/../../app/bootstrap.php'; require_once 'processor.php'; -$processor = new Error_Processor( +$processor = new \Magento\Framework\Error\Processor( new \Magento\Framework\App\Response\Http( new \Magento\Framework\Stdlib\Cookie(), new \Magento\Framework\App\Http\Context() diff --git a/pub/errors/503.php b/pub/errors/503.php index 1561cda35b326..ca2046d960839 100644 --- a/pub/errors/503.php +++ b/pub/errors/503.php @@ -27,7 +27,7 @@ require_once __DIR__ . '/../../app/bootstrap.php'; require_once 'processor.php'; -$processor = new Error_Processor( +$processor = new \Magento\Framework\Error\Processor( new \Magento\Framework\App\Response\Http( new \Magento\Framework\Stdlib\Cookie(), new \Magento\Framework\App\Http\Context() diff --git a/pub/errors/noCache.php b/pub/errors/noCache.php index 318bfcd15ca16..60994773b1e73 100644 --- a/pub/errors/noCache.php +++ b/pub/errors/noCache.php @@ -26,7 +26,7 @@ require_once 'processor.php'; -$processor = new Error_Processor( +$processor = new \Magento\Framework\Error\Processor( new \Magento\Framework\App\Response\Http( new \Magento\Framework\Stdlib\Cookie(), new \Magento\Framework\App\Http\Context() diff --git a/pub/errors/processor.php b/pub/errors/processor.php index a3939406d20cc..0aef2466f9afa 100644 --- a/pub/errors/processor.php +++ b/pub/errors/processor.php @@ -23,11 +23,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Framework\Error; /** * Error processor */ -class Error_Processor +class Processor { const MAGE_ERRORS_LOCAL_XML = 'local.xml'; const MAGE_ERRORS_DESIGN_XML = 'design.xml'; @@ -133,7 +134,7 @@ class Error_Processor /** * Internal config object * - * @var stdClass + * @var \stdClass */ protected $_config; @@ -280,6 +281,7 @@ public function getHostUrl() /** * Retrieve base URL * + * @param bool $param * @return string */ public function getBaseUrl($param = false) @@ -320,6 +322,8 @@ protected function _getIndexDir() /** * Prepare config data + * + * @return void */ protected function _prepareConfig() { @@ -327,7 +331,7 @@ protected function _prepareConfig() $design = $this->_loadXml(self::MAGE_ERRORS_DESIGN_XML); //initial settings - $config = new stdClass(); + $config = new \stdClass(); $config->action = ''; $config->subject = 'Store Debug Information'; $config->email_address = ''; @@ -448,6 +452,7 @@ protected function _getTemplatePath($template) * Set report data * * @param array $reportData + * @return void */ protected function _setReportData($reportData) { @@ -468,6 +473,7 @@ protected function _setReportData($reportData) * Create report * * @param array $reportData + * @return void */ public function saveReport($reportData) { @@ -500,6 +506,7 @@ public function saveReport($reportData) * Get report * * @param int $reportId + * @return void */ public function loadReport($reportId) { @@ -516,6 +523,7 @@ public function loadReport($reportId) /** * Send report * + * @return void */ public function sendReport() { @@ -575,8 +583,10 @@ public function sendReport() */ protected function _validate() { - $email = preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/', - $this->postData['email']); + $email = preg_match( + '/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/', + $this->postData['email'] + ); return ($this->postData['firstName'] && $this->postData['lastName'] && $email); } @@ -584,9 +594,10 @@ protected function _validate() * Skin setter * * @param string $value - * @param stdClass $config + * @param \stdClass $config + * @return void */ - protected function _setSkin($value, stdClass $config = null) + protected function _setSkin($value, \stdClass $config = null) { if (preg_match('/^[a-z0-9_]+$/i', $value) && is_dir($this->_indexDir . self::ERROR_DIR . '/' . $value)) { if (!$config) { @@ -602,6 +613,8 @@ protected function _setSkin($value, stdClass $config = null) /** * Set current report URL from current params + * + * @return void */ protected function _setReportUrl() { diff --git a/pub/errors/report.php b/pub/errors/report.php index 21c1ec9982365..d272a6082e411 100644 --- a/pub/errors/report.php +++ b/pub/errors/report.php @@ -27,7 +27,7 @@ require_once __DIR__ . '/../../app/bootstrap.php'; require_once 'processor.php'; -$processor = new Error_Processor( +$processor = new \Magento\Framework\Error\Processor( new \Magento\Framework\App\Response\Http( new \Magento\Framework\Stdlib\Cookie(), new \Magento\Framework\App\Http\Context() diff --git a/pub/get.php b/pub/get.php index a4b687bc1288a..f79a6602b0fab 100644 --- a/pub/get.php +++ b/pub/get.php @@ -84,11 +84,14 @@ } $entryPoint = new \Magento\Framework\App\EntryPoint\EntryPoint(dirname(__DIR__), $params); -$entryPoint->run('Magento\Core\App\Media', array( - 'request' => $request, - 'workingDirectory' => __DIR__, - 'mediaDirectory' => $mediaDirectory, - 'configCacheFile' => $configCacheFile, - 'isAllowed' => $isAllowed, - 'relativeFileName' => $relativeFilename, -)); +$entryPoint->run( + 'Magento\Core\App\Media', + array( + 'request' => $request, + 'workingDirectory' => __DIR__, + 'mediaDirectory' => $mediaDirectory, + 'configCacheFile' => $configCacheFile, + 'isAllowed' => $isAllowed, + 'relativeFileName' => $relativeFilename, + ) +); diff --git a/pub/lib/headjs/head.load.min.js b/pub/lib/headjs/head.load.min.js deleted file mode 100644 index e384332d8f3db..0000000000000 --- a/pub/lib/headjs/head.load.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/*! - * HeadJS The only script in your - * Author Tero Piirainen (tipiirai) - * Maintainer Robert Hoffmann (itechnology) - * License MIT / http://bit.ly/mit-license - * - * http://headjs.com - */ -(function(e,t){"use strict";function y(e){if(e._done)return;e(),e._done=1}function b(e){var t=e.split("/"),n=t[t.length-1],r=n.indexOf("?");return r!=-1?n.substring(0,r):n}function w(e){var t;if(typeof e=="object")for(var n in e)e[n]&&(t={name:n,url:e[n]});else t={name:b(e),url:e};var r=l[t.name];return r&&r.url===t.url?r:(l[t.name]=t,t)}function E(e,t){if(!e)return;typeof e=="object"&&(e=[].slice.call(e));for(var n=0;n