Мне нужно воспроизвести всплывающий блок с ограничением использования cookie в magento в зависимости от условия.
т.е.) если условие истинно, блок должен отображаться, иначе нет.
Я пытался, как показано ниже в CookieNotice.php, но я не могу понять, как удалить весь блок, если условие не выполняется.
\ приложение \ код \ ядро \ Mage \ Page \ Block \ Html \ CookieNotice.php
class Mage_Page_Block_Html_CookieNotice extends Mage_Core_Block_Template
{
public function getCookieRestrictionBlockContent()
{
$remoteAddr = Mage::helper('core/http')->getRemoteAddr(true);
$info = geoip_record_by_name($remoteAddr);
$countrycode = $info['country_code']; //IN
$allowed = Mage::getStoreConfig('general/country/eu_countries'); //AT,BE,BG,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IE,IT,LV,LT,LU,MT,NL,PL,PT,RO,SK,SI,ES,SE,GB
if(in_array($countrycode, $allowed)){
echo 'match found';
$blockIdentifier = Mage::helper('core/cookie')->getCookieRestrictionNoticeCmsBlockIdentifier();
$block = Mage::getModel('cms/block')->load($blockIdentifier, 'identifier');
$html = '';
if ($block->getIsActive()) {
/* @var $helper Mage_Cms_Helper_Data */
$helper = Mage::helper('cms');
$processor = $helper->getBlockTemplateProcessor();
$html = $processor->filter($block->getContent());
}
return $html;
}
else{
// Here still the pop block appears
echo 'No match found';
}
}
}
![enter image description here](https://i.stack.imgur.com/eB3us.png)