Magento 2.2.5: Error when trying to Override Widget












0















I'm doing override widget to my custom module.



So everything was great in the backend, until i come to the frontend and see nothing at all.



I mean it works perfect in backend, but not with the frontend.



I'm following CatalogWidget.



So here is my custom module, check it out:



enter image description here



Its under namespace Gssi.




C:xampphtdocsbezdanappcodeGssiProductsSliderBlockProductProductsList.php




<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

namespace GssiProductsSliderBlockProduct;

use MagentoFrameworkDataObjectIdentityInterface;
use MagentoWidgetBlockBlockInterface;
use MagentoCatalogWidgetBlockProductProductsList as CatalogWidgetProductList;

/**
* Catalog Products List widget block
* Class ProductsList
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ProductsList extends CatalogWidgetProductList implements BlockInterface, IdentityInterface
{
/**
* Default value for products count that will be shown
*/
const DEFAULT_PRODUCTS_COUNT = 10;

/**
* Name of request parameter for page number value
*
* @deprecated
*/
const PAGE_VAR_NAME = 'np';

/**
* Default value for products per page
*/
const DEFAULT_PRODUCTS_PER_PAGE = 5;

/**
* Default value whether show pager or not
*/
const DEFAULT_SHOW_PAGER = false;

/**
* Instance of pager block
*
* @var MagentoCatalogBlockProductWidgetHtmlPager
*/
protected $pager;

/**
* @var MagentoFrameworkAppHttpContext
*/
protected $httpContext;

/**
* Catalog product visibility
*
* @var MagentoCatalogModelProductVisibility
*/
protected $catalogProductVisibility;

/**
* Product collection factory
*
* @var MagentoCatalogModelResourceModelProductCollectionFactory
*/
protected $productCollectionFactory;

/**
* @var MagentoRuleModelConditionSqlBuilder
*/
protected $sqlBuilder;

/**
* @var MagentoCatalogWidgetModelRule
*/
protected $rule;

/**
* @var MagentoWidgetHelperConditions
*/
protected $conditionsHelper;

/**
* @param MagentoCatalogBlockProductContext $context
* @param MagentoCatalogModelResourceModelProductCollectionFactory $productCollectionFactory
* @param MagentoCatalogModelProductVisibility $catalogProductVisibility
* @param MagentoFrameworkAppHttpContext $httpContext
* @param MagentoRuleModelConditionSqlBuilder $sqlBuilder
* @param MagentoCatalogWidgetModelRule $rule
* @param MagentoWidgetHelperConditions $conditionsHelper
* @param array $data
*/
public function __construct(
MagentoCatalogBlockProductContext $context,
MagentoCatalogModelResourceModelProductCollectionFactory $productCollectionFactory,
MagentoCatalogModelProductVisibility $catalogProductVisibility,
MagentoFrameworkAppHttpContext $httpContext,
MagentoRuleModelConditionSqlBuilder $sqlBuilder,
MagentoCatalogWidgetModelRule $rule,
MagentoWidgetHelperConditions $conditionsHelper,
array $data =
) {
parent::__construct(
$context,
$productCollectionFactory,
$catalogProductVisibility,
$httpContext,
$sqlBuilder,
$rule,
$conditionsHelper
);
}

protected function _construct()
{
parent::_construct();
}

}


As i said, i'm following CatalogWidget module, so this block ProductsList.php is extends from it ( I'm not sure if i need to call every function in that ProductList.php and use parent::_FunctionName or they just called themselves.).




C:xampphtdocsbezdanappcodeGssiProductsSlideretcwidget.xml




<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
<widget id="products_list" class="GssiProductsSliderBlockProductProductsList" is_email_compatible="true"
placeholder_image="Magento_CatalogWidget::images/products_list.png" ttl="86400">
<label translate="true">Catalog Products List</label>
<description translate="true">List of Products</description>
<parameters>
<parameter name="title" xsi:type="text" required="false" visible="true">
<label translate="true">Title</label>
</parameter>
<parameter name="show_pager" xsi:type="select" visible="true"
source_model="MagentoConfigModelConfigSourceYesno">
<label translate="true">Display Page Control</label>
</parameter>
<parameter name="products_per_page" xsi:type="text" required="true" visible="true">
<label translate="true">Number of Products per Page</label>
<depends>
<parameter name="show_pager" value="1" />
</depends>
<value>5</value>
</parameter>
<parameter name="products_count" xsi:type="text" required="true" visible="true">
<label translate="true">Number of Products to Display</label>
<value>10</value>
</parameter>
<parameter name="template" xsi:type="select" required="true" visible="true">
<label translate="true">Template</label>
<options>
<option name="default" value="product/widget/content/grid.phtml" selected="true">
<label translate="true">Products Grid Template</label>
</option>
<option name="slider" value="product/widget/content/slider.phtml">
<label translate="true">Products Slider</label>
</option>
</options>
</parameter>
<parameter name="cache_lifetime" xsi:type="text" visible="true">
<label translate="true">Cache Lifetime (Seconds)</label>
<description translate="true">86400 by default, if not set. To refresh instantly, clear the Blocks HTML Output cache.</description>
</parameter>
<parameter name="condition" xsi:type="conditions" visible="true" required="true" sort_order="10"
class="MagentoCatalogWidgetBlockProductWidgetConditions">
<label translate="true">Conditions</label>
</parameter>
</parameters>
<containers>
<container name="content">
<template name="grid" value="default" />
</container>
<container name="content.top">
<template name="grid" value="default" />
</container>
<container name="content.bottom">
<template name="grid" value="default" />
</container>
</containers>
</widget>
</widgets>


The diffrence between my widget custom module and the widget of Catalog Widget module is i put 1 more <option> in the <parameter name="template">.




C:xampphtdocsbezdanappcodeGssiProductsSlideretcdi.xml




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="MagentoCatalogWidgetBlockProductProductsList" type="GssiProductsSliderBlockProductProductsList" />
</config>


In here, slider.phtml and grid.phtml is the same, and also, i copy it from C:xampphtdocsbezdanvendormagentomodule-catalog-widgetviewfrontendtemplatesproductwidgetcontentgrid.phtml

So i will not post grid.phtml here.




C:xampphtdocsbezdanappcodeGssiProductsSliderviewfrontendtemplatesproductwidgetcontentslider.phtml




<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

?>
<?php
echo 'dsadsdsdsadsdsa';
/**
* Template for displaying products list widget
*
* @var $block GssiProductsSliderBlockProductProductsList
*/
?>
<?php if ($exist = ($block->getProductCollection() && $block->getProductCollection()->getSize())):?>
<?php
$type = 'widget-product-grid';

$mode = 'grid';

$image = 'new_products_content_widget_grid';
$title = $block->getTitle() ? __($block->getTitle()) : '';
$items = $block->getProductCollection()->getItems();

$showWishlist = true;
$showCompare = true;
$showCart = true;
$templateType = MagentoCatalogBlockProductReviewRendererInterface::DEFAULT_VIEW;
$description = false;
?>
<div class="block widget block-products-list <?php /* @escapeNotVerified */ echo $mode; ?>">
<?php if ($title):?>
<div class="block-title">
<strong><?php /* @escapeNotVerified */ echo $title; ?></strong>
</div>
<?php endif ?>
<div class="block-content">
<?php /* @escapeNotVerified */ echo '<!-- ' . $image . '-->' ?>
<div class="products-<?php /* @escapeNotVerified */ echo $mode; ?> <?php /* @escapeNotVerified */ echo $mode; ?>">
<ol class="product-items <?php /* @escapeNotVerified */ echo $type; ?>">
<?php $iterator = 1; ?>
<?php foreach ($items as $_item): ?>
<?php /* @escapeNotVerified */ echo($iterator++ == 1) ? '<li class="product-item">' : '</li><li class="product-item">' ?>
<div class="product-item-info">
<a href="<?php /* @escapeNotVerified */ echo $block->getProductUrl($_item) ?>" class="product-item-photo">
<?php echo $block->getImage($_item, $image)->toHtml(); ?>
</a>
<div class="product-item-details">
<strong class="product-item-name">
<a title="<?php echo $block->escapeHtml($_item->getName()) ?>"
href="<?php /* @escapeNotVerified */ echo $block->getProductUrl($_item) ?>"
class="product-item-link">
<?php echo $block->escapeHtml($_item->getName()) ?>
</a>
</strong>
<?php
echo $block->getProductPriceHtml($_item, $type);
?>

<?php if ($templateType): ?>
<?php echo $block->getReviewsSummaryHtml($_item, $templateType) ?>
<?php endif; ?>

<?php if ($showWishlist || $showCompare || $showCart): ?>
<div class="product-item-actions">
<?php if ($showCart): ?>
<div class="actions-primary">
<?php if ($_item->isSaleable()): ?>
<?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?>
<button class="action tocart primary"
data-mage-init='{"redirectUrl":{"url":"<?php /* @escapeNotVerified */ echo $block->getAddToCartUrl($_item) ?>"}}'
type="button" title="<?php /* @escapeNotVerified */ echo __('Add to Cart') ?>">
<span><?php /* @escapeNotVerified */ echo __('Add to Cart') ?></span>
</button>
<?php else: ?>
<?php
$postDataHelper = $this->helper('MagentoFrameworkDataHelperPostHelper');
$postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()])
?>
<button class="action tocart primary"
data-post='<?php /* @escapeNotVerified */ echo $postData; ?>'
type="button" title="<?php /* @escapeNotVerified */ echo __('Add to Cart') ?>">
<span><?php /* @escapeNotVerified */ echo __('Add to Cart') ?></span>
</button>
<?php endif; ?>
<?php else: ?>
<?php if ($_item->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; ?>
</div>
<?php endif; ?>
<?php if ($showWishlist || $showCompare): ?>
<div class="actions-secondary" data-role="add-to-links">
<?php if ($this->helper('MagentoWishlistHelperData')->isAllow() && $showWishlist): ?>
<a href="#"
data-post='<?php /* @escapeNotVerified */ echo $block->getAddToWishlistParams($_item); ?>'
class="action towishlist" data-action="add-to-wishlist"
title="<?php /* @escapeNotVerified */ echo __('Add to Wish List') ?>">
<span><?php /* @escapeNotVerified */ echo __('Add to Wish List') ?></span>
</a>
<?php endif; ?>
<?php if ($block->getAddToCompareUrl() && $showCompare): ?>
<?php $compareHelper = $this->helper('MagentoCatalogHelperProductCompare');?>
<a href="#" class="action tocompare"
data-post='<?php /* @escapeNotVerified */ echo $compareHelper->getPostDataParams($_item);?>'
title="<?php /* @escapeNotVerified */ echo __('Add to Compare') ?>">
<span><?php /* @escapeNotVerified */ echo __('Add to Compare') ?></span>
</a>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</div>
<?php echo($iterator == count($items)+1) ? '</li>' : '' ?>
<?php endforeach ?>
</ol>
</div>
<?php echo $block->getPagerHtml() ?>
</div>
</div>
<?php endif;?>


The important thing is it seem like not running into the slider.phtml, because i've put echo "dsadsdsdsadsdsa" in the code, but it doesn't show up. So i dont know how to fix this.










share|improve this question





























    0















    I'm doing override widget to my custom module.



    So everything was great in the backend, until i come to the frontend and see nothing at all.



    I mean it works perfect in backend, but not with the frontend.



    I'm following CatalogWidget.



    So here is my custom module, check it out:



    enter image description here



    Its under namespace Gssi.




    C:xampphtdocsbezdanappcodeGssiProductsSliderBlockProductProductsList.php




    <?php
    /**
    * Copyright © 2013-2017 Magento, Inc. All rights reserved.
    * See COPYING.txt for license details.
    */

    // @codingStandardsIgnoreFile

    namespace GssiProductsSliderBlockProduct;

    use MagentoFrameworkDataObjectIdentityInterface;
    use MagentoWidgetBlockBlockInterface;
    use MagentoCatalogWidgetBlockProductProductsList as CatalogWidgetProductList;

    /**
    * Catalog Products List widget block
    * Class ProductsList
    * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
    */
    class ProductsList extends CatalogWidgetProductList implements BlockInterface, IdentityInterface
    {
    /**
    * Default value for products count that will be shown
    */
    const DEFAULT_PRODUCTS_COUNT = 10;

    /**
    * Name of request parameter for page number value
    *
    * @deprecated
    */
    const PAGE_VAR_NAME = 'np';

    /**
    * Default value for products per page
    */
    const DEFAULT_PRODUCTS_PER_PAGE = 5;

    /**
    * Default value whether show pager or not
    */
    const DEFAULT_SHOW_PAGER = false;

    /**
    * Instance of pager block
    *
    * @var MagentoCatalogBlockProductWidgetHtmlPager
    */
    protected $pager;

    /**
    * @var MagentoFrameworkAppHttpContext
    */
    protected $httpContext;

    /**
    * Catalog product visibility
    *
    * @var MagentoCatalogModelProductVisibility
    */
    protected $catalogProductVisibility;

    /**
    * Product collection factory
    *
    * @var MagentoCatalogModelResourceModelProductCollectionFactory
    */
    protected $productCollectionFactory;

    /**
    * @var MagentoRuleModelConditionSqlBuilder
    */
    protected $sqlBuilder;

    /**
    * @var MagentoCatalogWidgetModelRule
    */
    protected $rule;

    /**
    * @var MagentoWidgetHelperConditions
    */
    protected $conditionsHelper;

    /**
    * @param MagentoCatalogBlockProductContext $context
    * @param MagentoCatalogModelResourceModelProductCollectionFactory $productCollectionFactory
    * @param MagentoCatalogModelProductVisibility $catalogProductVisibility
    * @param MagentoFrameworkAppHttpContext $httpContext
    * @param MagentoRuleModelConditionSqlBuilder $sqlBuilder
    * @param MagentoCatalogWidgetModelRule $rule
    * @param MagentoWidgetHelperConditions $conditionsHelper
    * @param array $data
    */
    public function __construct(
    MagentoCatalogBlockProductContext $context,
    MagentoCatalogModelResourceModelProductCollectionFactory $productCollectionFactory,
    MagentoCatalogModelProductVisibility $catalogProductVisibility,
    MagentoFrameworkAppHttpContext $httpContext,
    MagentoRuleModelConditionSqlBuilder $sqlBuilder,
    MagentoCatalogWidgetModelRule $rule,
    MagentoWidgetHelperConditions $conditionsHelper,
    array $data =
    ) {
    parent::__construct(
    $context,
    $productCollectionFactory,
    $catalogProductVisibility,
    $httpContext,
    $sqlBuilder,
    $rule,
    $conditionsHelper
    );
    }

    protected function _construct()
    {
    parent::_construct();
    }

    }


    As i said, i'm following CatalogWidget module, so this block ProductsList.php is extends from it ( I'm not sure if i need to call every function in that ProductList.php and use parent::_FunctionName or they just called themselves.).




    C:xampphtdocsbezdanappcodeGssiProductsSlideretcwidget.xml




    <?xml version="1.0" encoding="UTF-8"?>
    <!--
    /**
    * Copyright © 2013-2017 Magento, Inc. All rights reserved.
    * See COPYING.txt for license details.
    */
    -->
    <widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
    <widget id="products_list" class="GssiProductsSliderBlockProductProductsList" is_email_compatible="true"
    placeholder_image="Magento_CatalogWidget::images/products_list.png" ttl="86400">
    <label translate="true">Catalog Products List</label>
    <description translate="true">List of Products</description>
    <parameters>
    <parameter name="title" xsi:type="text" required="false" visible="true">
    <label translate="true">Title</label>
    </parameter>
    <parameter name="show_pager" xsi:type="select" visible="true"
    source_model="MagentoConfigModelConfigSourceYesno">
    <label translate="true">Display Page Control</label>
    </parameter>
    <parameter name="products_per_page" xsi:type="text" required="true" visible="true">
    <label translate="true">Number of Products per Page</label>
    <depends>
    <parameter name="show_pager" value="1" />
    </depends>
    <value>5</value>
    </parameter>
    <parameter name="products_count" xsi:type="text" required="true" visible="true">
    <label translate="true">Number of Products to Display</label>
    <value>10</value>
    </parameter>
    <parameter name="template" xsi:type="select" required="true" visible="true">
    <label translate="true">Template</label>
    <options>
    <option name="default" value="product/widget/content/grid.phtml" selected="true">
    <label translate="true">Products Grid Template</label>
    </option>
    <option name="slider" value="product/widget/content/slider.phtml">
    <label translate="true">Products Slider</label>
    </option>
    </options>
    </parameter>
    <parameter name="cache_lifetime" xsi:type="text" visible="true">
    <label translate="true">Cache Lifetime (Seconds)</label>
    <description translate="true">86400 by default, if not set. To refresh instantly, clear the Blocks HTML Output cache.</description>
    </parameter>
    <parameter name="condition" xsi:type="conditions" visible="true" required="true" sort_order="10"
    class="MagentoCatalogWidgetBlockProductWidgetConditions">
    <label translate="true">Conditions</label>
    </parameter>
    </parameters>
    <containers>
    <container name="content">
    <template name="grid" value="default" />
    </container>
    <container name="content.top">
    <template name="grid" value="default" />
    </container>
    <container name="content.bottom">
    <template name="grid" value="default" />
    </container>
    </containers>
    </widget>
    </widgets>


    The diffrence between my widget custom module and the widget of Catalog Widget module is i put 1 more <option> in the <parameter name="template">.




    C:xampphtdocsbezdanappcodeGssiProductsSlideretcdi.xml




    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="MagentoCatalogWidgetBlockProductProductsList" type="GssiProductsSliderBlockProductProductsList" />
    </config>


    In here, slider.phtml and grid.phtml is the same, and also, i copy it from C:xampphtdocsbezdanvendormagentomodule-catalog-widgetviewfrontendtemplatesproductwidgetcontentgrid.phtml

    So i will not post grid.phtml here.




    C:xampphtdocsbezdanappcodeGssiProductsSliderviewfrontendtemplatesproductwidgetcontentslider.phtml




    <?php
    /**
    * Copyright © 2013-2017 Magento, Inc. All rights reserved.
    * See COPYING.txt for license details.
    */

    // @codingStandardsIgnoreFile

    ?>
    <?php
    echo 'dsadsdsdsadsdsa';
    /**
    * Template for displaying products list widget
    *
    * @var $block GssiProductsSliderBlockProductProductsList
    */
    ?>
    <?php if ($exist = ($block->getProductCollection() && $block->getProductCollection()->getSize())):?>
    <?php
    $type = 'widget-product-grid';

    $mode = 'grid';

    $image = 'new_products_content_widget_grid';
    $title = $block->getTitle() ? __($block->getTitle()) : '';
    $items = $block->getProductCollection()->getItems();

    $showWishlist = true;
    $showCompare = true;
    $showCart = true;
    $templateType = MagentoCatalogBlockProductReviewRendererInterface::DEFAULT_VIEW;
    $description = false;
    ?>
    <div class="block widget block-products-list <?php /* @escapeNotVerified */ echo $mode; ?>">
    <?php if ($title):?>
    <div class="block-title">
    <strong><?php /* @escapeNotVerified */ echo $title; ?></strong>
    </div>
    <?php endif ?>
    <div class="block-content">
    <?php /* @escapeNotVerified */ echo '<!-- ' . $image . '-->' ?>
    <div class="products-<?php /* @escapeNotVerified */ echo $mode; ?> <?php /* @escapeNotVerified */ echo $mode; ?>">
    <ol class="product-items <?php /* @escapeNotVerified */ echo $type; ?>">
    <?php $iterator = 1; ?>
    <?php foreach ($items as $_item): ?>
    <?php /* @escapeNotVerified */ echo($iterator++ == 1) ? '<li class="product-item">' : '</li><li class="product-item">' ?>
    <div class="product-item-info">
    <a href="<?php /* @escapeNotVerified */ echo $block->getProductUrl($_item) ?>" class="product-item-photo">
    <?php echo $block->getImage($_item, $image)->toHtml(); ?>
    </a>
    <div class="product-item-details">
    <strong class="product-item-name">
    <a title="<?php echo $block->escapeHtml($_item->getName()) ?>"
    href="<?php /* @escapeNotVerified */ echo $block->getProductUrl($_item) ?>"
    class="product-item-link">
    <?php echo $block->escapeHtml($_item->getName()) ?>
    </a>
    </strong>
    <?php
    echo $block->getProductPriceHtml($_item, $type);
    ?>

    <?php if ($templateType): ?>
    <?php echo $block->getReviewsSummaryHtml($_item, $templateType) ?>
    <?php endif; ?>

    <?php if ($showWishlist || $showCompare || $showCart): ?>
    <div class="product-item-actions">
    <?php if ($showCart): ?>
    <div class="actions-primary">
    <?php if ($_item->isSaleable()): ?>
    <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?>
    <button class="action tocart primary"
    data-mage-init='{"redirectUrl":{"url":"<?php /* @escapeNotVerified */ echo $block->getAddToCartUrl($_item) ?>"}}'
    type="button" title="<?php /* @escapeNotVerified */ echo __('Add to Cart') ?>">
    <span><?php /* @escapeNotVerified */ echo __('Add to Cart') ?></span>
    </button>
    <?php else: ?>
    <?php
    $postDataHelper = $this->helper('MagentoFrameworkDataHelperPostHelper');
    $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()])
    ?>
    <button class="action tocart primary"
    data-post='<?php /* @escapeNotVerified */ echo $postData; ?>'
    type="button" title="<?php /* @escapeNotVerified */ echo __('Add to Cart') ?>">
    <span><?php /* @escapeNotVerified */ echo __('Add to Cart') ?></span>
    </button>
    <?php endif; ?>
    <?php else: ?>
    <?php if ($_item->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; ?>
    </div>
    <?php endif; ?>
    <?php if ($showWishlist || $showCompare): ?>
    <div class="actions-secondary" data-role="add-to-links">
    <?php if ($this->helper('MagentoWishlistHelperData')->isAllow() && $showWishlist): ?>
    <a href="#"
    data-post='<?php /* @escapeNotVerified */ echo $block->getAddToWishlistParams($_item); ?>'
    class="action towishlist" data-action="add-to-wishlist"
    title="<?php /* @escapeNotVerified */ echo __('Add to Wish List') ?>">
    <span><?php /* @escapeNotVerified */ echo __('Add to Wish List') ?></span>
    </a>
    <?php endif; ?>
    <?php if ($block->getAddToCompareUrl() && $showCompare): ?>
    <?php $compareHelper = $this->helper('MagentoCatalogHelperProductCompare');?>
    <a href="#" class="action tocompare"
    data-post='<?php /* @escapeNotVerified */ echo $compareHelper->getPostDataParams($_item);?>'
    title="<?php /* @escapeNotVerified */ echo __('Add to Compare') ?>">
    <span><?php /* @escapeNotVerified */ echo __('Add to Compare') ?></span>
    </a>
    <?php endif; ?>
    </div>
    <?php endif; ?>
    </div>
    <?php endif; ?>
    </div>
    </div>
    <?php echo($iterator == count($items)+1) ? '</li>' : '' ?>
    <?php endforeach ?>
    </ol>
    </div>
    <?php echo $block->getPagerHtml() ?>
    </div>
    </div>
    <?php endif;?>


    The important thing is it seem like not running into the slider.phtml, because i've put echo "dsadsdsdsadsdsa" in the code, but it doesn't show up. So i dont know how to fix this.










    share|improve this question



























      0












      0








      0








      I'm doing override widget to my custom module.



      So everything was great in the backend, until i come to the frontend and see nothing at all.



      I mean it works perfect in backend, but not with the frontend.



      I'm following CatalogWidget.



      So here is my custom module, check it out:



      enter image description here



      Its under namespace Gssi.




      C:xampphtdocsbezdanappcodeGssiProductsSliderBlockProductProductsList.php




      <?php
      /**
      * Copyright © 2013-2017 Magento, Inc. All rights reserved.
      * See COPYING.txt for license details.
      */

      // @codingStandardsIgnoreFile

      namespace GssiProductsSliderBlockProduct;

      use MagentoFrameworkDataObjectIdentityInterface;
      use MagentoWidgetBlockBlockInterface;
      use MagentoCatalogWidgetBlockProductProductsList as CatalogWidgetProductList;

      /**
      * Catalog Products List widget block
      * Class ProductsList
      * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
      */
      class ProductsList extends CatalogWidgetProductList implements BlockInterface, IdentityInterface
      {
      /**
      * Default value for products count that will be shown
      */
      const DEFAULT_PRODUCTS_COUNT = 10;

      /**
      * Name of request parameter for page number value
      *
      * @deprecated
      */
      const PAGE_VAR_NAME = 'np';

      /**
      * Default value for products per page
      */
      const DEFAULT_PRODUCTS_PER_PAGE = 5;

      /**
      * Default value whether show pager or not
      */
      const DEFAULT_SHOW_PAGER = false;

      /**
      * Instance of pager block
      *
      * @var MagentoCatalogBlockProductWidgetHtmlPager
      */
      protected $pager;

      /**
      * @var MagentoFrameworkAppHttpContext
      */
      protected $httpContext;

      /**
      * Catalog product visibility
      *
      * @var MagentoCatalogModelProductVisibility
      */
      protected $catalogProductVisibility;

      /**
      * Product collection factory
      *
      * @var MagentoCatalogModelResourceModelProductCollectionFactory
      */
      protected $productCollectionFactory;

      /**
      * @var MagentoRuleModelConditionSqlBuilder
      */
      protected $sqlBuilder;

      /**
      * @var MagentoCatalogWidgetModelRule
      */
      protected $rule;

      /**
      * @var MagentoWidgetHelperConditions
      */
      protected $conditionsHelper;

      /**
      * @param MagentoCatalogBlockProductContext $context
      * @param MagentoCatalogModelResourceModelProductCollectionFactory $productCollectionFactory
      * @param MagentoCatalogModelProductVisibility $catalogProductVisibility
      * @param MagentoFrameworkAppHttpContext $httpContext
      * @param MagentoRuleModelConditionSqlBuilder $sqlBuilder
      * @param MagentoCatalogWidgetModelRule $rule
      * @param MagentoWidgetHelperConditions $conditionsHelper
      * @param array $data
      */
      public function __construct(
      MagentoCatalogBlockProductContext $context,
      MagentoCatalogModelResourceModelProductCollectionFactory $productCollectionFactory,
      MagentoCatalogModelProductVisibility $catalogProductVisibility,
      MagentoFrameworkAppHttpContext $httpContext,
      MagentoRuleModelConditionSqlBuilder $sqlBuilder,
      MagentoCatalogWidgetModelRule $rule,
      MagentoWidgetHelperConditions $conditionsHelper,
      array $data =
      ) {
      parent::__construct(
      $context,
      $productCollectionFactory,
      $catalogProductVisibility,
      $httpContext,
      $sqlBuilder,
      $rule,
      $conditionsHelper
      );
      }

      protected function _construct()
      {
      parent::_construct();
      }

      }


      As i said, i'm following CatalogWidget module, so this block ProductsList.php is extends from it ( I'm not sure if i need to call every function in that ProductList.php and use parent::_FunctionName or they just called themselves.).




      C:xampphtdocsbezdanappcodeGssiProductsSlideretcwidget.xml




      <?xml version="1.0" encoding="UTF-8"?>
      <!--
      /**
      * Copyright © 2013-2017 Magento, Inc. All rights reserved.
      * See COPYING.txt for license details.
      */
      -->
      <widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
      <widget id="products_list" class="GssiProductsSliderBlockProductProductsList" is_email_compatible="true"
      placeholder_image="Magento_CatalogWidget::images/products_list.png" ttl="86400">
      <label translate="true">Catalog Products List</label>
      <description translate="true">List of Products</description>
      <parameters>
      <parameter name="title" xsi:type="text" required="false" visible="true">
      <label translate="true">Title</label>
      </parameter>
      <parameter name="show_pager" xsi:type="select" visible="true"
      source_model="MagentoConfigModelConfigSourceYesno">
      <label translate="true">Display Page Control</label>
      </parameter>
      <parameter name="products_per_page" xsi:type="text" required="true" visible="true">
      <label translate="true">Number of Products per Page</label>
      <depends>
      <parameter name="show_pager" value="1" />
      </depends>
      <value>5</value>
      </parameter>
      <parameter name="products_count" xsi:type="text" required="true" visible="true">
      <label translate="true">Number of Products to Display</label>
      <value>10</value>
      </parameter>
      <parameter name="template" xsi:type="select" required="true" visible="true">
      <label translate="true">Template</label>
      <options>
      <option name="default" value="product/widget/content/grid.phtml" selected="true">
      <label translate="true">Products Grid Template</label>
      </option>
      <option name="slider" value="product/widget/content/slider.phtml">
      <label translate="true">Products Slider</label>
      </option>
      </options>
      </parameter>
      <parameter name="cache_lifetime" xsi:type="text" visible="true">
      <label translate="true">Cache Lifetime (Seconds)</label>
      <description translate="true">86400 by default, if not set. To refresh instantly, clear the Blocks HTML Output cache.</description>
      </parameter>
      <parameter name="condition" xsi:type="conditions" visible="true" required="true" sort_order="10"
      class="MagentoCatalogWidgetBlockProductWidgetConditions">
      <label translate="true">Conditions</label>
      </parameter>
      </parameters>
      <containers>
      <container name="content">
      <template name="grid" value="default" />
      </container>
      <container name="content.top">
      <template name="grid" value="default" />
      </container>
      <container name="content.bottom">
      <template name="grid" value="default" />
      </container>
      </containers>
      </widget>
      </widgets>


      The diffrence between my widget custom module and the widget of Catalog Widget module is i put 1 more <option> in the <parameter name="template">.




      C:xampphtdocsbezdanappcodeGssiProductsSlideretcdi.xml




      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
      <preference for="MagentoCatalogWidgetBlockProductProductsList" type="GssiProductsSliderBlockProductProductsList" />
      </config>


      In here, slider.phtml and grid.phtml is the same, and also, i copy it from C:xampphtdocsbezdanvendormagentomodule-catalog-widgetviewfrontendtemplatesproductwidgetcontentgrid.phtml

      So i will not post grid.phtml here.




      C:xampphtdocsbezdanappcodeGssiProductsSliderviewfrontendtemplatesproductwidgetcontentslider.phtml




      <?php
      /**
      * Copyright © 2013-2017 Magento, Inc. All rights reserved.
      * See COPYING.txt for license details.
      */

      // @codingStandardsIgnoreFile

      ?>
      <?php
      echo 'dsadsdsdsadsdsa';
      /**
      * Template for displaying products list widget
      *
      * @var $block GssiProductsSliderBlockProductProductsList
      */
      ?>
      <?php if ($exist = ($block->getProductCollection() && $block->getProductCollection()->getSize())):?>
      <?php
      $type = 'widget-product-grid';

      $mode = 'grid';

      $image = 'new_products_content_widget_grid';
      $title = $block->getTitle() ? __($block->getTitle()) : '';
      $items = $block->getProductCollection()->getItems();

      $showWishlist = true;
      $showCompare = true;
      $showCart = true;
      $templateType = MagentoCatalogBlockProductReviewRendererInterface::DEFAULT_VIEW;
      $description = false;
      ?>
      <div class="block widget block-products-list <?php /* @escapeNotVerified */ echo $mode; ?>">
      <?php if ($title):?>
      <div class="block-title">
      <strong><?php /* @escapeNotVerified */ echo $title; ?></strong>
      </div>
      <?php endif ?>
      <div class="block-content">
      <?php /* @escapeNotVerified */ echo '<!-- ' . $image . '-->' ?>
      <div class="products-<?php /* @escapeNotVerified */ echo $mode; ?> <?php /* @escapeNotVerified */ echo $mode; ?>">
      <ol class="product-items <?php /* @escapeNotVerified */ echo $type; ?>">
      <?php $iterator = 1; ?>
      <?php foreach ($items as $_item): ?>
      <?php /* @escapeNotVerified */ echo($iterator++ == 1) ? '<li class="product-item">' : '</li><li class="product-item">' ?>
      <div class="product-item-info">
      <a href="<?php /* @escapeNotVerified */ echo $block->getProductUrl($_item) ?>" class="product-item-photo">
      <?php echo $block->getImage($_item, $image)->toHtml(); ?>
      </a>
      <div class="product-item-details">
      <strong class="product-item-name">
      <a title="<?php echo $block->escapeHtml($_item->getName()) ?>"
      href="<?php /* @escapeNotVerified */ echo $block->getProductUrl($_item) ?>"
      class="product-item-link">
      <?php echo $block->escapeHtml($_item->getName()) ?>
      </a>
      </strong>
      <?php
      echo $block->getProductPriceHtml($_item, $type);
      ?>

      <?php if ($templateType): ?>
      <?php echo $block->getReviewsSummaryHtml($_item, $templateType) ?>
      <?php endif; ?>

      <?php if ($showWishlist || $showCompare || $showCart): ?>
      <div class="product-item-actions">
      <?php if ($showCart): ?>
      <div class="actions-primary">
      <?php if ($_item->isSaleable()): ?>
      <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?>
      <button class="action tocart primary"
      data-mage-init='{"redirectUrl":{"url":"<?php /* @escapeNotVerified */ echo $block->getAddToCartUrl($_item) ?>"}}'
      type="button" title="<?php /* @escapeNotVerified */ echo __('Add to Cart') ?>">
      <span><?php /* @escapeNotVerified */ echo __('Add to Cart') ?></span>
      </button>
      <?php else: ?>
      <?php
      $postDataHelper = $this->helper('MagentoFrameworkDataHelperPostHelper');
      $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()])
      ?>
      <button class="action tocart primary"
      data-post='<?php /* @escapeNotVerified */ echo $postData; ?>'
      type="button" title="<?php /* @escapeNotVerified */ echo __('Add to Cart') ?>">
      <span><?php /* @escapeNotVerified */ echo __('Add to Cart') ?></span>
      </button>
      <?php endif; ?>
      <?php else: ?>
      <?php if ($_item->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; ?>
      </div>
      <?php endif; ?>
      <?php if ($showWishlist || $showCompare): ?>
      <div class="actions-secondary" data-role="add-to-links">
      <?php if ($this->helper('MagentoWishlistHelperData')->isAllow() && $showWishlist): ?>
      <a href="#"
      data-post='<?php /* @escapeNotVerified */ echo $block->getAddToWishlistParams($_item); ?>'
      class="action towishlist" data-action="add-to-wishlist"
      title="<?php /* @escapeNotVerified */ echo __('Add to Wish List') ?>">
      <span><?php /* @escapeNotVerified */ echo __('Add to Wish List') ?></span>
      </a>
      <?php endif; ?>
      <?php if ($block->getAddToCompareUrl() && $showCompare): ?>
      <?php $compareHelper = $this->helper('MagentoCatalogHelperProductCompare');?>
      <a href="#" class="action tocompare"
      data-post='<?php /* @escapeNotVerified */ echo $compareHelper->getPostDataParams($_item);?>'
      title="<?php /* @escapeNotVerified */ echo __('Add to Compare') ?>">
      <span><?php /* @escapeNotVerified */ echo __('Add to Compare') ?></span>
      </a>
      <?php endif; ?>
      </div>
      <?php endif; ?>
      </div>
      <?php endif; ?>
      </div>
      </div>
      <?php echo($iterator == count($items)+1) ? '</li>' : '' ?>
      <?php endforeach ?>
      </ol>
      </div>
      <?php echo $block->getPagerHtml() ?>
      </div>
      </div>
      <?php endif;?>


      The important thing is it seem like not running into the slider.phtml, because i've put echo "dsadsdsdsadsdsa" in the code, but it doesn't show up. So i dont know how to fix this.










      share|improve this question
















      I'm doing override widget to my custom module.



      So everything was great in the backend, until i come to the frontend and see nothing at all.



      I mean it works perfect in backend, but not with the frontend.



      I'm following CatalogWidget.



      So here is my custom module, check it out:



      enter image description here



      Its under namespace Gssi.




      C:xampphtdocsbezdanappcodeGssiProductsSliderBlockProductProductsList.php




      <?php
      /**
      * Copyright © 2013-2017 Magento, Inc. All rights reserved.
      * See COPYING.txt for license details.
      */

      // @codingStandardsIgnoreFile

      namespace GssiProductsSliderBlockProduct;

      use MagentoFrameworkDataObjectIdentityInterface;
      use MagentoWidgetBlockBlockInterface;
      use MagentoCatalogWidgetBlockProductProductsList as CatalogWidgetProductList;

      /**
      * Catalog Products List widget block
      * Class ProductsList
      * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
      */
      class ProductsList extends CatalogWidgetProductList implements BlockInterface, IdentityInterface
      {
      /**
      * Default value for products count that will be shown
      */
      const DEFAULT_PRODUCTS_COUNT = 10;

      /**
      * Name of request parameter for page number value
      *
      * @deprecated
      */
      const PAGE_VAR_NAME = 'np';

      /**
      * Default value for products per page
      */
      const DEFAULT_PRODUCTS_PER_PAGE = 5;

      /**
      * Default value whether show pager or not
      */
      const DEFAULT_SHOW_PAGER = false;

      /**
      * Instance of pager block
      *
      * @var MagentoCatalogBlockProductWidgetHtmlPager
      */
      protected $pager;

      /**
      * @var MagentoFrameworkAppHttpContext
      */
      protected $httpContext;

      /**
      * Catalog product visibility
      *
      * @var MagentoCatalogModelProductVisibility
      */
      protected $catalogProductVisibility;

      /**
      * Product collection factory
      *
      * @var MagentoCatalogModelResourceModelProductCollectionFactory
      */
      protected $productCollectionFactory;

      /**
      * @var MagentoRuleModelConditionSqlBuilder
      */
      protected $sqlBuilder;

      /**
      * @var MagentoCatalogWidgetModelRule
      */
      protected $rule;

      /**
      * @var MagentoWidgetHelperConditions
      */
      protected $conditionsHelper;

      /**
      * @param MagentoCatalogBlockProductContext $context
      * @param MagentoCatalogModelResourceModelProductCollectionFactory $productCollectionFactory
      * @param MagentoCatalogModelProductVisibility $catalogProductVisibility
      * @param MagentoFrameworkAppHttpContext $httpContext
      * @param MagentoRuleModelConditionSqlBuilder $sqlBuilder
      * @param MagentoCatalogWidgetModelRule $rule
      * @param MagentoWidgetHelperConditions $conditionsHelper
      * @param array $data
      */
      public function __construct(
      MagentoCatalogBlockProductContext $context,
      MagentoCatalogModelResourceModelProductCollectionFactory $productCollectionFactory,
      MagentoCatalogModelProductVisibility $catalogProductVisibility,
      MagentoFrameworkAppHttpContext $httpContext,
      MagentoRuleModelConditionSqlBuilder $sqlBuilder,
      MagentoCatalogWidgetModelRule $rule,
      MagentoWidgetHelperConditions $conditionsHelper,
      array $data =
      ) {
      parent::__construct(
      $context,
      $productCollectionFactory,
      $catalogProductVisibility,
      $httpContext,
      $sqlBuilder,
      $rule,
      $conditionsHelper
      );
      }

      protected function _construct()
      {
      parent::_construct();
      }

      }


      As i said, i'm following CatalogWidget module, so this block ProductsList.php is extends from it ( I'm not sure if i need to call every function in that ProductList.php and use parent::_FunctionName or they just called themselves.).




      C:xampphtdocsbezdanappcodeGssiProductsSlideretcwidget.xml




      <?xml version="1.0" encoding="UTF-8"?>
      <!--
      /**
      * Copyright © 2013-2017 Magento, Inc. All rights reserved.
      * See COPYING.txt for license details.
      */
      -->
      <widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
      <widget id="products_list" class="GssiProductsSliderBlockProductProductsList" is_email_compatible="true"
      placeholder_image="Magento_CatalogWidget::images/products_list.png" ttl="86400">
      <label translate="true">Catalog Products List</label>
      <description translate="true">List of Products</description>
      <parameters>
      <parameter name="title" xsi:type="text" required="false" visible="true">
      <label translate="true">Title</label>
      </parameter>
      <parameter name="show_pager" xsi:type="select" visible="true"
      source_model="MagentoConfigModelConfigSourceYesno">
      <label translate="true">Display Page Control</label>
      </parameter>
      <parameter name="products_per_page" xsi:type="text" required="true" visible="true">
      <label translate="true">Number of Products per Page</label>
      <depends>
      <parameter name="show_pager" value="1" />
      </depends>
      <value>5</value>
      </parameter>
      <parameter name="products_count" xsi:type="text" required="true" visible="true">
      <label translate="true">Number of Products to Display</label>
      <value>10</value>
      </parameter>
      <parameter name="template" xsi:type="select" required="true" visible="true">
      <label translate="true">Template</label>
      <options>
      <option name="default" value="product/widget/content/grid.phtml" selected="true">
      <label translate="true">Products Grid Template</label>
      </option>
      <option name="slider" value="product/widget/content/slider.phtml">
      <label translate="true">Products Slider</label>
      </option>
      </options>
      </parameter>
      <parameter name="cache_lifetime" xsi:type="text" visible="true">
      <label translate="true">Cache Lifetime (Seconds)</label>
      <description translate="true">86400 by default, if not set. To refresh instantly, clear the Blocks HTML Output cache.</description>
      </parameter>
      <parameter name="condition" xsi:type="conditions" visible="true" required="true" sort_order="10"
      class="MagentoCatalogWidgetBlockProductWidgetConditions">
      <label translate="true">Conditions</label>
      </parameter>
      </parameters>
      <containers>
      <container name="content">
      <template name="grid" value="default" />
      </container>
      <container name="content.top">
      <template name="grid" value="default" />
      </container>
      <container name="content.bottom">
      <template name="grid" value="default" />
      </container>
      </containers>
      </widget>
      </widgets>


      The diffrence between my widget custom module and the widget of Catalog Widget module is i put 1 more <option> in the <parameter name="template">.




      C:xampphtdocsbezdanappcodeGssiProductsSlideretcdi.xml




      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
      <preference for="MagentoCatalogWidgetBlockProductProductsList" type="GssiProductsSliderBlockProductProductsList" />
      </config>


      In here, slider.phtml and grid.phtml is the same, and also, i copy it from C:xampphtdocsbezdanvendormagentomodule-catalog-widgetviewfrontendtemplatesproductwidgetcontentgrid.phtml

      So i will not post grid.phtml here.




      C:xampphtdocsbezdanappcodeGssiProductsSliderviewfrontendtemplatesproductwidgetcontentslider.phtml




      <?php
      /**
      * Copyright © 2013-2017 Magento, Inc. All rights reserved.
      * See COPYING.txt for license details.
      */

      // @codingStandardsIgnoreFile

      ?>
      <?php
      echo 'dsadsdsdsadsdsa';
      /**
      * Template for displaying products list widget
      *
      * @var $block GssiProductsSliderBlockProductProductsList
      */
      ?>
      <?php if ($exist = ($block->getProductCollection() && $block->getProductCollection()->getSize())):?>
      <?php
      $type = 'widget-product-grid';

      $mode = 'grid';

      $image = 'new_products_content_widget_grid';
      $title = $block->getTitle() ? __($block->getTitle()) : '';
      $items = $block->getProductCollection()->getItems();

      $showWishlist = true;
      $showCompare = true;
      $showCart = true;
      $templateType = MagentoCatalogBlockProductReviewRendererInterface::DEFAULT_VIEW;
      $description = false;
      ?>
      <div class="block widget block-products-list <?php /* @escapeNotVerified */ echo $mode; ?>">
      <?php if ($title):?>
      <div class="block-title">
      <strong><?php /* @escapeNotVerified */ echo $title; ?></strong>
      </div>
      <?php endif ?>
      <div class="block-content">
      <?php /* @escapeNotVerified */ echo '<!-- ' . $image . '-->' ?>
      <div class="products-<?php /* @escapeNotVerified */ echo $mode; ?> <?php /* @escapeNotVerified */ echo $mode; ?>">
      <ol class="product-items <?php /* @escapeNotVerified */ echo $type; ?>">
      <?php $iterator = 1; ?>
      <?php foreach ($items as $_item): ?>
      <?php /* @escapeNotVerified */ echo($iterator++ == 1) ? '<li class="product-item">' : '</li><li class="product-item">' ?>
      <div class="product-item-info">
      <a href="<?php /* @escapeNotVerified */ echo $block->getProductUrl($_item) ?>" class="product-item-photo">
      <?php echo $block->getImage($_item, $image)->toHtml(); ?>
      </a>
      <div class="product-item-details">
      <strong class="product-item-name">
      <a title="<?php echo $block->escapeHtml($_item->getName()) ?>"
      href="<?php /* @escapeNotVerified */ echo $block->getProductUrl($_item) ?>"
      class="product-item-link">
      <?php echo $block->escapeHtml($_item->getName()) ?>
      </a>
      </strong>
      <?php
      echo $block->getProductPriceHtml($_item, $type);
      ?>

      <?php if ($templateType): ?>
      <?php echo $block->getReviewsSummaryHtml($_item, $templateType) ?>
      <?php endif; ?>

      <?php if ($showWishlist || $showCompare || $showCart): ?>
      <div class="product-item-actions">
      <?php if ($showCart): ?>
      <div class="actions-primary">
      <?php if ($_item->isSaleable()): ?>
      <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?>
      <button class="action tocart primary"
      data-mage-init='{"redirectUrl":{"url":"<?php /* @escapeNotVerified */ echo $block->getAddToCartUrl($_item) ?>"}}'
      type="button" title="<?php /* @escapeNotVerified */ echo __('Add to Cart') ?>">
      <span><?php /* @escapeNotVerified */ echo __('Add to Cart') ?></span>
      </button>
      <?php else: ?>
      <?php
      $postDataHelper = $this->helper('MagentoFrameworkDataHelperPostHelper');
      $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()])
      ?>
      <button class="action tocart primary"
      data-post='<?php /* @escapeNotVerified */ echo $postData; ?>'
      type="button" title="<?php /* @escapeNotVerified */ echo __('Add to Cart') ?>">
      <span><?php /* @escapeNotVerified */ echo __('Add to Cart') ?></span>
      </button>
      <?php endif; ?>
      <?php else: ?>
      <?php if ($_item->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; ?>
      </div>
      <?php endif; ?>
      <?php if ($showWishlist || $showCompare): ?>
      <div class="actions-secondary" data-role="add-to-links">
      <?php if ($this->helper('MagentoWishlistHelperData')->isAllow() && $showWishlist): ?>
      <a href="#"
      data-post='<?php /* @escapeNotVerified */ echo $block->getAddToWishlistParams($_item); ?>'
      class="action towishlist" data-action="add-to-wishlist"
      title="<?php /* @escapeNotVerified */ echo __('Add to Wish List') ?>">
      <span><?php /* @escapeNotVerified */ echo __('Add to Wish List') ?></span>
      </a>
      <?php endif; ?>
      <?php if ($block->getAddToCompareUrl() && $showCompare): ?>
      <?php $compareHelper = $this->helper('MagentoCatalogHelperProductCompare');?>
      <a href="#" class="action tocompare"
      data-post='<?php /* @escapeNotVerified */ echo $compareHelper->getPostDataParams($_item);?>'
      title="<?php /* @escapeNotVerified */ echo __('Add to Compare') ?>">
      <span><?php /* @escapeNotVerified */ echo __('Add to Compare') ?></span>
      </a>
      <?php endif; ?>
      </div>
      <?php endif; ?>
      </div>
      <?php endif; ?>
      </div>
      </div>
      <?php echo($iterator == count($items)+1) ? '</li>' : '' ?>
      <?php endforeach ?>
      </ol>
      </div>
      <?php echo $block->getPagerHtml() ?>
      </div>
      </div>
      <?php endif;?>


      The important thing is it seem like not running into the slider.phtml, because i've put echo "dsadsdsdsadsdsa" in the code, but it doesn't show up. So i dont know how to fix this.







      overrides magento-2.2.5 widget






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 11 mins ago









      Teja Bhagavan Kollepara

      2,94841847




      2,94841847










      asked Aug 24 '18 at 13:45









      fudufudu

      38411




      38411






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Remove etcdi.xml as you do not need the preference and change your reference to the new template to include the new module's name.



          app/code/Gssi/ProductsSlider/etc/widget.xml:39



          <option name="slider" value="Gssi_ProductsSlider::product/widget/content/slider.phtml">





          share|improve this answer
























          • Thanks for replying, but if i need that to custom something new? I still need etc/di.xml right? And is that di.xml causing my issue?

            – fudu
            Aug 24 '18 at 14:13











          • The preference in di.xml is causing issues in your code. Once it's removed and you make the change I suggested it will start working.

            – Media Lounge
            Aug 24 '18 at 14:40











          • Hmmm .. so may you explain why that preference causing issue in my code please? I dont understand at all .. :'(

            – fudu
            Aug 24 '18 at 14:52











          • I'm not sure but I was getting an empty output same as you until I removed it. It may be that you are already referencing the new class in widget.xml.

            – Media Lounge
            Aug 24 '18 at 14:56











          • Hmmm .. this is weird, because if i need to custom a new block, so i will need to call preference right? So how could this be issue? :)

            – fudu
            Aug 24 '18 at 15:29











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f239525%2fmagento-2-2-5-error-when-trying-to-override-widget%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Remove etcdi.xml as you do not need the preference and change your reference to the new template to include the new module's name.



          app/code/Gssi/ProductsSlider/etc/widget.xml:39



          <option name="slider" value="Gssi_ProductsSlider::product/widget/content/slider.phtml">





          share|improve this answer
























          • Thanks for replying, but if i need that to custom something new? I still need etc/di.xml right? And is that di.xml causing my issue?

            – fudu
            Aug 24 '18 at 14:13











          • The preference in di.xml is causing issues in your code. Once it's removed and you make the change I suggested it will start working.

            – Media Lounge
            Aug 24 '18 at 14:40











          • Hmmm .. so may you explain why that preference causing issue in my code please? I dont understand at all .. :'(

            – fudu
            Aug 24 '18 at 14:52











          • I'm not sure but I was getting an empty output same as you until I removed it. It may be that you are already referencing the new class in widget.xml.

            – Media Lounge
            Aug 24 '18 at 14:56











          • Hmmm .. this is weird, because if i need to custom a new block, so i will need to call preference right? So how could this be issue? :)

            – fudu
            Aug 24 '18 at 15:29
















          1














          Remove etcdi.xml as you do not need the preference and change your reference to the new template to include the new module's name.



          app/code/Gssi/ProductsSlider/etc/widget.xml:39



          <option name="slider" value="Gssi_ProductsSlider::product/widget/content/slider.phtml">





          share|improve this answer
























          • Thanks for replying, but if i need that to custom something new? I still need etc/di.xml right? And is that di.xml causing my issue?

            – fudu
            Aug 24 '18 at 14:13











          • The preference in di.xml is causing issues in your code. Once it's removed and you make the change I suggested it will start working.

            – Media Lounge
            Aug 24 '18 at 14:40











          • Hmmm .. so may you explain why that preference causing issue in my code please? I dont understand at all .. :'(

            – fudu
            Aug 24 '18 at 14:52











          • I'm not sure but I was getting an empty output same as you until I removed it. It may be that you are already referencing the new class in widget.xml.

            – Media Lounge
            Aug 24 '18 at 14:56











          • Hmmm .. this is weird, because if i need to custom a new block, so i will need to call preference right? So how could this be issue? :)

            – fudu
            Aug 24 '18 at 15:29














          1












          1








          1







          Remove etcdi.xml as you do not need the preference and change your reference to the new template to include the new module's name.



          app/code/Gssi/ProductsSlider/etc/widget.xml:39



          <option name="slider" value="Gssi_ProductsSlider::product/widget/content/slider.phtml">





          share|improve this answer













          Remove etcdi.xml as you do not need the preference and change your reference to the new template to include the new module's name.



          app/code/Gssi/ProductsSlider/etc/widget.xml:39



          <option name="slider" value="Gssi_ProductsSlider::product/widget/content/slider.phtml">






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 24 '18 at 14:07









          Media LoungeMedia Lounge

          1465




          1465













          • Thanks for replying, but if i need that to custom something new? I still need etc/di.xml right? And is that di.xml causing my issue?

            – fudu
            Aug 24 '18 at 14:13











          • The preference in di.xml is causing issues in your code. Once it's removed and you make the change I suggested it will start working.

            – Media Lounge
            Aug 24 '18 at 14:40











          • Hmmm .. so may you explain why that preference causing issue in my code please? I dont understand at all .. :'(

            – fudu
            Aug 24 '18 at 14:52











          • I'm not sure but I was getting an empty output same as you until I removed it. It may be that you are already referencing the new class in widget.xml.

            – Media Lounge
            Aug 24 '18 at 14:56











          • Hmmm .. this is weird, because if i need to custom a new block, so i will need to call preference right? So how could this be issue? :)

            – fudu
            Aug 24 '18 at 15:29



















          • Thanks for replying, but if i need that to custom something new? I still need etc/di.xml right? And is that di.xml causing my issue?

            – fudu
            Aug 24 '18 at 14:13











          • The preference in di.xml is causing issues in your code. Once it's removed and you make the change I suggested it will start working.

            – Media Lounge
            Aug 24 '18 at 14:40











          • Hmmm .. so may you explain why that preference causing issue in my code please? I dont understand at all .. :'(

            – fudu
            Aug 24 '18 at 14:52











          • I'm not sure but I was getting an empty output same as you until I removed it. It may be that you are already referencing the new class in widget.xml.

            – Media Lounge
            Aug 24 '18 at 14:56











          • Hmmm .. this is weird, because if i need to custom a new block, so i will need to call preference right? So how could this be issue? :)

            – fudu
            Aug 24 '18 at 15:29

















          Thanks for replying, but if i need that to custom something new? I still need etc/di.xml right? And is that di.xml causing my issue?

          – fudu
          Aug 24 '18 at 14:13





          Thanks for replying, but if i need that to custom something new? I still need etc/di.xml right? And is that di.xml causing my issue?

          – fudu
          Aug 24 '18 at 14:13













          The preference in di.xml is causing issues in your code. Once it's removed and you make the change I suggested it will start working.

          – Media Lounge
          Aug 24 '18 at 14:40





          The preference in di.xml is causing issues in your code. Once it's removed and you make the change I suggested it will start working.

          – Media Lounge
          Aug 24 '18 at 14:40













          Hmmm .. so may you explain why that preference causing issue in my code please? I dont understand at all .. :'(

          – fudu
          Aug 24 '18 at 14:52





          Hmmm .. so may you explain why that preference causing issue in my code please? I dont understand at all .. :'(

          – fudu
          Aug 24 '18 at 14:52













          I'm not sure but I was getting an empty output same as you until I removed it. It may be that you are already referencing the new class in widget.xml.

          – Media Lounge
          Aug 24 '18 at 14:56





          I'm not sure but I was getting an empty output same as you until I removed it. It may be that you are already referencing the new class in widget.xml.

          – Media Lounge
          Aug 24 '18 at 14:56













          Hmmm .. this is weird, because if i need to custom a new block, so i will need to call preference right? So how could this be issue? :)

          – fudu
          Aug 24 '18 at 15:29





          Hmmm .. this is weird, because if i need to custom a new block, so i will need to call preference right? So how could this be issue? :)

          – fudu
          Aug 24 '18 at 15:29


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f239525%2fmagento-2-2-5-error-when-trying-to-override-widget%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Polycentropodidae

          Magento 2 Error message: Invalid state change requested

          Paulmy