Exemplo n.º 1
1
 /**
  * Retrieve filter array
  *
  * @param Enterprise_Search_Model_Resource_Collection $collection
  * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
  * @param string|array $value
  * @return array
  */
 protected function _getSearchParam($collection, $attribute, $value)
 {
     if (!is_string($value) && empty($value) || is_string($value) && strlen(trim($value)) == 0 || is_array($value) && isset($value['from']) && empty($value['from']) && isset($value['to']) && empty($value['to'])) {
         return array();
     }
     if (!is_array($value)) {
         $value = array($value);
     }
     $field = Mage::getResourceSingleton('enterprise_search/engine')->getSearchEngineFieldName($attribute, 'nav');
     if ($attribute->getBackendType() == 'datetime') {
         $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
         foreach ($value as &$val) {
             if (!is_empty_date($val)) {
                 $date = new Zend_Date($val, $format);
                 $val = $date->toString(Zend_Date::ISO_8601) . 'Z';
             }
         }
         unset($val);
     }
     if (empty($value)) {
         return array();
     } else {
         return array($field => $value);
     }
 }
Exemplo n.º 2
0
 /**
  * Prepare form fields and structure
  *
  * @return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $model = Mage::registry('current_status');
     $labels = $model ? $model->getStoreLabels() : array();
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('Mage_Sales_Helper_Data')->__('Order Status Information')));
     $fieldset->addField('is_new', 'hidden', array('name' => 'is_new', 'value' => 1));
     $fieldset->addField('status', 'text', array('name' => 'status', 'label' => Mage::helper('Mage_Sales_Helper_Data')->__('Status Code'), 'class' => 'required-entry validate-code', 'required' => true));
     $fieldset->addField('label', 'text', array('name' => 'label', 'label' => Mage::helper('Mage_Sales_Helper_Data')->__('Status Label'), 'class' => 'required-entry', 'required' => true));
     $fieldset = $form->addFieldset('store_labels_fieldset', array('legend' => Mage::helper('Mage_Sales_Helper_Data')->__('Store View Specific Labels'), 'table_class' => 'form-list stores-tree'));
     foreach (Mage::app()->getWebsites() as $website) {
         $fieldset->addField("w_{$website->getId()}_label", 'note', array('label' => $website->getName(), 'fieldset_html_class' => 'website'));
         foreach ($website->getGroups() as $group) {
             $stores = $group->getStores();
             if (count($stores) == 0) {
                 continue;
             }
             $fieldset->addField("sg_{$group->getId()}_label", 'note', array('label' => $group->getName(), 'fieldset_html_class' => 'store-group'));
             foreach ($stores as $store) {
                 $fieldset->addField("store_label_{$store->getId()}", 'text', array('name' => 'store_labels[' . $store->getId() . ']', 'required' => false, 'label' => $store->getName(), 'value' => isset($labels[$store->getId()]) ? $labels[$store->getId()] : '', 'fieldset_html_class' => 'store'));
             }
         }
     }
     if ($model) {
         $form->addValues($model->getData());
     }
     $form->setAction($this->getUrl('*/sales_order_status/save'));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 3
0
 protected function _construct()
 {
     $this->_init('catalogindex/price');
     $this->_getResource()->setStoreId(Mage::app()->getStore()->getId());
     $this->_getResource()->setRate(Mage::app()->getStore()->getCurrentCurrencyRate());
     $this->_getResource()->setCustomerGroupId(Mage::getSingleton('customer/session')->getCustomerGroupId());
 }
Exemplo n.º 4
0
 /**
  * Prepare cart items URLs
  *
  * @deprecated after 1.7.0.2
  */
 public function prepareItemUrls()
 {
     $products = array();
     /* @var $item Mage_Sales_Model_Quote_Item */
     foreach ($this->getItems() as $item) {
         $product = $item->getProduct();
         $option = $item->getOptionByCode('product_type');
         if ($option) {
             $product = $option->getProduct();
         }
         if ($item->getStoreId() != Mage::app()->getStore()->getId() && !$item->getRedirectUrl() && !$product->isVisibleInSiteVisibility()) {
             $products[$product->getId()] = $item->getStoreId();
         }
     }
     if ($products) {
         $products = Mage::getResourceSingleton('catalog/url')->getRewriteByProductStore($products);
         foreach ($this->getItems() as $item) {
             $product = $item->getProduct();
             $option = $item->getOptionByCode('product_type');
             if ($option) {
                 $product = $option->getProduct();
             }
             if (isset($products[$product->getId()])) {
                 $object = new Varien_Object($products[$product->getId()]);
                 $item->getProduct()->setUrlDataObject($object);
             }
         }
     }
 }
 protected function _addSubscriberToAutomation($email, $subscriber, $websiteId)
 {
     $storeId = $subscriber->getStoreId();
     $store = Mage::app()->getStore($storeId);
     $programId = Mage::helper('ddg')->getAutomationIdByType('XML_PATH_CONNECTOR_AUTOMATION_STUDIO_SUBSCRIBER', $websiteId);
     //not mapped ignore
     if (!$programId) {
         return;
     }
     try {
         //check the subscriber alredy exists
         $enrolmentCollection = Mage::getModel('ddg_automation/automation')->getCollection()->addFieldToFilter('email', $email)->addFieldToFilter('automation_type', Dotdigitalgroup_Email_Model_Automation::AUTOMATION_TYPE_NEW_SUBSCRIBER)->addFieldToFilter('website_id', $websiteId);
         $enrolmentCollection->getSelect()->limit(1);
         $enrolment = $enrolmentCollection->getFirstItem();
         //add new subscriber to automation
         if (!$enrolment->getId()) {
             //save subscriber to the queue
             $automation = Mage::getModel('ddg_automation/automation');
             $automation->setEmail($email)->setAutomationType(Dotdigitalgroup_Email_Model_Automation::AUTOMATION_TYPE_NEW_SUBSCRIBER)->setEnrolmentStatus(Dotdigitalgroup_Email_Model_Automation::AUTOMATION_STATUS_PENDING)->setTypeId($subscriber->getId())->setWebsiteId($websiteId)->setStoreName($store->getName())->setProgramId($programId);
             $automation->save();
         }
     } catch (Exception $e) {
         Mage::logException($e);
     }
 }
Exemplo n.º 6
0
 /**
  * Preparation of current form
  *
  * @return Inic_Faq_Block_Admin_Edit_Tab_Main Self
  */
 protected function _prepareForm()
 {
     $model = Mage::registry('faq');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('faq_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('faq')->__('General information'), 'class' => 'fieldset-wide'));
     if ($model->getFaqId()) {
         $fieldset->addField('faq_id', 'hidden', array('name' => 'faq_id'));
     }
     $approveInfo = $fieldset->addField('question', 'text', array('name' => 'question', 'label' => Mage::helper('faq')->__('FAQ item question'), 'title' => Mage::helper('faq')->__('FAQ item question'), 'required' => true));
     /**
      * Check is single store mode
      */
     if (!Mage::app()->isSingleStoreMode()) {
         $store_id = $fieldset->addField('store_id', 'multiselect', array('name' => 'store_id[]', 'label' => Mage::helper('faq')->__('Store view'), 'title' => Mage::helper('faq')->__('Store view'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     } else {
         $store_id = $fieldset->addField('store_id', 'hidden', array('name' => 'store_id[]', 'value' => Mage::app()->getStore(true)->getId()));
         $model->setStoreId(Mage::app()->getStore(true)->getId());
     }
     $status = $fieldset->addField('is_active', 'select', array('label' => Mage::helper('faq')->__('Status'), 'title' => Mage::helper('faq')->__('Item status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => Mage::helper('faq')->__('Enabled'), '0' => Mage::helper('faq')->__('Disabled'))));
     $fieldset->addField('is_most_frequent', 'select', array('label' => Mage::helper('faq')->__('Is Most Frequent'), 'title' => Mage::helper('faq')->__('Is Most Frequent'), 'name' => 'is_most_frequent', 'required' => true, 'options' => array('1' => Mage::helper('faq')->__('Yes'), '0' => Mage::helper('faq')->__('No'))));
     $category_id = $fieldset->addField('category_id', 'multiselect', array('label' => Mage::helper('faq')->__('Category'), 'title' => Mage::helper('faq')->__('Category'), 'name' => 'category_id[]', 'required' => false, 'values' => Mage::getResourceSingleton('faq/category_collection')->toOptionArray()));
     $fieldset->addField('answer', 'editor', array('name' => 'answer', 'label' => Mage::helper('faq')->__('Content'), 'title' => Mage::helper('faq')->__('Content'), 'style' => 'height:36em;', 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(), 'state' => 'html', 'required' => true));
     $data = $model->getData();
     if (!count($data)) {
         $data['store_id'] = 0;
     }
     $form->setValues($data);
     $this->setForm($form);
     $cat_id = $model->getData('category_id');
     $selected = $cat_id ? $cat_id : "";
     $this->setChild('form_after', $this->getLayout()->createBlock('faq/adminhtml_widget_form_element_selectdependence')->addFieldMap($store_id->getHtmlId(), $category_id->getHtmlId(), $selected));
     return parent::_prepareForm();
 }
Exemplo n.º 7
0
 protected function _prepareForm()
 {
     /*
      * Checking if user have permissions to save information
      */
     if ($this->_isAllowedAction('save')) {
         $isElementDisabled = false;
     } else {
         $isElementDisabled = true;
     }
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('page_');
     $model = Mage::registry('cms_page');
     $layoutFieldset = $form->addFieldset('layout_fieldset', array('legend' => Mage::helper('cms')->__('Page Layout'), 'class' => 'fieldset-wide', 'disabled' => $isElementDisabled));
     $layoutFieldset->addField('root_template', 'select', array('name' => 'root_template', 'label' => Mage::helper('cms')->__('Layout'), 'required' => true, 'values' => Mage::getSingleton('page/source_layout')->toOptionArray(), 'disabled' => $isElementDisabled));
     if (!$model->getId()) {
         $model->setRootTemplate(Mage::getSingleton('page/source_layout')->getDefaultValue());
     }
     $layoutFieldset->addField('layout_update_xml', 'textarea', array('name' => 'layout_update_xml', 'label' => Mage::helper('cms')->__('Layout Update XML'), 'style' => 'height:24em;', 'disabled' => $isElementDisabled));
     $designFieldset = $form->addFieldset('design_fieldset', array('legend' => Mage::helper('cms')->__('Custom Design'), 'class' => 'fieldset-wide', 'disabled' => $isElementDisabled));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $designFieldset->addField('custom_theme_from', 'date', array('name' => 'custom_theme_from', 'label' => Mage::helper('cms')->__('Custom Design From'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso, 'disabled' => $isElementDisabled));
     $designFieldset->addField('custom_theme_to', 'date', array('name' => 'custom_theme_to', 'label' => Mage::helper('cms')->__('Custom Design To'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso, 'disabled' => $isElementDisabled));
     $designFieldset->addField('custom_theme', 'select', array('name' => 'custom_theme', 'label' => Mage::helper('cms')->__('Custom Theme'), 'values' => Mage::getModel('core/design_source_design')->getAllOptions(), 'disabled' => $isElementDisabled));
     $designFieldset->addField('custom_root_template', 'select', array('name' => 'custom_root_template', 'label' => Mage::helper('cms')->__('Custom Layout'), 'values' => Mage::getSingleton('page/source_layout')->toOptionArray(true), 'disabled' => $isElementDisabled));
     $designFieldset->addField('custom_layout_update_xml', 'textarea', array('name' => 'custom_layout_update_xml', 'label' => Mage::helper('cms')->__('Custom Layout Update XML'), 'style' => 'height:24em;', 'disabled' => $isElementDisabled));
     Mage::dispatchEvent('adminhtml_cms_page_edit_tab_design_prepare_form', array('form' => $form));
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 8
0
 protected function setUp()
 {
     $this->_product = Mage::getModel('Mage_Catalog_Model_Product');
     $this->_product->load(1);
     $this->_block = Mage::app()->getLayout()->createBlock('Mage_Catalog_Block_Product_View_Type_Configurable');
     $this->_block->setProduct($this->_product);
 }
Exemplo n.º 9
0
 /**
  * Load backup file info
  *
  * @param string fileName
  * @param string filePath
  * @return Mage_Backup_Model_Backup
  */
 public function load($fileName, $filePath)
 {
     $backupData = Mage::helper('backup')->extractDataFromFilename($fileName);
     $this->addData(array('id' => $filePath . DS . $fileName, 'time' => (int) $backupData->getTime(), 'path' => $filePath, 'extension' => Mage::helper('backup')->getExtensionByType($backupData->getType()), 'display_name' => Mage::helper('backup')->nameToDisplayName($backupData->getName()), 'name' => $backupData->getName(), 'date_object' => new Zend_Date((int) $backupData->getTime(), Mage::app()->getLocale()->getLocaleCode())));
     $this->setType($backupData->getType());
     return $this;
 }
Exemplo n.º 10
0
 /**
  * Check whether it is single store mode
  *
  * @return bool
  */
 public function isSingleStoreMode()
 {
     if (!Mage::app()->isSingleStoreMode()) {
         return false;
     }
     return true;
 }
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $this->setForm($form);
     $fieldset = $form->addFieldset('promotional_form', array('legend' => Mage::helper('promotional')->__('General')));
     $fieldset->addField('name', 'text', array('label' => Mage::helper('promotional')->__('Name'), 'name' => 'name', 'class' => 'required-entry', 'required' => true));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('date_from', 'date', array('label' => Mage::helper('promotional')->__('Date From'), 'name' => 'date_from', 'required' => false, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     $fieldset->addField('date_to', 'date', array('label' => Mage::helper('promotional')->__('Date To'), 'name' => 'date_to', 'required' => false, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     if (!Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('store_view', 'multiselect', array('label' => Mage::helper('promotional')->__('Store View'), 'name' => 'store_view', 'class' => 'required-entry', 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     }
     $fieldset->addField('page_type', 'multiselect', array('label' => Mage::helper('promotional')->__('Page Type'), 'name' => 'page_type', 'class' => 'required-entry', 'required' => true, 'values' => Mage::getModel('promotional/source_page')->toOptionArray()));
     $fieldset->addField('position', 'select', array('label' => Mage::helper('promotional')->__('Position'), 'name' => 'position', 'class' => 'required-entry', 'required' => true, 'values' => Mage::getModel('promotional/source_position')->toOptionArray()));
     $fieldset->addField('status', 'select', array('label' => Mage::helper('promotional')->__('Status'), 'name' => 'status', 'class' => 'required-entry', 'required' => true, 'values' => Mage::getModel('promotional/source_status')->toOptionArray()));
     $fieldset->addField('width', 'text', array('label' => Mage::helper('promotional')->__('Width, px'), 'name' => 'width', 'required' => false, 'note' => $this->__('Minimum width is 200px')));
     $fieldset->addField('height', 'text', array('label' => Mage::helper('promotional')->__('Height, px'), 'name' => 'height', 'required' => false, 'note' => $this->__('Miimum height is 300px')));
     if (Mage::getSingleton('adminhtml/session')->getPromotionalData()) {
         $form->setValues(Mage::getSingleton('adminhtml/session')->getPromotionalData());
         Mage::getSingleton('adminhtml/session')->setPromotionalData(null);
     } elseif (Mage::registry('promotional_data')) {
         $form->setValues(Mage::registry('promotional_data')->getData());
     }
     if (Mage::getSingleton('adminhtml/session')->getPromotionalData() == NULL && Mage::registry('promotional_data')->getData() == NULL) {
         $form->setValues(array('position' => Mage::helper('promotional')->getDefaultPosition()));
     }
     return parent::_prepareForm();
 }
 /**
  * Controller pre-dispatch method
  *
  * @return Mage_XmlConnect_Controller_AdminAction
  */
 public function preDispatch()
 {
     Mage::getSingleton('adminhtml/url')->turnOffSecretKey();
     // override admin store design settings via stores section
     Mage::getDesign()->setArea($this->_currentArea)->setPackageName((string) Mage::getConfig()->getNode('stores/admin/design/package/name'))->setTheme((string) Mage::getConfig()->getNode('stores/admin/design/theme/default'));
     foreach (array('layout', 'template', 'skin', 'locale') as $type) {
         $value = (string) Mage::getConfig()->getNode("stores/admin/design/theme/{$type}");
         if ($value) {
             Mage::getDesign()->setTheme($type, $value);
         }
     }
     $this->getLayout()->setArea($this->_currentArea);
     Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
     Mage_Core_Controller_Varien_Action::preDispatch();
     if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->_forward('denied');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return $this;
     }
     if (is_null(Mage::getSingleton('adminhtml/session')->getLocale())) {
         Mage::getSingleton('adminhtml/session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
     }
     $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
     if ($this->_isCheckCookieRequired()) {
         $this->_checkCookie();
     }
     return $this;
 }
Exemplo n.º 13
0
 /**
  * Saving information about customer
  *
  * @param   Mage_Log_Model_Visitor $visitor
  *
  * @return  Mage_Log_Model_Resource_Visitor
  */
 protected function _saveCustomerInfo($visitor)
 {
     $adapter = $this->_getWriteAdapter();
     if ($visitor->getDoCustomerLogout() && ($logId = $visitor->getCustomerLogId())) {
         $resource = Mage::getSingleton('core/resource');
         $connection = $resource->getConnection('core_read');
         $select = new Zend_Db_Select($connection);
         $select->from($resource->getTableName('log/customer'));
         $select->reset(Zend_Db_Select::COLUMNS);
         $select->columns('login_at');
         $select->where('log_id = ?', $logId);
         $loginAt = $connection->fetchOne($select);
         if (!$loginAt) {
             return parent::_saveCustomerInfo($visitor);
         }
         $data = new Varien_Object(array('login_at' => $loginAt, 'logout_at' => Mage::getSingleton('core/date')->gmtDate(), 'store_id' => (int) Mage::app()->getStore()->getId()));
         $bind = $this->_prepareDataForTable($data, $this->getTable('log/customer'));
         $condition = array('log_id = ?' => (int) $logId);
         $adapter->update($this->getTable('log/customer'), $bind, $condition);
         $visitor->setDoCustomerLogout(false);
         $visitor->setCustomerId(null);
         $visitor->setCustomerLogId(null);
     } else {
         return parent::_saveCustomerInfo($visitor);
     }
     return $this;
 }
Exemplo n.º 14
0
 protected function _toHtml()
 {
     $rssObj = Mage::getModel('rss/rss');
     $route = Mage::helper('blog')->getRoute();
     $url = $this->getUrl($route);
     $title = Mage::getStoreConfig('blog/blog/title');
     $data = array('title' => $title, 'description' => $title, 'link' => $url, 'charset' => 'UTF-8');
     if (Mage::getStoreConfig('blog/rss/image') != "") {
         $data['image'] = $this->getSkinUrl(Mage::getStoreConfig('blog/rss/image'));
     }
     $rssObj->_addHeader($data);
     $collection = Mage::getModel('blog/blog')->getCollection()->addStoreFilter(Mage::app()->getStore()->getId())->setOrder('created_time ', 'desc');
     $identifier = $this->getRequest()->getParam('identifier');
     $tag = $this->getRequest()->getParam('tag');
     if ($tag) {
         $collection->addTagFilter(urldecode($tag));
     }
     if ($cat_id = Mage::getSingleton('blog/cat')->load($identifier)->getcatId()) {
         Mage::getSingleton('blog/status')->addCatFilterToCollection($collection, $cat_id);
     }
     Mage::getSingleton('blog/status')->addEnabledFilterToCollection($collection);
     $collection->setPageSize((int) Mage::getStoreConfig('blog/rss/posts'));
     $collection->setCurPage(1);
     if ($collection->getSize() > 0) {
         foreach ($collection as $post) {
             $data = array('title' => $post->getTitle(), 'link' => $this->getUrl($route . "/" . $post->getIdentifier()), 'description' => $post->getPostContent(), 'lastUpdate' => strtotime($post->getCreatedTime()));
             $rssObj->_addEntry($data);
         }
     }
     return $rssObj->createRssXml();
 }
Exemplo n.º 15
0
 /**
  * Prepare data before save
  *
  * @param Varien_Object $object
  * @return Mage_Eav_Model_Entity_Attribute_Backend_Store
  */
 protected function _beforeSave($object)
 {
     if (!$object->getData($this->getAttribute()->getAttributeCode())) {
         $object->setData($this->getAttribute()->getAttributeCode(), Mage::app()->getStore()->getId());
     }
     return $this;
 }
 /**
  * Ajax Create the addressbooks.
  *
  * @param Varien_Data_Form_Element_Abstract $element
  *
  * @return string
  */
 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $url = Mage::helper('adminhtml')->getUrl('*/connector/createnewaddressbook');
     $website = Mage::app()->getRequest()->getParam('website', 0);
     $element->setData('after_element_html', "<script>\n                function createAddressbook(form, element) {\n                    var name       = \$('connector_sync_settings_dynamic_addressbook_addressbook_name').value;\n                    var visibility = \$('connector_sync_settings_dynamic_addressbook_visibility').value;\n                    var reloadurl  = '{$url}';\n                    if(name && visibility){\n                        new Ajax.Request(reloadurl, {\n                            method: 'post',\n                            parameters: {'name' : name, 'visibility' : visibility, 'website': '{$website}'},\n                            onComplete: function(transport) {\n                                window.location.reload();\n                            }\n                        });\n                    }\n                    return false;\n                }\n            </script>");
     return parent::_getElementHtml($element);
 }
Exemplo n.º 17
0
 /**
  * Collect address discount amount
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @return  Mage_SalesRule_Model_Quote_Discount
  */
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     parent::collect($address);
     $quote = $address->getQuote();
     $store = Mage::app()->getStore($quote->getStoreId());
     $this->_calculator->reset($address);
     $items = $this->_getAddressItems($address);
     if (!count($items)) {
         return $this;
     }
     $eventArgs = array('website_id' => $store->getWebsiteId(), 'customer_group_id' => $quote->getCustomerGroupId(), 'coupon_code' => $quote->getCouponCode());
     $this->_calculator->init($store->getWebsiteId(), $quote->getCustomerGroupId(), $quote->getCouponCode());
     $this->_calculator->initTotals($items, $address);
     $address->setDiscountDescription(array());
     $items = $this->_calculator->sortItemsByPriority($items);
     foreach ($items as $item) {
         if ($item->getNoDiscount()) {
             $item->setDiscountAmount(0);
             $item->setBaseDiscountAmount(0);
         } else {
             /**
              * Child item discount we calculate for parent
              */
             if ($item->getParentItemId()) {
                 continue;
             }
             $eventArgs['item'] = $item;
             Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
             if ($item->getHasChildren() && $item->isChildrenCalculated()) {
                 foreach ($item->getChildren() as $child) {
                     $this->_calculator->process($child);
                     $eventArgs['item'] = $child;
                     Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
                     $this->_aggregateItemDiscount($child);
                 }
             } else {
                 $this->_calculator->process($item);
                 $this->_aggregateItemDiscount($item);
             }
         }
     }
     /**
      * process weee amount
      */
     if (Mage::helper('weee')->isEnabled() && Mage::helper('weee')->isDiscounted($store)) {
         $this->_calculator->processWeeeAmount($address, $items);
     }
     /**
      * Process shipping amount discount
      */
     $address->setShippingDiscountAmount(0);
     $address->setBaseShippingDiscountAmount(0);
     if ($address->getShippingAmount()) {
         $this->_calculator->processShippingAmount($address);
         $this->_addAmount(-$address->getShippingDiscountAmount());
         $this->_addBaseAmount(-$address->getBaseShippingDiscountAmount());
     }
     $this->_calculator->prepareDescription($address);
     return $this;
 }
Exemplo n.º 18
0
 public function ajaxAction()
 {
     $idItem = Mage::app()->getRequest()->getParam('idItem');
     Mage::register('current_log', Mage::getModel('amaudit/log')->load($idItem));
     $block = $this->getLayout()->createBlock('amaudit/adminhtml_userlog_edit_tab_view_details');
     $this->getResponse()->setBody($block->toHtml());
 }
Exemplo n.º 19
0
 public function addBlogSection($observer)
 {
     $sitemapObject = $observer->getSitemapObject();
     if (!$sitemapObject instanceof Mage_Sitemap_Model_Sitemap) {
         throw new Exception(Mage::helper('blog')->__('Error during generation sitemap'));
     }
     $storeId = $sitemapObject->getStoreId();
     $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
     $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
     /**
      * Generate blog pages sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/blog/changefreq');
     $priority = (string) Mage::getStoreConfig('sitemap/blog/priority');
     $collection = Mage::getModel('blog/blog')->getCollection()->addStoreFilter($storeId);
     Mage::getSingleton('blog/status')->addEnabledFilterToCollection($collection);
     $route = Mage::getStoreConfig('blog/blog/route');
     if ($route == "") {
         $route = "blog";
     }
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $route . '/' . $item->getIdentifier()), $date, $changefreq, $priority);
         $sitemapObject->sitemapFileAddLine($xml);
     }
     unset($collection);
 }
Exemplo n.º 20
0
 protected function _prepareForm()
 {
     $rule = Mage::registry('current_promo_quote_rule');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('rule_');
     $fieldset = $form->addFieldset('default_label_fieldset', array('legend' => Mage::helper('salesrule')->__('Default Label')));
     $labels = $rule->getStoreLabels();
     $fieldset->addField('store_default_label', 'text', array('name' => 'store_labels[0]', 'required' => false, 'label' => Mage::helper('salesrule')->__('Default Rule Label for All Store Views'), 'value' => isset($labels[0]) ? $labels[0] : ''));
     $fieldset = $form->addFieldset('store_labels_fieldset', array('legend' => Mage::helper('salesrule')->__('Store View Specific Labels'), 'table_class' => 'form-list stores-tree'));
     $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset');
     $fieldset->setRenderer($renderer);
     foreach (Mage::app()->getWebsites() as $website) {
         $fieldset->addField("w_{$website->getId()}_label", 'note', array('label' => $website->getName(), 'fieldset_html_class' => 'website'));
         foreach ($website->getGroups() as $group) {
             $stores = $group->getStores();
             if (count($stores) == 0) {
                 continue;
             }
             $fieldset->addField("sg_{$group->getId()}_label", 'note', array('label' => $group->getName(), 'fieldset_html_class' => 'store-group'));
             foreach ($stores as $store) {
                 $fieldset->addField("s_{$store->getId()}", 'text', array('name' => 'store_labels[' . $store->getId() . ']', 'required' => false, 'label' => $store->getName(), 'value' => isset($labels[$store->getId()]) ? $labels[$store->getId()] : '', 'fieldset_html_class' => 'store'));
             }
         }
     }
     if ($rule->isReadonly()) {
         foreach ($fieldset->getElements() as $element) {
             $element->setReadonly(true, true);
         }
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 21
0
 /**
  * Preparing default form elements for editing attribute
  *
  * @return Mage_Eav_Block_Adminhtml_Attribute_Edit_Main_Abstract
  */
 protected function _prepareForm()
 {
     $attributeObject = $this->getAttributeObject();
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('eav')->__('Attribute Properties')));
     if ($attributeObject->getAttributeId()) {
         $fieldset->addField('attribute_id', 'hidden', array('name' => 'attribute_id'));
     }
     $this->_addElementTypes($fieldset);
     $yesno = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
     $validateClass = sprintf('validate-code validate-length maximum-length-%d', Mage_Eav_Model_Entity_Attribute::ATTRIBUTE_CODE_MAX_LENGTH);
     $fieldset->addField('attribute_code', 'text', array('name' => 'attribute_code', 'label' => Mage::helper('eav')->__('Attribute Code'), 'title' => Mage::helper('eav')->__('Attribute Code'), 'note' => Mage::helper('eav')->__('For internal use. Must be unique with no spaces. Maximum length of attribute code must be less then %s symbols', Mage_Eav_Model_Entity_Attribute::ATTRIBUTE_CODE_MAX_LENGTH), 'class' => $validateClass, 'required' => true));
     $inputTypes = Mage::getModel('eav/adminhtml_system_config_source_inputtype')->toOptionArray();
     $fieldset->addField('frontend_input', 'select', array('name' => 'frontend_input', 'label' => Mage::helper('eav')->__('Catalog Input Type for Store Owner'), 'title' => Mage::helper('eav')->__('Catalog Input Type for Store Owner'), 'value' => 'text', 'values' => $inputTypes));
     $fieldset->addField('default_value_text', 'text', array('name' => 'default_value_text', 'label' => Mage::helper('eav')->__('Default Value'), 'title' => Mage::helper('eav')->__('Default Value'), 'value' => $attributeObject->getDefaultValue()));
     $fieldset->addField('default_value_yesno', 'select', array('name' => 'default_value_yesno', 'label' => Mage::helper('eav')->__('Default Value'), 'title' => Mage::helper('eav')->__('Default Value'), 'values' => $yesno, 'value' => $attributeObject->getDefaultValue()));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('default_value_date', 'date', array('name' => 'default_value_date', 'label' => Mage::helper('eav')->__('Default Value'), 'title' => Mage::helper('eav')->__('Default Value'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'value' => $attributeObject->getDefaultValue(), 'format' => $dateFormatIso));
     $fieldset->addField('default_value_textarea', 'textarea', array('name' => 'default_value_textarea', 'label' => Mage::helper('eav')->__('Default Value'), 'title' => Mage::helper('eav')->__('Default Value'), 'value' => $attributeObject->getDefaultValue()));
     $fieldset->addField('is_unique', 'select', array('name' => 'is_unique', 'label' => Mage::helper('eav')->__('Unique Value'), 'title' => Mage::helper('eav')->__('Unique Value (not shared with other products)'), 'note' => Mage::helper('eav')->__('Not shared with other products'), 'values' => $yesno));
     $fieldset->addField('is_required', 'select', array('name' => 'is_required', 'label' => Mage::helper('eav')->__('Values Required'), 'title' => Mage::helper('eav')->__('Values Required'), 'values' => $yesno));
     $fieldset->addField('frontend_class', 'select', array('name' => 'frontend_class', 'label' => Mage::helper('eav')->__('Input Validation for Store Owner'), 'title' => Mage::helper('eav')->__('Input Validation for Store Owner'), 'values' => Mage::helper('eav')->getFrontendClasses($attributeObject->getEntityType()->getEntityTypeCode())));
     if ($attributeObject->getId()) {
         $form->getElement('attribute_code')->setDisabled(1);
         $form->getElement('frontend_input')->setDisabled(1);
         if (!$attributeObject->getIsUserDefined()) {
             $form->getElement('is_unique')->setDisabled(1);
         }
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
Exemplo n.º 22
0
 /**
  * After Save Attribute manipulation
  *
  * @param Mage_Catalog_Model_Product $object
  * @return Mage_Catalog_Model_Product_Attribute_Backend_Price
  */
 public function afterSave($object)
 {
     $value = $object->getData($this->getAttribute()->getAttributeCode());
     /**
      * Orig value is only for existing objects
      */
     $oridData = $object->getOrigData();
     $origValueExist = $oridData && array_key_exists($this->getAttribute()->getAttributeCode(), $oridData);
     if ($object->getStoreId() != 0 || !$value || $origValueExist) {
         return $this;
     }
     if ($this->getAttribute()->getIsGlobal() == Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE) {
         $baseCurrency = Mage::app()->getBaseCurrencyCode();
         $storeIds = $object->getStoreIds();
         if (is_array($storeIds)) {
             foreach ($storeIds as $storeId) {
                 $storeCurrency = Mage::app()->getStore($storeId)->getBaseCurrencyCode();
                 if ($storeCurrency == $baseCurrency) {
                     continue;
                 }
                 $rate = Mage::getModel('directory/currency')->load($baseCurrency)->getRate($storeCurrency);
                 if (!$rate) {
                     $rate = 1;
                 }
                 $newValue = $value * $rate;
                 $object->addAttributeUpdate($this->getAttribute()->getAttributeCode(), $newValue, $storeId);
             }
         }
     }
     return $this;
 }
Exemplo n.º 23
0
 /**
  * Process the gift rules
  * 
  * @param Mage_Sales_Model_Quote_Address $address
  */
 protected function _processGiftRules($address)
 {
     $quote = $address->getQuote();
     $store = Mage::app()->getStore($quote->getStoreId());
     $validator = Mage::getSingleton('gift/rule_validator')->init($store->getWebsiteId(), $quote->getCustomerGroupId());
     $validator->process($address);
 }
Exemplo n.º 24
0
 protected function _toHtml()
 {
     $storeId = $this->_getStoreId();
     $newurl = Mage::getUrl('rss/catalog/new/store_id/' . $storeId);
     $title = Mage::helper('rss')->__('New Products from %s', Mage::app()->getStore()->getGroup()->getName());
     $lang = Mage::getStoreConfig('general/locale/code');
     $rssObj = Mage::getModel('rss/rss');
     $data = array('title' => $title, 'description' => $title, 'link' => $newurl, 'charset' => 'UTF-8', 'language' => $lang);
     $rssObj->_addHeader($data);
     /*
     oringinal price - getPrice() - inputed in admin
     special price - getSpecialPrice()
     getFinalPrice() - used in shopping cart calculations
     */
     $product = Mage::getModel('catalog/product');
     $todayDate = $product->getResource()->formatDate(time());
     $products = $product->getCollection()->setStoreId($storeId)->addStoreFilter()->addAttributeToFilter('news_from_date', array('date' => true, 'to' => $todayDate))->addAttributeToFilter(array(array('attribute' => 'news_to_date', 'date' => true, 'from' => $todayDate), array('attribute' => 'news_to_date', 'is' => new Zend_Db_Expr('null'))), '', 'left')->addAttributeToSort('news_from_date', 'desc')->addAttributeToSelect(array('name', 'short_description', 'description', 'thumbnail'), 'inner')->addAttributeToSelect(array('price', 'special_price', 'special_from_date', 'special_to_date', 'msrp_enabled', 'msrp_display_actual_price_type', 'msrp'), 'left')->applyFrontendPriceLimitations();
     $products->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
     /*
     using resource iterator to load the data one by one
     instead of loading all at the same time. loading all data at the same time can cause the big memory allocation.
     */
     Mage::getSingleton('core/resource_iterator')->walk($products->getSelect(), array(array($this, 'addNewItemXmlCallback')), array('rssObj' => $rssObj, 'product' => $product));
     return $rssObj->createRssXml();
 }
Exemplo n.º 25
0
 /**
  * event: catalog_product_save_before
  *
  * @param Varien_Event_Observer $observer
  */
 public function handleMultipleQuantitiesPost(Varien_Event_Observer $observer)
 {
     if (!Mage::app()->getRequest()->isPost()) {
         return;
     }
     if (!isset($post['wgmulti_original_use_multiple_qty']) && !isset($post['wgmulti_use_multiple_qty'])) {
         return;
     }
     /** @var Mage_Catalog_Model_Product $product */
     $product = $observer->getProduct();
     $post = Mage::app()->getRequest()->getPost();
     // if multiple quantity was disabled
     if ($post['wgmulti_original_use_multiple_qty'] == 1 && $post['wgmulti_use_multiple_qty'] == 0) {
         Mage::getModel('wgmulti/warehouse_product')->getCollection()->addProductIdFilter($product->getId())->delete();
     }
     // if multiple quantity was enabled
     if ($post['wgmulti_use_multiple_qty'] == 1) {
         $totalQty = 0.0;
         foreach ($post['wgmultiqty'] as $warehouseId => $qty) {
             Mage::getModel('wgmulti/warehouse_product')->getCollection()->addWarehouseIdFilter($warehouseId)->addProductIdFilter($product->getId())->getFirstItem()->setWarehouseId($warehouseId)->setProductId($product->getId())->setQty($qty)->save();
             $totalQty += $qty;
         }
         $product->getStockItem()->setQty($totalQty);
     }
 }
Exemplo n.º 26
0
 public function initForm()
 {
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('_info');
     $model = Mage::registry('current_giftcardaccount');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('enterprise_giftcardaccount')->__('Information')));
     if ($model->getId()) {
         $fieldset->addField('code', 'label', array('name' => 'code', 'label' => Mage::helper('enterprise_giftcardaccount')->__('Gift Card Code'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Gift Card Code')));
         $fieldset->addField('state_text', 'label', array('name' => 'state_text', 'label' => Mage::helper('enterprise_giftcardaccount')->__('Status'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Status')));
     }
     $fieldset->addField('status', 'select', array('label' => Mage::helper('enterprise_giftcardaccount')->__('Active'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Active'), 'name' => 'status', 'required' => true, 'options' => array(Enterprise_GiftCardAccount_Model_Giftcardaccount::STATUS_ENABLED => Mage::helper('enterprise_giftcardaccount')->__('Yes'), Enterprise_GiftCardAccount_Model_Giftcardaccount::STATUS_DISABLED => Mage::helper('enterprise_giftcardaccount')->__('No'))));
     if (!$model->getId()) {
         $model->setData('status', Enterprise_GiftCardAccount_Model_Giftcardaccount::STATUS_ENABLED);
     }
     $fieldset->addField('is_redeemable', 'select', array('label' => Mage::helper('enterprise_giftcardaccount')->__('Redeemable'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Redeemable'), 'name' => 'is_redeemable', 'required' => true, 'options' => array(Enterprise_GiftCardAccount_Model_Giftcardaccount::REDEEMABLE => Mage::helper('enterprise_giftcardaccount')->__('Yes'), Enterprise_GiftCardAccount_Model_Giftcardaccount::NOT_REDEEMABLE => Mage::helper('enterprise_giftcardaccount')->__('No'))));
     if (!$model->getId()) {
         $model->setData('is_redeemable', Enterprise_GiftCardAccount_Model_Giftcardaccount::REDEEMABLE);
     }
     $fieldset->addField('website_id', 'select', array('name' => 'website_id', 'label' => Mage::helper('enterprise_giftcardaccount')->__('Website'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Website'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getWebsiteValuesForForm(true)));
     $fieldset->addType('price', 'Enterprise_GiftCardAccount_Block_Adminhtml_Giftcardaccount_Form_Price');
     $fieldset->addField('balance', 'price', array('label' => Mage::helper('enterprise_giftcardaccount')->__('Balance'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Balance'), 'name' => 'balance', 'class' => 'validate-number', 'required' => true, 'note' => '<div id="balance_currency"></div>'));
     $fieldset->addField('date_expires', 'date', array('name' => 'date_expires', 'label' => Mage::helper('enterprise_giftcardaccount')->__('Expiration Date'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Expiration Date'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)));
     $form->setValues($model->getData());
     $this->setForm($form);
     return $this;
 }
Exemplo n.º 27
0
 /**
  * Prepare product collection
  *
  * @param Mage_Catalog_Model_Resource_Eav_Resource_Product_Collection $collection
  * @return Mage_Catalog_Model_Layer
  */
 public function prepareProductCollection($collection)
 {
     $collection->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addSearchFilter(Mage::helper('catalogsearch')->getQuery()->getQueryText())->setStore(Mage::app()->getStore())->addMinimalPrice()->addFinalPrice()->addTaxPercents()->addStoreFilter()->addUrlRewrite();
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
     Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
     return $this;
 }
Exemplo n.º 28
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('add_review_form', array('legend' => Mage::helper('review')->__('Review Details')));
     $fieldset->addField('product_name', 'note', array('label' => Mage::helper('review')->__('Product'), 'text' => 'product_name'));
     $fieldset->addField('detailed_rating', 'note', array('label' => Mage::helper('review')->__('Product Rating'), 'required' => true, 'text' => '<div id="rating_detail">' . $this->getLayout()->createBlock('adminhtml/review_rating_detailed')->toHtml() . '</div>'));
     $fieldset->addField('status_id', 'select', array('label' => Mage::helper('review')->__('Status'), 'required' => true, 'name' => 'status_id', 'values' => Mage::helper('review')->getReviewStatusesOptionArray()));
     /**
      * Check is single store mode
      */
     if (!Mage::app()->isSingleStoreMode()) {
         $field = $fieldset->addField('select_stores', 'multiselect', array('label' => Mage::helper('review')->__('Visible In'), 'required' => true, 'name' => 'select_stores[]', 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm()));
         $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
         $field->setRenderer($renderer);
     }
     $fieldset->addField('nickname', 'text', array('name' => 'nickname', 'title' => Mage::helper('review')->__('Nickname'), 'label' => Mage::helper('review')->__('Nickname'), 'maxlength' => '50', 'required' => true));
     $fieldset->addField('title', 'text', array('name' => 'title', 'title' => Mage::helper('review')->__('Summary of Review'), 'label' => Mage::helper('review')->__('Summary of Review'), 'maxlength' => '255', 'required' => true));
     $fieldset->addField('detail', 'textarea', array('name' => 'detail', 'title' => Mage::helper('review')->__('Review'), 'label' => Mage::helper('review')->__('Review'), 'style' => 'height: 600px;', 'required' => true));
     $fieldset->addField('product_id', 'hidden', array('name' => 'product_id'));
     /*$gridFieldset = $form->addFieldset('add_review_grid', array('legend' => Mage::helper('review')->__('Please select a product')));
       $gridFieldset->addField('products_grid', 'note', array(
           'text' => $this->getLayout()->createBlock('adminhtml/review_product_grid')->toHtml(),
       ));*/
     $form->setMethod('post');
     $form->setUseContainer(true);
     $form->setId('edit_form');
     $form->setAction($this->getUrl('*/*/post'));
     $this->setForm($form);
 }
Exemplo n.º 29
0
 public function run()
 {
     // prepare
     Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
     // verbose mode?
     $verbose = $this->getArg('verbose');
     $mygassi = $this->getArg('mygassionly');
     $limit = $this->getArg('limit');
     $product = $this->getArg('product');
     if ($limit === false) {
         $limit = 100;
     }
     // check what we're up to
     if ($this->getArg('import')) {
         /** @var $importer Codex_Productimport_Model_Import */
         $importer = Mage::getModel('codex_productimport/import');
         if ($product) {
             $importer->importSingleProduct($product, false);
         } else {
             $importer->importProducts($limit, $mygassi, $verbose);
         }
         // clean image cache
         exec("rm -Rf " . Mage::getBaseDir('media') . '/catalog/product/cache');
     } else {
         if ($this->getArg('dump')) {
             /** @var $importer Codex_Productimport_Model_Import */
             $importer = Mage::getModel('codex_productimport/import');
             $importer->dumpProducts($limit, $mygassi, $verbose, $product);
         } else {
             $this->usageHelp();
         }
     }
 }
Exemplo n.º 30
0
 protected function _generateStoreCss($x0b, $x0d)
 {
     if (!Mage::app()->getStore($x0d)->getIsActive()) {
         return;
     }
     $x11 = '_' . $x0d;
     $x12 = $x0b . $x11 . '.css';
     $x13 = Mage::helper('ultimo/cssgen')->getGeneratedCssDir() . $x12;
     $x14 = Mage::helper('ultimo/cssgen')->getTemplatePath() . $x0b . '.phtml';
     Mage::register('cssgen_store', $x0d);
     try {
         $x15 = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($x14)->toHtml();
         if (empty($x15)) {
             throw new Exception(Mage::helper('ultimo')->__("Template file is empty or doesn't exist: %s", $x14));
         }
         $x16 = new Varien_Io_File();
         $x16->setAllowCreateFolders(true);
         $x16->open(array('path' => Mage::helper('ultimo/cssgen')->getGeneratedCssDir()));
         $x16->streamOpen($x13, 'w+', 0777);
         $x16->streamLock(true);
         $x16->streamWrite($x15);
         $x16->streamUnlock();
         $x16->streamClose();
     } catch (Exception $x17) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ultimo')->__('Failed generating CSS file: %s in %s', $x12, Mage::helper('ultimo/cssgen')->getGeneratedCssDir()) . '<br/>Message: ' . $x17->getMessage());
         Mage::logException($x17);
     }
     Mage::unregister('cssgen_store');
 }