Programmatically remove block from layout

后端 未结 3 719
逝去的感伤
逝去的感伤 2021-01-15 13:55

I want to remove the product_options_wrapper block from the product view page according to the logedin user via frontend router controller.

I know that I can program

3条回答
  •  被撕碎了的回忆
    2021-01-15 14:47

    The OP code should work, if it used the correct block name, which is product.info.options.wrapper, as opposed to the block alias.

    $this->loadLayout();
    //e.g. 
    if (Mage::getSingleton('customer/session')->getCustomerGroupId() == [id]){
         $this->getLayout()->unsetBlock('product.info.options.wrapper');
    }
    $this->renderLayout();
    

提交回复
热议问题