0

I am using Codazon Fastest theme and my Magento version is 2.2.6. The issue is looking like a responsive problem.

When the site is loading, the grids look like attachment 1. When I make restore and maximize the browser window, it looks like attachemnt 2.

I could not solve the problem.

Does anybody have any idea?

Attachment 1
Attachment 1

Attachment 2
Attachment 2

And the custom grid.phtml is

<?php
use Magento\Framework\App\Action\Action;
?>

<?php
$_productCollection = $block->getProductCollection();
$_helper = $this->helper('Magento\Catalog\Helper\Output');
$_productSize = $_productCollection->count();
$uniqId = uniqid('block_');
?>
<?php if (!$_productSize): ?>
    <div class="message info empty"><div><?php /* @escapeNotVerified */ echo __('We can\'t find products matching the selection.') ?></div></div>
<?php else: ?>
    <?php echo $block->getToolbarHtml() ?>
    <?php echo $block->getAdditionalHtml() ?>
    <?php
    $viewMode = 'grid';
    $image = 'category_page_grid';
    $image_hover = 'category_page_grid_hover';
    $showDescription = false;
    $title = $block->getTitle() ? __($block->getTitle()) : '';
    $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW;
    $classid = md5(json_encode($block->getData()));
    $labelHelper = $this->helper('Codazon\ProductLabel\Helper\Data');
    /**
     * Position for actions regarding image size changing in vde if needed
     */
    $pos = $block->getPositioned();
    $row = 2;
    ?>
    <div class="block widget block-products-list <?php /* @escapeNotVerified */ echo $viewMode; ?>">
        <?php if ($title):?>
        <div class="block-title">
            <strong><?php /* @escapeNotVerified */ echo $title; ?></strong>
        </div>
        <?php endif ?>
        <div class="block-content <?php echo $classid ?>">
            <div class="products wrapper <?php /* @escapeNotVerified */ echo $viewMode; ?> products-<?php /* @escapeNotVerified */ echo $viewMode; ?>">
                <?php $iterator = 0; ?>
                <div class="products list items product-items same-height <?php echo $block->getData('show_slider') ? 'cdz-slider' : '' ?>"
                    <?php if($block->getData('show_slider')) : ?>
                    <?php $slider_item =  $block->getData('slider_item') > 0 ?  $block->getData('slider_item') : 7 ?>
                        data-items="<?php echo $slider_item ?>"
                        data-items-0="2"
                        data-items-480="2"
                        data-items-768="<?php echo abs($slider_item-2) ?>"                      
                        data-items-1024="<?php echo abs($slider_item-1) ?>" 
                        data-items-1280="<?php echo $slider_item ?>"
                        data-items-1440="<?php echo $slider_item ?>"
                        data-loop="false"
                        data-margin="-1"
                    <?php endif; ?>
                >
                    <?php /** @var $_product \Magento\Catalog\Model\Product */ ?>
                    <?php foreach ($_productCollection as $_product): ?>

                    <?php if ($iterator%$row==0 || $iterator == 0): ?>
                    <div class="item-slider"> 
                        <?php endif; ?>
                        <div class="item product product-item">
                        <div class="product-item-info" data-container="product-grid">
                            <?php
                            $productImage = $block->getImage($_product, $image);
                            $productHoverImage = $block->getImage($_product, $image_hover);
                            if ($pos != null) {
                                $position = ' style="left:' . $productImage->getWidth() . 'px;'
                                    . 'top:' . $productImage->getHeight() . 'px;"';
                            }
                            ?>
                            <?php // Product Image ?>
                            <?php if($block->isShow('thumb')): ?>
                            <div class="cdz-hover-section">
                                <div class="cdz-product-top">
                            <a href="<?php /* @escapeNotVerified */ echo $_product->getProductUrl() ?>" class="product photo product-item-photo" tabindex="-1">
                                <span class="main-image">
                                    <?php echo $productImage->toHtml(); ?>
                                </span>
                                <span class="hover-image">
                                    <?php echo $productHoverImage->toHtml(); ?>
                                </span>
                            </a>
                                </div>
                                <?php $labelHelper->showLabel($_product) ?>                                                                
                            </div>
                            <?php endif ?>
                            <div class="product details product-item-details">
                                <?php
                                    $_productNameStripped = $block->stripTags($_product->getName(), null, true);
                                ?>
                                <?php if($block->isShow('name')): ?>
                                <strong class="product name product-item-name">
                                    <a class="product-item-link"
                                       href="<?php /* @escapeNotVerified */ echo $_product->getProductUrl() ?>">
                                        <?php /* @escapeNotVerified */ echo $_helper->productAttribute($_product, $_product->getName(), 'name'); ?>
                                    </a>
                                </strong>
                                <?php endif ?>
                                <?php if($block->isShow('description')): ?>

                                    <?php $desc = $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description');
                                    $descLength = 100;
                                    if(strlen($desc)> $descLength ) { 
                                        $strCutDesc = substr($desc, 0, $descLength);
                                        $desc = substr($strCutDesc, 0, strrpos($strCutDesc, ' ')).'&hellip;';
                                    }
                                    $desc = $this->stripTags($desc,null,true);
?>
                                    <div class="product description product-item-description">
                                        <?php /* @escapeNotVerified */ echo $desc; ?>
                                    </div>
                                <?php endif; ?> 
                                <?php if($block->isShow('price')): ?>
                                <?php /* @escapeNotVerified */ echo $block->getProductPrice($_product) ?>
                                <?php endif ?>
                                <?php if($block->isShow('review')): ?>
                                <?php echo $block->getReviewsSummaryHtml($_product, $templateType); ?>
                                <?php endif ?>

                                <?php echo $block->getProductDetailsHtml($_product); ?>


                                <div class="cdz-product-bottom">
                                    <div class="cdz-buttons-container">
                                        <div class="cdz-buttons-inner">
                                        <?php if($block->isShow('addtocart')): ?>
                                            <?php if ($_product->isSaleable()): ?>
                                                <?php $postParams = $block->getAddToCartPostParams($_product); ?>
                                                <form data-role="tocart-form" action="<?php /* @escapeNotVerified */ echo $postParams['action']; ?>" method="post">
                                                    <input type="hidden" name="product" value="<?php /* @escapeNotVerified */ echo $postParams['data']['product']; ?>">
                                                    <input type="hidden" name="<?php /* @escapeNotVerified */ echo Action::PARAM_NAME_URL_ENCODED; ?>" value="<?php /* @escapeNotVerified */ echo $postParams['data'][Action::PARAM_NAME_URL_ENCODED]; ?>">
                                                    <?php echo $block->getBlockHtml('formkey')?>
                                                    <button type="submit"
                                                            title="<?php echo $block->escapeHtml(__('Add to Cart')); ?>"
                                                            class="action tocart primary">
                                                        <span><?php /* @escapeNotVerified */ echo __('Add to Cart') ?></span>
                                                    </button>
                                                </form>
                                            <?php else: ?>
                                                <?php if ($_product->getIsSalable()): ?>
                                                    <div class="stock available"><span><?php /* @escapeNotVerified */ echo __('In stock') ?></span></div>
                                                <?php else: ?>
                                                    <div class="stock unavailable"><span><?php /* @escapeNotVerified */ echo __('Out of stock') ?></span></div>
                                                <?php endif; ?>
                                            <?php endif; ?>

                                        <?php endif ?>
                                        <?php if($block->isShow('addto')): ?>
                                        <div data-role="add-to-links" class="actions-secondary"<?php echo strpos($pos, $viewMode . '-secondary') ? $position : ''; ?>>
                                            <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()): ?>
                                                <a href="#"
                                                   class="action towishlist"
                                                   title="<?php echo $block->escapeHtml(__('Add to Wish List')); ?>"
                                                   aria-label="<?php echo $block->escapeHtml(__('Add to Wish List')); ?>"
                                                   data-post='<?php /* @escapeNotVerified */ echo $block->getAddToWishlistParams($_product); ?>'
                                                   data-action="add-to-wishlist"
                                                   role="button">
                                                    <span><?php /* @escapeNotVerified */ echo __('Add to Wish List') ?></span>
                                                </a>
                                            <?php endif; ?>
                                            <?php
                                            $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');
                                            ?>
                                            <a href="#"
                                               class="action tocompare"
                                               title="<?php echo $block->escapeHtml(__('Add to Compare')); ?>"
                                               aria-label="<?php echo $block->escapeHtml(__('Add to Compare')); ?>"
                                               data-post='<?php /* @escapeNotVerified */ echo $compareHelper->getPostDataParams($_product); ?>'
                                               role="button">
                                                <span><?php /* @escapeNotVerified */ echo __('Add to Compare') ?></span>
                                            </a>
                                        </div>                                      
                                        <?php endif ?>
                                        <?php echo $this->helper('Codazon\QuickShop\Helper\Data')->getQuickShopButton($_product); ?>
                                        </div>
                                    </div>

                                </div>
                            </div>
                        </div>
                        </div>
                    <?php if ( ($iterator+1)%$row==0 || $iterator+1==$_productSize ): ?>
                        </div>
                    <?php endif; ?>
                        <?php $iterator++; ?>
                    <?php endforeach; ?>
                </div>
            </div>

            <?php if (!$block->isRedirectToCartEnabled()) : ?>
                <script type="text/x-magento-init">
                {
                    "[data-role=tocart-form], .form.map.checkout": {
                        "catalogAddToCart": {}
                    }
                }
                </script>
            <?php endif; ?>
        </div>
    </div>

<?php endif; ?>
  • Can you add any custom javascript in this page or in layout?. – Monark Bhawani Aug 9 at 7:51
  • Nope ! It is pure theme installation. – ozan yeni Aug 9 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.