X hide

Magento 2 Private Sales v4.x Developers Guide and API Reference

From Plumrocket Documentation

You are viewing:  Private-sale-icon-32.png  Private Sales & Flash Sales v4.x

In order to display countdown timer for any product in your Magento 2, please, follow the instructions below.

Display countdown timer for a product

Changes to be made Website Frontend - Product Grid

In order to display product countdown timer for products in Magento 2, for example in the product list page - paste the following code into the file template:

app/design/frontend/Infortis/ultimo/Magento_Catalog/templates/product/list.phtml 
Code Example

This is an example of the code to be used:

<?php if (!( ($_cc = $this->helper('Magento\Catalog\Helper\Data')->getCategory()) && $_cc->getData('privatesale_date_start'))) { ?>
 <?php echo $this->getLayout()->createBlock('Plumrocket\PrivateSale\Block\Event\Product')->setTemplate('event/item.phtml')->setProduct($_product)->toHtml() ?>
<?php } ?>

Where "$_product" is a product object the countdown timer you need to set up for. Find the code:

<?php if ($gc['display_name'] != 0): ?>
 <strong class="product name product-item-name product-name<?php echo $productNameClasses; ?>">
 <a class="product-item-link"
 href="<?php /* @escapeNotVerified */ echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>">
 <?php /* @escapeNotVerified */ echo $_helper->productAttribute($_product, $_product->getName(), 'name'); ?>
 </a>
 </strong>
<?php endif; ?>
<?php $gc['display_swatches'] = 1; //TODO: add to config ?>

The code should be replaced with the following:

<?php if ($gc['display_name'] != 0): ?>
 <strong class="product name product-item-name product-name<?php echo $productNameClasses; ?>">
 <a class="product-item-link"
 href="<?php /* @escapeNotVerified */ echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>">
 <?php /* @escapeNotVerified */ echo $_helper->productAttribute($_product, $_product->getName(), 'name'); ?>
 </a>
 </strong>
<?php endif; ?>
!!-<?php if (!( ($_cc = $this->helper('Magento\Catalog\Helper\Data')->getCategory()) && $_cc->getData('privatesale_date_start'))) { ?>
 <?php echo $this->getLayout()->createBlock('Plumrocket\PrivateSale\Block\Event\Product')->setTemplate('event/item.phtml')->setProduct($_product)->toHtml() ?>
<?php } ?>-!!
<?php $gc['display_swatches'] = 1; //TODO: add to config ?>
  1. Product countdown timer.

Magento 2 private sales and flash sales developer's guide daily deals.jpg

Private Sales Extension for Magento 2 Private Sales Extension for Magento 2

Buy Magento 2 Private Sales Extension on Plumrocket Store
Click below to check key features of this extension, view live demo and screenshots:
Navigation