Example #1
0
$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['recipients'] = array('recipient_email');
$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['attachment_tokens'] = array('form_*', 'document');
$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_text'] = array('uniqid', 'order_status', 'order_status_old', 'order_status_id', 'order_status_id_old', 'recipient_email', 'order_id', 'order_items', 'order_products', 'order_subtotal', 'order_total', 'document_number', 'cart_html', 'cart_text', 'document', 'billing_address', 'billing_address_*', 'shipping_address', 'shipping_address_*', 'form_*', 'payment_id', 'payment_label', 'payment_note', 'shipping_id', 'shipping_label', 'shipping_note', 'config_*', 'member_*');
$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_subject'] =& $GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_text'];
$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_html'] =& $GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_text'];
$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_replyTo'] =& $GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['recipients'];
$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_recipient_cc'] =& $GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['recipients'];
$GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['email_recipient_bcc'] =& $GLOBALS['NOTIFICATION_CENTER']['NOTIFICATION_TYPE']['isotope']['iso_order_status_change']['recipients'];
/**
 * Models
 */
$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';
Example #2
0
    /**
     * Pass an order to the document
     * @param   DataContainer
     */
    public function printDocument(\DataContainer $dc)
    {
        $strRedirectUrl = str_replace('&key=print_document', '', \Environment::get('request'));
        if (\Input::post('FORM_SUBMIT') == 'tl_iso_print_document') {
            if (($objOrder = Order::findByPk($dc->id)) === null) {
                \Message::addError('Could not find order id.');
                \Controller::redirect($strRedirectUrl);
            }
            if (($objConfig = $objOrder->getRelated('config_id')) === null) {
                \Message::addError('Could not find config id.');
                \Controller::redirect($strRedirectUrl);
            }
            // Set current config
            Isotope::setConfig($objConfig);
            /** @var \Isotope\Interfaces\IsotopeDocument $objDocument */
            if (($objDocument = Document::findByPk(\Input::post('document'))) === null) {
                \Message::addError('Could not find document id.');
                \Controller::redirect($strRedirectUrl);
            }
            $objDocument->outputToBrowser($objOrder);
        }
        $arrSelect = array('name' => 'document', 'label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['document_choice'], 'inputType' => 'select', 'foreignKey' => 'tl_iso_document.name', 'eval' => array('mandatory' => true));
        $objSelect = new \SelectMenu(\SelectMenu::getAttributesFromDca($arrSelect, $arrSelect['name']));
        $strMessages = \Message::generate();
        \Message::reset();
        // Return form
        return '
<div id="tl_buttons">
<a href="' . ampersand($strRedirectUrl) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBT']) . '">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>

<h2 class="sub_headline">' . sprintf($GLOBALS['TL_LANG']['tl_iso_product_collection']['print_document'][1], $dc->id) . '</h2>' . $strMessages . '

<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_iso_product_import" class="tl_form" method="post">
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="tl_iso_print_document">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">

<div class="tl_tbox block">
  ' . $objSelect->parse() . '
  <p class="tl_help">' . $objSelect->description . '</p>
</div>

</div>

<div class="tl_formbody_submit">

<div class="tl_submit_container">
<input type="submit" name="print" id="print" class="tl_submit" alt="" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['tl_iso_product_collection']['print']) . '">
</div>

</div>
</form>';
    }
Example #3
0
 /**
  * Retrieve the array of notification data for parsing simple tokens
  *
  * @param int $intNotification
  *
  * @return array
  */
 public function getNotificationTokens($intNotification)
 {
     /** @type \Isotope\Model\Config $objConfig */
     $objConfig = $this->getRelated('config_id');
     $arrTokens = deserialize($this->email_data, true);
     $arrTokens['uniqid'] = $this->uniqid;
     $arrTokens['order_status_id'] = $this->order_status;
     $arrTokens['order_status'] = $this->getStatusLabel();
     $arrTokens['recipient_email'] = $this->getEmailRecipient();
     $arrTokens['order_id'] = $this->id;
     $arrTokens['order_items'] = $this->sumItemsQuantity();
     $arrTokens['order_products'] = $this->countItems();
     $arrTokens['order_subtotal'] = Isotope::formatPriceWithCurrency($this->getSubtotal(), false);
     $arrTokens['order_total'] = Isotope::formatPriceWithCurrency($this->getTotal(), false);
     $arrTokens['document_number'] = $this->document_number;
     $arrTokens['cart_html'] = '';
     $arrTokens['cart_text'] = '';
     $arrTokens['document'] = '';
     // Add all the collection fields
     foreach ($this->row() as $k => $v) {
         $arrTokens['collection_' . $k] = $v;
     }
     // Add billing/customer address fields
     if (($objAddress = $this->getBillingAddress()) !== null) {
         foreach ($objAddress->row() as $k => $v) {
             $arrTokens['billing_address_' . $k] = Format::dcaValue($objAddress->getTable(), $k, $v);
             // @deprecated (use ##billing_address_*##)
             $arrTokens['billing_' . $k] = $arrTokens['billing_address_' . $k];
         }
         $arrTokens['billing_address'] = $objAddress->generate($objConfig->getBillingFieldsConfig());
         // @deprecated (use ##billing_address##)
         $arrTokens['billing_address_text'] = $arrTokens['billing_address'];
     }
     // Add shipping address fields
     if (($objAddress = $this->getShippingAddress()) !== null) {
         foreach ($objAddress->row() as $k => $v) {
             $arrTokens['shipping_address_' . $k] = Format::dcaValue($objAddress->getTable(), $k, $v);
             // @deprecated (use ##billing_address_*##)
             $arrTokens['shipping_' . $k] = $arrTokens['shipping_address_' . $k];
         }
         $arrTokens['shipping_address'] = $objAddress->generate($objConfig->getShippingFieldsConfig());
         // Shipping address equals billing address
         // @deprecated (use ##shipping_address##)
         if ($objAddress->id == $this->getBillingAddress()->id) {
             $arrTokens['shipping_address_text'] = $this->requiresPayment() ? $GLOBALS['TL_LANG']['MSC']['useBillingAddress'] : $GLOBALS['TL_LANG']['MSC']['useCustomerAddress'];
         } else {
             $arrTokens['shipping_address_text'] = $arrTokens['shipping_address'];
         }
     }
     // Add payment method info
     if ($this->hasPayment() && ($objPayment = $this->getPaymentMethod()) !== null) {
         $arrTokens['payment_id'] = $objPayment->id;
         $arrTokens['payment_label'] = $objPayment->getLabel();
         $arrTokens['payment_note'] = $objPayment->note;
     }
     // Add shipping method info
     if ($this->hasShipping() && ($objShipping = $this->getShippingMethod()) !== null) {
         $arrTokens['shipping_id'] = $objShipping->id;
         $arrTokens['shipping_label'] = $objShipping->getLabel();
         $arrTokens['shipping_note'] = $objShipping->note;
     }
     // Add config fields
     if ($this->getRelated('config_id') !== null) {
         foreach ($this->getRelated('config_id')->row() as $k => $v) {
             $arrTokens['config_' . $k] = Format::dcaValue($this->getRelated('config_id')->getTable(), $k, $v);
         }
     }
     // Add member fields
     if ($this->member > 0 && $this->getRelated('member') !== null) {
         foreach ($this->getRelated('member')->row() as $k => $v) {
             $arrTokens['member_' . $k] = Format::dcaValue($this->getRelated('member')->getTable(), $k, $v);
         }
     }
     if ($intNotification > 0 && ($objNotification = Notification::findByPk($intNotification)) !== null) {
         $objTemplate = new \Isotope\Template($objNotification->iso_collectionTpl);
         $objTemplate->isNotification = true;
         $this->addToTemplate($objTemplate, array('gallery' => $objNotification->iso_gallery, 'sorting' => $this->getItemsSortingCallable($objNotification->iso_orderCollectionBy)));
         $arrTokens['cart_html'] = Haste::getInstance()->call('replaceInsertTags', array($objTemplate->parse(), false));
         $objTemplate->textOnly = true;
         $arrTokens['cart_text'] = strip_tags(Haste::getInstance()->call('replaceInsertTags', array($objTemplate->parse(), true)));
         // Generate and "attach" document
         /** @var \Isotope\Interfaces\IsotopeDocument $objDocument */
         if ($objNotification->iso_document > 0 && ($objDocument = Document::findByPk($objNotification->iso_document)) !== null) {
             $strFilePath = $objDocument->outputToFile($this, TL_ROOT . '/system/tmp');
             $arrTokens['document'] = str_replace(TL_ROOT . '/', '', $strFilePath);
         }
     }
     // !HOOK: add custom email tokens
     if (isset($GLOBALS['ISO_HOOKS']['getOrderNotificationTokens']) && is_array($GLOBALS['ISO_HOOKS']['getOrderNotificationTokens'])) {
         foreach ($GLOBALS['ISO_HOOKS']['getOrderNotificationTokens'] as $callback) {
             $objCallback = \System::importStatic($callback[0]);
             $arrTokens = $objCallback->{$callback}[1]($this, $arrTokens);
         }
     }
     return $arrTokens;
 }
<?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
 */
/**
 * Table tl_iso_document
 */
$GLOBALS['TL_DCA']['tl_iso_document'] = array('config' => array('dataContainer' => 'Table', 'enableVersioning' => true, 'closed' => true, 'onload_callback' => array(array('Isotope\\Backend', 'initializeSetupModule')), 'sql' => array('keys' => array('id' => 'primary'))), 'list' => array('sorting' => array('mode' => 1, 'fields' => array('name'), 'flag' => 1, 'panelLayout' => 'filter;search,limit'), 'label' => array('fields' => array('name'), 'format' => '%s'), 'global_operations' => array('back' => array('label' => &$GLOBALS['TL_LANG']['MSC']['backBT'], 'href' => 'mod=&table=', 'class' => 'header_back', 'attributes' => 'onclick="Backend.getScrollOffset();"'), 'new' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['new'], 'href' => 'act=create', 'class' => 'header_new', 'attributes' => 'onclick="Backend.getScrollOffset();"'), 'all' => array('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset();"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif'), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['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_document']['show'], 'href' => 'act=show', 'icon' => 'show.gif'))), 'palettes' => array('__selector__' => array('type'), 'default' => '{type_legend},name,type', 'standard' => '{type_legend},name,type;{config_legend},documentTitle,fileTitle;{template_legend},documentTpl,gallery,collectionTpl,orderCollectionBy'), 'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'name' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['name'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'type' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['type'], 'exclude' => true, 'filter' => true, 'inputType' => 'select', 'default' => 'Standard', 'options_callback' => function () {
    return \Isotope\Model\Document::getModelTypeOptions();
}, 'eval' => array('submitOnChange' => true, 'tl_class' => 'w50', 'includeBlankOption' => true), 'sql' => "varchar(255) NOT NULL default ''"), 'documentTitle' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['documentTitle'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'decodeEntities' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'fileTitle' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['fileTitle'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'decodeEntities' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'documentTpl' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['documentTpl'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => function (\DataContainer $dc) {
    return \Isotope\Backend::getTemplates('iso_document_');
}, 'eval' => array('includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50', 'mandatory' => true), 'sql' => "varchar(64) NOT NULL default ''"), 'collectionTpl' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['collectionTpl'], 'exclude' => true, 'default' => 'iso_collection_invoice', 'inputType' => 'select', 'options_callback' => function (\DataContainer $dc) {
    return \Isotope\Backend::getTemplates('iso_collection_');
}, 'eval' => array('includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50', 'mandatory' => true), 'sql' => "varchar(64) NOT NULL default ''"), 'orderCollectionBy' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['orderCollectionBy'], 'exclude' => true, 'default' => 'asc_id', 'inputType' => 'select', 'options' => $GLOBALS['TL_LANG']['MSC']['iso_orderCollectionBy'], 'eval' => array('mandatory' => true, 'tl_class' => 'w50'), 'sql' => "varchar(16) NOT NULL default ''"), 'gallery' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_document']['gallery'], 'exclude' => true, 'inputType' => 'select', 'foreignKey' => \Isotope\Model\Gallery::getTable() . '.name', 'eval' => array('includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'), 'sql' => "int(10) unsigned NOT NULL default '0'")));