本文整理汇总了PHP中HelperKpi::generate方法的典型用法代码示例。如果您正苦于以下问题:PHP HelperKpi::generate方法的具体用法?PHP HelperKpi::generate怎么用?PHP HelperKpi::generate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HelperKpi
的用法示例。
在下文中一共展示了HelperKpi::generate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderKpis
public function renderKpis()
{
$time = time();
$kpis = array();
/* The data generation is located in AdminStatsControllerCore */
$helper = new HelperKpi();
$helper->id = 'box-pending-messages';
$helper->icon = 'icon-envelope';
$helper->color = 'color1';
$helper->href = $this->context->link->getAdminLink('AdminCustomerThreads');
$helper->title = $this->l('Pending Discussion Threads', null, null, false);
if (ConfigurationKPI::get('PENDING_MESSAGES') !== false) {
$helper->value = ConfigurationKPI::get('PENDING_MESSAGES');
}
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=pending_messages';
$helper->refresh = (bool) (ConfigurationKPI::get('PENDING_MESSAGES_EXPIRE') < $time);
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-age';
$helper->icon = 'icon-time';
$helper->color = 'color2';
$helper->title = $this->l('Average Response Time', null, null, false);
$helper->subtitle = $this->l('30 days', null, null, false);
if (ConfigurationKPI::get('AVG_MSG_RESPONSE_TIME') !== false) {
$helper->value = ConfigurationKPI::get('AVG_MSG_RESPONSE_TIME');
}
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=avg_msg_response_time';
$helper->refresh = (bool) (ConfigurationKPI::get('AVG_MSG_RESPONSE_TIME_EXPIRE') < $time);
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-messages-per-thread';
$helper->icon = 'icon-copy';
$helper->color = 'color3';
$helper->title = $this->l('Messages per Thread', null, null, false);
$helper->subtitle = $this->l('30 day', null, null, false);
if (ConfigurationKPI::get('MESSAGES_PER_THREAD') !== false) {
$helper->value = ConfigurationKPI::get('MESSAGES_PER_THREAD');
}
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=messages_per_thread';
$helper->refresh = (bool) (ConfigurationKPI::get('MESSAGES_PER_THREAD_EXPIRE') < $time);
$kpis[] = $helper->generate();
$helper = new HelperKpiRow();
$helper->kpis = $kpis;
return $helper->generate();
}
示例2: renderKpis
public function renderKpis()
{
$time = time();
$kpis = array();
/* The data generation is located in AdminStatsControllerCore */
$helper = new HelperKpi();
$helper->id = 'box-installed-modules';
$helper->icon = 'icon-puzzle-piece';
$helper->color = 'color1';
$helper->title = $this->l('Installed Modules', null, null, false);
if (ConfigurationKPI::get('INSTALLED_MODULES') !== false && ConfigurationKPI::get('INSTALLED_MODULES') != '') {
$helper->value = ConfigurationKPI::get('INSTALLED_MODULES');
}
if (ConfigurationKPI::get('INSTALLED_MODULES_EXPIRE') < $time) {
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=installed_modules';
}
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-disabled-modules';
$helper->icon = 'icon-off';
$helper->color = 'color2';
$helper->title = $this->l('Disabled Modules', null, null, false);
if (ConfigurationKPI::get('DISABLED_MODULES') !== false && ConfigurationKPI::get('DISABLED_MODULES') != '') {
$helper->value = ConfigurationKPI::get('DISABLED_MODULES');
}
if (ConfigurationKPI::get('DISABLED_MODULES_EXPIRE') < $time) {
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=disabled_modules';
}
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-update-modules';
$helper->icon = 'icon-refresh';
$helper->color = 'color3';
$helper->title = $this->l('Modules to update', null, null, false);
if (ConfigurationKPI::get('UPDATE_MODULES') !== false && ConfigurationKPI::get('UPDATE_MODULES') != '') {
$helper->value = ConfigurationKPI::get('UPDATE_MODULES');
}
if (ConfigurationKPI::get('UPDATE_MODULES_EXPIRE') < $time) {
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=update_modules';
}
$kpis[] = $helper->generate();
$helper = new HelperKpiRow();
$helper->kpis = $kpis;
return $helper->generate();
}
示例3: renderView
public function renderView()
{
if (!($cart = $this->loadObject(true))) {
return;
}
$customer = new Customer($cart->id_customer);
$currency = new Currency($cart->id_currency);
$this->context->cart = $cart;
$this->context->currency = $currency;
$this->context->customer = $customer;
$this->toolbar_title = sprintf($this->l('Cart #%06d'), $this->context->cart->id);
$products = $cart->getProducts();
$customized_datas = Product::getAllCustomizedDatas((int) $cart->id);
Product::addCustomizationPrice($products, $customized_datas);
$summary = $cart->getSummaryDetails();
/* Display order information */
$id_order = (int) Order::getOrderByCartId($cart->id);
$order = new Order($id_order);
if (Validate::isLoadedObject($order)) {
$tax_calculation_method = $order->getTaxCalculationMethod();
$id_shop = (int) $order->id_shop;
} else {
$id_shop = (int) $cart->id_shop;
$tax_calculation_method = Group::getPriceDisplayMethod(Group::getCurrent()->id);
}
if ($tax_calculation_method == PS_TAX_EXC) {
$total_products = $summary['total_products'];
$total_discounts = $summary['total_discounts_tax_exc'];
$total_wrapping = $summary['total_wrapping_tax_exc'];
$total_price = $summary['total_price_without_tax'];
$total_shipping = $summary['total_shipping_tax_exc'];
} else {
$total_products = $summary['total_products_wt'];
$total_discounts = $summary['total_discounts'];
$total_wrapping = $summary['total_wrapping'];
$total_price = $summary['total_price'];
$total_shipping = $summary['total_shipping'];
}
foreach ($products as $k => &$product) {
if ($tax_calculation_method == PS_TAX_EXC) {
$product['product_price'] = $product['price'];
$product['product_total'] = $product['total'];
} else {
$product['product_price'] = $product['price_wt'];
$product['product_total'] = $product['total_wt'];
}
$image = array();
if (isset($product['id_product_attribute']) && (int) $product['id_product_attribute']) {
$image = Db::getInstance()->getRow('SELECT id_image FROM ' . _DB_PREFIX_ . 'product_attribute_image WHERE id_product_attribute = ' . (int) $product['id_product_attribute']);
}
if (!isset($image['id_image'])) {
$image = Db::getInstance()->getRow('SELECT id_image FROM ' . _DB_PREFIX_ . 'image WHERE id_product = ' . (int) $product['id_product'] . ' AND cover = 1');
}
$product_obj = new Product($product['id_product']);
$product['qty_in_stock'] = StockAvailable::getQuantityAvailableByProduct($product['id_product'], isset($product['id_product_attribute']) ? $product['id_product_attribute'] : null, (int) $id_shop);
$image_product = new Image($image['id_image']);
$product['image'] = isset($image['id_image']) ? ImageManager::thumbnail(_PS_IMG_DIR_ . 'p/' . $image_product->getExistingImgPath() . '.jpg', 'product_mini_' . (int) $product['id_product'] . (isset($product['id_product_attribute']) ? '_' . (int) $product['id_product_attribute'] : '') . '.jpg', 45, 'jpg') : '--';
}
$helper = new HelperKpi();
$helper->id = 'box-kpi-cart';
$helper->icon = 'icon-shopping-cart';
$helper->color = 'color1';
$helper->title = $this->l('Total Cart', null, null, false);
$helper->subtitle = sprintf($this->l('Cart #%06d', null, null, false), $cart->id);
$helper->value = Tools::displayPrice($total_price, $currency);
$kpi = $helper->generate();
$this->tpl_view_vars = array('kpi' => $kpi, 'products' => $products, 'discounts' => $cart->getCartRules(), 'order' => $order, 'cart' => $cart, 'currency' => $currency, 'customer' => $customer, 'customer_stats' => $customer->getStats(), 'total_products' => $total_products, 'total_discounts' => $total_discounts, 'total_wrapping' => $total_wrapping, 'total_price' => $total_price, 'total_shipping' => $total_shipping, 'customized_datas' => $customized_datas);
return parent::renderView();
}
示例4: renderKpis
public function renderKpis()
{
$time = time();
$kpis = array();
/* The data generation is located in AdminStatsControllerCore */
$helper = new HelperKpi();
$helper->id = 'box-gender';
$helper->icon = 'icon-male';
$helper->color = 'color1';
$helper->title = $this->l('Customers', null, null, false);
$helper->subtitle = $this->l('All Time', null, null, false);
if (ConfigurationKPI::get('CUSTOMER_MAIN_GENDER', $this->context->language->id) !== false) {
$helper->value = ConfigurationKPI::get('CUSTOMER_MAIN_GENDER', $this->context->language->id);
}
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=customer_main_gender';
$helper->refresh = (bool) (ConfigurationKPI::get('CUSTOMER_MAIN_GENDER_EXPIRE', $this->context->language->id) < $time);
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-age';
$helper->icon = 'icon-calendar';
$helper->color = 'color2';
$helper->title = $this->l('Average Age', 'AdminTab', null, false);
$helper->subtitle = $this->l('All Time', null, null, false);
if (ConfigurationKPI::get('AVG_CUSTOMER_AGE', $this->context->language->id) !== false) {
$helper->value = ConfigurationKPI::get('AVG_CUSTOMER_AGE', $this->context->language->id);
}
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=avg_customer_age';
$helper->refresh = (bool) (ConfigurationKPI::get('AVG_CUSTOMER_AGE_EXPIRE', $this->context->language->id) < $time);
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-orders';
$helper->icon = 'icon-retweet';
$helper->color = 'color3';
$helper->title = $this->l('Orders per Customer', null, null, false);
$helper->subtitle = $this->l('All Time', null, null, false);
if (ConfigurationKPI::get('ORDERS_PER_CUSTOMER') !== false) {
$helper->value = ConfigurationKPI::get('ORDERS_PER_CUSTOMER');
}
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=orders_per_customer';
$helper->refresh = (bool) (ConfigurationKPI::get('ORDERS_PER_CUSTOMER_EXPIRE') < $time);
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-newsletter';
$helper->icon = 'icon-envelope';
$helper->color = 'color4';
$helper->title = $this->l('Newsletter Registrations', null, null, false);
$helper->subtitle = $this->l('All Time', null, null, false);
if (ConfigurationKPI::get('NEWSLETTER_REGISTRATIONS') !== false) {
$helper->value = ConfigurationKPI::get('NEWSLETTER_REGISTRATIONS');
}
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=newsletter_registrations';
$helper->refresh = (bool) (ConfigurationKPI::get('NEWSLETTER_REGISTRATIONS_EXPIRE') < $time);
$kpis[] = $helper->generate();
$helper = new HelperKpiRow();
$helper->kpis = $kpis;
return $helper->generate();
}
示例5: renderKpis
public function renderKpis()
{
$time = time();
$kpis = array();
/* The data generation is located in AdminStatsControllerCore */
if (Configuration::get('PS_STOCK_MANAGEMENT')) {
$helper = new HelperKpi();
$helper->id = 'box-products-stock';
$helper->icon = 'icon-archive';
$helper->color = 'color1';
$helper->title = $this->l('Out of stock items', null, null, false);
if (ConfigurationKPI::get('PERCENT_PRODUCT_OUT_OF_STOCK') !== false) {
$helper->value = ConfigurationKPI::get('PERCENT_PRODUCT_OUT_OF_STOCK');
}
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=percent_product_out_of_stock';
$helper->tooltip = $this->l('X% of your products for sale are out of stock.', null, null, false);
$helper->refresh = (bool) (ConfigurationKPI::get('PERCENT_PRODUCT_OUT_OF_STOCK_EXPIRE') < $time);
$helper->href = Context::getContext()->link->getAdminLink('AdminProducts') . '&productFilter_sav!quantity=0&productFilter_active=1&submitFilterproduct=1';
$kpis[] = $helper->generate();
}
$helper = new HelperKpi();
$helper->id = 'box-avg-gross-margin';
$helper->icon = 'icon-tags';
$helper->color = 'color2';
$helper->title = $this->l('Average Gross Margin', null, null, false);
if (ConfigurationKPI::get('PRODUCT_AVG_GROSS_MARGIN') !== false) {
$helper->value = ConfigurationKPI::get('PRODUCT_AVG_GROSS_MARGIN');
}
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=product_avg_gross_margin';
$helper->tooltip = $this->l('The gross margin is the difference between the retail price and the wholesale price, on all your products for sale.', null, null, false);
$helper->refresh = (bool) (ConfigurationKPI::get('PRODUCT_AVG_GROSS_MARGIN_EXPIRE') < $time);
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-8020-sales-catalog';
$helper->icon = 'icon-beaker';
$helper->color = 'color3';
$helper->title = $this->l('Purchased references', null, null, false);
$helper->subtitle = $this->l('30 days', null, null, false);
if (ConfigurationKPI::get('8020_SALES_CATALOG') !== false) {
$helper->value = ConfigurationKPI::get('8020_SALES_CATALOG');
}
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=8020_sales_catalog';
$helper->tooltip = $this->l('X% of your references have been purchased for the past 30 days', null, null, false);
$helper->refresh = (bool) (ConfigurationKPI::get('8020_SALES_CATALOG_EXPIRE') < $time);
if (Module::isInstalled('statsbestproducts')) {
$helper->href = Context::getContext()->link->getAdminLink('AdminStats') . '&module=statsbestproducts&datepickerFrom=' . date('Y-m-d', strtotime('-30 days')) . '&datepickerTo=' . date('Y-m-d');
}
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-disabled-products';
$helper->icon = 'icon-off';
$helper->color = 'color4';
$helper->href = $this->context->link->getAdminLink('AdminProducts');
$helper->title = $this->l('Disabled Products', null, null, false);
if (ConfigurationKPI::get('DISABLED_PRODUCTS') !== false) {
$helper->value = ConfigurationKPI::get('DISABLED_PRODUCTS');
}
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=disabled_products';
$helper->refresh = (bool) (ConfigurationKPI::get('DISABLED_PRODUCTS_EXPIRE') < $time);
$helper->tooltip = $this->l('X% of your products are disabled and not visible to your customers', null, null, false);
$helper->href = Context::getContext()->link->getAdminLink('AdminProducts') . '&productFilter_active=0&submitFilterproduct=1';
$kpis[] = $helper->generate();
$helper = new HelperKpiRow();
$helper->kpis = $kpis;
return $helper->generate();
}
示例6: renderKpis
public function renderKpis()
{
$time = time();
$kpis = array();
/* The data generation is located in AdminStatsControllerCore */
$helper = new HelperKpi();
$helper->id = 'box-disabled-categories';
$helper->icon = 'icon-off';
$helper->color = 'color1';
$helper->title = $this->l('Disabled Categories', null, null, false);
if (ConfigurationKPI::get('DISABLED_CATEGORIES') !== false) {
$helper->value = ConfigurationKPI::get('DISABLED_CATEGORIES');
}
if (ConfigurationKPI::get('DISABLED_CATEGORIES_EXPIRE') < $time) {
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=disabled_categories';
}
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-empty-categories';
$helper->icon = 'icon-bookmark-empty';
$helper->color = 'color2';
$helper->href = $this->context->link->getAdminLink('AdminTracking');
$helper->title = $this->l('Empty Categories', null, null, false);
if (ConfigurationKPI::get('EMPTY_CATEGORIES') !== false) {
$helper->value = ConfigurationKPI::get('EMPTY_CATEGORIES');
}
if (ConfigurationKPI::get('EMPTY_CATEGORIES_EXPIRE') < $time) {
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=empty_categories';
}
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-top-category';
$helper->icon = 'icon-money';
$helper->color = 'color3';
$helper->title = $this->l('Top Category', null, null, false);
$helper->subtitle = $this->l('30 days', null, null, false);
if (ConfigurationKPI::get('TOP_CATEGORY', $this->context->employee->id_lang) !== false) {
$helper->value = ConfigurationKPI::get('TOP_CATEGORY', $this->context->employee->id_lang);
}
if (ConfigurationKPI::get('TOP_CATEGORY_EXPIRE', $this->context->employee->id_lang) < $time) {
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=top_category';
}
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-products-per-category';
$helper->icon = 'icon-search';
$helper->color = 'color4';
$helper->title = $this->l('Average number of products per category', null, null, false);
if (ConfigurationKPI::get('PRODUCTS_PER_CATEGORY') !== false) {
$helper->value = ConfigurationKPI::get('PRODUCTS_PER_CATEGORY');
}
if (ConfigurationKPI::get('PRODUCTS_PER_CATEGORY_EXPIRE') < $time) {
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=products_per_category';
}
$kpis[] = $helper->generate();
$helper = new HelperKpiRow();
$helper->kpis = $kpis;
return $helper->generate();
}
示例7: renderKpis
public function renderKpis()
{
$time = time();
$kpis = array();
/* The data generation is located in AdminStatsControllerCore */
$helper = new HelperKpi();
$helper->id = 'box-languages';
$helper->icon = 'icon-microphone';
$helper->color = 'color1';
$helper->title = $this->l('Enabled Languages', null, null, false);
if (ConfigurationKPI::get('ENABLED_LANGUAGES') !== false) {
$helper->value = ConfigurationKPI::get('ENABLED_LANGUAGES');
}
if (ConfigurationKPI::get('ENABLED_LANGUAGES_EXPIRE') < $time) {
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=enabled_languages';
}
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-country';
$helper->icon = 'icon-home';
$helper->color = 'color2';
$helper->title = $this->l('Main Country', null, null, false);
$helper->subtitle = $this->l('30 Days', null, null, false);
if (ConfigurationKPI::get('MAIN_COUNTRY', $this->context->language->id) !== false) {
$helper->value = ConfigurationKPI::get('MAIN_COUNTRY', $this->context->language->id);
}
if (ConfigurationKPI::get('MAIN_COUNTRY_EXPIRE', $this->context->language->id) < $time) {
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=main_country';
}
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-translations';
$helper->icon = 'icon-list';
$helper->color = 'color3';
$helper->title = $this->l('Front Office Translations', null, null, false);
if (ConfigurationKPI::get('FRONTOFFICE_TRANSLATIONS') !== false) {
$helper->value = ConfigurationKPI::get('FRONTOFFICE_TRANSLATIONS');
}
if (ConfigurationKPI::get('FRONTOFFICE_TRANSLATIONS_EXPIRE') < $time) {
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=frontoffice_translations';
}
$kpis[] = $helper->generate();
$helper = new HelperKpiRow();
$helper->kpis = $kpis;
return $helper->generate();
}
示例8: renderKpis
public function renderKpis()
{
$time = time();
$kpis = array();
/* The data generation is located in AdminStatsControllerCore */
if (Configuration::get('PS_STOCK_MANAGEMENT')) {
$helper = new HelperKpi();
$helper->id = 'box-products-stock';
$helper->icon = 'local_shipping';
$helper->color = 'color1';
$helper->title = $this->l('Out of stock items', null, null, false);
if (ConfigurationKPI::get('PERCENT_PRODUCT_OUT_OF_STOCK') !== false) {
$helper->value = ConfigurationKPI::get('PERCENT_PRODUCT_OUT_OF_STOCK');
}
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=percent_product_out_of_stock';
$helper->tooltip = sprintf($this->l('%s of your products for sale are out of stock.', null, null, false), $helper->value);
$helper->refresh = (bool) (ConfigurationKPI::get('PERCENT_PRODUCT_OUT_OF_STOCK_EXPIRE') < $time);
$product_token = Tools::getAdminToken('AdminProducts' . (int) Tab::getIdFromClassName('AdminProducts') . (int) Context::getContext()->employee->id);
$urlParams = ['filter_column_sav_quantity' => '<=0', 'filter_column_active' => '1', 'token' => $product_token, 'submitFilterproduct' => 1];
$helper->href = preg_replace("/\\?.*\$/", '?tab=AdminProducts&productFilter_sav!quantity=0&productFilter_active=1&submitFilterproduct=1&token=' . $product_token, Context::getContext()->link->getAdminLink('AdminProducts', true, $urlParams));
$kpis[] = $helper->generate();
}
$helper = new HelperKpi();
$helper->id = 'box-avg-gross-margin';
$helper->icon = 'label';
$helper->color = 'color2';
$helper->title = $this->l('Average Gross Margin %', null, null, false);
if (ConfigurationKPI::get('PRODUCT_AVG_GROSS_MARGIN') !== false) {
$helper->value = ConfigurationKPI::get('PRODUCT_AVG_GROSS_MARGIN');
}
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=product_avg_gross_margin';
$helper->tooltip = sprintf($this->l('Gross margin expressed in percentage assesses how cost-effectively you sell your goods. Out of $100, you will retain $%s to cover profit and expenses.', null, null, false), str_replace('%', '', $helper->value));
$helper->refresh = (bool) (ConfigurationKPI::get('PRODUCT_AVG_GROSS_MARGIN_EXPIRE') < $time);
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-8020-sales-catalog';
$helper->icon = 'whatshot';
$helper->color = 'color3';
$helper->title = $this->l('Catalog popularity', null, null, false);
$helper->subtitle = $this->l('30 days', null, null, false);
if (ConfigurationKPI::get('8020_SALES_CATALOG') !== false) {
$helper->value = ConfigurationKPI::get('8020_SALES_CATALOG');
}
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=8020_sales_catalog';
$helper->tooltip = sprintf($this->l('Within your catalog, %s of your products have had sales in the last 30 days', null, null, false), $helper->value);
$helper->refresh = (bool) (ConfigurationKPI::get('8020_SALES_CATALOG_EXPIRE') < $time);
$moduleManagerBuilder = ModuleManagerBuilder::getInstance();
$moduleManager = $moduleManagerBuilder->build();
if ($moduleManager->isInstalled('statsbestproducts')) {
$helper->href = Context::getContext()->link->getAdminLink('AdminStats') . '&module=statsbestproducts&datepickerFrom=' . date('Y-m-d', strtotime('-30 days')) . '&datepickerTo=' . date('Y-m-d');
}
$kpis[] = $helper->generate();
$helper = new HelperKpi();
$helper->id = 'box-disabled-products';
$helper->icon = 'visibility_off';
$helper->color = 'color4';
$helper->title = $this->l('Disabled Products', null, null, false);
if (ConfigurationKPI::get('DISABLED_PRODUCTS') !== false) {
$helper->value = ConfigurationKPI::get('DISABLED_PRODUCTS');
}
$helper->source = $this->context->link->getAdminLink('AdminStats') . '&ajax=1&action=getKpi&kpi=disabled_products';
$helper->refresh = (bool) (ConfigurationKPI::get('DISABLED_PRODUCTS_EXPIRE') < $time);
$helper->tooltip = sprintf($this->l('%s of your products are disabled and not visible to your customers', null, null, false), $helper->value);
$product_token = Tools::getAdminToken('AdminProducts' . (int) Tab::getIdFromClassName('AdminProducts') . (int) Context::getContext()->employee->id);
$urlParams = ['filter_column_active' => '0', 'token' => $product_token, 'submitFilterproduct' => 1];
$helper->href = preg_replace("/\\?.*\$/", '?tab=AdminProducts&productFilter_active=0&submitFilterproduct=1&token=' . $product_token, Context::getContext()->link->getAdminLink('AdminProducts', true, $urlParams));
$kpis[] = $helper->generate();
$helper = new HelperKpiRow();
$helper->kpis = $kpis;
return $helper->generate();
}
示例9: renderView
public function renderView()
{
/** @var Cart $cart */
if (!($cart = $this->loadObject(true))) {
return;
}
$customer = new Customer($cart->id_customer);
$currency = new Currency($cart->id_currency);
$this->context->cart = $cart;
$this->context->currency = $currency;
$this->context->customer = $customer;
$this->toolbar_title = sprintf($this->l('Cart #%06d'), $this->context->cart->id);
$products = $cart->getProducts();
$customized_datas = Product::getAllCustomizedDatas((int) $cart->id);
Product::addCustomizationPrice($products, $customized_datas);
$summary = $cart->getSummaryDetails();
/* Display order information */
$id_order = (int) Order::getOrderByCartId($cart->id);
$order = new Order($id_order);
if (Validate::isLoadedObject($order)) {
$tax_calculation_method = $order->getTaxCalculationMethod();
$id_shop = (int) $order->id_shop;
} else {
$id_shop = (int) $cart->id_shop;
$tax_calculation_method = Group::getPriceDisplayMethod(Group::getCurrent()->id);
}
if ($tax_calculation_method == PS_TAX_EXC) {
$total_products = $summary['total_products'];
$total_discounts = $summary['total_discounts_tax_exc'];
$total_wrapping = $summary['total_wrapping_tax_exc'];
$total_price = $summary['total_price_without_tax'];
$total_shipping = $summary['total_shipping_tax_exc'];
} else {
$total_products = $summary['total_products_wt'];
$total_discounts = $summary['total_discounts'];
$total_wrapping = $summary['total_wrapping'];
$total_price = $summary['total_price'];
$total_shipping = $summary['total_shipping'];
}
foreach ($products as $k => &$product) {
if ($tax_calculation_method == PS_TAX_EXC) {
$product['product_price'] = $product['price'];
$product['product_total'] = $product['total'];
} else {
$product['product_price'] = $product['price_wt'];
$product['product_total'] = $product['total_wt'];
}
$image = array();
if (isset($product['id_product_attribute']) && (int) $product['id_product_attribute']) {
$image = Db::getInstance()->getRow('SELECT id_image FROM ' . _DB_PREFIX_ . 'product_attribute_image WHERE id_product_attribute = ' . (int) $product['id_product_attribute']);
}
if (!isset($image['id_image'])) {
$image = Db::getInstance()->getRow('SELECT id_image FROM ' . _DB_PREFIX_ . 'image WHERE id_product = ' . (int) $product['id_product'] . ' AND cover = 1');
}
$product['qty_in_stock'] = StockAvailable::getQuantityAvailableByProduct($product['id_product'], isset($product['id_product_attribute']) ? $product['id_product_attribute'] : null, (int) $id_shop);
$image_product = new Image($image['id_image']);
$product['image'] = isset($image['id_image']) ? ImageManager::thumbnail(_PS_IMG_DIR_ . 'p/' . $image_product->getExistingImgPath() . '.jpg', 'product_mini_' . (int) $product['id_product'] . (isset($product['id_product_attribute']) ? '_' . (int) $product['id_product_attribute'] : '') . '.jpg', 45, 'jpg') : '--';
}
$helper = new HelperKpi();
$helper->id = 'box-kpi-cart';
$helper->icon = 'icon-shopping-cart';
$helper->color = 'color1';
$helper->title = $this->l('Total Cart', null, null, false);
$helper->subtitle = sprintf($this->l('Cart #%06d', null, null, false), $cart->id);
$helper->value = Tools::displayPrice($total_price, $currency);
$kpi = $helper->generate();
// by webkul to show rooms available in the cart
$cart_id = $cart->id;
$cart_detail_data = array();
$cart_detail_data_obj = new HotelCartBookingData();
$cart_detail_data = $cart_detail_data_obj->getCartCurrentDataByCartId((int) $cart_id);
if ($cart_detail_data) {
foreach ($cart_detail_data as $key => $value) {
$product_image_id = Product::getCover($value['id_product']);
$link_rewrite = (new Product((int) $value['id_product'], Configuration::get('PS_LANG_DEFAULT')))->link_rewrite[Configuration::get('PS_LANG_DEFAULT')];
if ($product_image_id) {
$cart_detail_data[$key]['image_link'] = $this->context->link->getImageLink($link_rewrite, $product_image_id['id_image'], 'small_default');
} else {
$cart_detail_data[$key]['image_link'] = $this->context->link->getImageLink($link_rewrite, $this->context->language->iso_code . "-default", 'small_default');
}
$cart_detail_data[$key]['room_type'] = (new Product((int) $value['id_product']))->name[Configuration::get('PS_LANG_DEFAULT')];
$cart_detail_data[$key]['room_num'] = (new HotelRoomInformation((int) $value['id_room']))->room_num;
$cart_detail_data[$key]['date_from'] = (new DateTime($value['date_from']))->format('d-M Y');
$cart_detail_data[$key]['date_to'] = (new DateTime($value['date_to']))->format('d-M Y');
}
}
//end
$this->tpl_view_vars = array('cart_detail_data' => $cart_detail_data, 'kpi' => $kpi, 'products' => $products, 'discounts' => $cart->getCartRules(), 'order' => $order, 'cart' => $cart, 'currency' => $currency, 'customer' => $customer, 'customer_stats' => $customer->getStats(), 'total_products' => $total_products, 'total_discounts' => $total_discounts, 'total_wrapping' => $total_wrapping, 'total_price' => $total_price, 'total_shipping' => $total_shipping, 'customized_datas' => $customized_datas, 'tax_calculation_method' => $tax_calculation_method);
return parent::renderView();
}