class Selectpage implements \Magento\Framework\Option\ArrayInterface{
/**
* @var array
*/
protected $options;
/**
* @var CollectionFactory
*/
protected $collectionFactory;
/**
* @param CollectionFactory $collectionFactory
*/
public function toOptionArray__construct()
{CollectionFactory $collectionFactory
) {
$options$this->collectionFactory = [$collectionFactory;
}
/**
* To option array
[ *
* @return array
*/
public function toOptionArray()
'label' => __{
if ('-!$this->options) Please{
select $this->options = $this-'>collectionFactory->create(),->toOptionIdArray();
}
$extra_pages_list = array(
array(
'value' => '''catalog_category_view',
]'label' => 'Category Page',
),
[ array(
'value' => 'catalog_product_view',
'label' => __('Home'Product PagePage',
' ),
array(
'value' => '1''checkout_cart_index',
]'label' => 'Shoopping Cart',
),
[ array(
'value' => 'checkout_index_index',
'label' => __('404'Checkout',
Page' ),
);
'value'$allPages =>= '2'array_merge($this->options,$extra_pages_list);
return $allPages;
}
my.phtml
<?php
$field = $this->getConfigValue('popup/general/page');
$pages = ]explode(',',$field);
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$request = $objectManager->get('Magento\Framework\App\Action\Context')->getRequest();
//echo $request->getFullActionName();exit;
$t1 = "default"; /* don't change this */
if ($request->getFullActionName() == 'catalog_category_view') [{
$t1 = $request->getFullActionName();
}
elseif($request->getFullActionName() == 'catalog_product_view'){
$t1 = $request->getFullActionName();
}
elseif($request->getFullActionName() == 'checkout_cart_index'){
$t1 = $request->getFullActionName();
}
elseif($request->getFullActionName() == 'checkout_index_index'){
'label'$t1 =>= __$request->getFullActionName('About);
}
elseif($this->getPageDetails()){
Page' $t1 = $this->getPageDetails();
}
?>
<?php
//$oN = '';
//if(in_array($t1,$this->getOverlayPages())){
//$oN = "one";
// echo "ok";
//echo $t1;
//var_dump($this->getOverlayPages());
/*}
'value'elseif($t1 =>&& '3'in_array($t1,$this->getOverlayPages('two'))){
$oN = "two";
}
elseif($t1 && in_array($t1,$this->getOverlayPages('three'))){
]$oN = "three";
}*/
?>
<?php if(in_array($t1,$this->getOverlayPages())):?>
[<div style="display:none;" id="OverlayContent">
<div class="overlay-contents">
<h2 class="overlay-title"><?php echo $this->getTitle(); ?></h2>
<?php echo $this->getStaticblockcontent();?>
</div>
</div>
<script>
jQuery(document).ready(function() {
'label' => __jQuery('Product'document).bind("mouseleave", function(e){
if (e.pageY - jQuery(window).scrollTop() <= 1){
'value' => '4',if(!readCookie('<?php echo $this->getCookieName();?>')){ //check cookie
if(!jQuery('.fancybox-wrap').length){ ],
jQuery.fancybox({
[ 'width': '<?php echo $this->getWidth();?>',
'label''height': =>'<?php __echo $this->getHeight('Category');?>',
'value''transitionIn': =>'fade',
'5' 'transitionOut': 'fade',
] 'showCloseButton': true,
'fitToView' : false,
]; 'autoSize' : false,
return $options; 'fixed': false,
'href': "#OverlayContent",
'autoCenter': false,
'helpers' : {
'overlay' : {'closeClick': false}
layout.xml
},
'afterClose' : function(){
<?xmlphp version="1.0"if($this->getCookieExpireTime()){ ?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema createCookie('<?php echo $this-instance">getCookieName();?>', layout="1column"1, xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">'<?php echo $this->getCookieExpireTime();?>');
<head> <?php } ?>
<title>Sample Paage</title> }
<css src="Namespace_Module::css });
}/mycsss.css"/cookie check
}
}
});
<?php if(!$this->getCookieExpireTime()){ ?>
eraseCookie('<?php echo $this->getCookieName();?>');
</head>?php } ?>
}); <body>
/**To create cookie**/
function createCookie(name, value, time) {
var time = parseInt(time);
if <referenceContainer(time) name="content">{
var date = new Date();
date.setTime(date.getTime() + (time * <block60 class="Namespace\Module\Block\Popup\Index"* name="popup_index"60 template="popup/index* 1000));
var expires = "; expires=" + date.phtml">toGMTString();
} else var expires = "";
<document.cookie = escape(name) + "=" + escape(value) + expires + "; path=/block>";
}
/**To read cookie**/
function readCookie(name) {
</referenceContainer>var nameEQ = escape(name) + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return unescape(c.substring(nameEQ.length, c.length));
}
return null;
}
/body>**To erase cookie**/
function eraseCookie(name) {
createCookie(name, "", -1);
}
</page>script>
<?php endif;?>
How to display popup/index.phtml** Content ** in selected page's only ?