Created
November 28, 2018 10:23
-
-
Save cgi-caesar/ef51ac63e5d81a2d62ea6e8b809258ea to your computer and use it in GitHub Desktop.
aMember (site.php): Add images for products within Active Subscriptions widget
This file contains 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 | |
/** | |
* This feature uses shopping cart module and its product images (cart view size) | |
*/ | |
$di = Am_Di::getInstance(); | |
if ($di->auth->getUser() && ($pids = $di->user->getActiveProductIds())) { | |
$di->view->headStyle() | |
->appendStyle("#member-subscriptions li {display: block;}"); | |
$products = $di->productTable->loadIds($pids); | |
foreach ($products as $p) { | |
if ($p->img_cart_path) { | |
$img = $di->url("data/public/{$p->img_cart_path}"); | |
$di->view->headStyle()->appendStyle(<<<CUT | |
#member-subscriptions li#product-item-{$p->pk()} { | |
background: url('{$img}') left center no-repeat; | |
padding-left: 60px; | |
min-height: 50px; | |
vertical-align: middle; | |
} | |
CUT | |
); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment