コード例 #1
0
 /**
  * Check if a product can be deleted by the current backend user
  * Deleting is prohibited if a product has been ordered
  * @return  bool
  */
 public static function getUndeletableIds()
 {
     static $arrProducts;
     if (null === $arrProducts) {
         $arrProducts = \Database::getInstance()->query("\n                    SELECT p.type AS type FROM " . Product::getTable() . " p\n                    INNER JOIN " . ProductCollectionItem::getTable() . " i ON i.product_id=p.id\n                    INNER JOIN " . ProductCollection::getTable() . " c ON i.pid=c.id\n                    WHERE p.type>0 AND c.type='order'\n                UNION\n                    SELECT p.type AS type FROM " . Product::getTable() . " p\n                    INNER JOIN " . Product::getTable() . " p2 ON p2.pid=p.pid\n                    INNER JOIN " . ProductCollectionItem::getTable() . " i ON i.product_id=p2.id\n                    INNER JOIN " . ProductCollection::getTable() . " c ON i.pid=c.id\n                    WHERE c.type='order'\n            ")->fetchEach('type');
     }
     return $arrProducts;
 }
コード例 #2
0
 protected function compile()
 {
     $periodFactory = new PeriodFactory();
     $arrSession = \Session::getInstance()->get('iso_reports');
     $intConfig = (int) $arrSession[$this->name]['iso_config'];
     $strPeriod = (string) $arrSession[$this->name]['period'];
     $intStart = (int) $arrSession[$this->name]['start'];
     $intStop = (int) $arrSession[$this->name]['stop'];
     $intStatus = (int) $arrSession[$this->name]['iso_status'];
     $period = $periodFactory->create($strPeriod);
     $intStart = $period->getPeriodStart($intStart);
     $intStop = $period->getPeriodEnd($intStop);
     $dateFrom = $period->getKey($intStart);
     $dateTo = $period->getKey($intStop);
     $objData = \Database::getInstance()->query("\n            SELECT\n                c.id AS config_id,\n                c.currency,\n                o.locked AS date,\n                COUNT(o.id) AS total_orders,\n                COUNT(i.id) AS total_products,\n                COUNT(DISTINCT o.id) AS total_orders,\n                COUNT(DISTINCT i.id) AS total_products,\n                SUM(i.quantity) AS total_items,\n                SUM(i.tax_free_price * i.quantity) AS total_sales,\n                " . $period->getSqlField('o.' . $this->strDateField) . " AS dateGroup\n            FROM " . ProductCollection::getTable() . " o\n            LEFT JOIN " . ProductCollectionItem::getTable() . " i ON o.id=i.pid\n            LEFT JOIN " . OrderStatus::getTable() . " os ON os.id=o.order_status\n            LEFT OUTER JOIN " . Config::getTable() . " c ON o.config_id=c.id\n            WHERE o.type='order' AND o.order_status>0 AND o.locked!=''\n            " . ($intStatus > 0 ? " AND o.order_status=" . $intStatus : '') . "\n            " . $this->getProductProcedure('i', 'product_id') . "\n            " . ($intConfig > 0 ? " AND c.id=" . $intConfig : '') . "\n            " . $this->getConfigProcedure('c') . "\n            GROUP BY config_id, dateGroup\n            HAVING dateGroup>={$dateFrom} AND dateGroup<={$dateTo}\n        ");
     $arrCurrencies = array();
     $arrData = $this->initializeData($period, $intStart, $intStop);
     $arrChart = $this->initializeChart($period, $intStart, $intStop);
     while ($objData->next()) {
         $arrCurrencies[$objData->currency] = $objData->config_id;
         $arrData['rows'][$objData->dateGroup]['columns'][1]['value'] += $objData->total_orders;
         $arrData['rows'][$objData->dateGroup]['columns'][2]['value'] += $objData->total_products;
         $arrData['rows'][$objData->dateGroup]['columns'][3]['value'] += $objData->total_items;
         if (!is_array($arrData['rows'][$objData->dateGroup]['columns'][4]['value'])) {
             $arrData['rows'][$objData->dateGroup]['columns'][4]['value'] = array();
         }
         $arrData['rows'][$objData->dateGroup]['columns'][4]['value'][$objData->currency] = $arrData['rows'][$objData->dateGroup]['columns'][4]['value'][$objData->currency] + $objData->total_sales;
         // Summary in the footer
         $arrData['footer'][1]['value'] += $objData->total_orders;
         $arrData['footer'][2]['value'] += $objData->total_products;
         $arrData['footer'][3]['value'] += $objData->total_items;
         $arrData['footer'][4]['value'][$objData->currency] = (double) $arrData['footer'][4]['value'][$objData->currency] + $objData->total_sales;
         // Generate chart data
         $arrChart[$objData->currency]['data'][$objData->dateGroup]['y'] = (double) $arrChart[$objData->currency]['data'][$objData->dateGroup]['y'] + $objData->total_sales;
     }
     // Apply formatting
     $arrData = $this->formatValues($arrData, $arrCurrencies);
     $this->Template->data = $arrData;
     $this->Template->chart = $arrChart;
     $this->Template->periodFormat = $period->getJavascriptClosure();
 }
コード例 #3
0
ファイル: Reports.php プロジェクト: Aziz-JH/core
    /**
     * Generate a daily summary for the overview page
     * @return array
     */
    protected function getDailySummary()
    {
        $strBuffer = '
<div class="tl_formbody_edit be_iso_overview">
<fieldset class="tl_tbox">
<legend style="cursor: default;">' . $GLOBALS['TL_LANG']['ISO_REPORT']['24h_summary'] . '</legend>';
        $arrAllowedProducts = \Isotope\Backend\Product\Permission::getAllowedIds();
        $objOrders = \Database::getInstance()->prepare("\n            SELECT\n                c.id AS config_id,\n                c.name AS config_name,\n                c.currency,\n                COUNT(o.id) AS total_orders,\n                SUM(i.tax_free_price * i.quantity) AS total_sales,\n                SUM(i.quantity) AS total_items\n            FROM " . \Isotope\Model\ProductCollection::getTable() . " o\n            LEFT JOIN " . \Isotope\Model\ProductCollectionItem::getTable() . " i ON o.id=i.pid\n            LEFT OUTER JOIN " . \Isotope\Model\Config::getTable() . " c ON o.config_id=c.id\n            WHERE o.type='order' AND o.order_status>0 AND o.locked>=?\n            " . ($arrAllowedProducts === true ? '' : " AND i.product_id IN (" . (empty($arrAllowedProducts) ? '0' : implode(',', $arrAllowedProducts)) . ")") . "\n            GROUP BY config_id\n        ")->execute(strtotime('-24 hours'));
        if (!$objOrders->numRows) {
            $strBuffer .= '
<p class="tl_info" style="margin-top:10px">' . $GLOBALS['TL_LANG']['ISO_REPORT']['24h_empty'] . '</p>';
        } else {
            $i = -1;
            $strBuffer .= '
<br>
<table class="tl_listing">
<tr>
    <th class="tl_folder_tlist">' . $GLOBALS['TL_LANG']['ISO_REPORT']['shop_config'] . '</th>
    <th class="tl_folder_tlist">' . $GLOBALS['TL_LANG']['ISO_REPORT']['currency'] . '</th>
    <th class="tl_folder_tlist">' . $GLOBALS['TL_LANG']['ISO_REPORT']['orders#'] . '</th>
    <th class="tl_folder_tlist">' . $GLOBALS['TL_LANG']['ISO_REPORT']['products#'] . '</th>
    <th class="tl_folder_tlist">' . $GLOBALS['TL_LANG']['ISO_REPORT']['sales#'] . '</th>
</tr>';
            while ($objOrders->next()) {
                $strBuffer .= '
<tr class="row_' . ++$i . ($i % 2 ? 'odd' : 'even') . '">
    <td class="tl_file_list">' . $objOrders->config_name . '</td>
    <td class="tl_file_list">' . $objOrders->currency . '</td>
    <td class="tl_file_list">' . $objOrders->total_orders . '</td>
    <td class="tl_file_list">' . $objOrders->total_items . '</td>
    <td class="tl_file_list">' . Isotope::formatPrice($objOrders->total_sales) . '</td>
</tr>';
            }
            $strBuffer .= '
</table>';
        }
        $strBuffer .= '
</fieldset>
</div>';
        return $strBuffer;
    }
コード例 #4
0
ファイル: SalesTotal.php プロジェクト: Aziz-JH/core
 protected function compile()
 {
     $arrSession = \Session::getInstance()->get('iso_reports');
     $intConfig = (int) $arrSession[$this->name]['iso_config'];
     $strPeriod = (string) $arrSession[$this->name]['period'];
     $intStart = (int) $arrSession[$this->name]['start'];
     $intStop = (int) $arrSession[$this->name]['stop'];
     $intStatus = (int) $arrSession[$this->name]['iso_status'];
     list($publicDate, $privateDate, $sqlDate) = $this->getPeriodConfiguration($strPeriod);
     $dateFrom = date($privateDate, $intStart);
     $dateTo = date($privateDate, $intStop);
     $objData = \Database::getInstance()->prepare("\n            SELECT\n                c.id AS config_id,\n                c.currency,\n                o.locked AS date,\n                COUNT(o.id) AS total_orders,\n                COUNT(i.id) AS total_products,\n                COUNT(DISTINCT o.id) AS total_orders,\n                COUNT(DISTINCT i.id) AS total_products,\n                SUM(i.quantity) AS total_items,\n                SUM(i.tax_free_price * i.quantity) AS total_sales,\n                DATE_FORMAT(FROM_UNIXTIME(o.{$this->strDateField}), ?) AS dateGroup\n            FROM " . \Isotope\Model\ProductCollection::getTable() . " o\n            LEFT JOIN " . \Isotope\Model\ProductCollectionItem::getTable() . " i ON o.id=i.pid\n            LEFT JOIN " . \Isotope\Model\OrderStatus::getTable() . " os ON os.id=o.order_status\n            LEFT OUTER JOIN " . \Isotope\Model\Config::getTable() . " c ON o.config_id=c.id\n            WHERE o.type='order' AND o.order_status>0 AND o.locked!=''\n            " . ($intStatus > 0 ? " AND o.order_status=" . $intStatus : '') . "\n            " . $this->getProductProcedure('i', 'product_id') . "\n            " . ($intConfig > 0 ? " AND c.id=" . $intConfig : '') . "\n            " . $this->getConfigProcedure('c') . "\n            GROUP BY config_id, dateGroup\n            HAVING dateGroup>={$dateFrom} AND dateGroup<={$dateTo}\n        ")->execute($sqlDate);
     $arrCurrencies = array();
     $arrData = $this->initializeData($strPeriod, $intStart, $intStop, $privateDate, $publicDate);
     $arrChart = $this->initializeChart($strPeriod, $intStart, $intStop, $privateDate, $publicDate);
     while ($objData->next()) {
         $arrCurrencies[$objData->currency] = $objData->config_id;
         $arrData['rows'][$objData->dateGroup]['columns'][1]['value'] += $objData->total_orders;
         $arrData['rows'][$objData->dateGroup]['columns'][2]['value'] += $objData->total_products;
         $arrData['rows'][$objData->dateGroup]['columns'][3]['value'] += $objData->total_items;
         if (!is_array($arrData['rows'][$objData->dateGroup]['columns'][4]['value'])) {
             $arrData['rows'][$objData->dateGroup]['columns'][4]['value'] = array();
         }
         $arrData['rows'][$objData->dateGroup]['columns'][4]['value'][$objData->currency] = $arrData['rows'][$objData->dateGroup]['columns'][4]['value'][$objData->currency] + $objData->total_sales;
         // Summary in the footer
         $arrData['footer'][1]['value'] += $objData->total_orders;
         $arrData['footer'][2]['value'] += $objData->total_products;
         $arrData['footer'][3]['value'] += $objData->total_items;
         $arrData['footer'][4]['value'][$objData->currency] = (double) $arrData['footer'][4]['value'][$objData->currency] + $objData->total_sales;
         // Generate chart data
         $arrChart[$objData->currency]['data'][$objData->dateGroup]['y'] = (double) $arrChart['rows'][$objData->dateGroup]['columns'][$objData->currency]['value'] + $objData->total_sales;
     }
     // Apply formatting
     $arrData = $this->formatValues($arrData, $arrCurrencies);
     $this->Template->data = $arrData;
     $this->Template->chart = $arrChart;
 }
コード例 #5
0
ファイル: SalesProduct.php プロジェクト: error08/core
 protected function compile()
 {
     $periodFactory = new PeriodFactory();
     $arrSession = \Session::getInstance()->get('iso_reports');
     $strPeriod = (string) $arrSession[$this->name]['period'];
     $intColumns = (int) $arrSession[$this->name]['columns'];
     $blnVariants = (bool) $arrSession[$this->name]['variants'];
     $intStatus = (int) $arrSession[$this->name]['iso_status'];
     if ($arrSession[$this->name]['from'] == '') {
         $intStart = strtotime('-' . ($intColumns - 1) . ' ' . $strPeriod);
     } else {
         $intStart = (int) $arrSession[$this->name]['from'];
     }
     $period = $periodFactory->create($strPeriod);
     $intStart = $period->getPeriodStart($intStart);
     $dateFrom = $period->getKey($intStart);
     $dateTo = $period->getKey(strtotime('+ ' . ($intColumns - 1) . ' ' . $strPeriod, $intStart));
     $arrData = array('rows' => array());
     $arrData['header'] = $this->getHeader($period, $intStart, $intColumns);
     $groupVariants = $blnVariants ? 'p1.id' : 'IF(p1.pid=0, p1.id, p1.pid)';
     $objProducts = \Database::getInstance()->query("\n            SELECT\n                IFNULL({$groupVariants}, i.product_id) AS product_id,\n                IFNULL(p1.name, i.name) AS variant_name,\n                IFNULL(p2.name, i.name) AS product_name,\n                p1.sku AS product_sku,\n                p2.sku AS variant_sku,\n                IF(p1.pid=0, p1.type, p2.type) AS type,\n                i.configuration AS product_configuration,\n                SUM(i.quantity) AS quantity,\n                SUM(i.tax_free_price * i.quantity) AS total,\n                " . $period->getSqlField($this->strDateField) . " AS dateGroup\n            FROM " . ProductCollectionItem::getTable() . " i\n            LEFT JOIN " . ProductCollection::getTable() . " o ON i.pid=o.id\n            LEFT JOIN " . OrderStatus::getTable() . " os ON os.id=o.order_status\n            LEFT OUTER JOIN " . Product::getTable() . " p1 ON i.product_id=p1.id\n            LEFT OUTER JOIN " . Product::getTable() . " p2 ON p1.pid=p2.id\n            WHERE o.type='order' AND o.order_status>0 AND o.locked!=''\n                " . ($intStatus > 0 ? " AND o.order_status=" . $intStatus : '') . "\n                " . $this->getProductProcedure('p1') . "\n                " . $this->getConfigProcedure('o', 'config_id') . "\n            GROUP BY dateGroup, product_id\n            HAVING dateGroup>={$dateFrom} AND dateGroup<={$dateTo}\n        ");
     // Cache product types so call to findByPk() will trigger the registry
     ProductType::findMultipleByIds($objProducts->fetchEach('type'));
     $arrRaw = array();
     $objProducts->reset();
     // Prepare product data
     while ($objProducts->next()) {
         $arrAttributes = array();
         $arrVariantAttributes = array();
         $blnHasVariants = false;
         // Can't use it without a type
         if ($objProducts->type > 0 && ($objType = ProductType::findByPk($objProducts->type)) !== null) {
             /** @type ProductType $objType */
             $arrAttributes = $objType->getAttributes();
             $arrVariantAttributes = $objType->getVariantAttributes();
             $blnHasVariants = $objType->hasVariants();
             $product_type_name = $objType->name;
         }
         $arrOptions = array('name' => $objProducts->variant_name);
         // Use product title if name is not a variant attribute
         if ($blnHasVariants && !in_array('name', $arrVariantAttributes)) {
             $arrOptions['name'] = $objProducts->product_name;
         }
         $strSku = $blnHasVariants ? $objProducts->variant_sku : $objProducts->product_sku;
         if (in_array('sku', $arrAttributes) && $strSku != '') {
             $arrOptions['name'] = sprintf('%s <span style="color:#b3b3b3; padding-left:3px;">[%s]</span>', $arrOptions['name'], $strSku);
         }
         if ($blnVariants && $blnHasVariants) {
             if (in_array('sku', $arrVariantAttributes) && $objProducts->product_sku != '') {
                 $arrOptions['name'] = sprintf('%s <span style="color:#b3b3b3; padding-left:3px;">[%s]</span>', $arrOptions['name'], $objProducts->product_sku);
             }
             foreach (deserialize($objProducts->product_configuration, true) as $strName => $strValue) {
                 if (isset($GLOBALS['TL_DCA']['tl_iso_product']['fields'][$strName])) {
                     $strValue = $GLOBALS['TL_DCA']['tl_iso_product']['fields'][$strName]['options'][$strValue] ? $GLOBALS['TL_DCA']['tl_iso_product']['fields'][$strName]['options'][$strValue] : $strValue;
                     $strName = $GLOBALS['TL_DCA']['tl_iso_product']['fields'][$strName]['label'][0] ? $GLOBALS['TL_DCA']['tl_iso_product']['fields'][$strName]['label'][0] : $strName;
                 }
                 $arrOptions[] = '<span class="variant">' . $strName . ': ' . $strValue . '</span>';
             }
         }
         $arrOptions['name'] = '<span class="product">' . $arrOptions['name'] . '</span>';
         $arrRaw[$objProducts->product_id]['name'] = implode('<br>', $arrOptions);
         $arrRaw[$objProducts->product_id]['product_type_name'] = $product_type_name;
         $arrRaw[$objProducts->product_id][$objProducts->dateGroup] = (double) $arrRaw[$objProducts->product_id][$objProducts->dateGroup] + (double) $objProducts->total;
         $arrRaw[$objProducts->product_id][$objProducts->dateGroup . '_quantity'] = (int) $arrRaw[$objProducts->product_id][$objProducts->dateGroup . '_quantity'] + (int) $objProducts->quantity;
         $arrRaw[$objProducts->product_id]['total'] = (double) $arrRaw[$objProducts->product_id]['total'] + (double) $objProducts->total;
         $arrRaw[$objProducts->product_id]['quantity'] = (int) $arrRaw[$objProducts->product_id]['quantity'] + (int) $objProducts->quantity;
     }
     // Prepare columns
     $arrColumns = array();
     for ($i = 0; $i < $intColumns; $i++) {
         $arrColumns[] = $period->getKey($intStart);
         $intStart = $period->getNext($intStart);
     }
     $arrFooter = array();
     // Sort the data
     if ($arrSession[$this->name]['tl_sort'] == 'product_name') {
         usort($arrRaw, function ($a, $b) {
             return strcasecmp($a['name'], $b['name']);
         });
     } else {
         usort($arrRaw, function ($a, $b) {
             return $a['total'] == $b['total'] ? 0 : ($a['total'] < $b['total'] ? 1 : -1);
         });
     }
     // Generate data
     foreach ($arrRaw as $arrProduct) {
         $arrRow = array(array('value' => array($arrProduct['name'], sprintf('<span style="color:#b3b3b3;">[%s]</span>', $arrProduct['product_type_name']))));
         $arrFooter[0] = array('value' => $GLOBALS['TL_LANG']['ISO_REPORT']['sums']);
         foreach ($arrColumns as $i => $column) {
             $arrRow[$i + 1] = array('value' => Isotope::formatPriceWithCurrency($arrProduct[$column]) . ($arrProduct[$column . '_quantity'] !== null ? '<br><span class="variant">' . Isotope::formatItemsString($arrProduct[$column . '_quantity']) . '</span>' : ''));
             $arrFooter[$i + 1] = array('total' => $arrFooter[$i + 1]['total'] + $arrProduct[$column], 'quantity' => $arrFooter[$i + 1]['quantity'] + $arrProduct[$column . '_quantity']);
         }
         $arrRow[$i + 2] = array('value' => Isotope::formatPriceWithCurrency($arrProduct['total']) . ($arrProduct['quantity'] !== null ? '<br><span class="variant">' . Isotope::formatItemsString($arrProduct['quantity']) . '</span>' : ''));
         $arrFooter[$i + 2] = array('total' => $arrFooter[$i + 2]['total'] + $arrProduct['total'], 'quantity' => $arrFooter[$i + 2]['quantity'] + $arrProduct['quantity']);
         $arrData['rows'][] = array('columns' => $arrRow);
     }
     for ($i = 1; $i < count($arrFooter); $i++) {
         $arrFooter[$i]['value'] = Isotope::formatPriceWithCurrency($arrFooter[$i]['total']) . '<br><span class="variant">' . Isotope::formatItemsString($arrFooter[$i]['quantity']) . '</span>';
         unset($arrFooter[$i]['total']);
     }
     $arrData['footer'] = $arrFooter;
     $this->Template->data = $arrData;
 }
コード例 #6
0
ファイル: config.php プロジェクト: Aziz-JH/core
$GLOBALS['TL_MODELS'][\Isotope\Model\Address::getTable()] = 'Isotope\\Model\\Address';
$GLOBALS['TL_MODELS'][\Isotope\Model\Attribute::getTable()] = 'Isotope\\Model\\Attribute';
$GLOBALS['TL_MODELS'][\Isotope\Model\BasePrice::getTable()] = 'Isotope\\Model\\BasePrice';
$GLOBALS['TL_MODELS'][\Isotope\Model\Config::getTable()] = 'Isotope\\Model\\Config';
$GLOBALS['TL_MODELS'][\Isotope\Model\Document::getTable()] = 'Isotope\\Model\\Document';
$GLOBALS['TL_MODELS'][\Isotope\Model\Download::getTable()] = 'Isotope\\Model\\Download';
$GLOBALS['TL_MODELS'][\Isotope\Model\Gallery::getTable()] = 'Isotope\\Model\\Gallery';
$GLOBALS['TL_MODELS'][\Isotope\Model\Group::getTable()] = 'Isotope\\Model\\Group';
$GLOBALS['TL_MODELS'][\Isotope\Model\Label::getTable()] = 'Isotope\\Model\\Label';
$GLOBALS['TL_MODELS'][\Isotope\Model\OrderStatus::getTable()] = 'Isotope\\Model\\OrderStatus';
$GLOBALS['TL_MODELS'][\Isotope\Model\Payment::getTable()] = 'Isotope\\Model\\Payment';
$GLOBALS['TL_MODELS'][\Isotope\Model\Product::getTable()] = 'Isotope\\Model\\Product';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductCategory::getTable()] = 'Isotope\\Model\\ProductCategory';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductCollection::getTable()] = 'Isotope\\Model\\ProductCollection';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductCollectionDownload::getTable()] = 'Isotope\\Model\\ProductCollectionDownload';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductCollectionItem::getTable()] = 'Isotope\\Model\\ProductCollectionItem';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductCollectionSurcharge::getTable()] = 'Isotope\\Model\\ProductCollectionSurcharge';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductPrice::getTable()] = 'Isotope\\Model\\ProductPrice';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductCache::getTable()] = 'Isotope\\Model\\ProductCache';
$GLOBALS['TL_MODELS'][\Isotope\Model\ProductType::getTable()] = 'Isotope\\Model\\ProductType';
$GLOBALS['TL_MODELS'][\Isotope\Model\RelatedCategory::getTable()] = 'Isotope\\Model\\RelatedCategory';
$GLOBALS['TL_MODELS'][\Isotope\Model\RelatedProduct::getTable()] = 'Isotope\\Model\\RelatedProduct';
$GLOBALS['TL_MODELS'][\Isotope\Model\RequestCache::getTable()] = 'Isotope\\Model\\RequestCache';
$GLOBALS['TL_MODELS'][\Isotope\Model\Shipping::getTable()] = 'Isotope\\Model\\Shipping';
$GLOBALS['TL_MODELS'][\Isotope\Model\TaxClass::getTable()] = 'Isotope\\Model\\TaxClass';
$GLOBALS['TL_MODELS'][\Isotope\Model\TaxRate::getTable()] = 'Isotope\\Model\\TaxRate';
/**
 * Checkout steps
 */
$GLOBALS['ISO_CHECKOUTSTEP'] = array('address' => array('\\Isotope\\CheckoutStep\\BillingAddress', '\\Isotope\\CheckoutStep\\ShippingAddress'), 'shipping' => array('\\Isotope\\CheckoutStep\\ShippingMethod'), 'payment' => array('\\Isotope\\CheckoutStep\\PaymentMethod'), 'review' => array('\\Isotope\\CheckoutStep\\OrderConditionsOnTop', '\\Isotope\\CheckoutStep\\OrderInfo', '\\Isotope\\CheckoutStep\\OrderConditionsBeforeProducts', '\\Isotope\\CheckoutStep\\OrderProducts', '\\Isotope\\CheckoutStep\\OrderConditionsAfterProducts'));
/**
コード例 #7
0
ファイル: ProductCollection.php プロジェクト: Aziz-JH/core
 /**
  * Also delete child table records when dropping this collection
  * @return integer
  */
 public function delete()
 {
     $this->ensureNotLocked();
     // !HOOK: additional functionality when deleting a collection
     if (isset($GLOBALS['ISO_HOOKS']['deleteCollection']) && is_array($GLOBALS['ISO_HOOKS']['deleteCollection'])) {
         foreach ($GLOBALS['ISO_HOOKS']['deleteCollection'] as $callback) {
             $objCallback = \System::importStatic($callback[0]);
             $blnRemove = $objCallback->{$callback}[1]($this);
             if ($blnRemove === false) {
                 return 0;
             }
         }
     }
     $intPid = $this->id;
     $intAffectedRows = parent::delete();
     if ($intAffectedRows > 0 && $intPid > 0) {
         \Database::getInstance()->query("DELETE FROM " . \Isotope\Model\ProductCollectionItem::getTable() . " WHERE pid={$intPid}");
         \Database::getInstance()->query("DELETE FROM " . \Isotope\Model\Address::getTable() . " WHERE ptable='" . static::$strTable . "' AND pid={$intPid}");
     }
     $this->arrCache = array();
     $this->arrItems = null;
     $this->arrSurcharges = null;
     return $intAffectedRows;
 }
コード例 #8
0
ファイル: ProductCollection.php プロジェクト: Aziz-JH/core
 /**
  * Generate item array for template
  * @param   ProductCollectionItem
  * @return  array
  */
 protected function generateItem(ProductCollectionItem $objItem)
 {
     $blnHasProduct = $objItem->hasProduct();
     $objProduct = $objItem->getProduct();
     // Set the active product for insert tags replacement
     if ($blnHasProduct) {
         Product::setActive($objProduct);
     }
     $arrCSS = $blnHasProduct ? deserialize($objProduct->cssID, true) : array();
     $arrItem = array('id' => $objItem->id, 'sku' => $objItem->getSku(), 'name' => $objItem->getName(), 'options' => Isotope::formatOptions($objItem->getOptions()), 'quantity' => $objItem->quantity, 'price' => Isotope::formatPriceWithCurrency($objItem->getPrice()), 'tax_free_price' => Isotope::formatPriceWithCurrency($objItem->getTaxFreePrice()), 'total' => Isotope::formatPriceWithCurrency($objItem->getTotalPrice()), 'tax_free_total' => Isotope::formatPriceWithCurrency($objItem->getTaxFreeTotalPrice()), 'tax_id' => $objItem->tax_id, 'href' => false, 'hasProduct' => $blnHasProduct, 'product' => $objProduct, 'item' => $objItem, 'raw' => $objItem->row(), 'rowClass' => trim('product ' . ($blnHasProduct && $objProduct->isNew() ? 'new ' : '') . $arrCSS[1]));
     if (null !== $objItem->getRelated('jumpTo') && $blnHasProduct && $objProduct->isAvailableInFrontend()) {
         $arrItem['href'] = $objProduct->generateUrl($objItem->getRelated('jumpTo'));
     }
     Product::unsetActive();
     return $arrItem;
 }
コード例 #9
0
 /**
  * @category ISO_HOOKS: itemIsAvailable
  *
  * @param ProductCollectionItem|\Model $item
  *
  * @return false|null Return false but never true
  */
 public function checkItemIsAvailable(ProductCollectionItem $item)
 {
     /** @var Product|\Model $product */
     $product = $item->getProduct();
     /** @var ProductType|\Model $productType */
     $productType = $product->getRelated('type');
     if (!$productType->stockmanagement_active) {
         return null;
     }
     $stock = Stock::getStockForProduct($product->id);
     if (false !== $stock && $stock < 1) {
         return false;
     }
     return null;
 }
コード例 #10
0
<?php

/**
 * Isotope eCommerce for Contao Open Source CMS
 *
 * Copyright (C) 2009-2014 terminal42 gmbh & Isotope eCommerce Workgroup
 *
 * @package    Isotope
 * @link       http://isotopeecommerce.org
 * @license    http://opensource.org/licenses/lgpl-3.0.html
 */
/**
 * Load tl_iso_product data container and language files
 */
$this->loadDataContainer('tl_iso_product');
\System::loadLanguageFile('tl_iso_product');
/**
 * Table tl_iso_product_collection
 */
$GLOBALS['TL_DCA']['tl_iso_product_collection'] = array('config' => array('dataContainer' => 'Table', 'enableVersioning' => false, 'ctable' => array(\Isotope\Model\ProductCollectionItem::getTable(), \Isotope\Model\ProductCollectionSurcharge::getTable(), \Isotope\Model\Address::getTable()), 'closed' => true, 'notDeletable' => \Input::get('act') == 'select', 'onload_callback' => array(array('Isotope\\Backend\\ProductCollection\\Callback', 'checkPermission')), 'onsubmit_callback' => array(array('Isotope\\Backend\\ProductCollection\\Callback', 'executeSaveHook')), 'sql' => array('keys' => array('id' => 'primary', 'uniqid' => 'unique', 'member,store_id,type' => 'index', 'uniqid,store_id,type' => 'index', 'source_collection_id,type' => 'index'))), 'list' => array('sorting' => array('mode' => 2, 'fields' => array('locked DESC'), 'panelLayout' => 'filter;sort,search,limit', 'filter' => array(array('type=?', 'order'), array('order_status>?', '0'), array("locked!=?", ''))), 'label' => array('fields' => array('document_number', 'locked', 'billing_address_id', 'total', 'order_status'), 'showColumns' => true, 'label_callback' => array('Isotope\\Backend\\ProductCollection\\Callback', 'getOrderLabel')), 'global_operations' => array('all' => array('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['delete'], 'href' => 'act=delete', 'icon' => 'delete.gif', 'attributes' => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['show'], 'href' => 'act=show', 'icon' => 'show.gif'), 'payment' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['payment'], 'href' => 'key=payment', 'icon' => 'system/modules/isotope/assets/images/money-coin.png', 'button_callback' => array('\\Isotope\\Backend\\ProductCollection\\Callback', 'paymentButton')), 'shipping' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['shipping'], 'href' => 'key=shipping', 'icon' => 'system/modules/isotope/assets/images/box-label.png', 'button_callback' => array('\\Isotope\\Backend\\ProductCollection\\Callback', 'shippingButton')), 'print_document' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['print_document'], 'href' => 'key=print_document', 'icon' => 'system/modules/isotope/assets/images/document-pdf-text.png'))), 'palettes' => array('default' => '{status_legend},order_status,date_paid,date_shipped;{details_legend},details,notes;{email_legend:hide},email_data;{billing_address_legend:hide},billing_address_data;{shipping_address_legend:hide},shipping_address_data'), 'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'type' => array('eval' => array('doNotShow' => true), 'sql' => "varchar(32) NOT NULL default ''"), 'member' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['member'], 'foreignKey' => "tl_member.CONCAT(firstname, ' ', lastname)", 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy')), 'locked' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['locked'], 'flag' => 8, 'filter' => true, 'sorting' => true, 'eval' => array('rgxp' => 'date'), 'sql' => "varchar(10) NOT NULL default ''"), 'store_id' => array('eval' => array('doNotShow' => true), 'sql' => "int(2) unsigned NOT NULL default '0'"), 'settings' => array('eval' => array('doNotShow' => true), 'sql' => "blob NULL"), 'checkout_info' => array('eval' => array('doNotShow' => true), 'sql' => "blob NULL"), 'payment_data' => array('eval' => array('doNotShow' => true), 'sql' => "blob NULL"), 'shipping_data' => array('eval' => array('doNotShow' => true), 'sql' => "blob NULL"), 'source_collection_id' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['source_collection_id'], 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy', 'table' => 'tl_iso_product_collection')), 'document_number' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['document_number'], 'search' => true, 'sorting' => true, 'sql' => "varchar(64) NOT NULL default ''"), 'uniqid' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['uniqid'], 'search' => true, 'sql' => "varchar(64) NULL"), 'order_status' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['order_status'], 'exclude' => true, 'filter' => true, 'sorting' => true, 'inputType' => 'select', 'foreignKey' => \Isotope\Model\OrderStatus::getTable() . '.name', 'options_callback' => array('\\Isotope\\Backend', 'getOrderStatus'), 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy'), 'save_callback' => array(array('Isotope\\Backend\\ProductCollection\\Callback', 'updateOrderStatus'))), 'date_paid' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['date_paid'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp' => 'datim', 'datepicker' => method_exists($this, 'getDatePickerString') ? $this->getDatePickerString() : true, 'tl_class' => 'w50 wizard'), 'sql' => "varchar(10) NOT NULL default ''"), 'date_shipped' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['date_shipped'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp' => 'date', 'datepicker' => method_exists($this, 'getDatePickerString') ? $this->getDatePickerString() : true, 'tl_class' => 'w50 wizard'), 'sql' => "varchar(10) NOT NULL default ''"), 'config_id' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['config_id'], 'foreignKey' => \Isotope\Model\Config::getTable() . '.name', 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy')), 'payment_id' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['payment_id'], 'filter' => true, 'foreignKey' => \Isotope\Model\Payment::getTable() . '.name', 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy')), 'shipping_id' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['shipping_id'], 'filter' => true, 'foreignKey' => \Isotope\Model\Shipping::getTable() . '.name', 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy')), 'billing_address_id' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['billing_address_id'], 'foreignKey' => \Isotope\Model\Address::getTable() . '.label', 'eval' => array('doNotShow' => true), 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy')), 'shipping_address_id' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['shipping_address_id'], 'foreignKey' => \Isotope\Model\Address::getTable() . '.label', 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy')), 'details' => array('input_field_callback' => array('Isotope\\Backend\\ProductCollection\\Callback', 'generateOrderDetails'), 'eval' => array('doNotShow' => true)), 'subtotal' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['subtotal'], 'sql' => "decimal(12,2) NOT NULL default '0.00'"), 'tax_free_subtotal' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['tax_free_subtotal'], 'sql' => "decimal(12,2) NOT NULL default '0.00'"), 'total' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['total'], 'sorting' => true, 'sql' => "decimal(12,2) NOT NULL default '0.00'"), 'tax_free_total' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['tax_free_total'], 'sql' => "decimal(12,2) NOT NULL default '0.00'"), 'currency' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['currency'], 'sql' => "varchar(4) NOT NULL default ''"), 'language' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['language'], 'sql' => "varchar(5) NOT NULL default ''"), 'notes' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['notes'], 'exclude' => true, 'inputType' => 'textarea', 'eval' => array('style' => 'height:80px;'), 'sql' => "text NULL"), 'email_data' => array('input_field_callback' => array('Isotope\\Backend\\ProductCollection\\Callback', 'generateEmailData'), 'eval' => array('doNotShow' => true)), 'billing_address_data' => array('input_field_callback' => array('Isotope\\Backend\\ProductCollection\\Callback', 'generateBillingAddressData'), 'eval' => array('doNotShow' => true)), 'shipping_address_data' => array('input_field_callback' => array('Isotope\\Backend\\ProductCollection\\Callback', 'generateShippingAddressData'), 'eval' => array('doNotShow' => true))));