public static function getAddons($hParams = array()) { $ahAddons = shopShopping::readStore(array('norm' => 'add-on', 'check_orderable' => 1, 'return_array' => 1, 'return_detail_limits' => 1, 'return_shop_price' => 1)); $iAllOrderableCount = 0; if ($ahAddons) { foreach ($ahAddons as &$hGroup) { $iGroupOrderableCount = 0; foreach ($hGroup['entrys'] as $hEntry) { if ($hEntry['orderable']['amount'] != 0) { $iGroupOrderableCount++; } } $hGroup['orderable_entrys'] = $iGroupOrderableCount; $iAllOrderableCount += $iGroupOrderableCount; } unset($hGroup); } return array('groups' => $ahAddons, 'orderable_count' => $iAllOrderableCount); }
/** * Günstigsten Preis eines Produkts auslesen * * Um die Suche auf einen Produkttyp einzuschränken, geben Sie beim * Aufruf der Methode in $hParams folgenden Wert an: * 'norm' => 'tariff' * In diesem Fall werden nur die Preise der Tarife geprüft. * * @param array $hParams Zusätzliche Parameter für Aufruf von readStore * @return float|null Günstiger Preis der gesuchten Artikel */ public static function getCheapestStorePrice($hParams = array()) { // Produktgruppen auslesen $ahProductGroups = shopShopping::readStore(array_merge(array('check_orderable' => 1, 'return_array' => 1, 'return_shop_price' => 1), $hParams)); // Sind keine Daten vorhanden, wird als Rückgabewert null angegeben $fCheapestPrice = null; if ($ahProductGroups && count($ahProductGroups)) { foreach ($ahProductGroups as $hProductGroup) { // Befinden sich Produkte in der Gruppe? if (!array_key_exists('entrys', $hProductGroup) || !count($hProductGroup['entrys'])) { continue; } foreach ($hProductGroup['entrys'] as $hProduct) { if ($fCheapestPrice === null || $hProduct['shop_price']['price_long'] < $fCheapestPrice) { $fCheapestPrice = $hProduct['shop_price']['price_long']; // Günstiger als kostenlos wirds nicht... if ($fCheapestPrice !== null && $fCheapestPrice === 0.0) { return 0.0; } } } } } return $fCheapestPrice; }
/** * Artikel aus dem Warenkorb auslesen * * @param array [$hParams] Parameter fuer bbShopping::readCart * @return array */ public static function getCart($hParams = array()) { $bReturnCartOrder = false; if (array_key_exists('return_shop_cart_order', $hParams)) { $bReturnCartOrder = $hParams['return_shop_cart_order']; unset($hParams['return_shop_cart_order']); } $cart = shopShopping::getCartData($hParams); // Alle Artikel der abgefragten Produkttyps auslesen $hTypeItems = null; if (array_key_exists('return_norms', $hParams) && count($hParams['return_norms'])) { $hTypeItems = shopShopping::readStore(array('norm' => $hParams['return_norms'], 'return_array' => 1, 'return_orderable' => 1)); } $hAssigns = array('count' => $cart['item_count'], 'items' => $cart['items'], 'norms' => $hTypeItems); Renderer::assign('cart', $cart); if ($bReturnCartOrder) { $sTemplate = Renderer::render('modules/order_cart_sidebar.tpl'); // Haupt-Darstellung rendern $ahIntervals = shopProduct::readInterval(array('return_shopformat' => 1)); $ahIntervals[0] = 'einmalig'; $ahIntervals['descr'][0] = 'einmalig'; Renderer::assign('interval', $ahIntervals); Renderer::assign('cart', $cart); Renderer::assign('cart_editable', true); $hAssigns['overview'] = Renderer::render('modules/cart_articles.tpl'); } else { $sTemplate = Renderer::render('modules/cart_nav.tpl'); } // Template rendern und Daten zurueck geben return array('template' => $sTemplate, 'assigns' => $hAssigns); }