Created
December 25, 2020 08:47
-
-
Save cgi-caesar/29686555c899aea15c203d5b6c7d490e to your computer and use it in GitHub Desktop.
aMember (site.php): Hide sidebar for some products in shopping cart catalogue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Am_Di::getInstance()->productTable->customFields() | |
->add(new Am_CustomFieldSingle_Checkbox('remove_sidebar', 'Remove Sidebar?')); | |
Am_Di::getInstance()->front->registerPlugin(new class extends Zend_Controller_Plugin_Abstract { | |
public function preDispatch(Zend_Controller_Request_Abstract $request) | |
{ | |
if ($request->getModuleName() == 'cart' | |
&& $request->getControllerName() == 'index' | |
&& $request->getActionName() == 'product') { | |
$product = $request->getParam('path') ? | |
Am_Di::getInstance()->productTable->findFirstByPath($request->getParam('path')) : | |
Am_Di::getInstance()->productTable->load($request->getParam('id')); | |
if ($product->data()->get('remove_sidebar')) { | |
$bm = Am_Di::getInstance()->blocks; | |
foreach ($bm->get('cart/right') as $block) { | |
$bm->remove($block->getId()); | |
} | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment