function _setData() { global $osC_Database, $osC_Language, $osC_Currencies; if (!isset($osC_Currencies)) { if (!class_exists('osC_Currencies')) { include '../includes/classes/currencies.php'; } $osC_Currencies = new osC_Currencies(); } $this->_data = '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">' . ' <thead>' . ' <tr>' . ' <th>' . $osC_Language->get('summary_products_table_heading_products') . '</th>' . ' <th>' . $osC_Language->get('summary_products_table_heading_price') . '</th>' . ' <th>' . $osC_Language->get('summary_products_table_heading_date') . '</th>' . ' <th>' . $osC_Language->get('summary_products_table_heading_status') . '</th>' . ' </tr>' . ' </thead>' . ' <tbody>'; $Qproducts = $osC_Database->query('select products_id, greatest(products_date_added, products_last_modified) as date_last_modified from :table_products where parent_id = 0 order by date_last_modified desc limit 6'); $Qproducts->bindTable(':table_products', TABLE_PRODUCTS); $Qproducts->execute(); while ($Qproducts->next()) { $data = osC_Products_Admin::get($Qproducts->valueInt('products_id')); $products_icon = osc_icon('products.png'); $products_price = $data['products_price']; if (!empty($data['variants'])) { $products_icon = osc_icon('attach.png'); $products_price = null; foreach ($data['variants'] as $variant) { if ($products_price === null || $variant['data']['price'] < $products_price) { $products_price = $variant['data']['price']; } } if ($products_price === null) { $products_price = 0; } } $this->_data .= ' <tr onmouseover="rowOverEffect(this);" onmouseout="rowOutEffect(this);">' . ' <td>' . osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, 'products=' . (int) $data['products_id'] . '&action=save'), $products_icon . ' ' . osc_output_string_protected($data['products_name'])) . '</td>' . ' <td>' . (!empty($data['variants']) ? 'from ' : '') . $osC_Currencies->format($products_price) . '</td>' . ' <td>' . $Qproducts->value('date_last_modified') . '</td>' . ' <td align="center">' . osc_icon((int) $data['products_status'] === 1 ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif', null, null) . '</td>' . ' </tr>'; } $this->_data .= ' </tbody>' . '</table>'; $Qproducts->freeResult(); }
public function __construct() { Registry::get('Language')->loadIniFile('modules/Dashboard/Products.php'); $this->_title = OSCOM::getDef('admin_indexmodules_products_title'); $this->_title_link = OSCOM::getLink(null, 'Products'); if (Access::hasAccess(OSCOM::getSite(), 'Products')) { if (!isset($osC_Currencies)) { if (!class_exists('osC_Currencies')) { include 'includes/classes/currencies.php'; } $osC_Currencies = new osC_Currencies(); } $this->_data = '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">' . ' <thead>' . ' <tr>' . ' <th>' . OSCOM::getDef('admin_indexmodules_products_table_heading_products') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_products_table_heading_price') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_products_table_heading_date') . '</th>' . ' <th>' . OSCOM::getDef('admin_indexmodules_products_table_heading_status') . '</th>' . ' </tr>' . ' </thead>' . ' <tbody>'; $Qproducts = Registry::get('PDO')->query('select products_id, greatest(products_date_added, products_last_modified) as date_last_modified from :table_products where parent_id is null order by date_last_modified desc limit 6'); $Qproducts->execute(); $counter = 0; while ($Qproducts->fetch()) { $data = osC_Products_Admin::get($Qproducts->valueInt('products_id')); $products_icon = osc_icon('products.png'); $products_price = $data['products_price']; if (!empty($data['variants'])) { $products_icon = osc_icon('attach.png'); $products_price = null; foreach ($data['variants'] as $variant) { if ($products_price === null || $variant['data']['price'] < $products_price) { $products_price = $variant['data']['price']; } } if ($products_price === null) { $products_price = 0; } } $this->_data .= ' <tr onmouseover="$(this).addClass(\'mouseOver\');" onmouseout="$(this).removeClass(\'mouseOver\');"' . ($counter % 2 ? ' class="alt"' : '') . '>' . ' <td>' . osc_link_object(OSCOM::getLink(null, 'Products', 'id=' . (int) $data['products_id'] . '&action=save'), $products_icon . ' ' . osc_output_string_protected($data['products_name'])) . '</td>' . ' <td>' . (!empty($data['variants']) ? 'from ' : '') . $osC_Currencies->format($products_price) . '</td>' . ' <td>' . $Qproducts->value('date_last_modified') . '</td>' . ' <td align="center">' . osc_icon((int) $data['products_status'] === 1 ? 'checkbox_ticked.gif' : 'checkbox_crossed.gif', null, null) . '</td>' . ' </tr>'; $counter++; } $this->_data .= ' </tbody>' . '</table>'; } }
<?php /* $Id: $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2009 osCommerce This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2 (1991) as published by the Free Software Foundation. */ $osC_ObjectInfo = new osC_ObjectInfo(osC_Products_Admin::get($_GET[$osC_Template->getModule()])); $in_categories = array(); $Qcategories = $osC_Database->query('select categories_id from :table_products_to_categories where products_id = :products_id'); $Qcategories->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES); $Qcategories->bindInt(':products_id', $osC_ObjectInfo->get('products_id')); $Qcategories->execute(); while ($Qcategories->next()) { $in_categories[] = $Qcategories->valueInt('categories_id'); } $categories_array = array(); foreach ($in_categories as $category_id) { $categories_array[] = array('id' => $category_id, 'text' => $osC_CategoryTree->getPath($category_id, 0, ' » ')); } ?> <h1><?php echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), $osC_Template->getPageTitle());
<?php /* $Id: $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2009 osCommerce This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2 (1991) as published by the Free Software Foundation. */ $osC_ObjectInfo = new osC_ObjectInfo(osC_Products_Admin::get($_GET['pID'])); $Qdata = $osC_Database->query('select str_to_date(pa.value, "%Y-%m-%d") as products_date_available from :table_product_attributes pa, :table_templates_boxes tb where tb.code = :code and tb.modules_group = :modules_group and tb.id = pa.id'); $Qdata->bindTable(':table_product_attributes', TABLE_PRODUCT_ATTRIBUTES); $Qdata->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES); $Qdata->bindValue(':code', 'date_available'); $Qdata->bindValue(':modules_group', 'product_attributes'); $Qdata->execute(); $osC_ObjectInfo->set('products_date_available', $Qdata->value('products_date_available')); ?> <h1><?php echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), $osC_Template->getPageTitle()); ?> </h1> <?php if ($osC_MessageStack->exists($osC_Template->getModule())) {