protected function getCheckoutList() { $sJsObject = $this->getPageJsObject(); $oTemplate = BxDolStudioTemplate::getInstance(); //--- Empty cart by vendor if the payment was accepted. $mixedVendor = bx_get('vendor'); $mixedProducts = bx_get('products'); if ($mixedVendor !== false && $mixedProducts !== false) { $oCart = BxDolStudioCart::getInstance(); $aProducts = explode(',', base64_decode($mixedProducts)); foreach ($aProducts as $iId) { $oCart->delete($mixedVendor, $iId); } return $this->getMessage('_adm_block_cpt_checkout', '_adm_msg_modules_success_checkouted'); } $aVendors = $this->loadCheckout(); if (empty($aVendors)) { return $this->getMessage('_adm_block_cpt_checkout', '_Empty'); } $sContent = ''; foreach ($aVendors as $sName => $aInfo) { $fTotal = 0; $sCurrency = ''; foreach ($aInfo['products'] as $aProduct) { $iCount = isset($aInfo['counts'][$aProduct['id']]) ? (int) $aInfo['counts'][$aProduct['id']] : 1; $fTotal += $iCount * $aProduct['price']; if ($sCurrency == '' && isset($aProduct['currency_sign'])) { $sCurrency = $aProduct['currency_sign']; } } $aMenu = array(array('id' => 'checkout-' . $sName, 'name' => 'checkout-' . $sName, 'link' => 'javascript:void(0)', 'onclick' => $sJsObject . ".checkoutCart('" . $sName . "', this);", 'target' => '_self', 'title' => '_adm_action_cpt_checkout', 'active' => 1), array('id' => 'delete-all-' . $sName, 'name' => 'delete-all-' . $sName, 'link' => 'javascript:void(0)', 'onclick' => $sJsObject . ".deleteAllFromCart('" . $sName . "', this)", 'target' => '_self', 'title' => '_adm_action_cpt_delete_all', 'active' => 1)); $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_buttons_hor.html', 'menu_id' => 'timeline-view-all', 'menu_items' => $aMenu)); $sContent .= $this->getBlockCode(array('caption' => _t('_adm_block_cpt_checkout_by_vendor_csign', $sName, $sCurrency, $fTotal), 'items' => $oTemplate->parseHtmlByName('str_products.html', array('list' => $this->displayProducts($aInfo['products'], array('is_shopping_cart' => true, 'counts' => $aInfo['counts'])), 'paginate' => '')), 'panel_bottom' => $oMenu->getCode())); } return $oTemplate->parseHtmlByName('store.html', array('js_object' => $sJsObject, 'content' => $sContent)); }
/** * private functions */ protected function _getControlsBox() { $oTemplate = BxDolTemplate::getInstance(); $sDisplay = ''; $bDisplay = (int) $this->_aSystem['is_display_switch'] == 1; if ($bDisplay) { $aDisplayLinks = array(array('id' => $this->_sSystem . '-flat', 'name' => $this->_sSystem . '-flat', 'class' => '', 'title' => '_cmt_display_flat', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeDisplay(this, \'flat\');'), array('id' => $this->_sSystem . '-threaded', 'name' => $this->_sSystem . '-threaded', 'class' => '', 'title' => '_cmt_display_threaded', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeDisplay(this, \'threaded\');')); bx_import('BxTemplMenuInteractive'); $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive_vertical.html', 'menu_id' => $this->_sSystem . '-display', 'menu_items' => $aDisplayLinks)); $oMenu->setSelected('', $this->_sSystem . '-' . $this->_sDisplayType); $sDisplay = $oMenu->getCode(); } $sBrowseType = ''; $bBrowseType = (int) $this->_aSystem['is_browse_switch'] == 1; if ($bBrowseType) { $aBrowseLinks = array(array('id' => $this->_sSystem . '-tail', 'name' => $this->_sSystem . '-tail', 'class' => '', 'title' => '_cmt_browse_tail', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeBrowse(this, \'tail\');'), array('id' => $this->_sSystem . '-head', 'name' => $this->_sSystem . '-head', 'class' => '', 'title' => '_cmt_browse_head', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeBrowse(this, \'head\');'), array('id' => $this->_sSystem . '-popular', 'name' => $this->_sSystem . '-popular', 'class' => '', 'title' => '_cmt_browse_popular', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeBrowse(this, \'popular\');')); bx_import('BxTemplMenuInteractive'); $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive_vertical.html', 'menu_id' => $this->_sSystem . '-browse', 'menu_items' => $aBrowseLinks)); $oMenu->setSelected('', $this->_sSystem . '-' . $this->_sBrowseType); $sBrowseType = $oMenu->getCode(); } $sBrowseFilter = ''; $bBrowseFilter = $bBrowseType; if ($bBrowseFilter) { $aFilterLinks = array(array('id' => $this->_sSystem . '-all', 'name' => $this->_sSystem . '-all', 'class' => '', 'title' => '_cmt_browse_all', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeFilter(this, \'all\');'), array('id' => $this->_sSystem . '-friends', 'name' => $this->_sSystem . '-friends', 'class' => '', 'title' => '_cmt_browse_friends', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeFilter(this, \'friends\');'), array('id' => $this->_sSystem . '-subscriptions', 'name' => $this->_sSystem . '-subscriptions', 'class' => '', 'title' => '_cmt_browse_subscriptions', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeFilter(this, \'subscriptions\');')); $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive_vertical.html', 'menu_id' => $this->_sSystem . '-filter', 'menu_items' => $aFilterLinks)); $oMenu->setSelected('', $this->_sSystem . '-' . $this->_sBrowseFilter); $sBrowseFilter = $oMenu->getCode(); } return $oTemplate->parseHtmlByName('comments_controls.html', array('display_switcher' => $bDisplay ? $sDisplay : '', 'bx_if:is_divider_1' => array('condition' => $bDisplay && $bBrowseType, 'content' => array('style_prefix' => $this->_sStylePrefix)), 'browse_switcher' => $bBrowseType ? $sBrowseType : '', 'bx_if:is_divider_2' => array('condition' => $bBrowseType && $bBrowseFilter, 'content' => array('style_prefix' => $this->_sStylePrefix)), 'filter_switcher' => $bBrowseFilter ? $sBrowseFilter : '')); }