Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into pr1
  • Loading branch information
vitalysery committed Feb 20, 2017
2 parents 38a7ad5 + c98828b commit afe52d0
Show file tree
Hide file tree
Showing 43 changed files with 1,369 additions and 294 deletions.
59 changes: 6 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,14 @@
<h2>Welcome</h2>
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting edge, feature-rich eCommerce solution that gets results.

The installation instructions that used to be here are now published on our GitHub site. Use the information on this page to get started or go directly to the <a href="http://devdocs.magento.com/guides/v2.0/install-gde/bk-install-guide.html" target="_blank">guide</a>.
## Magento system requirements
[Magento system requirements](http://devdocs.magento.com/magento-system-requirements.html)

<h2>New to Magento? Need some help?</h2>
If you're not sure about the following, you probably need a little help before you start installing the Magento software:
## Install Magento
To install Magento, see either:

* Is the Magento software <a href="http://devdocs.magento.com/guides/v2.0/install-gde/basics/basics_magento-installed.html">installed already</a>?
* What's a <a href="http://devdocs.magento.com/guides/v2.0/install-gde/basics/basics_login.html">terminal, command prompt, or Secure Shell (ssh)</a>?
* Where's my <a href="http://devdocs.magento.com/guides/v2.0/install-gde/basics/basics_login.html">Magento server</a> and how do I access it?
* What's <a href="http://devdocs.magento.com/guides/v2.0/install-gde/basics/basics_software.html">PHP</a>?
* What's <a href="http://devdocs.magento.com/guides/v2.0/install-gde/basics/basics_software.html">Apache</a>?
* What's <a href="http://devdocs.magento.com/guides/v2.0/install-gde/basics/basics_software.html">MySQL</a>?

<h2>Step 1: Verify your prerequisites</h2>

Use the following table to verify you have the correct prerequisites to install the Magento software.

<table>
<tbody>
<tr>
<th>Prerequisite</th>
<th>How to check</th>
<th>For more information</th>
</tr>
<tr>
<td>Apache 2.2 or 2.4</td>
<td>Ubuntu: <code>apache2 -v</code><br>
CentOS: <code>httpd -v</code></td>
<td><a href="http://devdocs.magento.com/guides/v2.0/install-gde/prereq/apache.html">Apache</a></td>
</tr>
<tr>
<td>PHP 5.6.x, 7.0.2, 7.0.4 or 7.0.6</td>
<td><code>php -v</code></td>
<td><a href="http://devdocs.magento.com/guides/v2.0/install-gde/prereq/php-ubuntu.html">PHP Ubuntu</a><br><a href="http://devdocs.magento.com/guides/v2.0/install-gde/prereq/php-centos.html">PHP CentOS</a></td>
</tr>
<tr><td>MySQL 5.6.x</td>
<td><code>mysql -u [root user name] -p</code></td>
<td><a href="http://devdocs.magento.com/guides/v2.0/install-gde/prereq/mysql.html">MySQL</a></td>
</tr>
</tbody>
</table>

<h2>Step 2: Prepare to install</h2>

After verifying your prerequisites, perform the following tasks in order to prepare to install the Magento software.

1. <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/composer-clone.html#instgde-prereq-compose-install">Install Composer</a>
2. <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/composer-clone.html#instgde-prereq-compose-clone">Clone the Magento repository</a>

<h2>Step 3: Install and verify the installation</h2>

1. <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/prepare-install.html">Update installation dependencies</a>
2. Install Magento:
* <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/install-web.html">Install Magento software using the web interface</a>
* <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/install-cli.html">Install Magento software using the command line</a>
2. <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/verify.html">Verify the installation</a>
* [Magento DevBox](https://magento.com/tech-resources/download), the easiest way to get started with Magento.
* [Installation guide](http://devdocs.magento.com/guides/v2.0/install-gde/bk-install-guide.html)

<h2>Contributing to the Magento 2 code base</h2>
Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations, or just good suggestions.
Expand Down
11 changes: 10 additions & 1 deletion app/code/Magento/Backend/Block/Dashboard/Tab/Products/Viewed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/
namespace Magento\Backend\Block\Dashboard\Tab\Products;

use Magento\Catalog\Model\Product;
use Magento\Catalog\Pricing\Price\FinalPrice;

/**
* Adminhtml dashboard most viewed products grid
*
Expand Down Expand Up @@ -66,8 +69,14 @@ protected function _prepareCollection()
);

$this->setCollection($collection);
parent::_prepareCollection();

/** @var Product $product */
foreach ($collection as $product) {
$product->setPrice($product->getPriceInfo()->getPrice(FinalPrice::PRICE_CODE)->getValue());
}

return parent::_prepareCollection();
return $this;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ Minute,Minute
"JavaScript may be disabled in your browser.","JavaScript may be disabled in your browser."
"To use this website you must first enable JavaScript in your browser.","To use this website you must first enable JavaScript in your browser."
"This is only a demo store. You can browse and place orders, but nothing will be processed.","This is only a demo store. You can browse and place orders, but nothing will be processed."
"Report Bugs","Report Bugs"
"Report a Bug","Report a Bug"
"Store View:","Store View:"
"Stores Configuration","Stores Configuration"
"Please confirm scope switching. All data that hasn\'t been saved will be lost.","Please confirm scope switching. All data that hasn\'t been saved will be lost."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

?>
<?php if ($block->getBugreportUrl()): ?>
<a class="link-report" href="<?php /* @escapeNotVerified */ echo $block->getBugreportUrl(); ?>" id="footer_bug_tracking"><?php /* @escapeNotVerified */ echo __('Report Bugs') ?></a>
<a class="link-report" href="<?php /* @escapeNotVerified */ echo $block->getBugreportUrl(); ?>" id="footer_bug_tracking"><?php /* @escapeNotVerified */ echo __('Report a Bug') ?></a>
<?php endif; ?>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function save(ProductWebsiteLinkInterface $productWebsiteLink)
$product = $this->productRepository->get($productWebsiteLink->getSku());
$product->setWebsiteIds(array_merge($product->getWebsiteIds(), [$productWebsiteLink->getWebsiteId()]));
try {
$product->save();
$this->productRepository->save($product);
} catch (\Exception $e) {
throw new CouldNotSaveException(
__(
Expand Down Expand Up @@ -68,7 +68,7 @@ public function deleteById($sku, $websiteId)
$product->setWebsiteIds(array_diff($product->getWebsiteIds(), [$websiteId]));

try {
$product->save();
$this->productRepository->save($product);
} catch (\Exception $e) {
throw new CouldNotSaveException(
__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ public function build($productId)
->limit(1);
$priceSelect = $this->baseSelectProcessor->process($priceSelect);

$priceSelectDefault = clone $priceSelect;
$priceSelectDefault->where('t.store_id = ?', Store::DEFAULT_STORE_ID);
$select[] = $priceSelectDefault;

if (!$this->catalogHelper->isPriceGlobal()) {
$priceSelect->where('t.store_id = ?', $this->storeManager->getStore()->getId());
$select[] = $priceSelect;
$priceSelectStore = clone $priceSelect;
$priceSelectStore->where('t.store_id = ?', $this->storeManager->getStore()->getId());
$selects[] = $priceSelectStore;
}

return $select;
$priceSelect->where('t.store_id = ?', Store::DEFAULT_STORE_ID);
$selects[] = $priceSelect;

return $selects;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ public function build($productId)
->limit(1);
$specialPrice = $this->baseSelectProcessor->process($specialPrice);

$specialPriceDefault = clone $specialPrice;
$specialPriceDefault->where('t.store_id = ?', Store::DEFAULT_STORE_ID);
$select[] = $specialPriceDefault;

if (!$this->catalogHelper->isPriceGlobal()) {
$specialPrice->where('t.store_id = ?', $this->storeManager->getStore()->getId());
$select[] = $specialPrice;
$priceSelectStore = clone $specialPrice;
$priceSelectStore->where('t.store_id = ?', $this->storeManager->getStore()->getId());
$selects[] = $priceSelectStore;
}

return $select;
$specialPrice->where('t.store_id = ?', Store::DEFAULT_STORE_ID);
$selects[] = $specialPrice;

return $selects;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ public function build($productId)
->limit(1);
$priceSelect = $this->baseSelectProcessor->process($priceSelect);

$priceSelectDefault = clone $priceSelect;
$priceSelectDefault->where('t.website_id = ?', self::DEFAULT_WEBSITE_ID);
$select[] = $priceSelectDefault;

if (!$this->catalogHelper->isPriceGlobal()) {
$priceSelect->where('t.website_id = ?', $this->storeManager->getStore()->getWebsiteId());
$select[] = $priceSelect;
$priceSelectStore = clone $priceSelect;
$priceSelectStore->where('t.website_id = ?', $this->storeManager->getStore()->getWebsiteId());
$selects[] = $priceSelectStore;
}

return $select;
$priceSelect->where('t.website_id = ?', self::DEFAULT_WEBSITE_ID);
$selects[] = $priceSelect;

return $selects;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public function __construct($linkedProductSelectBuilder)
*/
public function build($productId)
{
$select = [];
$selects = [];
foreach ($this->linkedProductSelectBuilder as $productSelectBuilder) {
$select = array_merge($select, $productSelectBuilder->build($productId));
$selects = array_merge($selects, $productSelectBuilder->build($productId));
}

return $select;
return $selects;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Model\ResourceModel\Product\Website;

use Magento\Catalog\Model\ResourceModel\Product\BaseSelectProcessorInterface;
use Magento\Framework\DB\Select;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Framework\App\ResourceConnection;
use Magento\Store\Model\StoreManagerInterface;

/**
* Filter products that belongs to current website
*/
class SelectProcessor implements BaseSelectProcessorInterface
{
/**
* @var ResourceConnection
*/
private $resource;

/**
* @var MetadataPool
*/
private $metadataPool;

/**
* @var StoreManagerInterface
*/
private $storeManager;

/**
* @param MetadataPool $metadataPool
* @param ResourceConnection $resource
* @param StoreManagerInterface $storeManager
*/
public function __construct(
MetadataPool $metadataPool,
ResourceConnection $resource,
StoreManagerInterface $storeManager
) {
$this->metadataPool = $metadataPool;
$this->resource = $resource;
$this->storeManager = $storeManager;
}

/**
* Joins website-product relation table to filter products that are only in current website
*
* {@inheritdoc}
*/
public function process(Select $select)
{
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
$select->joinInner(
['pw' => $this->resource->getTableName('catalog_product_website')],
'pw.product_id = ' . BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS . '.' . $linkField
. ' AND pw.website_id = ' . $this->storeManager->getWebsite()->getId(),
[]
);

return $select;
}
}
14 changes: 13 additions & 1 deletion app/code/Magento/Catalog/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -851,14 +851,26 @@
<type name="Magento\Quote\Model\Quote\Item\ToOrderItem">
<plugin name="copy_quote_files_to_order" type="Magento\Catalog\Model\Plugin\QuoteItemProductOption"/>
</type>
<preference for="Magento\Catalog\Model\ResourceModel\Product\BaseSelectProcessorInterface" type="Magento\Catalog\Model\ResourceModel\Product\CompositeBaseSelectProcessor" />
<preference for="Magento\Catalog\Model\ResourceModel\Product\BaseSelectProcessorInterface" type="Magento\Catalog\Model\ResourceModel\Product\CompositeWithWebsiteProcessor" />
<type name="Magento\Catalog\Model\ResourceModel\Product\CompositeBaseSelectProcessor">
<arguments>
<argument name="baseSelectProcessors" xsi:type="array">
<item name="status" xsi:type="object">Magento\Catalog\Model\ResourceModel\Product\StatusBaseSelectProcessor</item>
</argument>
</arguments>
</type>
<virtualType name="Magento\Catalog\Model\ResourceModel\Product\CompositeWithWebsiteProcessor" type="Magento\Catalog\Model\ResourceModel\Product\CompositeBaseSelectProcessor">
<arguments>
<argument name="baseSelectProcessors" xsi:type="array">
<item name="website" xsi:type="object">Magento\Catalog\Model\ResourceModel\Product\Website\SelectProcessor</item>
</argument>
</arguments>
</virtualType>
<type name="Magento\Catalog\Model\ResourceModel\Product\Indexer\LinkedProductSelectBuilderByIndexPrice">
<arguments>
<argument name="baseSelectProcessor" xsi:type="object">Magento\Catalog\Model\ResourceModel\Product\CompositeBaseSelectProcessor</argument>
</arguments>
</type>
<type name="Magento\Catalog\Model\Product\Price\CostStorage">
<arguments>
<argument name="allowedProductTypes" xsi:type="array">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,27 @@ define([
if (!data) {
return;
}
data.each(function (item) {
_.each(data, function (item) {
if (!item.options) {
return;
}
item.options.each(function (option) {
_.each(item.options, function (option) {
currentOption = utils.copy(option);

if (currentOption.hasOwnProperty('sort_order')) {
delete currentOption['sort_order'];
}
currentOption['option_id'] = ++maxId;

if (currentOption.hasOwnProperty('option_id')) {
delete currentOption['option_id'];
}

if (currentOption.values.length > 0) {
_.each(currentOption.values, function (optionValue) {
delete optionValue['option_id'];
delete optionValue['option_type_id'];
});
}
options.push(currentOption);
});
});
Expand All @@ -73,7 +83,7 @@ define([
return;
}
this.cacheGridData = options;
options.each(function (opt) {
_.each(options, function (opt) {
this.mappingValue(opt);
}, this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@
<block class="Magento\Framework\View\Element\Template" name="product.info.form.options" as="options_container">
<block class="Magento\Catalog\Block\Product\View" name="product.info.options.wrapper" as="product_options_wrapper" template="product/view/options/wrapper.phtml">
<block class="Magento\Catalog\Block\Product\View\Options" name="product.info.options" as="product_options" template="product/view/options.phtml">
<block class="Magento\Catalog\Block\Product\View\Options\Type\DefaultType" as="default" template="product/view/options/type/default.phtml"/>
<block class="Magento\Catalog\Block\Product\View\Options\Type\Text" as="text" template="product/view/options/type/text.phtml"/>
<block class="Magento\Catalog\Block\Product\View\Options\Type\File" as="file" template="product/view/options/type/file.phtml"/>
<block class="Magento\Catalog\Block\Product\View\Options\Type\Select" as="select" template="product/view/options/type/select.phtml"/>
<block class="Magento\Catalog\Block\Product\View\Options\Type\Date" as="date" template="product/view/options/type/date.phtml"/>
<block class="Magento\Catalog\Block\Product\View\Options\Type\DefaultType" name="product.info.options.default" as="default" template="product/view/options/type/default.phtml"/>
<block class="Magento\Catalog\Block\Product\View\Options\Type\Text" name="product.info.options.text" as="text" template="product/view/options/type/text.phtml"/>
<block class="Magento\Catalog\Block\Product\View\Options\Type\File" name="product.info.options.file" as="file" template="product/view/options/type/file.phtml"/>
<block class="Magento\Catalog\Block\Product\View\Options\Type\Select" name="product.info.options.select" as="select" template="product/view/options/type/select.phtml"/>
<block class="Magento\Catalog\Block\Product\View\Options\Type\Date" name="product.info.options.date" as="date" template="product/view/options/type/date.phtml"/>
</block>
<block class="Magento\Framework\View\Element\Html\Calendar" name="html_calendar" as="html_calendar" template="Magento_Theme::js/calendar.phtml"/>
</block>
Expand Down
Loading

0 comments on commit afe52d0

Please sign in to comment.