Skip to content

Instantly share code, notes, and snippets.

@cgi-caesar
Created November 28, 2018 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgi-caesar/ef51ac63e5d81a2d62ea6e8b809258ea to your computer and use it in GitHub Desktop.
Save cgi-caesar/ef51ac63e5d81a2d62ea6e8b809258ea to your computer and use it in GitHub Desktop.
aMember (site.php): Add images for products within Active Subscriptions widget
<?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