我必须根据条件来删除magento的cookie限制弹出块。
ie)如果Condition为true,则应显示该块,否则不显示。
我在CookieNotice.php中尝试过如下,但如果不满足条件,我无法获取如何删除整个块。
\应用\代码\核心\法师\页\块\ 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';
}
}
}