Skip to content

Commit

Permalink
https://github.com/tradefurniturecompany/site/issues/189
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Oct 30, 2020
1 parent 53e9133 commit e367af4
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 70 deletions.
Original file line number Diff line number Diff line change
@@ -1,37 +1,28 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

?>
<?php
/**
* Category view template
*
* @var $block \Magento\Catalog\Block\Category\View
*/
?>
<?php if ($_description = $block->getCurrentCategory()->getDescription()): ?>
<div class="category-description">
<?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Output')->categoryAttribute($block->getCurrentCategory(), $_description, 'description') ?>
</div>
<script type="text/javascript">
require(["jquery"],function($){
$(document).ready(function() {
$("#toggle").click(function() {
var elem = $("#toggle").text();
if (elem == "Read more...") {
$("#toggle").text("Read less...");
$(".text-wrapper").css("height","auto")
} else {
$("#toggle").text("Read more...");
$(".text-wrapper").css("height","54px")
}
});
});
});
</script>
<?php endif; ?>
use Magento\Catalog\Block\Category\View as B;
use Magento\Catalog\Model\Category as C;
/* @var B $block */ $b = $block; /** @var B $b */
$c = $b->getCurrentCategory(); /** @var C $c */
if ($v = $c->getDescription()) { /** @var string $v */?>
<div class='category-description'>
<?php
# 2020-10-30 Dmitry Fedyuk https://www.upwork.com/fl/mage2pro
# https://stackoverflow.com/a/3809121
?>
<?= df_trim(preg_replace('#<p[^>]*>[ \s]*<\/p[^>]*>#', '',
df_catalog_output()->categoryAttribute($c, $v, 'description'))
); ?>
</div>
<script type='text/javascript'>
require(['jquery', 'domReady!'], function($) {
$('#toggle').click(function() {
var $this = $(this);
var elem = $this.text();
var more = 'Read more...';
var bMore = more === elem;
$this.text(bMore ? 'Read less...' : more);
$('.text-wrapper').css('height', bMore ? 'auto' : '54px');
});
});
</script>
<?php }
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,17 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output');
<?= $productImage->toHtml() ?>
</a>
<div class="product details product-item-details">
<?= /* @escapeNotVerified */
$block->getProductPrice($_product) ?>
<div class='price-and-wishlist'>
<?= $block->getProductPrice($_product) ?>
<div class="product actions product-item-actions actions-secondary-container">
<div data-role="add-to-links"
class="actions-secondary"<?= strpos($pos, $viewMode . '-secondary') ? $position : '' ?>>
<?php if ($addToBlock = $block->getChildBlock('addto')): ?>
<?= $addToBlock->setProduct($_product)->getChildHtml() ?>
<?php endif; ?>
</div>
</div>
</div>
<?php
$_productNameStripped = $block->stripTags($_product->getName(), null, true);
?>
Expand All @@ -92,19 +101,7 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output');
</a>
</strong>


<?= $block->getProductDetailsHtml($_product) ?>

<div class="">
<div class="product actions product-item-actions"<?= strpos($pos, $viewMode . '-actions') ? $position : '' ?>>

<div data-role="add-to-links"
class="actions-secondary"<?= strpos($pos, $viewMode . '-secondary') ? $position : '' ?>>
<?php if ($addToBlock = $block->getChildBlock('addto')): ?>
<?= $addToBlock->setProduct($_product)->getChildHtml() ?>
<?php endif; ?>
</div>

<div class="actions-primary"<?= strpos($pos, $viewMode . '-primary') ? $position : '' ?>>
<?php if ($_product->isSaleable()): ?>
<?php $postParams = $block->getAddToCartPostParams($_product); ?>
Expand Down Expand Up @@ -140,22 +137,7 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output');
<?php endif; ?>
<?php endif; ?>
</div>


</div>
<?php if ($showDescription): ?>
<div class="product description product-item-description">
<?= /* @escapeNotVerified */
$_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
<a href="<?= /* @escapeNotVerified */
$_product->getProductUrl() ?>"
title="<?= /* @escapeNotVerified */
$_productNameStripped ?>"
class="action more"><?= /* @escapeNotVerified */
__('Learn More') ?></a>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?= ($iterator == count($_productCollection) + 1) ? '</li>' : '' ?>
Expand All @@ -173,10 +155,6 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output');
}
}
}




</script>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>

0 comments on commit e367af4

Please sign in to comment.