From 8078623d0874b229c6a6d015cb4ecb644fc41dfd Mon Sep 17 00:00:00 2001 From: Lorenzo Stramaccia Date: Wed, 1 Mar 2017 22:19:21 +0100 Subject: [PATCH 01/25] simplify product lists --- .../frontend/templates/product/list.phtml | 5 +- .../templates/product/list/items.phtml | 7 +- .../frontend/templates/product/listing.phtml | 103 ++++++----- .../widget/new/column/new_default_list.phtml | 91 +++++----- .../product/widget/new/content/new_grid.phtml | 5 +- .../product/widget/new/content/new_list.phtml | 159 ++++++++-------- .../product/widget/content/grid.phtml | 126 +++++++------ .../column/compared_default_list.phtml | 97 +++++----- .../compared/content/compared_grid.phtml | 155 ++++++++-------- .../compared/content/compared_list.phtml | 171 +++++++++--------- .../viewed/column/viewed_default_list.phtml | 95 +++++----- .../viewed/column/viewed_images_list.phtml | 7 +- .../widget/viewed/content/viewed_grid.phtml | 151 ++++++++-------- .../widget/viewed/content/viewed_list.phtml | 167 +++++++++-------- .../view/frontend/templates/item/list.phtml | 15 +- 15 files changed, 669 insertions(+), 685 deletions(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml index bcbd2882e02c2..0109cdd348dea 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml @@ -42,11 +42,10 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); $pos = $block->getPositioned(); ?>
-
    - ' : '
  1. ' ?> +
  2. getImage($_product, $image); @@ -112,7 +111,7 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output');
- ' : '' ?> + diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml index 84be9271980b4..3d1cb88cac4d8 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml @@ -174,7 +174,6 @@ switch ($type = $block->getType()) {
    - isComposite() && $_item->isSaleable() && $type == 'related'): ?> @@ -183,9 +182,9 @@ switch ($type = $block->getType()) { - ' : '
  1. ' ?> +
  2. ' ?> @@ -252,7 +251,7 @@ switch ($type = $block->getType()) {
- ' : '' ?> + diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml index 2f5bb0211a1ee..27907bf5ebe95 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml @@ -38,61 +38,60 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); } ?>
-
    - ' : '
  1. ' ?> -
    - - - getImage($_product, $image)->toHtml(); ?> - -
    - ' - . ' ' - . $_helper->productAttribute($_product, $_product->getName(), 'name') - . ''; - $info['price'] = $block->getProductPrice($_product); - $info['review'] = $block->getReviewsSummaryHtml($_product, $templateType); - - if ($_product->isSaleable()) { - $info['button'] = ''; - } else { - $info['button'] = $_product->getIsSalable() ? '
    ' . __('In stock') . '
    ' : - '
    ' . __('Out of stock') . '
    '; - } - - $info['links'] = ''; - $info['actions'] = '
    ' . $info['button'] . $info['links'] . '
    '; - - if ($showDescription) { - $info['description'] = '
    ' - . $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') - . ' ' - . __('Learn More') . '
    '; - } else { - $info['description'] = ''; - } - - $details = $block->getInfoOrder() ?: ['name','price','review','description','actions']; - foreach ($details as $detail) { - /* @escapeNotVerified */ echo $info[$detail]; - } - ?> - +
  2. +
    + + + getImage($_product, $image)->toHtml(); ?> + +
    + ' + . ' ' + . $_helper->productAttribute($_product, $_product->getName(), 'name') + . ''; + $info['price'] = $block->getProductPrice($_product); + $info['review'] = $block->getReviewsSummaryHtml($_product, $templateType); + + if ($_product->isSaleable()) { + $info['button'] = ''; + } else { + $info['button'] = $_product->getIsSalable() ? '
    ' . __('In stock') . '
    ' : + '
    ' . __('Out of stock') . '
    '; + } + + $info['links'] = ''; + $info['actions'] = '
    ' . $info['button'] . $info['links'] . '
    '; + + if ($showDescription) { + $info['description'] = '
    ' + . $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') + . ' ' + . __('Learn More') . '
    '; + } else { + $info['description'] = ''; + } + + $details = $block->getInfoOrder() ?: ['name','price','review','description','actions']; + foreach ($details as $detail) { + /* @escapeNotVerified */ echo $info[$detail]; + } + ?> + +
    -
- ' : '' ?> + diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml index e2f3c1888c30e..b5f7d2e1559f0 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml @@ -14,59 +14,58 @@
getNameInLayout(); ?> -
    getItems() as $_product): ?> - ' : '
  1. ' ?> -
    - - getImage($_product, 'side_column_widget_product_thumbnail')->toHtml(); ?> - -
    - - - helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> - - - getProductPriceHtml($_product, '-widget-new-' . $suffix) ?> -
    -
    - isSaleable()): ?> - getTypeInstance()->hasRequiredOptions($_product)): ?> - +
  2. +
    + + getImage($_product, 'side_column_widget_product_thumbnail')->toHtml(); ?> + +
    + + + helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> + + + getProductPriceHtml($_product, '-widget-new-' . $suffix) ?> +
    +
    + isSaleable()): ?> + getTypeInstance()->hasRequiredOptions($_product)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); + ?> + + - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); - ?> - + getIsSalable()): ?> +
    + +
    + +
    + +
    + - - getIsSalable()): ?> -
    - -
    - -
    - -
    - - +
    -
- getItems())+1) ? '' : '' ?> + getPagerHtml() ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml index 897d70c23acc2..342613f5efcb4 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml @@ -39,9 +39,8 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()-> ' ?>
    - - ' : '
  1. ' ?> +
- ' : '' ?> + diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml index 567ccb2d11581..125e92683be9f 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml @@ -40,91 +40,90 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()-> ' ?>
    - - ' : '
  1. ' ?> -
    - - getImage($_item, $image)->toHtml(); ?> - -
    - - - escapeHtml($_item->getName()) ?> - - - getProductPriceHtml($_item, $type); ?> - - - getReviewsSummaryHtml($_item, $templateType) ?> - - - -
    - -
    - isSaleable()): ?> - getTypeInstance()->hasRequiredOptions($_item)): ?> - +
  2. +
    + + getImage($_item, $image)->toHtml(); ?> + +
    + + + escapeHtml($_item->getName()) ?> + + + getProductPriceHtml($_item, $type); ?> + + + getReviewsSummaryHtml($_item, $templateType) ?> + + + +
    + +
    + isSaleable()): ?> + getTypeInstance()->hasRequiredOptions($_item)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + + - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) - ?> - + getIsSalable()): ?> +
    + +
    + - - getIsSalable()): ?> -
    - -
    +
    + + +
    + helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + + + - -
    - - -
    - helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - - - - - getAddToCompareUrl() && $showCompare): ?> - helper('Magento\Catalog\Helper\Product\Compare'); ?> - - - - -
    - -
    - - -
    - productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> - -
    - + getAddToCompareUrl() && $showCompare): ?> + helper('Magento\Catalog\Helper\Product\Compare'); ?> + + + + +
    + +
    + + +
    + productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> + +
    + +
- - ' : '' ?> + diff --git a/app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml b/app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml index 51943355e8ea7..9976d6fa6bdd6 100644 --- a/app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml +++ b/app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml @@ -33,78 +33,76 @@ ' ?>
    - -
  1. -
    - - getImage($_item, $image)->toHtml(); ?> - -
    - - - escapeHtml($_item->getName()) ?> - - - getProductPriceHtml($_item, $type); - ?> +
    + + getImage($_item, $image)->toHtml(); ?> + +
    + + + escapeHtml($_item->getName()) ?> + + + getProductPriceHtml($_item, $type); + ?> - - getReviewsSummaryHtml($_item, $templateType) ?> - + + getReviewsSummaryHtml($_item, $templateType) ?> + - -
    - -
    - isSaleable()): ?> - getTypeInstance()->hasRequiredOptions($_item)): ?> - + +
    + +
    + isSaleable()): ?> + getTypeInstance()->hasRequiredOptions($_item)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + + - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) - ?> - + getIsSalable()): ?> +
    escapeHtml(__('In stock')) ?>
    + +
    escapeHtml(__('Out of stock')) ?>
    + - - getIsSalable()): ?> -
    escapeHtml(__('In stock')) ?>
    - -
    escapeHtml(__('Out of stock')) ?>
    +
    + + +
    + helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + + escapeHtml(__('Add to Wish List')) ?> + + + getAddToCompareUrl() && $showCompare): ?> + helper('Magento\Catalog\Helper\Product\Compare');?> + + escapeHtml(__('Add to Compare')) ?> + - -
    - - -
    - helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - - escapeHtml(__('Add to Wish List')) ?> - - - getAddToCompareUrl() && $showCompare): ?> - helper('Magento\Catalog\Helper\Product\Compare');?> - - escapeHtml(__('Add to Compare')) ?> - - -
    - -
    - +
    + +
    + +
    -
    - ' : '' ?> +
diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml index f26c96a9f9e2f..b6a76e945d0a2 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml @@ -33,61 +33,60 @@ if ($exist = $block->getRecentlyComparedProducts()) {
getNameInLayout(); ?>
    - - ' : '
  1. ' ?> -
    - - getImage($_product, $image)->toHtml(); ?> - -
    - - - helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> - - - getProductPriceHtml( - $_product, - \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, - \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, - [ - 'price_id_suffix' => '-widget-compared-' . $suffix - ] - ) ?> -
    - isSaleable()): ?> -
    - getTypeInstance()->hasRequiredOptions($_product)): ?> - +
  2. +
    + + getImage($_product, $image)->toHtml(); ?> + +
    + + + helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> + + + getProductPriceHtml( + $_product, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-widget-compared-' . $suffix + ] + ) ?> +
    + isSaleable()): ?> +
    + getTypeInstance()->hasRequiredOptions($_product)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]) + ?> + + +
    - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]) - ?> - + getIsSalable()): ?> +
    + +
    +
    - - getIsSalable()): ?> -
    - -
    - -
    -
- ' : '' ?> + diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml index 151e5d6044515..8d0a87fe615ab 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml @@ -37,89 +37,88 @@ if ($exist = $block->getRecentlyComparedProducts()) { ' ?>
    - - ' : '
  1. ' ?> -
    - - getImage($_item, $image)->toHtml(); ?> - -
    - - - escapeHtml($_item->getName()) ?> - - - getProductPriceHtml( - $_item, - \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, - \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, - [ - 'price_id_suffix' => '-' . $type - ] - ) ?> - - getReviewsSummaryHtml($_item, $rating) ?> - - -
    - -
    - isSaleable()): ?> - getTypeInstance()->hasRequiredOptions($_item)): ?> - +
  2. +
    + + getImage($_item, $image)->toHtml(); ?> + +
    + + + escapeHtml($_item->getName()) ?> + + + getProductPriceHtml( + $_item, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-' . $type + ] + ) ?> + + getReviewsSummaryHtml($_item, $rating) ?> + + +
    + +
    + isSaleable()): ?> + getTypeInstance()->hasRequiredOptions($_item)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + + - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) - ?> - + getIsSalable()): ?> +
    + +
    + - - getIsSalable()): ?> -
    - -
    +
    + + + +
    + helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + + + - -
    - - - -
    - helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - - - - - getAddToCompareUrl() && $showCompare): ?> - helper('Magento\Catalog\Helper\Product\Compare'); ?> - - - - -
    - -
    - + getAddToCompareUrl() && $showCompare): ?> + helper('Magento\Catalog\Helper\Product\Compare'); ?> + + + + +
    + +
    + +
- - ' : '' ?> + diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml index 9b6dbc9cbac2c..0ddfc9d936a78 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml @@ -38,97 +38,96 @@ if ($exist = $block->getRecentlyComparedProducts()) { ' ?>
    - - ' : '
  1. ' ?> -
    - - getImage($_item, $image)->toHtml(); ?> - -
    - - - escapeHtml($_item->getName()) ?> - - - getProductPriceHtml( - $_item, - \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, - \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, - [ - 'price_id_suffix' => '-' . $type - ] - ) ?> - - getReviewsSummaryHtml($_item, $rating) ?> - - -
    - -
    - isSaleable()): ?> - getTypeInstance()->hasRequiredOptions($_item)): ?> - +
  2. +
    + + getImage($_item, $image)->toHtml(); ?> + +
    + + + escapeHtml($_item->getName()) ?> + + + getProductPriceHtml( + $_item, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-' . $type + ] + ) ?> + + getReviewsSummaryHtml($_item, $rating) ?> + + +
    + +
    + isSaleable()): ?> + getTypeInstance()->hasRequiredOptions($_item)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + + - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) - ?> - + getIsSalable()): ?> +
    + +
    + - - getIsSalable()): ?> -
    - -
    +
    + + + +
    + helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + + + - -
    - - - -
    - helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - - - - - getAddToCompareUrl() && $showCompare): ?> - helper('Magento\Catalog\Helper\Product\Compare');?> - - - - -
    - -
    - - -
    - productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> - -
    - + getAddToCompareUrl() && $showCompare): ?> + helper('Magento\Catalog\Helper\Product\Compare');?> + + + + +
    + +
    + + +
    + productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> + +
    + +
- - ' : '' ?> + diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml index 0c4b84737a08c..3b84087284881 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml @@ -38,60 +38,59 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr
getNameInLayout(); ?>
    - - ' : '
  1. ' ?> -
    - - getImage($_product, $image)->toHtml(); ?> - -
    - - - helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> - - - getProductPriceHtml( - $_product, - \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, - \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, - [ - 'price_id_suffix' => '-widget-viewed-' . $suffix - ] - ) ?> -
    - isSaleable()): ?> -
    - getTypeInstance()->hasRequiredOptions($_product)): ?> - +
  2. +
    + + getImage($_product, $image)->toHtml(); ?> + +
    + + + helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> + + + getProductPriceHtml( + $_product, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-widget-viewed-' . $suffix + ] + ) ?> +
    + isSaleable()): ?> +
    + getTypeInstance()->hasRequiredOptions($_product)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); + ?> + + +
    - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); - ?> - + getIsSalable()): ?> +
    + +
    +
    - - getIsSalable()): ?> -
    - -
    - -
    -
- ' : '' ?> + diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml index 3a548aaedb8ad..e5b3b735edb10 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml @@ -35,14 +35,13 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr
getNameInLayout(); ?>
    - - ' : '
  1. ' ?> +
  2. getImage($_product, $image)->toHtml(); ?> - ' : '' ?> - +
  3. +
diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml index e9fe8c8c3aea9..d2c694179eb0f 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml @@ -39,87 +39,86 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr ' ?>
    - - ' : '
  1. ' ?> -
    - - getImage($_item, $image)->toHtml(); ?> - -
    - - - escapeHtml($_item->getName()) ?> - - - getProductPriceHtml( - $_item, - \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, - \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, - [ - 'price_id_suffix' => '-' . $type - ] - ) ?> - - getReviewsSummaryHtml($_item, $rating) ?> - - -
    - -
    - isSaleable()): ?> - getTypeInstance()->hasRequiredOptions($_item)): ?> - +
  2. +
    + + getImage($_item, $image)->toHtml(); ?> + +
    + + + escapeHtml($_item->getName()) ?> + + + getProductPriceHtml( + $_item, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-' . $type + ] + ) ?> + + getReviewsSummaryHtml($_item, $rating) ?> + + +
    + +
    + isSaleable()): ?> + getTypeInstance()->hasRequiredOptions($_item)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + + - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) - ?> - + getIsSalable()): ?> +
    + +
    + - - getIsSalable()): ?> -
    - -
    +
    + + +
    + helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + + + + + getAddToCompareUrl() && $showCompare): ?> + helper('Magento\Catalog\Helper\Product\Compare');?> + + + - -
    - - -
    - helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - - - - - getAddToCompareUrl() && $showCompare): ?> - helper('Magento\Catalog\Helper\Product\Compare');?> - - - - -
    - -
    - +
    + +
    + +
- - ' : '' ?> + diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml index b2077b441b79f..2a2700886a9d9 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml @@ -41,96 +41,95 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr ' ?>
    - - ' : '
  1. ' ?> -
    - - getImage($_item, $image)->toHtml(); ?> - -
    - - - escapeHtml($_item->getName()) ?> - - - getProductPriceHtml( - $_item, - \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, - \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, - [ - 'price_id_suffix' => '-' . $type - ] - ) ?> - - getReviewsSummaryHtml($_item, $rating) ?> - - -
    - -
    - isSaleable()): ?> - getTypeInstance()->hasRequiredOptions($_item)): ?> - +
  2. +
    + + getImage($_item, $image)->toHtml(); ?> + +
    + + + escapeHtml($_item->getName()) ?> + + + getProductPriceHtml( + $_item, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-' . $type + ] + ) ?> + + getReviewsSummaryHtml($_item, $rating) ?> + + +
    + +
    + isSaleable()): ?> + getTypeInstance()->hasRequiredOptions($_item)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]); + ?> + + - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]); - ?> - + getIsSalable()): ?> +
    + +
    - - getIsSalable()): ?> -
    - -
    - -
    - +
    + - -
    - helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - - - - - getAddToCompareUrl() && $showCompare): ?> - helper('Magento\Catalog\Helper\Product\Compare');?> - - - - -
    - -
    - - -
    - productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> - -
    - + +
    + helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + + + + + getAddToCompareUrl() && $showCompare): ?> + helper('Magento\Catalog\Helper\Product\Compare');?> + + + + +
    + +
    + + +
    + productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> + +
    + +
- - ' : '' ?> + diff --git a/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml b/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml index dce3241ea5f92..38cda03093018 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml @@ -13,17 +13,16 @@ $columns = $block->getColumns(); ?>
- getItems())): ?>
    getItems() as $item): ?> - escapeHtmlAttr($item->getId()) . '">' : '
  1. ' ?> -
    - - setItem($item); echo $column->toHtml($item);?> - -
    - getItems())+1) ? '
  2. ' : '' ?> +
  3. +
    + + setItem($item); echo $column->toHtml($item);?> + +
    +
From 1886e266eed0410d29555698fef621ed0802794a Mon Sep 17 00:00:00 2001 From: Rafael Kassner Date: Sun, 26 Mar 2017 22:32:17 +0200 Subject: [PATCH 02/25] Fix fatal errors with deleteOptionsAndSelections --- .../Model/Import/Product/Type/Bundle.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php b/app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php index d5548f61c2bf2..8e13dee30aea6 100644 --- a/app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php +++ b/app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php @@ -629,8 +629,13 @@ protected function _initAttributes() */ protected function deleteOptionsAndSelections($productIds) { + if (empty($productIds)) { + return $this; + } + $optionTable = $this->_resource->getTableName('catalog_product_bundle_option'); $optionValueTable = $this->_resource->getTableName('catalog_product_bundle_option_value'); + $selectionTable = $this->_resource->getTableName('catalog_product_bundle_selection'); $valuesIds = $this->connection->fetchAssoc($this->connection->select()->from( ['bov' => $optionValueTable], ['value_id'] @@ -643,17 +648,16 @@ protected function deleteOptionsAndSelections($productIds) $productIds )); $this->connection->delete( - $optionTable, + $optionValueTable, $this->connection->quoteInto('value_id IN (?)', array_keys($valuesIds)) ); - $productIdsInWhere = $this->connection->quoteInto('parent_id IN (?)', $productIds); $this->connection->delete( $optionTable, - $this->connection->quoteInto('parent_id IN (?)', $productIdsInWhere) + $this->connection->quoteInto('parent_id IN (?)', $productIds) ); $this->connection->delete( - $optionTable, - $this->connection->quoteInto('parent_product_id IN (?)', $productIdsInWhere) + $selectionTable, + $this->connection->quoteInto('parent_product_id IN (?)', $productIds) ); return $this; } From 148c5cdc67f0b77f6369041917e3b94e45d3ce95 Mon Sep 17 00:00:00 2001 From: Ranjith VK Date: Mon, 12 Jun 2017 10:59:28 +0530 Subject: [PATCH 03/25] magento/magento2 #9196 - separated simple products of a configurable in product ordered report --- .../Model/ResourceModel/Product/Sold/Collection.php | 7 +++---- .../layout/reports_report_product_sold_grid.xml | 10 ++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php b/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php index c45d2a3480cde..b75c1c985f9b6 100644 --- a/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php +++ b/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php @@ -46,6 +46,7 @@ public function setDateRange($from, $to) */ public function addOrderedQty($from = '', $to = '') { + //return $this; $connection = $this->getConnection(); $orderTableAliasName = $connection->quoteIdentifier('order'); @@ -61,17 +62,15 @@ public function addOrderedQty($from = '', $to = '') $this->getSelect()->reset()->from( ['order_items' => $this->getTable('sales_order_item')], - ['ordered_qty' => 'SUM(order_items.qty_ordered)', 'order_items_name' => 'order_items.name'] + ['ordered_qty' => 'order_items.qty_ordered', 'order_items_name' => 'order_items.name', 'order_items_sku' => 'order_items.sku'] )->joinInner( ['order' => $this->getTable('sales_order')], implode(' AND ', $orderJoinCondition), [] )->where( 'parent_item_id IS NULL' - )->group( - 'order_items.product_id' )->having( - 'SUM(order_items.qty_ordered) > ?', + 'order_items.qty_ordered > ?', 0 ); return $this; diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml index 6d13fa2d7c9e2..143d605461b67 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml @@ -41,6 +41,16 @@ col-product + + + SKU + text + order_items_sku + sku + col-sku + col-sku + + Ordered Quantity From e5ab63d1d1518c258a04de92338360420846e93a Mon Sep 17 00:00:00 2001 From: Ranjith VK Date: Mon, 12 Jun 2017 13:54:31 +0530 Subject: [PATCH 04/25] removed a unwanted comment line and broke a line into multiple lines due to character limit --- .../Model/ResourceModel/Product/Sold/Collection.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php b/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php index b75c1c985f9b6..35d8c892aa2e2 100644 --- a/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php +++ b/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php @@ -46,7 +46,6 @@ public function setDateRange($from, $to) */ public function addOrderedQty($from = '', $to = '') { - //return $this; $connection = $this->getConnection(); $orderTableAliasName = $connection->quoteIdentifier('order'); @@ -62,7 +61,11 @@ public function addOrderedQty($from = '', $to = '') $this->getSelect()->reset()->from( ['order_items' => $this->getTable('sales_order_item')], - ['ordered_qty' => 'order_items.qty_ordered', 'order_items_name' => 'order_items.name', 'order_items_sku' => 'order_items.sku'] + [ + 'ordered_qty' => 'order_items.qty_ordered', + 'order_items_name' => 'order_items.name', + 'order_items_sku' => 'order_items.sku' + ] )->joinInner( ['order' => $this->getTable('sales_order')], implode(' AND ', $orderJoinCondition), From 7da540532e3990507509ed2e1f302529eaaf347a Mon Sep 17 00:00:00 2001 From: Milan Osztromok Date: Mon, 3 Jul 2017 16:29:37 +0200 Subject: [PATCH 05/25] add missing criterion (canUseForBilling) Use current shipping address as billing address only if address is marked as canUseForBilling --- .../frontend/web/js/model/shipping-save-processor/default.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-save-processor/default.js b/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-save-processor/default.js index b2a273513181d..a477856235768 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-save-processor/default.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-save-processor/default.js @@ -33,7 +33,7 @@ define([ saveShippingInformation: function () { var payload; - if (!quote.billingAddress()) { + if (!quote.billingAddress() && quote.shippingAddress().canUseForBilling()) { selectBillingAddressAction(quote.shippingAddress()); } From 5fda163df4071fd1ef00873ad66507b7b6b5bb7f Mon Sep 17 00:00:00 2001 From: Ranjith VK Date: Mon, 10 Jul 2017 14:54:58 +0530 Subject: [PATCH 06/25] fixed the SKU display for fixed bundle product. Added a new grid column block to render the correct SKU --- .../Reports/Block/Adminhtml/Grid/Column.php | 502 ++++++++++++++++++ 1 file changed, 502 insertions(+) create mode 100644 app/code/Magento/Reports/Block/Adminhtml/Grid/Column.php diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column.php new file mode 100644 index 0000000000000..860398fcab133 --- /dev/null +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column.php @@ -0,0 +1,502 @@ + \Magento\Backend\Block\Widget\Grid\Column\Renderer\Action::class, + 'button' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Button::class, + 'checkbox' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Checkbox::class, + 'concat' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Concat::class, + 'country' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Country::class, + 'currency' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Currency::class, + 'date' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Date::class, + 'datetime' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Datetime::class, + 'default' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text::class, + 'draggable-handle' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\DraggableHandle::class, + 'input' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Input::class, + 'massaction' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Massaction::class, + 'number' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Number::class, + 'options' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Options::class, + 'price' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Price::class, + 'radio' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Radio::class, + 'select' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Select::class, + 'store' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Store::class, + 'text' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Longtext::class, + 'wrapline' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Wrapline::class, + ]; + + /** + * Filter types + * + * @var array + */ + protected $_filterTypes = [ + 'datetime' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Datetime::class, + 'date' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Date::class, + 'range' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Range::class, + 'number' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Range::class, + 'currency' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Range::class, + 'price' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Price::class, + 'country' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Country::class, + 'options' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Select::class, + 'massaction' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Massaction::class, + 'checkbox' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Checkbox::class, + 'radio' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Radio::class, + 'skip-list' => \Magento\Backend\Block\Widget\Grid\Column\Filter\SkipList::class, + 'store' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Store::class, + 'theme' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Theme::class, + 'default' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Text::class, + ]; + + /** + * Column is grouped + * @var bool + */ + protected $_isGrouped = false; + + /** + * @return void + */ + public function _construct() + { + if ($this->hasData('grouped')) { + $this->_isGrouped = (bool)$this->getData('grouped'); + } + + parent::_construct(); + } + + /** + * Should column be displayed in grid + * + * @return bool + */ + public function isDisplayed() + { + return true; + } + + /** + * Set grid block to column + * + * @param \Magento\Backend\Block\Widget\Grid $grid + * @return $this + */ + public function setGrid($grid) + { + $this->_grid = $grid; + // Init filter object + $this->getFilter(); + return $this; + } + + /** + * Get grid block + * + * @return \Magento\Backend\Block\Widget\Grid + */ + public function getGrid() + { + return $this->_grid; + } + + /** + * Retrieve html id of filter + * + * @return string + */ + public function getHtmlId() + { + return $this->getGrid()->getId() . '_' . $this->getGrid()->getVarNameFilter() . '_' . $this->getId(); + } + + /** + * Get html code for column properties + * + * @return string + */ + public function getHtmlProperty() + { + return $this->getRenderer()->renderProperty(); + } + + /** + * Get Header html + * @return string + */ + public function getHeaderHtml() + { + return $this->getRenderer()->renderHeader(); + } + + /** + * Get column css classes + * + * @return string + */ + public function getCssClass() + { + if ($this->_cssClass === null) { + if ($this->getAlign()) { + $this->_cssClass .= 'a-' . $this->getAlign(); + } + // Add a custom css class for column + if ($this->hasData('column_css_class')) { + $this->_cssClass .= ' ' . $this->getData('column_css_class'); + } + if ($this->getEditable()) { + $this->_cssClass .= ' editable'; + } + $this->_cssClass .= ' col-' . $this->getId(); + } + return $this->_cssClass; + } + + /** + * Get column css property + * + * @return string + */ + public function getCssProperty() + { + return $this->getRenderer()->renderCss(); + } + + /** + * Set is column sortable + * + * @param bool $value + * @return void + */ + public function setSortable($value) + { + $this->setData('sortable', $value); + } + + /** + * Get header css class name + * @return string + */ + public function getHeaderCssClass() + { + $class = $this->getData('header_css_class'); + $class .= false === $this->getSortable() ? ' no-link' : ''; + $class .= ' col-' . $this->getId(); + return $class; + } + + /** + * @return bool + * @SuppressWarnings(PHPMD.BooleanGetMethodName) + */ + public function getSortable() + { + return $this->hasData('sortable') ? (bool)$this->getData('sortable') : true; + } + + /** + * Add css class to column header + * + * @param string $className + * @return void + */ + public function addHeaderCssClass($className) + { + $classes = $this->getData('header_css_class') ? $this->getData('header_css_class') . ' ' : ''; + $this->setData('header_css_class', $classes . $className); + } + + /** + * Get header class names + * @return string + */ + public function getHeaderHtmlProperty() + { + $str = ''; + if ($class = $this->getHeaderCssClass()) { + $str .= ' class="' . $class . '"'; + } + + return $str; + } + + /** + * Retrieve row column field value for display + * + * @param \Magento\Framework\DataObject $row + * @return string + */ + public function getRowField(\Magento\Framework\DataObject $row) + { + $renderedValue = $this->getRenderer()->render($row); + if ($this->getHtmlDecorators()) { + $renderedValue = $this->_applyDecorators($renderedValue, $this->getHtmlDecorators()); + } + + /* + * if column has determined callback for framing call + * it before give away rendered value + * + * callback_function($renderedValue, $row, $column, $isExport) + * should return new version of rendered value + */ + $frameCallback = $this->getFrameCallback(); + if (is_array($frameCallback)) { + $renderedValue = call_user_func($frameCallback, $renderedValue, $row, $this, false); + } + + return $renderedValue; + } + + /** + * Retrieve row column field value for export + * + * @param \Magento\Framework\DataObject $row + * @return string + */ + public function getRowFieldExport(\Magento\Framework\DataObject $row) + { + $renderedValue = $this->getRenderer()->renderExport($row); + + /* + * if column has determined callback for framing call + * it before give away rendered value + * + * callback_function($renderedValue, $row, $column, $isExport) + * should return new version of rendered value + */ + $frameCallback = $this->getFrameCallback(); + if (is_array($frameCallback)) { + $renderedValue = call_user_func($frameCallback, $renderedValue, $row, $this, true); + } + + return $renderedValue; + } + + /** + * Retrieve Header Name for Export + * + * @return string + */ + public function getExportHeader() + { + if ($this->getHeaderExport()) { + return $this->getHeaderExport(); + } + return $this->getHeader(); + } + + /** + * Decorate rendered cell value + * + * @param string $value + * @param array|string $decorators + * @return string + */ + protected function &_applyDecorators($value, $decorators) + { + if (!is_array($decorators)) { + if (is_string($decorators)) { + $decorators = explode(' ', $decorators); + } + } + if (!is_array($decorators) || empty($decorators)) { + return $value; + } + switch (array_shift($decorators)) { + case 'nobr': + $value = '' . $value . ''; + break; + } + if (!empty($decorators)) { + return $this->_applyDecorators($value, $decorators); + } + return $value; + } + + /** + * Set column renderer + * + * @param \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer $renderer + * @return $this + */ + public function setRenderer($renderer) + { + $this->_renderer = $renderer; + return $this; + } + + /** + * Set renderer type class name + * + * @param string $type type of renderer + * @param string $className renderer class name + * @return void + */ + public function setRendererType($type, $className) + { + $this->_rendererTypes[$type] = $className; + } + + /** + * Get renderer class name by renderer type + * + * @return string + */ + protected function _getRendererByType() + { + $type = strtolower($this->getType()); + $rendererClass = isset( + $this->_rendererTypes[$type] + ) ? $this->_rendererTypes[$type] : $this->_rendererTypes['default']; + + return $rendererClass; + } + + /** + * Retrieve column renderer + * + * @return \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer + */ + public function getRenderer() + { + if ($this->_renderer === null) { + $rendererClass = $this->getData('renderer'); + if (empty($rendererClass)) { + $rendererClass = $this->_getRendererByType(); + } + $this->_renderer = $this->getLayout()->createBlock($rendererClass)->setColumn($this); + } + return $this->_renderer; + } + + /** + * Set column filter + * + * @param string $filterClass filter class name + * @return void + */ + public function setFilter($filterClass) + { + $filterBlock = $this->getLayout()->createBlock($filterClass); + $filterBlock->setColumn($this); + $this->_filter = $filterBlock; + } + + /** + * Set filter type class name + * + * @param string $type type of filter + * @param string $className filter class name + * @return void + */ + public function setFilterType($type, $className) + { + $this->_filterTypes[$type] = $className; + } + + /** + * Get column filter class name by filter type + * + * @return string + */ + protected function _getFilterByType() + { + $type = $this->getFilterType() ? strtolower($this->getFilterType()) : strtolower($this->getType()); + $filterClass = isset($this->_filterTypes[$type]) ? $this->_filterTypes[$type] : $this->_filterTypes['default']; + + return $filterClass; + } + + /** + * Get filter block + * + * @return AbstractFilter|false + */ + public function getFilter() + { + if ($this->_filter === null) { + $filterClass = $this->getData('filter'); + if (false === (bool)$filterClass && false === ($filterClass === null)) { + return false; + } + if (!$filterClass) { + $filterClass = $this->_getFilterByType(); + if ($filterClass === false) { + return false; + } + } + $this->_filter = $this->getLayout()->createBlock($filterClass)->setColumn($this); + } + + return $this->_filter; + } + + /** + * Get filter html code + * + * @return null|string + */ + public function getFilterHtml() + { + $filter = $this->getFilter(); + $output = $filter ? $filter->getHtml() : ' '; + return $output; + } + + /** + * Check if column is grouped + * + * @return bool + */ + public function isGrouped() + { + return $this->_isGrouped; + } +} From fe68f61527b187e6a7b738771e717ebe6650b324 Mon Sep 17 00:00:00 2001 From: Ranjith VK Date: Mon, 10 Jul 2017 14:59:05 +0530 Subject: [PATCH 07/25] fixed the SKU display for fixed bundle product. Added a new grid column block to render the correct SKU --- .../Reports/Block/Adminhtml/Grid/Column.php | 469 +----------------- .../ResourceModel/Product/Sold/Collection.php | 10 +- .../reports_report_product_sold_grid.xml | 2 +- 3 files changed, 19 insertions(+), 462 deletions(-) diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column.php index 860398fcab133..e6fbfdbd87e30 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column.php @@ -3,9 +3,9 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Backend\Block\Widget\Grid; +namespace Magento\Reports\Block\Adminhtml\Grid; -use Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilter; +use Magento\Backend\Block\Widget\Grid\Column as GridColumn; /** * Grid column block @@ -13,259 +13,8 @@ * @api * @deprecated in favour of UI component implementation */ -class Column extends \Magento\Backend\Block\Widget +class Column extends GridColumn { - /** - * Parent grid - * - * @var \Magento\Backend\Block\Widget\Grid - */ - protected $_grid; - - /** - * Column renderer - * - * @var \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer - */ - protected $_renderer; - - /** - * Column filter - * - * @var AbstractFilter - */ - protected $_filter; - - /** - * Column css classes - * - * @var string|null - */ - protected $_cssClass = null; - - /** - * Renderer types - * - * @var array - */ - protected $_rendererTypes = [ - 'action' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Action::class, - 'button' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Button::class, - 'checkbox' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Checkbox::class, - 'concat' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Concat::class, - 'country' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Country::class, - 'currency' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Currency::class, - 'date' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Date::class, - 'datetime' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Datetime::class, - 'default' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text::class, - 'draggable-handle' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\DraggableHandle::class, - 'input' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Input::class, - 'massaction' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Massaction::class, - 'number' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Number::class, - 'options' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Options::class, - 'price' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Price::class, - 'radio' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Radio::class, - 'select' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Select::class, - 'store' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Store::class, - 'text' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Longtext::class, - 'wrapline' => \Magento\Backend\Block\Widget\Grid\Column\Renderer\Wrapline::class, - ]; - - /** - * Filter types - * - * @var array - */ - protected $_filterTypes = [ - 'datetime' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Datetime::class, - 'date' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Date::class, - 'range' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Range::class, - 'number' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Range::class, - 'currency' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Range::class, - 'price' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Price::class, - 'country' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Country::class, - 'options' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Select::class, - 'massaction' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Massaction::class, - 'checkbox' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Checkbox::class, - 'radio' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Radio::class, - 'skip-list' => \Magento\Backend\Block\Widget\Grid\Column\Filter\SkipList::class, - 'store' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Store::class, - 'theme' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Theme::class, - 'default' => \Magento\Backend\Block\Widget\Grid\Column\Filter\Text::class, - ]; - - /** - * Column is grouped - * @var bool - */ - protected $_isGrouped = false; - - /** - * @return void - */ - public function _construct() - { - if ($this->hasData('grouped')) { - $this->_isGrouped = (bool)$this->getData('grouped'); - } - - parent::_construct(); - } - - /** - * Should column be displayed in grid - * - * @return bool - */ - public function isDisplayed() - { - return true; - } - - /** - * Set grid block to column - * - * @param \Magento\Backend\Block\Widget\Grid $grid - * @return $this - */ - public function setGrid($grid) - { - $this->_grid = $grid; - // Init filter object - $this->getFilter(); - return $this; - } - - /** - * Get grid block - * - * @return \Magento\Backend\Block\Widget\Grid - */ - public function getGrid() - { - return $this->_grid; - } - - /** - * Retrieve html id of filter - * - * @return string - */ - public function getHtmlId() - { - return $this->getGrid()->getId() . '_' . $this->getGrid()->getVarNameFilter() . '_' . $this->getId(); - } - - /** - * Get html code for column properties - * - * @return string - */ - public function getHtmlProperty() - { - return $this->getRenderer()->renderProperty(); - } - - /** - * Get Header html - * @return string - */ - public function getHeaderHtml() - { - return $this->getRenderer()->renderHeader(); - } - - /** - * Get column css classes - * - * @return string - */ - public function getCssClass() - { - if ($this->_cssClass === null) { - if ($this->getAlign()) { - $this->_cssClass .= 'a-' . $this->getAlign(); - } - // Add a custom css class for column - if ($this->hasData('column_css_class')) { - $this->_cssClass .= ' ' . $this->getData('column_css_class'); - } - if ($this->getEditable()) { - $this->_cssClass .= ' editable'; - } - $this->_cssClass .= ' col-' . $this->getId(); - } - return $this->_cssClass; - } - - /** - * Get column css property - * - * @return string - */ - public function getCssProperty() - { - return $this->getRenderer()->renderCss(); - } - - /** - * Set is column sortable - * - * @param bool $value - * @return void - */ - public function setSortable($value) - { - $this->setData('sortable', $value); - } - - /** - * Get header css class name - * @return string - */ - public function getHeaderCssClass() - { - $class = $this->getData('header_css_class'); - $class .= false === $this->getSortable() ? ' no-link' : ''; - $class .= ' col-' . $this->getId(); - return $class; - } - - /** - * @return bool - * @SuppressWarnings(PHPMD.BooleanGetMethodName) - */ - public function getSortable() - { - return $this->hasData('sortable') ? (bool)$this->getData('sortable') : true; - } - - /** - * Add css class to column header - * - * @param string $className - * @return void - */ - public function addHeaderCssClass($className) - { - $classes = $this->getData('header_css_class') ? $this->getData('header_css_class') . ' ' : ''; - $this->setData('header_css_class', $classes . $className); - } - - /** - * Get header class names - * @return string - */ - public function getHeaderHtmlProperty() - { - $str = ''; - if ($class = $this->getHeaderCssClass()) { - $str .= ' class="' . $class . '"'; - } - - return $str; - } - /** * Retrieve row column field value for display * @@ -274,21 +23,10 @@ public function getHeaderHtmlProperty() */ public function getRowField(\Magento\Framework\DataObject $row) { - $renderedValue = $this->getRenderer()->render($row); - if ($this->getHtmlDecorators()) { - $renderedValue = $this->_applyDecorators($renderedValue, $this->getHtmlDecorators()); - } + $renderedValue = parent::getRowField($row); - /* - * if column has determined callback for framing call - * it before give away rendered value - * - * callback_function($renderedValue, $row, $column, $isExport) - * should return new version of rendered value - */ - $frameCallback = $this->getFrameCallback(); - if (is_array($frameCallback)) { - $renderedValue = call_user_func($frameCallback, $renderedValue, $row, $this, false); + if($row->getData('child_items_sku') != null) { + $renderedValue .= ' (' . $row->getData('child_items_sku') . ')'; } return $renderedValue; @@ -302,201 +40,12 @@ public function getRowField(\Magento\Framework\DataObject $row) */ public function getRowFieldExport(\Magento\Framework\DataObject $row) { - $renderedValue = $this->getRenderer()->renderExport($row); + $renderedValue = parent::getRowFieldExport($row); - /* - * if column has determined callback for framing call - * it before give away rendered value - * - * callback_function($renderedValue, $row, $column, $isExport) - * should return new version of rendered value - */ - $frameCallback = $this->getFrameCallback(); - if (is_array($frameCallback)) { - $renderedValue = call_user_func($frameCallback, $renderedValue, $row, $this, true); + if($row->getData('child_items_sku') != null) { + $renderedValue .= ' (' . $row->getData('child_items_sku') . ')'; } return $renderedValue; } - - /** - * Retrieve Header Name for Export - * - * @return string - */ - public function getExportHeader() - { - if ($this->getHeaderExport()) { - return $this->getHeaderExport(); - } - return $this->getHeader(); - } - - /** - * Decorate rendered cell value - * - * @param string $value - * @param array|string $decorators - * @return string - */ - protected function &_applyDecorators($value, $decorators) - { - if (!is_array($decorators)) { - if (is_string($decorators)) { - $decorators = explode(' ', $decorators); - } - } - if (!is_array($decorators) || empty($decorators)) { - return $value; - } - switch (array_shift($decorators)) { - case 'nobr': - $value = '' . $value . ''; - break; - } - if (!empty($decorators)) { - return $this->_applyDecorators($value, $decorators); - } - return $value; - } - - /** - * Set column renderer - * - * @param \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer $renderer - * @return $this - */ - public function setRenderer($renderer) - { - $this->_renderer = $renderer; - return $this; - } - - /** - * Set renderer type class name - * - * @param string $type type of renderer - * @param string $className renderer class name - * @return void - */ - public function setRendererType($type, $className) - { - $this->_rendererTypes[$type] = $className; - } - - /** - * Get renderer class name by renderer type - * - * @return string - */ - protected function _getRendererByType() - { - $type = strtolower($this->getType()); - $rendererClass = isset( - $this->_rendererTypes[$type] - ) ? $this->_rendererTypes[$type] : $this->_rendererTypes['default']; - - return $rendererClass; - } - - /** - * Retrieve column renderer - * - * @return \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer - */ - public function getRenderer() - { - if ($this->_renderer === null) { - $rendererClass = $this->getData('renderer'); - if (empty($rendererClass)) { - $rendererClass = $this->_getRendererByType(); - } - $this->_renderer = $this->getLayout()->createBlock($rendererClass)->setColumn($this); - } - return $this->_renderer; - } - - /** - * Set column filter - * - * @param string $filterClass filter class name - * @return void - */ - public function setFilter($filterClass) - { - $filterBlock = $this->getLayout()->createBlock($filterClass); - $filterBlock->setColumn($this); - $this->_filter = $filterBlock; - } - - /** - * Set filter type class name - * - * @param string $type type of filter - * @param string $className filter class name - * @return void - */ - public function setFilterType($type, $className) - { - $this->_filterTypes[$type] = $className; - } - - /** - * Get column filter class name by filter type - * - * @return string - */ - protected function _getFilterByType() - { - $type = $this->getFilterType() ? strtolower($this->getFilterType()) : strtolower($this->getType()); - $filterClass = isset($this->_filterTypes[$type]) ? $this->_filterTypes[$type] : $this->_filterTypes['default']; - - return $filterClass; - } - - /** - * Get filter block - * - * @return AbstractFilter|false - */ - public function getFilter() - { - if ($this->_filter === null) { - $filterClass = $this->getData('filter'); - if (false === (bool)$filterClass && false === ($filterClass === null)) { - return false; - } - if (!$filterClass) { - $filterClass = $this->_getFilterByType(); - if ($filterClass === false) { - return false; - } - } - $this->_filter = $this->getLayout()->createBlock($filterClass)->setColumn($this); - } - - return $this->_filter; - } - - /** - * Get filter html code - * - * @return null|string - */ - public function getFilterHtml() - { - $filter = $this->getFilter(); - $output = $filter ? $filter->getHtml() : ' '; - return $output; - } - - /** - * Check if column is grouped - * - * @return bool - */ - public function isGrouped() - { - return $this->_isGrouped; - } } diff --git a/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php b/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php index 31bf787ff1b78..2672ae53be6da 100644 --- a/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php +++ b/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php @@ -73,8 +73,16 @@ public function addOrderedQty($from = '', $to = '') ['order' => $this->getTable('sales_order')], implode(' AND ', $orderJoinCondition), [] + )->joinLeft( + ['child_items' => $this->getTable('sales_order_item')], + 'child_items.parent_item_id=order_items.item_id + AND order_items.product_type="bundle" + AND order_items.sku NOT LIKE CONCAT(\'%\', child_items.sku, \'%\')', + [ + 'child_items_sku' => 'child_items.sku' + ] )->where( - 'parent_item_id IS NULL' + 'order_items.parent_item_id IS NULL' )->having( 'order_items.qty_ordered > ?', 0 diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml index de82b724e8cf0..5ae51554063f3 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml @@ -41,7 +41,7 @@ col-product - + SKU text From b05ff2bc0274cd2a286b6c19904bec78c36b796a Mon Sep 17 00:00:00 2001 From: Ranjith VK Date: Mon, 10 Jul 2017 15:39:57 +0530 Subject: [PATCH 08/25] did code formating --- app/code/Magento/Reports/Block/Adminhtml/Grid/Column.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column.php index e6fbfdbd87e30..49f897698c711 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Reports\Block\Adminhtml\Grid; use Magento\Backend\Block\Widget\Grid\Column as GridColumn; @@ -25,7 +26,7 @@ public function getRowField(\Magento\Framework\DataObject $row) { $renderedValue = parent::getRowField($row); - if($row->getData('child_items_sku') != null) { + if ($row->getData('child_items_sku') != null) { $renderedValue .= ' (' . $row->getData('child_items_sku') . ')'; } @@ -42,7 +43,7 @@ public function getRowFieldExport(\Magento\Framework\DataObject $row) { $renderedValue = parent::getRowFieldExport($row); - if($row->getData('child_items_sku') != null) { + if ($row->getData('child_items_sku') != null) { $renderedValue .= ' (' . $row->getData('child_items_sku') . ')'; } From 7746c179f75bf3ba4f0dbacd24f57bb4c0281193 Mon Sep 17 00:00:00 2001 From: Pieter Cappelle Date: Tue, 11 Jul 2017 21:35:00 +0200 Subject: [PATCH 09/25] Display duplicate Admin elements in error message --- .../Adminhtml/Product/Attribute/Validate.php | 14 ++++++++++---- app/code/Magento/Catalog/i18n/en_US.csv | 2 +- .../catalog/product/attribute/options.phtml | 2 +- .../catalog/product/attribute/unique-validate.js | 16 ++++++++++++++-- app/code/Magento/Swatches/i18n/en_US.csv | 2 +- .../catalog/product/attribute/text.phtml | 2 +- .../catalog/product/attribute/visual.phtml | 2 +- 7 files changed, 29 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php index b41c67bb82e00..f14cb709c9ebb 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php @@ -128,7 +128,7 @@ private function isUniqueAdminValues(array $optionsValues, array $deletedOptions } } $uniqueValues = array_unique($adminValues); - return ($uniqueValues === $adminValues); + return array_diff_assoc($adminValues, $uniqueValues); } /** @@ -157,10 +157,16 @@ private function checkUniqueOption(DataObject $response, array $options = null) if (is_array($options) && !empty($options['value']) && !empty($options['delete']) - && !$this->isUniqueAdminValues($options['value'], $options['delete']) ) { - $this->setMessageToResponse($response, [__("The value of Admin must be unique.")]); - $response->setError(true); + $duplicates = $this->isUniqueAdminValues($options['value'], $options['delete']); + if ($duplicates) { + $this->setMessageToResponse( + $response, + [__('The value of Admin must be unique. (%1)', implode(', ', $duplicates))] + ); + + $response->setError(true); + } } return $this; } diff --git a/app/code/Magento/Catalog/i18n/en_US.csv b/app/code/Magento/Catalog/i18n/en_US.csv index 94b32f979383d..04500182eba22 100644 --- a/app/code/Magento/Catalog/i18n/en_US.csv +++ b/app/code/Magento/Catalog/i18n/en_US.csv @@ -716,4 +716,4 @@ Disable,Disable none,none Overview,Overview Details,Details -"The value of Admin must be unique.", "The value of Admin must be unique." +"The value of Admin must be unique. (%1)", "The value of Admin must be unique. (%1)" diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml index a0041d2e02988..6afc1bbca83f9 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml @@ -101,7 +101,7 @@ $stores = $block->getStoresSortedBySortOrder(); }, "Magento_Catalog/catalog/product/attribute/unique-validate": { "element": "required-dropdown-attribute-unique", - "message": "escapeHtml(__("The value of Admin must be unique.")) ?>" + "message": "escapeHtml(__("The value of Admin must be unique. (%1)")) ?>" } } } diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js index 034085df6cbb3..e500b53d0227c 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js @@ -17,6 +17,12 @@ define([ }, config); if (typeof _config.element === 'string') { + var msg = ''; + + var messager = function() { + return msg; + }; + jQuery.validator.addMethod( _config.element, @@ -25,21 +31,27 @@ define([ .closest('table') .find('.' + _config.uniqueClass + ':visible'), valuesHash = {}, - isValid = true; + isValid = true, + duplicates = []; inputs.each(function (el) { var inputValue = inputs[el].value; if (typeof valuesHash[inputValue] !== 'undefined') { isValid = false; + duplicates.push(inputValue); } valuesHash[inputValue] = el; }); + if (!isValid) { + msg = _config.message.replace('%1', duplicates.join(', ')); + } + return isValid; }, - _config.message + messager ); } }; diff --git a/app/code/Magento/Swatches/i18n/en_US.csv b/app/code/Magento/Swatches/i18n/en_US.csv index 98787122894d7..c64c619454e0e 100644 --- a/app/code/Magento/Swatches/i18n/en_US.csv +++ b/app/code/Magento/Swatches/i18n/en_US.csv @@ -33,5 +33,5 @@ Image,Image "Image Size","Image Size" "Example format: 200x300.","Example format: 200x300." "Image Position","Image Position" -"The value of Admin must be unique.","The value of Admin must be unique." +"The value of Admin must be unique. (%1)","The value of Admin must be unique. (%1)" Description,Description diff --git a/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/text.phtml b/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/text.phtml index 8d4400b3d0477..2cc3b9d31b0dc 100644 --- a/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/text.phtml +++ b/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/text.phtml @@ -108,7 +108,7 @@ $stores = $block->getStoresSortedBySortOrder(); "Magento_Swatches/js/text": getJsonConfig() ?> , "Magento_Catalog/catalog/product/attribute/unique-validate": { "element": "required-text-swatch-unique", - "message": "escapeHtml(__("The value of Admin must be unique.")) ?>" + "message": "escapeHtml(__("The value of Admin must be unique. (%1)")) ?>" } } } diff --git a/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml b/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml index 5b971d9a99a3b..5e437a85073fb 100644 --- a/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml +++ b/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml @@ -113,7 +113,7 @@ $stores = $block->getStoresSortedBySortOrder(); "Magento_Swatches/js/visual": getJsonConfig() ?> , "Magento_Catalog/catalog/product/attribute/unique-validate": { "element": "required-visual-swatch-unique", - "message": "escapeHtml(__("The value of Admin must be unique.")) ?>" + "message": "escapeHtml(__("The value of Admin must be unique. (%1)")) ?>" } } } From 25ae2e9f08f1c100ca767444ba38a2de3957c3be Mon Sep 17 00:00:00 2001 From: Pieter Cappelle Date: Wed, 12 Jul 2017 08:13:12 +0200 Subject: [PATCH 10/25] Fix jslint errors --- .../web/catalog/product/attribute/unique-validate.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js index e500b53d0227c..60351f0079a9c 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js @@ -10,6 +10,7 @@ define([ 'use strict'; return function (config) { + var msg = ''; var _config = jQuery.extend({ element: null, message: '', @@ -17,9 +18,7 @@ define([ }, config); if (typeof _config.element === 'string') { - var msg = ''; - - var messager = function() { + var messager = function () { return msg; }; From 2200f175405274c88072018eb9f98e29439a32d3 Mon Sep 17 00:00:00 2001 From: Pieter Cappelle Date: Wed, 12 Jul 2017 10:50:12 +0200 Subject: [PATCH 11/25] Fix jslint errors - 2 --- .../product/attribute/unique-validate.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js index 60351f0079a9c..2504d770f9518 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js @@ -10,18 +10,17 @@ define([ 'use strict'; return function (config) { - var msg = ''; - var _config = jQuery.extend({ - element: null, - message: '', - uniqueClass: 'required-unique' - }, config); - - if (typeof _config.element === 'string') { - var messager = function () { + var msg = '', + _config = jQuery.extend({ + element: null, + message: '', + uniqueClass: 'required-unique' + }, config), + messager = function () { return msg; }; + if (typeof _config.element === 'string') { jQuery.validator.addMethod( _config.element, From d1657aeadc1519060f51ee6d3d6c8e6b870e0092 Mon Sep 17 00:00:00 2001 From: Pieter Cappelle Date: Wed, 12 Jul 2017 14:02:36 +0200 Subject: [PATCH 12/25] Fix jslint errors - 3 --- .../adminhtml/web/catalog/product/attribute/unique-validate.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js index 2504d770f9518..63420be9d51fd 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js @@ -16,6 +16,7 @@ define([ message: '', uniqueClass: 'required-unique' }, config), + /** @inheritdoc */ messager = function () { return msg; }; From 7911d0e55564f74c62ac3a8c1cc34c1823bdfc51 Mon Sep 17 00:00:00 2001 From: Pieter Cappelle Date: Wed, 12 Jul 2017 17:16:45 +0200 Subject: [PATCH 13/25] Fix jslint errors - 4 --- .../adminhtml/web/catalog/product/attribute/unique-validate.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js index 63420be9d51fd..ed96bfbef0089 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js @@ -16,6 +16,7 @@ define([ message: '', uniqueClass: 'required-unique' }, config), + /** @inheritdoc */ messager = function () { return msg; From 8e22bacb8e5ff15634a93fc4e1336616156988bf Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Thu, 13 Jul 2017 17:52:47 -0500 Subject: [PATCH 14/25] Updated php tags format --- .../frontend/templates/product/list.phtml | 54 ++++++++-------- .../templates/product/list/items.phtml | 52 ++++++++-------- .../frontend/templates/product/listing.phtml | 16 ++--- .../widget/new/column/new_default_list.phtml | 40 ++++++------ .../product/widget/new/content/new_grid.phtml | 52 ++++++++-------- .../product/widget/new/content/new_list.phtml | 62 +++++++++---------- .../product/widget/content/grid.phtml | 44 ++++++------- .../column/compared_default_list.phtml | 34 +++++----- .../compared/content/compared_grid.phtml | 52 ++++++++-------- .../compared/content/compared_list.phtml | 60 +++++++++--------- .../viewed/column/viewed_default_list.phtml | 32 +++++----- .../viewed/column/viewed_images_list.phtml | 8 +-- .../widget/viewed/content/viewed_grid.phtml | 52 ++++++++-------- .../widget/viewed/content/viewed_list.phtml | 60 +++++++++--------- .../view/frontend/templates/item/list.phtml | 6 +- 15 files changed, 312 insertions(+), 312 deletions(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml index 0109cdd348dea..b48c138e5450b 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml @@ -20,10 +20,10 @@ $_productCollection = $block->getLoadedProductCollection(); $_helper = $this->helper('Magento\Catalog\Helper\Output'); ?> count()): ?> -
+
- getToolbarHtml() ?> - getAdditionalHtml() ?> + getToolbarHtml() ?> + getAdditionalHtml() ?> getMode() == 'grid') { $viewMode = 'grid'; @@ -41,7 +41,7 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); */ $pos = $block->getPositioned(); ?> -
+
    @@ -55,8 +55,8 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); } ?> - - toHtml(); ?> + + toHtml() ?>
    helper('Magento\Catalog\Helper\Output'); ?> - productAttribute($_product, $_product->getName(), 'name'); ?> + href="getProductUrl() ?>"> + productAttribute($_product, $_product->getName(), 'name') ?> - getReviewsSummaryHtml($_product, $templateType); ?> - getProductPrice($_product) ?> - getProductDetailsHtml($_product); ?> + getReviewsSummaryHtml($_product, $templateType) ?> + getProductPrice($_product) ?> + getProductDetailsHtml($_product) ?>
    -
    > -
    > +
    > +
    > isSaleable()): ?> getAddToCartPostParams($_product); ?> -
    - - - getBlockHtml('formkey')?> + + + + getBlockHtml('formkey') ?>
    isAvailable()): ?> -
    +
    -
    +
    -
    > +
    > getChildBlock('addto')): ?> - setProduct($_product)->getChildHtml(); ?> + setProduct($_product)->getChildHtml() ?>
    - productAttribute($_product, $_product->getShortDescription(), 'short_description') ?> - + productAttribute($_product, $_product->getShortDescription(), 'short_description') ?> +
    @@ -115,7 +115,7 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output');
- getToolbarHtml() ?> + getToolbarHtml() ?> isRedirectToCartEnabled()) : ?>