/** * Generate the module */ protected function compile() { $objCart = Isotope::getCart(); $objAddress = $objCart->getShippingAddress(); $this->Template->showResults = false; $this->Template->requiresShipping = false; // There is no address if (!$objAddress->id) { return; } $this->Template->showResults = true; $arrMethods = array(); // Get the shipping methods if ($objAddress->id && $objCart->requiresShipping()) { $this->Template->requiresShipping = true; $objShippingMethods = Shipping::findMultipleByIds($this->arrShippingMethods); /* @var Shipping $objShipping */ foreach ($objShippingMethods as $objShipping) { if ($objShipping->isAvailable()) { $fltPrice = $objShipping->getPrice(); $arrMethods[] = array('label' => $objShipping->getLabel(), 'price' => $fltPrice, 'formatted_price' => Isotope::formatPriceWithCurrency($fltPrice), 'shipping' => $objShipping); } } RowClass::withKey('rowClass')->addCount('row_')->addFirstLast('row_')->addEvenOdd('row_')->applyTo($arrMethods); } $this->Template->shippingMethods = $arrMethods; }
<?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_shipping */ $GLOBALS['TL_DCA']['tl_iso_shipping'] = array('config' => array('dataContainer' => 'Table', 'enableVersioning' => true, 'closed' => true, 'onload_callback' => array(array('Isotope\\Backend', 'initializeSetupModule'), array('Isotope\\Backend\\Shipping\\Callback', 'checkPermission')), 'sql' => array('keys' => array('id' => 'primary'))), 'list' => array('sorting' => array('mode' => 1, 'fields' => array('name'), 'flag' => 1, 'panelLayout' => 'sort,filter;search,limit'), 'label' => array('fields' => array('name', 'type'), 'format' => '%s <span style="color:#b3b3b3; padding-left:3px;">[%s]</span>'), '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_shipping']['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_shipping']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif', 'button_callback' => array('Isotope\\Backend\\Shipping\\Callback', 'copyShippingModule')), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['delete'], 'href' => 'act=delete', 'icon' => 'delete.gif', 'attributes' => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"', 'button_callback' => array('Isotope\\Backend\\Shipping\\Callback', 'deleteShippingModule')), 'toggle' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['toggle'], 'icon' => 'visible.gif', 'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"', 'button_callback' => array('Isotope\\Backend\\Shipping\\Callback', 'toggleIcon')), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['show'], 'href' => 'act=show', 'icon' => 'show.gif'))), 'palettes' => array('__selector__' => array('type', 'protected'), 'default' => '{title_legend},name,label,type', 'flat' => '{title_legend},name,label,type;{note_legend:hide},note;{price_legend},price,tax_class,flatCalculation;{config_legend},countries,subdivisions,postalCodes,quantity_mode,minimum_quantity,maximum_quantity,minimum_total,maximum_total,minimum_weight,maximum_weight,product_types,product_types_condition,config_ids;{expert_legend:hide},guests,protected;{enabled_legend},enabled', 'group' => '{title_legend},name,label,type;{note_legend:hide},note;{config_legend},group_methods;{price_legend},group_calculation,tax_class;{expert_legend:hide},guests,protected;{enabled_legend},enabled'), 'subpalettes' => array('protected' => 'groups'), '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_shipping']['name'], 'exclude' => true, 'search' => true, 'inputType' => 'text', 'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'label' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['label'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'type' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['type'], 'exclude' => true, 'filter' => true, 'inputType' => 'select', 'default' => 'flat', 'options_callback' => function () { return \Isotope\Model\Shipping::getModelTypeOptions(); }, 'eval' => array('helpwizard' => true, 'submitOnChange' => true, 'chosen' => true, 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''"), 'note' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['note'], 'exclude' => true, 'inputType' => 'textarea', 'eval' => array('rte' => 'tinyMCE', 'decodeEntities' => true), 'sql' => "text NULL"), 'countries' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['countries'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => function () { return \System::getCountries(); }, 'eval' => array('multiple' => true, 'size' => 8, 'tl_class' => 'w50 w50h', 'chosen' => true), 'sql' => "blob NULL"), 'subdivisions' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['subdivisions'], 'exclude' => true, 'sorting' => true, 'inputType' => 'conditionalselect', 'options_callback' => array('Isotope\\Backend', 'getSubdivisions'), 'eval' => array('multiple' => true, 'size' => 8, 'conditionField' => 'countries', 'tl_class' => 'w50 w50h'), 'sql' => "longblob NULL"), 'postalCodes' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['postalCodes'], 'exclude' => true, 'inputType' => 'textarea', 'eval' => array('style' => 'height:40px', 'tl_class' => 'clr'), 'sql' => "text NULL"), 'minimum_total' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['minimum_total'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 13, 'rgxp' => 'price', 'tl_class' => 'w50'), 'sql' => "decimal(12,2) NOT NULL default '0.00'"), 'maximum_total' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['maximum_total'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 13, 'rgxp' => 'price', 'tl_class' => 'w50'), 'sql' => "decimal(12,2) NOT NULL default '0.00'"), 'minimum_weight' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['minimum_weight'], 'exclude' => true, 'default' => array('unit' => 'kg'), 'inputType' => 'timePeriod', 'options' => array('mg', 'g', 'kg', 't', 'ct', 'oz', 'lb', 'st', 'grain'), 'reference' => &$GLOBALS['TL_LANG']['WGT'], 'eval' => array('rgxp' => 'digit', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'maximum_weight' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['maximum_weight'], 'exclude' => true, 'default' => array('unit' => 'kg'), 'inputType' => 'timePeriod', 'options' => array('mg', 'g', 'kg', 't', 'ct', 'oz', 'lb', 'st', 'grain'), 'reference' => &$GLOBALS['TL_LANG']['WGT'], 'eval' => array('rgxp' => 'digit', 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"), 'quantity_mode' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['quantity_mode'], 'exclude' => true, 'inputType' => 'select', 'options' => array('cart_items', 'cart_products'), 'reference' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['quantity_mode'], 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(32) NOT NULL default ''"), 'minimum_quantity' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['minimum_quantity'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 10, 'rgxp' => 'digit', 'tl_class' => 'clr w50'), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'maximum_quantity' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['maximum_quantity'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 10, 'rgxp' => 'digit', 'tl_class' => 'w50'), 'sql' => "int(10) unsigned NOT NULL default '0'"), 'product_types' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['product_types'], 'exclude' => true, 'inputType' => 'select', 'foreignKey' => \Isotope\Model\ProductType::getTable() . '.name', 'eval' => array('multiple' => true, 'size' => 8, 'chosen' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => "blob NULL", 'relation' => array('type' => 'hasMany', 'load' => 'lazy')), 'product_types_condition' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['product_types_condition'], 'exclude' => true, 'inputType' => 'select', 'options' => array('onlyAvailable', 'allAvailable', 'oneAvailable', 'calculation'), 'reference' => &$GLOBALS['TL_LANG']['tl_iso_shipping'], 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(16) NOT NULL default ''"), 'config_ids' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['config_ids'], 'exclude' => true, 'inputType' => 'select', 'foreignKey' => \Isotope\Model\Config::getTable() . '.name', 'eval' => array('multiple' => true, 'size' => 8, 'tl_class' => 'clr w50 w50h', 'chosen' => true), 'sql' => "blob NULL", 'relation' => array('type' => 'hasMany', 'load' => 'lazy')), 'price' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['price'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 16, 'rgxp' => 'surcharge', 'tl_class' => 'w50'), 'sql' => "varchar(16) NOT NULL default ''"), 'tax_class' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['tax_class'], 'exclude' => true, 'filter' => true, 'inputType' => 'select', 'foreignKey' => \Isotope\Model\TaxClass::getTable() . '.name', 'options_callback' => array('\\Isotope\\Model\\TaxClass', 'getOptionsWithSplit'), 'eval' => array('includeBlankOption' => true, 'blankOptionLabel' => &$GLOBALS['TL_LANG']['MSC']['taxFree'], 'tl_class' => 'w50'), 'sql' => "int(10) NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy')), 'flatCalculation' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['flatCalculation'], 'exclude' => true, 'inputType' => 'select', 'options' => array('flat', 'perProduct', 'perItem'), 'reference' => &$GLOBALS['TL_LANG']['tl_iso_shipping'], 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(10) NOT NULL default ''"), 'group_methods' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['group_methods'], 'exclude' => true, 'inputType' => 'checkboxWizard', 'options_callback' => function ($dc) { $objShipping = \Isotope\Model\Shipping::findBy(array($dc->table . '.id!=?'), $dc->id); return null === $objShipping ? array() : $objShipping->fetchEach('name'); }, 'eval' => array('mandatory' => true, 'multiple' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => "blob NULL"), 'group_calculation' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['group_calculation'], 'exclude' => true, 'inputType' => 'select', 'options' => array('first', 'lowest', 'highest', 'summarize'), 'reference' => &$GLOBALS['TL_LANG']['tl_iso_shipping'], 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(10) NOT NULL default ''"), 'guests' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['guests'], 'exclude' => true, 'inputType' => 'checkbox', 'sql' => "char(1) NOT NULL default ''"), 'protected' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['protected'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => true), 'sql' => "char(1) NOT NULL default ''"), 'groups' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['groups'], 'exclude' => true, 'inputType' => 'checkbox', 'foreignKey' => 'tl_member_group.name', 'eval' => array('multiple' => true), 'sql' => "blob NULL", 'relation' => array('type' => 'hasMany', 'load' => 'lazy')), 'enabled' => array('label' => &$GLOBALS['TL_LANG']['tl_iso_shipping']['enabled'], 'exclude' => true, 'inputType' => 'checkbox', 'sql' => "char(1) NOT NULL default ''")));
$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')); /** * Permissions are access settings for user and groups (fields in tl_user and tl_user_group) */ $GLOBALS['TL_PERMISSIONS'][] = 'iso_modules'; $GLOBALS['TL_PERMISSIONS'][] = 'iso_product_types'; $GLOBALS['TL_PERMISSIONS'][] = 'iso_product_typep'; $GLOBALS['TL_PERMISSIONS'][] = 'iso_payment_modules'; $GLOBALS['TL_PERMISSIONS'][] = 'iso_payment_modulep'; $GLOBALS['TL_PERMISSIONS'][] = 'iso_shipping_modules';
/** * Get shipping methods for this group * Must be lazy-loaded to prevent recursion * @return array */ protected function getGroupMethods() { if (false === $this->arrMethods) { $this->arrMethods = array(); $arrMethods = deserialize($this->group_methods, true); // Prevent recursion if we should load ourselves if (($key = array_search($this->id, $arrMethods)) !== false) { unset($arrMethods[$key]); } if (($objMethods = Shipping::findMultipleByIds($arrMethods)) !== null) { foreach ($objMethods as $objMethod) { if ($objMethod->isAvailable()) { $this->arrMethods[] = $objMethod; } } } } return $this->arrMethods; }
<?php /** * Isotope eCommerce for Contao Open Source CMS * * Copyright (C) 2016 Intelligent Spark * * @package Isotope Shipping Module "Zones Advanced" * @link http://isotopeecommerce.org * @license http://opensource.org/licenses/lgpl-3.0.html */ \Isotope\Model\Shipping::registerModelType('zones_advanced', 'IntelligentSpark\\Model\\Shipping\\ZonesAdvanced');
<?php /** * UPS Integration for Isotope eCommerce for Contao Open Source CMS * * Copyright (C) 2015 Rhyme Digital, LLC. * * @author Blair Winans <*****@*****.**> * @author Adam Fisher <*****@*****.**> * @link http://rhyme.digital * @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL */ /** * Frontend modules */ //$GLOBALS['FE_MOD']['isotope']['iso_upsratesandservice'] = 'ModuleUPSRatesAndService'; //$GLOBALS['FE_MOD']['isotope']['iso_upstracking'] = 'ModuleUPSTracking'; /** * Shipping methods */ \Isotope\Model\Shipping::registerModelType('ups', 'Rhyme\\Model\\Shipping\\UPS');
/** * Get all enabled shipping modules and return them as array * @return array */ public function getShippingModules() { $t = Shipping::getTable(); $objShipping = Shipping::findBy(array("{$t}.tstamp>0"), null); if (null === $objShipping) { return array(); } return $objShipping->fetchEach('name'); }
<?php /** * FedEx Integration for Isotope eCommerce for Contao Open Source CMS * * Copyright (C) 2015 Rhyme Digital, LLC. * * @author Blair Winans <*****@*****.**> * @author Adam Fisher <*****@*****.**> * @link http://rhyme.digital * @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL */ /** * Frontend modules */ //$GLOBALS['FE_MOD']['isotope']['iso_upsratesandservice'] = 'ModuleUPSRatesAndService'; //$GLOBALS['FE_MOD']['isotope']['iso_upstracking'] = 'ModuleUPSTracking'; /** * Shipping methods */ \Isotope\Model\Shipping::registerModelType('fedex_single', 'Rhyme\\Model\\Shipping\\FedEx');
return \Isotope\Backend::getTemplates('iso_collection_'); }, 'eval' => array('mandatory' => true, 'chosen' => true, 'tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_filterTpl'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_filterTpl'], 'exclude' => true, 'default' => 'iso_filter_default', 'inputType' => 'select', 'options_callback' => array('Isotope\\Backend\\Module\\Callback', 'getFilterTemplates'), 'eval' => array('mandatory' => true, 'tl_class' => 'w50', 'chosen' => true), 'sql' => "varchar(64) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_jump_first'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_jump_first'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_hide_list'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_hide_list'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_use_quantity'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_use_quantity'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_display404Page'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_display404Page'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_checkout_method'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_checkout_method'], 'exclude' => true, 'inputType' => 'radio', 'default' => 'member', 'options' => array('member', 'guest', 'both'), 'reference' => &$GLOBALS['TL_LANG']['tl_module']['iso_checkout_method_ref'], 'eval' => array('mandatory' => true, 'submitOnChange' => true), 'sql' => "varchar(10) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_login_jumpTo'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_login_jumpTo'], 'exclude' => true, 'inputType' => 'pageTree', 'foreignKey' => 'tl_page.title', 'eval' => array('fieldType' => 'radio', 'mandatory' => true, 'tl_class' => 'clr'), 'explanation' => 'jumpTo', 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy')); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_loginRequired'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_loginRequired'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_addProductJumpTo'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_addProductJumpTo'], 'exclude' => true, 'inputType' => 'pageTree', 'foreignKey' => 'tl_page.title', 'eval' => array('fieldType' => 'radio', 'tl_class' => 'clr'), 'explanation' => 'jumpTo', 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy')); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_cols'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_cols'], 'exclude' => true, 'default' => 1, 'inputType' => 'text', 'eval' => array('maxlength' => 1, 'rgxp' => 'digit', 'tl_class' => 'w50'), 'sql' => "int(1) unsigned NOT NULL default '1'"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_config_id'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_config_id'], 'exclude' => true, 'inputType' => 'select', 'foreignKey' => \Isotope\Model\Config::getTable() . '.name', 'eval' => array('includeBlankOption' => true, 'mandatory' => true, 'tl_class' => 'w50'), 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy')); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_config_ids'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_config_ids'], 'exclude' => true, 'inputType' => 'checkboxWizard', 'foreignKey' => \Isotope\Model\Config::getTable() . '.name', 'eval' => array('multiple' => true, 'mandatory' => true, 'tl_class' => 'clr'), 'sql' => "blob NULL", 'relation' => array('type' => 'hasMany', 'load' => 'lazy')); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_payment_modules'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_payment_modules'], 'exclude' => true, 'inputType' => 'checkboxWizard', 'foreignKey' => \Isotope\Model\Payment::getTable() . '.name', 'options_callback' => array('Isotope\\Backend\\Module\\Callback', 'getPaymentModules'), 'eval' => array('multiple' => true), 'sql' => "blob NULL", 'relation' => array('type' => 'hasMany', 'load' => 'lazy')); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_shipping_modules'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_shipping_modules'], 'exclude' => true, 'inputType' => 'checkboxWizard', 'foreignKey' => \Isotope\Model\Shipping::getTable() . '.name', 'options_callback' => array('Isotope\\Backend\\Module\\Callback', 'getShippingModules'), 'eval' => array('multiple' => true), 'sql' => "blob NULL", 'relation' => array('type' => 'hasMany', 'load' => 'lazy')); $GLOBALS['TL_DCA']['tl_module']['fields']['orderCompleteJumpTo'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['orderCompleteJumpTo'], 'exclude' => true, 'inputType' => 'pageTree', 'foreignKey' => 'tl_page.title', 'eval' => array('mandatory' => true, 'fieldType' => 'radio', 'tl_class' => 'clr'), 'explanation' => 'jumpTo', 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy')); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_forward_review'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_forward_review'], 'exclude' => true, 'inputType' => 'checkbox', 'sql' => "char(1) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_order_conditions'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_order_conditions'], 'exclude' => true, 'inputType' => 'select', 'foreignKey' => 'tl_form.title', 'eval' => array('includeBlankOption' => true, 'tl_class' => 'clr w50', 'chosen' => true), 'sql' => "int(10) unsigned NOT NULL default '0'", 'relation' => array('type' => 'hasOne', 'load' => 'lazy')); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_order_conditions_position'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_order_conditions_position'], 'exclude' => true, 'inputType' => 'radio', 'options' => array('top', 'before', 'after'), 'reference' => &$GLOBALS['TL_LANG']['tl_module']['iso_order_conditions_position'], 'eval' => array('tl_class' => 'w50 w50h'), 'sql' => "varchar(6) NOT NULL default 'after'"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_addToAddressbook'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_addToAddressbook'], 'exclude' => true, 'inputType' => 'checkbox', 'sql' => "char(1) NOT NULL default ''", 'eval' => array('tl_class' => 'w50 m12')); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_orderCollectionBy'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_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 ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_emptyMessage'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_emptyMessage'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => true, 'tl_class' => 'clr w50'), 'sql' => "char(1) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_noProducts'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_noProducts'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'tl_class' => 'clr long'), 'sql' => "varchar(255) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_emptyFilter'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_emptyFilter'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('submitOnChange' => true, 'tl_class' => 'clr'), 'sql' => "char(1) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_noFilter'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_noFilter'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('maxlength' => 255, 'tl_class' => 'clr long'), 'sql' => "varchar(255) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_category_scope'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_category_scope'], 'exclude' => true, 'inputType' => 'radio', 'default' => 'current_category', 'options' => array('current_category', 'current_and_first_child', 'current_and_all_children', 'parent', 'product', 'article', 'global'), 'reference' => &$GLOBALS['TL_LANG']['tl_module']['iso_category_scope_ref'], 'eval' => array('tl_class' => 'clr w50 w50h', 'helpwizard' => true), 'sql' => "varchar(64) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_list_where'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_list_where'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('preserveTags' => true, 'maxlength' => 255, 'tl_class' => 'w50'), 'sql' => "varchar(255) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_filterModules'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_filterModules'], 'exclude' => true, 'inputType' => 'checkboxWizard', 'foreignKey' => 'tl_module.name', 'options_callback' => array('Isotope\\Backend\\Module\\Callback', 'getFilterModules'), 'eval' => array('multiple' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => "blob NULL", 'relation' => array('type' => 'hasMany', 'load' => 'lazy')); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_filterFields'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_filterFields'], 'exclude' => true, 'inputType' => 'checkboxWizard', 'options_callback' => array('Isotope\\Backend\\Module\\Callback', 'getFilterFields'), 'eval' => array('multiple' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => "blob NULL"); $GLOBALS['TL_DCA']['tl_module']['fields']['iso_newFilter'] = array('label' => &$GLOBALS['TL_LANG']['tl_module']['iso_newFilter'], 'exclude' => true, 'inputType' => 'select', 'default' => 'show_all', 'options' => array('show_all', 'show_new', 'show_old'), 'reference' => &$GLOBALS['TL_LANG']['tl_module']['iso_newFilter'], 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(8) NOT NULL default ''");
<?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))));
/** * Load shipping modules into the DCA (options_callback would not work due to numeric array keys) * @param object * @return void */ public function loadShippingModules($dc) { $arrModules = array(-1 => $GLOBALS['TL_LANG'][$dc->table]['no_shipping']); $objShippings = Shipping::findAll(array('order' => 'name')); if (null !== $objShippings) { foreach ($objShippings as $objShipping) { $arrModules[$objShipping->id] = $objShipping->name; } } $GLOBALS['TL_DCA'][$dc->table]['fields']['shipping_modules']['options'] = array_keys($arrModules); $GLOBALS['TL_DCA'][$dc->table]['fields']['shipping_modules']['reference'] = $arrModules; }
/** * Generate the checkout step * @return string */ public function generate() { $arrModules = array(); $arrOptions = array(); $arrIds = deserialize($this->objModule->iso_shipping_modules); if (!empty($arrIds) && is_array($arrIds)) { $arrColumns = array('id IN (' . implode(',', $arrIds) . ')'); if (BE_USER_LOGGED_IN !== true) { $arrColumns[] = "enabled='1'"; } $objModules = Shipping::findBy($arrColumns, null, array('order' => \Database::getInstance()->findInSet('id', $arrIds))); if (null !== $objModules) { foreach ($objModules as $objModule) { if (!$objModule->isAvailable()) { continue; } $strLabel = $objModule->getLabel(); $fltPrice = $objModule->getPrice(); if ($fltPrice != 0) { if ($objModule->isPercentage()) { $strLabel .= ' (' . $objModule->getPercentageLabel() . ')'; } $strLabel .= ': ' . Isotope::formatPriceWithCurrency($fltPrice); } if ($objModule->note != '') { $strLabel .= '<span class="note">' . $objModule->note . '</span>'; } $arrOptions[] = array('value' => $objModule->id, 'label' => $strLabel); $arrModules[$objModule->id] = $objModule; } } } if (empty($arrModules)) { $this->blnError = true; \System::log('No shipping methods available for cart ID ' . Isotope::getCart()->id, __METHOD__, TL_ERROR); $objTemplate = new \Isotope\Template('mod_message'); $objTemplate->class = 'shipping_method'; $objTemplate->hl = 'h2'; $objTemplate->headline = $GLOBALS['TL_LANG']['MSC']['shipping_method']; $objTemplate->type = 'error'; $objTemplate->message = $GLOBALS['TL_LANG']['MSC']['noShippingModules']; return $objTemplate->parse(); } $strClass = $GLOBALS['TL_FFL']['radio']; $objWidget = new $strClass(array('id' => $this->getStepClass(), 'name' => $this->getStepClass(), 'mandatory' => true, 'options' => $arrOptions, 'value' => Isotope::getCart()->shipping_id, 'storeValues' => true, 'tableless' => true)); // If there is only one shipping method, mark it as selected by default if (count($arrModules) == 1) { $objModule = reset($arrModules); $objWidget->value = $objModule->id; Isotope::getCart()->setShippingMethod($objModule); } if (\Input::post('FORM_SUBMIT') == $this->objModule->getFormId()) { $objWidget->validate(); if (!$objWidget->hasErrors()) { Isotope::getCart()->setShippingMethod($arrModules[$objWidget->value]); } } $objTemplate = new \Isotope\Template('iso_checkout_shipping_method'); if (!Isotope::getCart()->hasShipping() || !isset($arrModules[Isotope::getCart()->shipping_id])) { $this->blnError = true; } $objTemplate->headline = $GLOBALS['TL_LANG']['MSC']['shipping_method']; $objTemplate->message = $GLOBALS['TL_LANG']['MSC']['shipping_method_message']; $objTemplate->options = $objWidget->parse(); $objTemplate->shippingMethods = $arrModules; return $objTemplate->parse(); }
/** * Run the controller */ public function run() { $objMethod = null; try { $strMod = $this->getModule(); $intId = $this->getModuleId(); if ($strMod == '' || $intId == 0) { \System::log('Invalid post-sale request (param error): ' . \Environment::get('request'), __METHOD__, TL_ERROR); $objResponse = new Response('Bad Request', 400); $objResponse->send(); } switch (strtolower($strMod)) { case 'pay': $objMethod = Payment::findByPk($intId); break; case 'ship': $objMethod = Shipping::findByPk($intId); break; } if (null === $objMethod) { \System::log('Invalid post-sale request (model not found): ' . \Environment::get('request'), __METHOD__, TL_ERROR); $objResponse = new Response('Not Found', 404); $objResponse->send(); } \System::log('New post-sale request: ' . \Environment::get('request'), __METHOD__, TL_ACCESS); if (!$objMethod instanceof IsotopePostsale) { \System::log('Invalid post-sale request (interface not implemented): ' . \Environment::get('request'), __METHOD__, TL_ERROR); $objResponse = new Response('Not Implemented', 501); $objResponse->send(); } $objOrder = $objMethod->getPostsaleOrder(); if (null === $objOrder || !$objOrder instanceof IsotopeProductCollection) { \System::log(get_class($objMethod) . ' did not return a valid order', __METHOD__, TL_ERROR); $objResponse = new Response('Failed Dependency', 424); $objResponse->send(); } global $objPage; // Load page configuration if (!is_object($objPage) && $objOrder->pageId > 0) { $objPage = \PageModel::findWithDetails($objOrder->pageId); $objPage = \Isotope\Frontend::loadPageConfig($objPage); } // Set the current system to the language when the user placed the order. // This will result in correct e-mails and payment description. if ($GLOBALS['TL_LANGUAGE'] != $objOrder->language) { $GLOBALS['TL_LANGUAGE'] = $objOrder->language; \System::loadLanguageFile('default', $objOrder->language, true); } Isotope::setConfig($objOrder->getRelated('config_id')); if (($objCart = $objOrder->getRelated('source_collection_id')) !== null && $objCart instanceof Cart) { Isotope::setCart($objCart); } $objMethod->processPostsale($objOrder); $objResponse = new Response(); $objResponse->send(); } catch (\Exception $e) { \System::log(sprintf('Exception in post-sale request in file "%s" on line "%s" with message "%s".', $e->getFile(), $e->getLine(), $e->getMessage()), __METHOD__, TL_ERROR); $objResponse = new Response('Internal Server Error', 500); $objResponse->send(); } }
/** * Run the controller */ public function run() { $this->logRequest(); $objMethod = null; try { $strMod = $this->getModule(); $intId = $this->getModuleId(); if ($strMod == '' || $intId == 0) { \System::log('Invalid post-sale request (param error): ' . \Environment::get('request'), __METHOD__, TL_ERROR); $objResponse = new Response('Bad Request', 400); $objResponse->send(); } switch (strtolower($strMod)) { case 'pay': $objMethod = Payment::findByPk($intId); break; case 'ship': $objMethod = Shipping::findByPk($intId); break; } if (null === $objMethod) { \System::log('Invalid post-sale request (model not found): ' . \Environment::get('request'), __METHOD__, TL_ERROR); $objResponse = new Response('Not Found', 404); $objResponse->send(); } \System::log('New post-sale request: ' . \Environment::get('request'), __METHOD__, TL_ACCESS); if (!$objMethod instanceof IsotopePostsale) { \System::log('Invalid post-sale request (interface not implemented): ' . \Environment::get('request'), __METHOD__, TL_ERROR); $objResponse = new Response('Not Implemented', 501); $objResponse->send(); } /** @type Order $objOrder */ $objOrder = $objMethod->getPostsaleOrder(); if (null === $objOrder || !$objOrder instanceof IsotopeProductCollection) { \System::log(get_class($objMethod) . ' did not return a valid order', __METHOD__, TL_ERROR); $objResponse = new Response('Failed Dependency', 424); $objResponse->send(); } Frontend::loadOrderEnvironment($objOrder); $objMethod->processPostsale($objOrder); $objResponse = new Response(); $objResponse->send(); } catch (\Exception $e) { \System::log(sprintf('Exception in post-sale request. See system/logs/isotope_postsale.log for details.', $e->getFile(), $e->getLine(), $e->getMessage()), __METHOD__, TL_ERROR); log_message(sprintf("Exception in post-sale request\n%s\n\n", $e->getTraceAsString()), 'isotope_postsale.log'); $objResponse = new Response('Internal Server Error', 500); $objResponse->send(); } }
* * Copyright (C) 2009-2014 terminal42 gmbh & Isotope eCommerce Workgroup * * @package Isotope * @link http://isotopeecommerce.org * @license http://opensource.org/licenses/lgpl-3.0.html */ \System::loadLanguageFile(\Isotope\Model\Group::getTable()); /** * Extend tl_user palettes */ $GLOBALS['TL_DCA']['tl_user']['palettes']['extend'] = str_replace('{account_legend}', '{isotope_legend},iso_modules,iso_product_types,iso_product_typep,iso_payment_modules,iso_payment_modulep,iso_shipping_modules,iso_shipping_modulep,iso_tax_classes,iso_tax_classp,iso_tax_rates,iso_tax_ratep,iso_configs,iso_configp,iso_groups,iso_groupp;{account_legend}', $GLOBALS['TL_DCA']['tl_user']['palettes']['extend']); $GLOBALS['TL_DCA']['tl_user']['palettes']['custom'] = str_replace('{account_legend}', '{isotope_legend},iso_modules,iso_product_types,iso_product_typep,iso_payment_modules,iso_payment_modulep,iso_shipping_modules,iso_shipping_modulep,iso_tax_classes,iso_tax_classp,iso_tax_rates,iso_tax_ratep,iso_configs,iso_configp,iso_groups,iso_groupp;{account_legend}', $GLOBALS['TL_DCA']['tl_user']['palettes']['custom']); /** * Add fields to tl_user */ $GLOBALS['TL_DCA']['tl_user']['fields']['iso_modules'] = array('label' => &$GLOBALS['TL_LANG']['tl_user']['iso_modules'], 'exclude' => true, 'filter' => true, 'inputType' => 'checkbox', 'options_callback' => array('Isotope\\Backend', 'getIsotopeModules'), 'reference' => &$GLOBALS['TL_LANG']['IMD'], 'eval' => array('multiple' => true, 'helpwizard' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => 'blob NULL'); $GLOBALS['TL_DCA']['tl_user']['fields']['iso_product_types'] = array('label' => &$GLOBALS['TL_LANG']['tl_user']['iso_product_types'], 'exclude' => true, 'inputType' => 'checkbox', 'foreignKey' => \Isotope\Model\ProductType::getTable() . '.name', 'eval' => array('multiple' => true, 'helpwizard' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => 'blob NULL'); $GLOBALS['TL_DCA']['tl_user']['fields']['iso_product_typep'] = array('label' => &$GLOBALS['TL_LANG']['tl_user']['iso_product_typep'], 'exclude' => true, 'inputType' => 'checkbox', 'options' => array('create', 'delete'), 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('multiple' => true, 'tl_class' => 'w50 w50h'), 'sql' => 'blob NULL'); $GLOBALS['TL_DCA']['tl_user']['fields']['iso_payment_modules'] = array('label' => &$GLOBALS['TL_LANG']['tl_user']['iso_payment_modules'], 'exclude' => true, 'inputType' => 'checkbox', 'foreignKey' => \Isotope\Model\Payment::getTable() . '.name', 'eval' => array('multiple' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => 'blob NULL'); $GLOBALS['TL_DCA']['tl_user']['fields']['iso_payment_modulep'] = array('label' => &$GLOBALS['TL_LANG']['tl_user']['iso_payment_modulep'], 'exclude' => true, 'inputType' => 'checkbox', 'options' => array('create', 'delete'), 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('multiple' => true, 'tl_class' => 'w50 w50h'), 'sql' => 'blob NULL'); $GLOBALS['TL_DCA']['tl_user']['fields']['iso_shipping_modules'] = array('label' => &$GLOBALS['TL_LANG']['tl_user']['iso_shipping_modules'], 'exclude' => true, 'inputType' => 'checkbox', 'foreignKey' => \Isotope\Model\Shipping::getTable() . '.name', 'eval' => array('multiple' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => 'blob NULL'); $GLOBALS['TL_DCA']['tl_user']['fields']['iso_shipping_modulep'] = array('label' => &$GLOBALS['TL_LANG']['tl_user']['iso_shipping_modulep'], 'exclude' => true, 'inputType' => 'checkbox', 'options' => array('create', 'delete'), 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('multiple' => true, 'tl_class' => 'w50 w50h'), 'sql' => 'blob NULL'); $GLOBALS['TL_DCA']['tl_user']['fields']['iso_tax_classes'] = array('label' => &$GLOBALS['TL_LANG']['tl_user']['iso_tax_classes'], 'exclude' => true, 'inputType' => 'checkbox', 'foreignKey' => \Isotope\Model\TaxClass::getTable() . '.name', 'eval' => array('multiple' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => 'blob NULL'); $GLOBALS['TL_DCA']['tl_user']['fields']['iso_tax_classp'] = array('label' => &$GLOBALS['TL_LANG']['tl_user']['iso_tax_classp'], 'exclude' => true, 'inputType' => 'checkbox', 'options' => array('create', 'delete'), 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('multiple' => true, 'tl_class' => 'w50 w50h'), 'sql' => 'blob NULL'); $GLOBALS['TL_DCA']['tl_user']['fields']['iso_tax_rates'] = array('label' => &$GLOBALS['TL_LANG']['tl_user']['iso_tax_rates'], 'exclude' => true, 'inputType' => 'checkbox', 'foreignKey' => \Isotope\Model\TaxRate::getTable() . '.name', 'eval' => array('multiple' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => 'blob NULL'); $GLOBALS['TL_DCA']['tl_user']['fields']['iso_tax_ratep'] = array('label' => &$GLOBALS['TL_LANG']['tl_user']['iso_tax_ratep'], 'exclude' => true, 'inputType' => 'checkbox', 'options' => array('create', 'delete'), 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('multiple' => true, 'tl_class' => 'w50 w50h'), 'sql' => 'blob NULL'); $GLOBALS['TL_DCA']['tl_user']['fields']['iso_configs'] = array('label' => &$GLOBALS['TL_LANG']['tl_user']['iso_configs'], 'exclude' => true, 'inputType' => 'checkbox', 'foreignKey' => \Isotope\Model\Config::getTable() . '.name', 'eval' => array('multiple' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => 'blob NULL'); $GLOBALS['TL_DCA']['tl_user']['fields']['iso_configp'] = array('label' => &$GLOBALS['TL_LANG']['tl_user']['iso_configp'], 'exclude' => true, 'inputType' => 'checkbox', 'options' => array('create', 'delete'), 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('multiple' => true, 'tl_class' => 'w50 w50h'), 'sql' => 'blob NULL'); $GLOBALS['TL_DCA']['tl_user']['fields']['iso_groups'] = array('label' => &$GLOBALS['TL_LANG']['tl_user']['iso_groups'], 'exclude' => true, 'inputType' => 'checkbox', 'options_callback' => array('\\Isotope\\Backend\\User\\Callback', 'getGroups'), 'eval' => array('multiple' => true, 'tl_class' => 'clr w50 w50h'), 'sql' => 'blob NULL'); $GLOBALS['TL_DCA']['tl_user']['fields']['iso_groupp'] = array('label' => &$GLOBALS['TL_LANG']['tl_user']['iso_groupp'], 'exclude' => true, 'inputType' => 'checkbox', 'options' => array('create', 'delete', 'rootPaste'), 'reference' => &$GLOBALS['TL_LANG']['MSC'], 'eval' => array('multiple' => true, 'tl_class' => 'w50 w50h'), 'sql' => 'blob NULL');