示例#1
0
 /**
  * Prepare the feed file and returns its path
  *
  * @param array $productsData
  * @param int $storeId
  * @return string
  */
 public function prepareFeed(array $productsData, $storeId)
 {
     $mId = $this->getVendorConfig('merchant_id', $storeId);
     if (!$mId) {
         Mage::throwException(Mage::helper('productfeed')->__('Rakuten Seller ID must be set.'));
     }
     $filename = 'rakuten_product_' . Mage::getModel('core/date')->date('Ymd') . '.txt';
     $filepath = $this->getFeedStorageDir() . $filename;
     try {
         $ioAdapter = new Varien_Io_File();
         $ioAdapter->setAllowCreateFolders(true);
         $ioAdapter->createDestinationDir($this->getFeedStorageDir());
         $ioAdapter->cd($this->getFeedStorageDir());
         $ioAdapter->streamOpen($filename);
         $ioAdapter->streamWrite(implode(self::DELIMITER, $this->getHeaders()) . "\n");
         foreach ($productsData as $productId => $row) {
             array_unshift($row, $mId);
             $this->prepareRow($row, $productId);
             $ioAdapter->streamWrite(implode(self::DELIMITER, $row) . "\n");
             // because a CSV enclosure is not supported
         }
         return $filepath;
     } catch (Exception $e) {
         Mage::throwException(Mage::helper('productfeed')->__('Could not write feed file to path: %s, %s', $filepath, $e->getMessage()));
     }
 }
示例#2
0
 /**
  * Create additional xml index file with links to other xml files (if number of them more than 1)
  */
 public function createIndexSitemapFile()
 {
     if (sizeof($this->filenamesForIndexSitemap) > 1) {
         $io = new Varien_Io_File();
         $io->setAllowCreateFolders(true);
         $io->open(array('path' => $this->getPath()));
         $fileToCreate = Mage::helper('ascurl')->insertStringToFilename($this->getSitemapFilename(), '_index');
         if ($io->fileExists($fileToCreate) && !$io->isWriteable($fileToCreate)) {
             Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $fileToCreate, $this->getPath()));
         }
         $io->streamOpen($fileToCreate);
         $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
         $io->streamWrite('<sitemapindex ' . self::URLSET . '>');
         $storeId = $this->getStoreId();
         $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
         $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
         $path = $this->getSitemapPath();
         $fullPath = preg_replace('/(?<=[^:])\\/{2,}/', '/', $baseUrl . $path);
         foreach ($this->filenamesForIndexSitemap as $item) {
             $xml = sprintf('<sitemap><loc>%s</loc><lastmod>%s</lastmod></sitemap>', htmlspecialchars($fullPath . $item), $date);
             $io->streamWrite($xml);
         }
         $io->streamWrite('</sitemapindex>');
         $io->streamClose();
     }
 }
示例#3
0
 /**
  * Generate XML file
  *
  * @return Mage_Sitemap_Model_Sitemap
  */
 public function generateXml()
 {
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $this->getPath()));
     if ($io->fileExists($this->getSitemapFilename()) && !$io->isWriteable($this->getSitemapFilename())) {
         Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $this->getSitemapFilename(), $this->getPath()));
     }
     $io->streamOpen($this->getSitemapFilename());
     $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
     $io->streamWrite('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:content="http://www.google.com/schemas/sitemap-content/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">' . "\n");
     $storeId = $this->getStoreId();
     $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
     $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
     // Hans2103 change -> set mediaUrl
     $mediaUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
     $mediaUrl = preg_replace('/^https/', 'http', $mediaUrl);
     /**
      * Generate categories sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/category/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/category/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/catalog_category')->getCollection($storeId);
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>' . "\n", htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
         $io->streamWrite($xml);
         $this->check_counter($io);
     }
     unset($collection);
     /**
      * Generate products sitemap
      */
     /**
      * override to include images in sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/product/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/product/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/catalog_product')->getCollection($storeId);
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><image:image><image:loc>%s</image:loc><image:title>%s</image:title></image:image><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority><PageMap xmlns="http://www.google.com/schemas/sitemap-pagemap/1.0"><DataObject type="thumbnail"><Attribute name="name" value="%s"/><Attribute name="src" value="%s"/></DataObject></PageMap></url>' . "\n", htmlspecialchars($baseUrl . $item->getUrl()), htmlspecialchars($mediaUrl . 'catalog/product' . $item->getMedia()), htmlspecialchars($item->getName()), $date, $changefreq, $priority, htmlspecialchars($item->getName()), htmlspecialchars($mediaUrl . 'catalog/product' . $item->getMedia()));
         $io->streamWrite($xml);
     }
     unset($collection);
     /**
      * Generate cms pages sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/page/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/page/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/cms_page')->getCollection($storeId);
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>' . "\n", htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
         $io->streamWrite($xml);
     }
     unset($collection);
     $io->streamWrite('</urlset>');
     $io->streamClose();
     $this->setSitemapTime(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
     $this->save();
     return $this;
 }
 public function generateXml()
 {
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $this->getPath()));
     if ($io->fileExists($this->getSitemapFilename()) && !$io->isWriteable($this->getSitemapFilename())) {
         Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $this->getSitemapFilename(), $this->getPath()));
     }
     $io->streamOpen($this->getSitemapFilename());
     $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
     $io->streamWrite('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
     $storeId = $this->getStoreId();
     $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
     $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
     // Generate filterurl sitemap
     $changefreq = (string) Mage::getStoreConfig('sitemap/category/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/category/priority', $storeId);
     /* @var $collection Flagbit_FilterUrls_Model_Resource_Mysql4_Url_Collection */
     $collection = Mage::getModel('filterurls/url')->getCollection();
     $collection->addFieldToFilter('store_id', $storeId);
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $item->getRequestPath()), $date, $changefreq, $priority);
         $io->streamWrite($xml . PHP_EOL);
     }
     $io->streamWrite('</urlset>');
     $io->streamClose();
     $this->setSitemapTime(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
     $this->save();
     return $this;
 }
示例#5
0
 protected function fileCreate()
 {
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $this->getPath()));
     $io->streamOpen($this->getSitemapFilename());
     $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
     $io->streamWrite('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
     $this->_io = $io;
 }
 public function genSitemap($params, $saveMode = NULL)
 {
     $product_collection = Mage::getResourceModel('catalog/product_collection')->addAttributeToSelect('*')->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED))->addAttributeToFilter('price', array('neq' => NULL));
     $base = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
     $filename = $params['filename'];
     $timestamp = "\n<!-- Generated at " . gmdate('Y-m-d\\TH:i:s', time()) . "-->";
     $masterTag = $params['field']['master']['code'];
     $producTag = $params['field']['master']['product']['code'];
     $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
     $xml .= sprintf("\n%s", $timestamp);
     $xml .= sprintf("\n<%s>", $masterTag);
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => Mage::getBaseDir() . '/' . $params['path']));
     $io->streamOpen(Mage::getBaseDir() . "/" . $params['path'] . $filename);
     $io->streamWrite($xml);
     $xml = "";
     foreach ($product_collection as $product) {
         $xml .= sprintf("\n\t<%s>", $producTag);
         foreach ($params['field'] as $fieldType => $field) {
             switch ($fieldType) {
                 case 'default':
                 case 'custom':
                     foreach ($field as $param) {
                         $code = $param['code'];
                         $value = self::splitAndSet($param['value'], $product);
                         $xml .= sprintf("\n\t\t<%s>%s</%s>", $code, $value, $code);
                     }
                     break;
             }
         }
         $xml .= sprintf("\n\t</%s>", $producTag);
         $io->streamWrite($xml);
         $xml = "";
     }
     $xml .= sprintf("\n</%s>", $masterTag);
     $io->streamWrite($xml);
     if ($io->streamClose()) {
         unset($product_collection);
         $configType = self::_getTypeId($params['type']);
         $typeModel = Mage::getModel('sitemaps/type')->load($configType['id']);
         $typeModel->setFields(json_encode($params['field']))->save();
         if (is_null($saveMode)) {
             $sitemaps = Mage::getModel('sitemaps/sitemap')->setFilename($filename)->setPath($params['path'])->setLink(self::_getLink($params['path'], $filename))->setType($configType['id'])->setData('created_at', date('Y-m-d H:i:s'))->setData('updated_at', date('Y-m-d H:i:s'));
         } else {
             if ($saveMode === 'edit') {
                 $sitemaps = Mage::getModel('sitemaps/sitemap')->load($params['sitemap_id'])->setFilename($filename)->setPath($params['path'])->setLink(self::_getLink($params['path'], $filename))->setType($configType['id'])->setData('updated_at', date('Y-m-d H:i:s'));
             }
         }
         if ($sitemaps->save()) {
             return true;
         }
     }
 }
示例#7
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');
 }
示例#8
0
 /**
  * regenerate theme css based on appearance settings
  */
 public function regenerate()
 {
     $websites = Mage::app()->getWebsites();
     foreach ($websites as $_website) {
         $_website_code = $_website->getCode();
         foreach ($_website->getStores() as $_store) {
             if (!Mage::app()->getStore($_store)->getIsActive()) {
                 continue;
             }
             ob_start();
             require $this->_css_template_path;
             $css = ob_get_clean();
             $filename = str_replace(array('%WEBSITE%', '%STORE%'), array($_website_code, $_store->getCode()), $this->_css_file);
             try {
                 $file = new Varien_Io_File();
                 $file->setAllowCreateFolders(true)->open(array('path' => $this->_css_path));
                 $file->streamOpen($filename, 'w+');
                 $file->streamWrite($css);
                 $file->streamClose();
             } catch (Exception $e) {
                 Mage::getSingleton('adminhtml/session')->addError(Mage::helper('athlete')->__('Css generation error: %s', $this->_css_path . $filename) . '<br/>' . $e->getMessage());
                 Mage::logException($e);
             }
         }
     }
 }
示例#9
0
 /**
  * Prepare the feed file and returns its path
  *
  * @param array $productsData
  * @param int $storeId
  * @return string
  */
 public function prepareFeed(array $productsData, $storeId)
 {
     $mId = $this->getVendorConfig('merchant_id', $storeId);
     $company = $this->getVendorConfig('company', $storeId);
     if (!$mId || !$company) {
         Mage::throwException(Mage::helper('productfeed')->__('LinkShare Merchant ID and Company Name must be set.'));
     }
     Varien_Profiler::start('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
     $content = implode(self::DELIMITER, array('HDR', $mId, $company, Mage::getModel('core/date')->date('Y-m-d/H:i:s'))) . self::EOL;
     foreach ($productsData as $row) {
         $content .= $row . self::EOL;
     }
     $filename = $mId . '_nmerchandis' . Mage::getModel('core/date')->date('Ymd') . '.txt';
     $filepath = $this->getFeedStorageDir() . $filename;
     try {
         $ioAdapter = new Varien_Io_File();
         $ioAdapter->setAllowCreateFolders(true);
         $ioAdapter->createDestinationDir($this->getFeedStorageDir());
         $ioAdapter->cd($this->getFeedStorageDir());
         $ioAdapter->streamOpen($filename);
         $ioAdapter->streamWrite($content);
         Varien_Profiler::stop('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
         return $filepath;
     } catch (Exception $e) {
         Varien_Profiler::stop('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
         Mage::throwException(Mage::helper('productfeed')->__('Could not write feed file to path: %s, %s', $filepath, $e->getMessage()));
     }
 }
示例#10
0
 public function generateStoreCss($x0c, $x0e = '')
 {
     $x12 = $x0e ? '_' . $x0e : '';
     $x13 = '_' . $x0c . $x12 . '.css';
     $x14 = $this->_cssDirPath . $x13;
     $x15 = 'infortis/ultimo/css/' . $x0c . '.phtml';
     Mage::register('cssgen_store', $x0e);
     try {
         $x16 = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($x15)->toHtml();
         if (empty($x16)) {
             throw new Exception(Mage::helper('ultimo')->__("Template file is empty or doesn't exist: %s", $x15));
         }
         $x17 = new Varien_Io_File();
         $x17->setAllowCreateFolders(true);
         $x17->open(array('path' => $this->_cssDirPath));
         $x17->streamOpen($x14, 'w+');
         $x17->streamLock(true);
         $x17->streamWrite($x16);
         $x17->streamUnlock();
         $x17->streamClose();
         Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ultimo')->__('CSS file %s has been refreshed', $x13));
     } catch (Exception $x18) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ultimo')->__('Failed refreshing css file %s in %s', $x13, Mage::helper('ultimo')->getGeneratedCssPath()) . '<br/>Message: ' . $x18->getMessage());
         Mage::logException($x18);
     }
     Mage::unregister('cssgen_store');
 }
示例#11
0
 protected function _generateStoreCss($type, $storeCode)
 {
     if (!Mage::app()->getStore($storeCode)->getIsActive()) {
         return false;
     }
     $fileName = $type . '_' . $storeCode . '.css';
     $file = Mage::helper('legenda/config')->getGeneratedCssDir() . $fileName;
     $templateFile = 'smartwave/legenda/css/' . $type . '.phtml';
     Mage::register('legenda_css_generate_store', $storeCode);
     try {
         $tempalte = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($templateFile)->toHtml();
         if (empty($tempalte)) {
             throw new Exception(Mage::helper('legenda')->__("Template file is empty or doesn't exist: %s", $templateFile));
             return false;
         }
         $io = new Varien_Io_File();
         $io->setAllowCreateFolders(true);
         $io->open(array('path' => Mage::helper('legenda/config')->getGeneratedCssDir()));
         $io->streamOpen($file, 'w+');
         $io->streamLock(true);
         $io->streamWrite($tempalte);
         $io->streamUnlock();
         $io->streamClose();
     } catch (Exception $exception) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('legenda')->__('Failed generating CSS file: %s in %s', $fileName, Mage::helper('legenda/config')->getGeneratedCssDir()) . '<br/>Message: ' . $exception->getMessage());
         Mage::logException($exception);
         return false;
     }
     Mage::unregister('legenda_css_generate_store');
     return true;
 }
示例#12
0
 public function massConfigGenAction()
 {
     $configArray = array();
     try {
         $ids = $this->getRequest()->getPost('ids', array());
         foreach ($ids as $id) {
             $model = Mage::getModel("configgen/config")->load($id);
             $configArray[] = $model->getData();
         }
         $output = $this->getLayout()->createBlock('core/template')->setTemplate('proxiblue_configgen.phtml')->setConfigItems($configArray);
         $io = new Varien_Io_File();
         $path = Mage::getBaseDir('var') . DS . 'export' . DS;
         $name = md5(microtime());
         $file = $path . DS . $name . '.php';
         $io->setAllowCreateFolders(true);
         $io->open(array('path' => $path));
         $io->streamOpen($file, 'w+');
         $io->streamLock(true);
         $io->streamWrite($output->toHtml());
         $io->streamUnlock();
         $io->streamClose();
         $this->_prepareDownloadResponse('proxiblue_generated_config.php', array('type' => 'filename', 'value' => $file, 'rm' => true));
         Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Config was generated"));
     } catch (Exception $e) {
         Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
     }
     $this->_redirect('*/*/');
 }
示例#13
0
文件: Adapter.php 项目: mygento/cdn
 public function getFile($downloadName)
 {
     Varien_Profiler::start('cdn_download_file_' . $downloadName);
     $adapter = $this->getAdapter();
     if ($adapter) {
         $fileName = Mage::helper('mycdn')->getRelativeFile($downloadName);
         $image = $adapter->downloadFile($fileName);
         if ($image) {
             $bn = new Zend_Filter_BaseName();
             $image_name = $bn->filter($downloadName);
             $dn = new Zend_Filter_Dir();
             $image_path = $dn->filter($downloadName);
             $file = new Varien_Io_File();
             $file->setAllowCreateFolders(true);
             $file->open(['path' => $image_path]);
             $file->streamOpen($image_name);
             $file->streamLock(true);
             $file->streamWrite($image);
             $file->streamUnlock();
             $file->streamClose();
             Mage::helper('mycdn')->addLog('[DOWNLOADED] File downloaded to ' . $downloadName);
             Varien_Profiler::stop('cdn_download_file_' . $downloadName);
             //saving to cache
             Mage::helper('mycdn')->savePathInCache($fileName, $this->getUrl($fileName));
             return true;
         } else {
             Mage::helper('mycdn')->addLog('[NOT DOWNLOADED] File not downloaded to ' . $downloadName);
         }
     }
     Varien_Profiler::stop('cdn_download_file_' . $downloadName);
     return false;
 }
示例#14
0
 protected function _generateStoreCss($design, $storeCode)
 {
     if (!Mage::app()->getStore($storeCode)->getIsActive()) {
         return;
     }
     $prefix = '_' . $storeCode;
     if ($design == 'layout') {
         $filename = $design . $prefix . '.css';
     } else {
         $filename = $design . $prefix . '.less';
     }
     $filedefault = Mage::helper('dgtyaris/cssgen')->getGeneratedCssDir() . $filename;
     $path = 'dgtthemes/dgtyaris/css/' . $design . '.phtml';
     Mage::register('cssgen_store', $storeCode);
     try {
         $block = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($path)->toHtml();
         if (empty($block)) {
             throw new Exception(Mage::helper('dgtyaris')->__("Template file is empty or doesn't exist: %s", $path));
         }
         $file = new Varien_Io_File();
         $file->setAllowCreateFolders(true);
         $file->open(array('path' => Mage::helper('dgtyaris/cssgen')->getGeneratedCssDir()));
         $file->streamOpen($filedefault, 'w+');
         $file->streamLock(true);
         $file->streamWrite($block);
         $file->streamUnlock();
         $file->streamClose();
     } catch (Exception $gener) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('dgtyaris')->__('Failed generating CSS file: %s in %s', $filename, Mage::helper('dgtyaris/cssgen')->getGeneratedCssDir()) . '<br/>Message: ' . $gener->getMessage());
         Mage::logException($gener);
     }
     Mage::unregister('cssgen_store');
 }
示例#15
0
 protected function generateStoreCss($type, $storeCode)
 {
     if (!Mage::app()->getStore($storeCode)->getIsActive()) {
         return;
     }
     $str1 = '_' . $storeCode;
     $str2 = $type . $str1 . '.css';
     $str3 = Mage::helper('mango/cssconfig')->getCssConfigDir() . $str2;
     $str4 = 'mango/css/' . $type . '.phtml';
     Mage::register('cssgen_store', $storeCode);
     try {
         $block = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($str4)->toHtml();
         if (empty($block)) {
             throw new Exception(Mage::helper('mango')->__("Template file is empty or doesn't exist: %s", $str4));
         }
         $file = new Varien_Io_File();
         $file->setAllowCreateFolders(true);
         $file->open(array('path' => Mage::helper('mango/cssconfig')->getCssConfigDir()));
         $file->streamOpen($str3, 'w+');
         $file->streamLock(true);
         $file->streamWrite($block);
         $file->streamUnlock();
         $file->streamClose();
     } catch (Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('mango')->__('Failed generating CSS file: %s in %s', $str2, Mage::helper('mango/cssconfig')->getCssConfigDir()) . '<br/>Message: ' . $e->getMessage());
         Mage::logException($e);
     }
     Mage::unregister('cssgen_store');
 }
示例#16
0
 /**
  * After any system config is saved
  */
 public function cssgenerate()
 {
     $section = Mage::app()->getRequest()->getParam('section');
     if ($section == 'themeoptions') {
         $store_ids = array();
         if (Mage::app()->getRequest()->getParam('store') && Mage::app()->getRequest()->getParam('website')) {
             $store_ids[] = Mage::getModel("core/store")->load(Mage::app()->getRequest()->getParam('store'))->getStore_id();
         } elseif (Mage::app()->getRequest()->getParam('website')) {
             $store_ids = Mage::getModel('core/website')->load(Mage::app()->getRequest()->getParam('website'))->getstoreIds();
         } else {
             foreach (Mage::app()->getWebsites() as $website) {
                 foreach ($website->getGroups() as $group) {
                     $stores = $group->getStores();
                     foreach ($stores as $store) {
                         $store_ids[] = $store->getId();
                     }
                 }
             }
         }
         foreach ($store_ids as $store_id) {
             $this->setLocation($store_id);
             if (!$this->getConfig('reset_css', $store_id)) {
                 $css = 'h1,h2,h3,h4,h5,h6{';
                 if ($this->getConfig('font_main', $store_id)) {
                     $css .= 'font-family:' . str_replace("+", " ", $this->getConfig('font', $store_id)) . ';font-weight:' . $this->getConfig('font_weight', $store_id) . ';';
                 }
                 $css .= 'color:' . $this->getConfig('title_color', $store_id) . '}';
                 $image_bg = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . 'frontend/' . $this->dir_store . '/images/pattern/' . $this->getConfig('bg_pattern', $store_id) . '.png';
                 $css .= 'body{';
                 if ($this->getConfig('font_content_main', $store_id)) {
                     $css .= 'font-family:' . str_replace("+", " ", $this->getConfig('font_content', $store_id)) . ';font-weight:' . $this->getConfig('font_contentweight', $store_id) . ';background-color:' . $this->getConfig('bg_color', $store_id) . ';';
                 }
                 $css .= 'color:' . $this->getConfig('text_color', $store_id) . ';';
                 if ($this->getConfig('bg_pattern', $store_id)) {
                     $css .= 'background-image:url("' . $image_bg . '")';
                 }
                 $css .= '}';
                 $css .= 'a{color:' . $this->getConfig('link_color', $store_id) . '}';
                 $css .= 'a:hover{color:' . $this->getConfig('link_hover_color', $store_id) . '}';
             } else {
                 $css = '';
             }
             try {
                 $fh = new Varien_Io_File();
                 $fh->setAllowCreateFolders(true);
                 $fh->open(array('path' => $this->dirPath));
                 $fh->streamOpen($this->filePath, 'w+');
                 $fh->streamLock(true);
                 $fh->streamWrite($css);
                 $fh->streamUnlock();
                 $fh->streamClose();
             } catch (Exception $e) {
                 Mage::getSingleton('adminhtml/session')->addError(Mage::helper('themeoptions')->__('Failed creation custom css rules. ' . $e->getMessage()));
             }
         }
     }
 }
示例#17
0
 /**
  * Write closing tag and close stream
  *
  * @param string $type
  */
 protected function _finalizeSitemap($type = self::TYPE_URL)
 {
     if ($this->_fileHandler) {
         $this->_fileHandler->streamWrite(sprintf($this->_tags[$type][self::CLOSE_TAG_KEY], $type));
         $this->_fileHandler->streamClose();
     }
     // Reset all counters
     $this->_lineCount = 0;
     $this->_fileSize = 0;
 }
示例#18
0
 /**
  * Decode uploaded file base64 encoded content
  *
  * @param array $fileInfo
  * @return array
  */
 private function _decodeFile($fileInfo)
 {
     $tmpFileName = $this->_getTmpFilePath();
     $file = new Varien_Io_File();
     $file->open(array('path' => sys_get_temp_dir()));
     $file->streamOpen($tmpFileName);
     $file->streamWrite(base64_decode($fileInfo['base64_content']));
     $file->streamClose();
     return array('name' => $fileInfo['name'], 'type' => isset($fileInfo['type']) ? $fileInfo['type'] : self::DEFAULT_FILE_TYPE, 'tmp_name' => $tmpFileName, 'error' => 0, 'size' => filesize($tmpFileName));
 }
示例#19
0
 /**
  * Generate sitemap XML file - override to dispatch more events
  *
  * @return $this|Mage_Sitemap_Model_Sitemap
  */
 public function generateXml()
 {
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $this->getPath()));
     if ($io->fileExists($this->getSitemapFilename()) && !$io->isWriteable($this->getSitemapFilename())) {
         Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $this->getSitemapFilename(), $this->getPath()));
     }
     $io->streamOpen($this->getSitemapFilename());
     $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
     $io->streamWrite('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
     $storeId = $this->getStoreId();
     $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
     $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
     /**
      * Generate categories sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/category/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/category/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/catalog_category')->getCollection($storeId);
     $categories = new Varien_Object();
     $categories->setItems($collection);
     Mage::dispatchEvent('sitemap_categories_generating_before', array('collection' => $categories));
     foreach ($categories->getItems() as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
         $io->streamWrite($xml);
     }
     unset($collection);
     /**
      * Generate products sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/product/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/product/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/catalog_product')->getCollection($storeId);
     $products = new Varien_Object();
     $products->setItems($collection);
     Mage::dispatchEvent('sitemap_products_generating_before', array('collection' => $products));
     foreach ($products->getItems() as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
         $io->streamWrite($xml);
     }
     unset($collection);
     /**
      * Generate cms pages sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/page/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/page/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/cms_page')->getCollection($storeId);
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
         $io->streamWrite($xml);
     }
     unset($collection);
     $io->streamWrite('</urlset>');
     $io->streamClose();
     $this->setSitemapTime(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
     $this->save();
     return $this;
 }
示例#20
0
 /**
  * Put css data to paths file
  *
  * @param string $cssPath Path of css file
  * @param string $cssFile Name of css file
  * @param string $strCss CSS data
  */
 private function _putCssToPath($cssPath, $cssFile, $strCss)
 {
     try {
         $file = new Varien_Io_File();
         $file->setAllowCreateFolders(true)->open(array('path' => $cssPath));
         $file->streamOpen($cssFile, 'w+');
         $file->streamWrite($strCss);
         $file->streamClose();
     } catch (Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('nwdall')->__('Css generation error: %s', $cssPath . $cssFile) . '<br/>' . $e->getMessage());
         Mage::logException($e);
     }
 }
示例#21
0
 private function _generateCss($store)
 {
     $io = new Varien_Io_File();
     $path = Mage::getBaseDir("skin") . DS . 'frontend' . DS . 'base' . DS . 'default' . DS . 'css' . DS . 'weltpixel' . DS;
     $name = 'color_' . $store->getCode() . '.css';
     $file = $path . DS . $name;
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $path));
     $io->streamOpen($file, 'w+');
     $io->streamLock(true);
     $cssContent = Mage::helper('selector')->getDynamicCssContent($store->getId());
     $io->streamWrite($cssContent);
     $io->close();
 }
示例#22
0
 public function ___generateXml()
 {
     if (!$this->getAllowedSitemap() || !$this->checkUpdate()) {
         return;
     }
     try {
         $this->initCollection();
         $io = new Varien_Io_File();
         $io->setAllowCreateFolders(true);
         $io->open(array('path' => $this->getPathToSiteMap()));
         $io->streamOpen($this->getFileSName());
         $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
         $io->streamWrite('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
         $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
         /**
          * Generate forum pages sitemap
          */
         $changefreq = (string) Mage::getStoreConfig('sitemap/forum/changefreq');
         $priority = (string) Mage::getStoreConfig('sitemap/forum/priority');
         if (!is_array($this->collection)) {
             return;
         }
         foreach ($this->collection as $item) {
             $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($item->getData('url')), $date, $changefreq, $priority);
             $io->streamWrite($xml);
         }
         unset($this->collection);
         $io->streamWrite('</urlset>');
         $io->streamClose();
         $this->___setSitemapTime();
         //$this->save();
     } catch (Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
     }
     return $this;
 }
示例#23
0
 protected function _debugWriteToFile($str)
 {
     if (!$this->_debugIoAdapter) {
         $this->_debugIoAdapter = new Varien_Io_File();
         $dir = $this->_debugIoAdapter->dirname($this->_debugFile);
         $this->_debugIoAdapter->checkAndCreateFolder($dir);
         $this->_debugIoAdapter->open(array('path' => $dir));
         $this->_debugFile = basename($this->_debugFile);
     }
     $this->_debugIoAdapter->streamOpen($this->_debugFile, 'a');
     $this->_debugIoAdapter->streamLock();
     $this->_debugIoAdapter->streamWrite($str);
     $this->_debugIoAdapter->streamUnlock();
     $this->_debugIoAdapter->streamClose();
 }
示例#24
0
 /**
  * Submit refunds back to LinkShare for reimbursement.
  *
  * @param int $storeId
  * @return Grommet_ProductFeed_Model_Vendor_LinkShare_Refund
  */
 public function processDailyRefunds($storeId)
 {
     $rows = array();
     $ordersProcessed = array();
     // add credit memos to the feed
     $creditmemos = $this->_getCreditMemos($storeId);
     if (count($creditmemos)) {
         foreach ($creditmemos as $creditmemo) {
             $rows = array_merge($rows, $this->creditmemoToFeed($creditmemo));
             $ordersProcessed[] = $creditmemo->getOrderId();
         }
     }
     // add cancelations to the feed
     $orders = $this->_getOrders($storeId, $ordersProcessed);
     if (count($orders)) {
         foreach ($orders as $order) {
             $rows = array_merge($rows, $this->orderToFeed($order));
         }
     }
     if (count($rows)) {
         $mId = $this->getVendorConfig('merchant_id', $storeId);
         if (!$mId) {
             Mage::throwException(Mage::helper('productfeed')->__('LinkShare Merchant ID must be set.'));
         }
         $content = '';
         foreach ($rows as $row) {
             $content .= implode(self::DELIMITER, array_values($row)) . self::EOL;
         }
         $filename = $mId . '_trans' . Mage::getModel('core/date')->date('Ymd') . '.txt';
         $filepath = $this->getFeedStorageDir() . $filename;
         try {
             $ioAdapter = new Varien_Io_File();
             $ioAdapter->setAllowCreateFolders(true);
             $ioAdapter->createDestinationDir($this->getFeedStorageDir());
             $ioAdapter->cd($this->getFeedStorageDir());
             $ioAdapter->streamOpen($filename);
             $ioAdapter->streamWrite($content);
         } catch (Exception $e) {
             Mage::throwException(Mage::helper('productfeed')->__('Could not write refund file to path: %s, %s', $filepath, $e->getMessage()));
         }
         $publisher = $this->getPublisher();
         $publisher->publish($filepath, $this->getPublishParams($storeId));
     }
     return $this;
 }
示例#25
0
 /**
  * Prepare the feed file and returns its path
  *
  * @param array $productsData
  * @param int $storeId
  * @return string
  */
 public function prepareFeed(array $productsData, $storeId)
 {
     Varien_Profiler::start('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
     $filename = $this->getVendorCode() . '_' . Mage::getModel('core/date')->date('Ymd') . '.json';
     $filepath = $this->getFeedStorageDir() . $filename;
     try {
         $ioAdapter = new Varien_Io_File();
         $ioAdapter->setAllowCreateFolders(true);
         $ioAdapter->createDestinationDir($this->getFeedStorageDir());
         $ioAdapter->cd($this->getFeedStorageDir());
         $ioAdapter->streamOpen($filename);
         $ioAdapter->streamWrite(json_encode($productsData));
         Varien_Profiler::stop('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
         return $filepath;
     } catch (Exception $e) {
         Varien_Profiler::stop('productfeed_' . $this->getVendorCode() . '::' . __FUNCTION__);
         Mage::throwException(Mage::helper('productfeed')->__('Could not write feed file to path: %s, %s', $filepath, $e->getMessage()));
     }
 }
示例#26
0
 public function generatePathfile($pathfileFilename)
 {
     $directoryPath = self::getLibDir();
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $directoryPath));
     $template = new Zend_Config_Xml($this->getConfigFile('template.xml'));
     $pathfileContent = $template->pathfile->content;
     $pathfileContent = str_replace('{{mediaAtosPath}}', Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'atos' . DS, $pathfileContent);
     $pathfileContent = str_replace('{{certificateAtosPath}}', $directoryPath . 'certif', $pathfileContent);
     $pathfileContent = str_replace('{{parmcomAtosPath}}', $directoryPath . 'parmcom', $pathfileContent);
     $pathfileContent = str_replace('{{pathfileAtosPath}}', $directoryPath . $pathfileFilename, $pathfileContent);
     $io->streamOpen($pathfileFilename);
     $io->streamWrite($pathfileContent);
     $io->streamClose();
     /*
      *
      * Generate parcom file
      *
      */
     $data = explode('.', $pathfileFilename);
     $merchant_id = $data[count($data) - 1];
     $parcomFilename = 'parmcom.' . $merchant_id;
     if (!file_exists($directoryPath . $parcomFilename)) {
         $parcomContent = $template->parcom->content;
         $parcomContent = str_replace('{{autoResponseUrl}}', Mage::getModel('atos/method_standard')->getAutomaticReturnUrl(), $parcomContent);
         $parcomContent = str_replace('{{cancelUrl}}', Mage::getModel('atos/method_standard')->getCancelReturnUrl(), $parcomContent);
         $parcomContent = str_replace('{{returnUrl}}', Mage::getModel('atos/method_standard')->getNormalReturnUrl(), $parcomContent);
         //$parcomContent = str_replace('{{cardList}}', implode(',', Mage::getModel('atos/system_config_source_paymentmeans')->getCCValues()), $parcomContent);
         $parcomContent = str_replace('{{cardList}}', implode(',', Mage::getModel('atos/method_standard')->getPaymentMeans()), $parcomContent);
         $parcomContent = str_replace('{{currency}}', Mage::getModel('atos/config')->getCurrencyCode(Mage::app()->getStore()->getCurrentCurrencyCode()), $parcomContent);
         $parcomContent = str_replace('{{language}}', Mage::getModel('atos/config')->getLanguageCode(), $parcomContent);
         $parcomContent = str_replace('{{merchantCountry}}', Mage::getModel('atos/config')->getMerchantCountry(), $parcomContent);
         $parcomContent = str_replace('{{merchantLanguage}}', Mage::getModel('atos/config')->getLanguageCode(), $parcomContent);
         //$parcomContent = str_replace('{{paymentMeans}}', implode(',2,', Mage::getModel('atos/system_config_source_paymentmeans')->getCCValues()) . ',2', $parcomContent);
         $parcomContent = str_replace('{{paymentMeans}}', implode(',2,', Mage::getModel('atos/method_standard')->getPaymentMeans()) . ',2', $parcomContent);
         $parcomContent = str_replace('{{templateFilename}}', $this->getConfig()->templatefile, $parcomContent);
         $io->streamOpen($parcomFilename);
         $io->streamWrite($parcomContent);
         $io->streamClose();
     }
 }
示例#27
0
文件: Data.php 项目: will-b/CreareSEO
 public function writeFile($file, $post, $field, $robots_location = '')
 {
     $adminsession = Mage::getSingleton('adminhtml/session');
     $io = new Varien_Io_File();
     $io->open(array('path' => Mage::getBaseDir() . DS . $robots_location));
     if ($io->fileExists($file)) {
         if ($io->isWriteable($file)) {
             try {
                 $io->streamOpen($file);
                 $io->streamWrite($post);
             } catch (Mage_Core_Exception $e) {
                 $adminsession->addError($e->getMessage());
             }
         } else {
             $adminsession->addError($file . " is not writable. Change permissions to 644 to use this feature.");
         }
     } else {
         $adminsession->addError($file . " does not exist. The file was not saved.");
     }
     $io->streamClose();
 }
 /**
  * Check file in database storage if needed and place it on file system
  *
  * @param string $filePath
  * @return bool
  */
 protected function _processDatabaseFile($filePath)
 {
     if (!Mage::helper('core/file_storage_database')->checkDbUsage()) {
         return false;
     }
     $relativePath = Mage::helper('core/file_storage_database')->getMediaRelativePath($filePath);
     $file = Mage::getModel('core/file_storage_database')->loadByFilename($relativePath);
     if (!$file->getId()) {
         return false;
     }
     $directory = dirname($filePath);
     @mkdir($directory, 0777, true);
     $io = new Varien_Io_File();
     $io->cd($directory);
     $io->streamOpen($filePath);
     $io->streamLock(true);
     $io->streamWrite($file->getContent());
     $io->streamUnlock();
     $io->streamClose();
     return true;
 }
 public function generateFile()
 {
     $x114 = "preg_split";
     $x115 = "implode";
     $x116 = "str_replace";
     $x117 = "utf8_encode";
     $x118 = "preg_match_all";
     $x119 = "preg_match";
     $x11a = "rtrim";
     $x11b = "is_null";
     $x11c = "count";
     $x11d = "is_numeric";
     $x11e = "explode";
     $x11f = "substr";
     $x120 = "trim";
     $x121 = "strlen";
     $x122 = "htmlentities";
     $x123 = "html_entity_decode";
     $x124 = "preg_replace";
     $x125 = "json_decode";
     $x126 = "is_array";
     $x127 = "stristr";
     $x128 = "print_r";
     $x129 = "is_string";
     $x12a = "ucwords";
     $x12b = "array_push";
     $x12c = "version_compare";
     $x12d = "in_array";
     $x12e = "sprintf";
     $x12f = "array_pop";
     $x130 = "ceil";
     $x131 = "ini_get";
     $x132 = "set_time_limit";
     $x133 = "number_format";
     $x134 = "strip_tags";
     $x135 = "htmlspecialchars";
     $x136 = "strrpos";
     $x137 = "is_bool";
     $x138 = "mb_strtolower";
     $x139 = "mb_strtoupper";
     $x13a = "ftp_connect";
     $x13b = "ftp_login";
     $x13c = "ftp_pasv";
     $x13d = "ftp_put";
     $x13e = "ftp_close";
     ini_set('memory_limit', Mage::getStoreConfig("datafeedmanager/system/memory_limit") . 'M');
     error_reporting(Mage::getStoreConfig("datafeedmanager/system/error_reporting"));
     $this->_debug = isset($_GET['debug']) ? true : false;
     $this->_log = Mage::getStoreConfig("datafeedmanager/system/log_enabled");
     if ($this->_debug) {
         echo "----------------------------------------------<br>------------ DEBUG MODE ----------------<br>----------------------------------------------<br><br>";
         $x128($x66);
     }
     $x67 = $this->_indexPhp;
     $x68 = array("ac" => "activation_code", "ak" => "activation_key", "bu" => "base_url", "md" => "md5", "th" => "this", "dm" => "_demo", "ext" => "dfm", "ver" => "6.5.0");
     $x129(Mage::app()->getRequest()->getParam("store_id")) ? $x69 = Mage::app()->getRequest()->getParam("store_id") : ($x69 = $this->getStoreId());
     $x6a = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
     $x6b = Mage::getDesign()->getSkinUrl();
     $x6c = Mage::getStoreConfig("catalog/placeholder/image_placeholder", $x69);
     $x6d = Mage::getStoreConfig("currency/options/base", $x69);
     $x6e = Mage::getStoreConfig("cataloginventory/item_options/manage_stock", $x69);
     $x6f = Mage::getStoreConfig("cataloginventory/item_options/backorders", $x69);
     $x70 = Mage::app()->getStore($x69)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, false);
     $x71 = Mage::getModel('core/store')->load($x69)->getBaseUrl();
     $x72 = Mage::app()->getStore($x69)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA, false);
     $x73 = Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, $x69);
     $x74 = Mage::app()->getStore($x69)->getRootCategoryId();
     $x75 = array("activation_key" => Mage::getStoreConfig("datafeedmanager/license/activation_key"), "activation_code" => Mage::getStoreConfig("datafeedmanager/license/activation_code"), "base_url" => Mage::getStoreConfig("web/secure/base_url"));
     $x129(Mage::app()->getRequest()->getParam("feed_product")) ? $x76 = Mage::app()->getRequest()->getParam("feed_product") : ($x76 = $this->getFeed_product());
     $x129(Mage::app()->getRequest()->getParam("feed_header")) ? $x63 = Mage::app()->getRequest()->getParam("feed_header") : ($x63 = $this->getFeed_header());
     $x129(Mage::app()->getRequest()->getParam("feed_footer")) ? $x77 = Mage::app()->getRequest()->getParam("feed_footer") : ($x77 = $this->getFeed_footer());
     $x129(Mage::app()->getRequest()->getParam("feed_type")) ? $x78 = Mage::app()->getRequest()->getParam("feed_type") : ($x78 = $this->getFeed_type());
     $x129(Mage::app()->getRequest()->getParam("feed_extraheader")) ? $x79 = Mage::app()->getRequest()->getParam("feed_extraheader") : ($x79 = $this->getFeed_extraheader());
     $x129(Mage::app()->getRequest()->getParam("feed_include_header")) ? $x7a = Mage::app()->getRequest()->getParam("feed_include_header") : ($x7a = $this->getFeed_include_header());
     $x129(Mage::app()->getRequest()->getParam("feed_separator")) ? $x5e = Mage::app()->getRequest()->getParam("feed_separator") : ($x5e = $this->getFeed_separator());
     $x129(Mage::app()->getRequest()->getParam("feed_protector")) ? $x5f = Mage::app()->getRequest()->getParam("feed_protector") : ($x5f = $this->getFeed_protector());
     $x129(Mage::app()->getRequest()->getParam("feed_escape")) ? $x60 = Mage::app()->getRequest()->getParam("feed_escape") : ($x60 = $this->getFeed_escape());
     $x129(Mage::app()->getRequest()->getParam("feed_satus")) ? $x7b = Mage::app()->getRequest()->getParam("feed_satus") : ($x7b = $this->getFeed_status());
     $x129(Mage::app()->getRequest()->getParam("feed_enclose_data")) ? $x7c = Mage::app()->getRequest()->getParam("feed_enclose_data") : ($x7c = $this->getFeed_enclose_data());
     $x129(Mage::app()->getRequest()->getParam("feed_clean_data")) ? $x7d = Mage::app()->getRequest()->getParam("feed_clean_data") : ($x7d = $this->getFeed_clean_data());
     $x129(Mage::app()->getRequest()->getParam("datafeedmanager_categories")) ? $x7e = $x125(Mage::app()->getRequest()->getParam("datafeedmanager_categories")) : ($x7e = $x125($this->getDatafeedmanagerCategories()));
     $x129(Mage::app()->getRequest()->getParam("datafeedmanager_category_filter")) ? $x7f = Mage::app()->getRequest()->getParam("datafeedmanager_category_filter") : ($x7f = $this->getDatafeedmanagerCategoryFilter());
     $x129(Mage::app()->getRequest()->getParam("datafeedmanager_categories")) ? $x66 = Mage::app()->getRequest()->getParam("datafeedmanager_categories") : ($x66 = $this->getDatafeedmanagerCategories());
     $x129(Mage::app()->getRequest()->getParam("feed_encoding")) ? $this->_feed_encoding = Mage::app()->getRequest()->getParam("feed_encoding") : ($this->_feed_encoding = $this->getFeed_encoding());
     $x80 = $this->getFtpEnabled();
     $x81 = $this->getFtpHost();
     $x82 = $this->getFtpLogin();
     $x83 = $this->getFtpPassword();
     $x84 = $this->getFtpDir();
     $x85 = $this->getFtpActive();
     $x86 = array();
     $x87 = array();
     if ($x66 != '*' && $x126($x7e)) {
         foreach ($x7e as $x88) {
             if ($x88->checked) {
                 $x86[] = $x88->line;
             }
         }
         foreach ($x7e as $x88) {
             if ($x88->mapping != "") {
                 $x87[$x88->line] = $x88->mapping;
             }
         }
     }
     if ($x11c($x86) < 1) {
         $x86[] = '*';
     }
     $x129(Mage::app()->getRequest()->getParam("datafeedmanager_type_ids")) ? $x89 = $x11e(',', Mage::app()->getRequest()->getParam("datafeedmanager_type_ids")) : ($x89 = $x11e(',', $this->getDatafeedmanagerTypeIds()));
     $x129(Mage::app()->getRequest()->getParam("datafeedmanager_visibility")) ? $x8a = $x11e(',', Mage::app()->getRequest()->getParam("datafeedmanager_visibility")) : ($x8a = $x11e(',', $this->getDatafeedmanagerVisibility()));
     $x129(Mage::app()->getRequest()->getParam("datafeedmanager_attributes")) ? $x8b = $x125(Mage::app()->getRequest()->getParam("datafeedmanager_attributes")) : ($x8b = $x125($this->getDatafeedmanagerAttributes()));
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> --------------- START PROCESS FOR " . strtoupper($this->getFilename(false)) . "-----------------", null, $this->getFilename('.log'));
     }
     if ($x75[$x68['ac']] != $x68["md"]($x68["md"]($x75[$x68['ak']]) . $x68["md"]($x75[$x68['bu']]) . $x68["md"]($x68["ext"]) . $x68["md"]($x68["ver"]))) {
         ${$x68}["ext"] = "valid";
         ${$x68}["th"]->{$x68}["dm"] = true;
     } else {
         ${$x68}["th"]->{$x68}["dm"] = false;
         ${$x68}["ext"] = "valid";
     }
     if (!$x7b && !$this->_display) {
         Mage::throwException(Mage::helper("datafeedmanager")->__("The data feed configuration must be enabled in order to generate a file."));
     }
     $x43 = new Varien_Io_File();
     $x43->setAllowCreateFolders(true);
     if (!$this->_display) {
         $x43->open(array('path' => $this->getPath()));
         if ($x43->fileExists($this->getFilename()) && !$x43->isWriteable($this->getFilename())) {
             Mage::throwException(Mage::helper('datafeedmanager')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $this->getFilename(), $this->getPath()));
         }
         $x43->streamOpen($this->getFilename());
         if ($this->_log) {
             Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " . $this->getFilename() . " created and opened", null, $this->getFilename('.log'));
         }
     }
     if (!isset(${$x68}["ext"]) || ${$x68}["th"]->{$x68}["dm"]) {
         ${$x68}["th"]->{$x68}["dm"] = true;
         return ${$x68}["th"];
     }
     $x8c = '';
     $x8d = '';
     header("Content-Type: text/html; charset=utf-8");
     $x3f = '/{([a-zA-Z_0-9:]+)(\\sparent|\\sgrouped|\\sconfigurable|\\sbundle)?([^}]*)}/';
     $x118($x3f, $x76, $x40);
     $x40[0][] = "{categories,[1],[1],[1]}";
     $x40[1][] = "categories";
     $x40[2][] = "";
     $x40[3][] = ",[1],[1],[1]";
     $x8e = array();
     $x8f = array();
     foreach ($x40[1] as $x41 => $x90) {
         $x8e[$x41]['methodName'] = "get" . $x116(' ', '', $x12a($x120($x90)) . '()');
         $x8e[$x41]['pattern'] = "{" . $x120($x90) . "}";
         $x8e[$x41]['fullpattern'] = $x40[0][$x41];
         $x8e[$x41]['name'] = $x120($x90);
         $x8e[$x41]['reference'] = $x120($x40[2][$x41]);
         if (empty($x8e[$x41]['reference'])) {
             $x8e[$x41]['reference'] = 'self';
         }
         switch ($x8e[$x41]['name']) {
             case 'url':
                 $x12b($x8f, 'url_key');
                 break;
             case 'uri':
                 $x12b($x8f, 'url_key');
                 break;
             case 'G:IMAGE_LINK':
                 $x12b($x8f, 'image');
                 $x12b($x8f, 'small_image');
                 $x12b($x8f, 'thumbnail');
                 break;
             case 'SC:IMAGES':
                 $x12b($x8f, 'image');
                 $x12b($x8f, 'small_image');
                 $x12b($x8f, 'thumbnail');
                 break;
             case 'SC:DESCRIPTION':
                 $x12b($x8f, 'description');
                 $x12b($x8f, 'short_description');
                 $x12b($x8f, 'manufacturer');
                 $x12b($x8f, 'name');
                 $x12b($x8f, 'sku');
                 break;
             case 'SC:EAN':
                 $x12b($x8f, 'ean');
                 break;
             case 'SC:URL':
                 $x12b($x8f, 'url_key');
                 $x12b($x8f, 'url');
                 break;
             case 'sc:images':
                 $x12b($x8f, 'image');
                 $x12b($x8f, 'small_image');
                 $x12b($x8f, 'thumbnail');
                 break;
             case 'sc:description':
                 $x12b($x8f, 'description');
                 $x12b($x8f, 'short_description');
                 $x12b($x8f, 'manufacturer');
                 $x12b($x8f, 'name');
                 $x12b($x8f, 'sku');
                 break;
             case 'sc:ean':
                 $x12b($x8f, 'ean');
                 break;
             case 'sc:url':
                 $x12b($x8f, 'url_key');
                 $x12b($x8f, 'url');
                 break;
             default:
                 $x12b($x8f, $x8e[$x41]['name']);
         }
         include Mage::getBaseDir() . "/app/code/local/Wyomind/Datafeedmanager/myRequiredAttributes.php";
         $x8e[$x41]["value"] = '$product->get' . $x8e[$x41]['name'] . "()";
         $x8e[$x41]["getText"] = 'getAttributeText(\'' . $x120($x90) . '\')';
         $x91 = '/\\[([^\\]]+)\\]/';
         $x118($x91, $x40[3][$x41], $x92);
         $x8e[$x41]["options"] = $x92[1];
     }
     if ($this->_debug) {
         echo "<br><br>------------ ATTRIBUTES REQUIRED ----------------<br>";
         $x128($x8e);
     }
     $x93 = Mage::getModel('catalog/category')->getCollection()->setStoreId($x69)->addAttributeToSelect('name')->addAttributeToSelect('is_active')->addAttributeToSelect('include_in_menu');
     $x66 = array();
     foreach ($x93 as $x94) {
         $x66[$x94->getId()]['name'] = $x94->getName();
         $x66[$x94->getId()]['path'] = $x94->getPath();
         $x66[$x94->getId()]['level'] = $x94->getLevel();
         if ($x12c(Mage::getVersion(), '1.6.0', '<') || Mage::getStoreConfig("datafeedmanager/system/include_in_menu")) {
             $x66[$x94->getId()]['include_in_menu'] = true;
         } else {
             $x66[$x94->getId()]['include_in_menu'] = $x94->getIncludeInMenu();
         }
     }
     if ($this->_debug) {
         echo "<br><br>------------ CATEGORIES ----------------<br>";
         $x128($x66);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Product template analyzed", null, $this->getFilename('.log'));
     }
     $x95 = Mage::getSingleton('core/resource');
     $x96 = $x95->getConnection('core_read');
     $x97 = $x95->getTableName('eav_entity_type');
     $x98 = $x96->select()->from($x97)->where('entity_type_code=\'catalog_product\'');
     $x5a = $x96->fetchAll($x98);
     $x99 = $x5a[0]['entity_type_id'];
     $x95 = Mage::getSingleton('core/resource');
     $x96 = $x95->getConnection('core_read');
     $x9a = $x95->getTableName('directory_currency_rate');
     $x98 = $x96->select()->from($x9a)->where('currency_from=\'' . $x6d . '\'');
     $x49 = $x96->fetchAll($x98);
     $x9b = array();
     foreach ($x49 as $x48) {
         $x9b[$x48['currency_to']] = $x48['rate'];
     }
     $this->_currencies = $x9b;
     if ($this->_debug) {
         echo "<br><br>------------ CURRENCIES ----------------<br>";
         $x128($x9b);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Currencies rate collected", null, $this->getFilename('.log'));
     }
     $x9c = Mage::getResourceModel('eav/entity_attribute_collection')->setEntityTypeFilter($x99)->addSetInfo()->getData();
     $x9d = array();
     $x9e = array();
     foreach ($x9c as $x41 => $x90) {
         if ($x12d($x90['attribute_code'], $x8f)) {
             $x12b($x9d, $x90['attribute_code']);
             $x9e[$x90['attribute_code']] = $x90['frontend_input'];
         }
     }
     if (!$x12d('special_price', $x9d)) {
         $x9d[] = 'special_price';
     }
     if (!$x12d('special_from_date', $x9d)) {
         $x9d[] = 'special_from_date';
     }
     if (!$x12d('special_to_date', $x9d)) {
         $x9d[] = 'special_to_date';
     }
     if (!$x12d('price_type', $x9d)) {
         $x9d[] = 'price_type';
     }
     if (!$x12d('price', $x9d)) {
         $x9d[] = 'price';
     }
     $x9d[] = 'tax_class_id';
     foreach ($x8b as $x9f) {
         if (!$x12d($x9f->code, $x9d) && $x9f->checked) {
             $x9d[] = $x9f->code;
         }
     }
     if ($this->_debug) {
         echo "<br><br>------------ ATTRIBUTES ----------------<br>";
         $x128($x9d);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> List of required attributes collected", null, $this->getFilename('.log'));
     }
     $x95 = Mage::getSingleton('core/resource');
     $x96 = $x95->getConnection('core_read');
     $xa0 = $x95->getTableName('eav_attribute_option_value');
     $x98 = $x96->select();
     $x98->from($xa0);
     $x98->where("store_id=" . $x69 . ' OR store_id=0');
     $x98->order(array('option_id', 'store_id'));
     $xa1 = $x96->fetchAll($x98);
     foreach ($xa1 as $xa2) {
         $xa3[$xa2['option_id']][$xa2['store_id']] = $xa2['value'];
     }
     if ($this->_debug) {
         echo "<br><br>------------ ATTRIBUTES LABEL ----------------<br>";
         $x128($xa3);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> List of attribute labels collected", null, $this->getFilename('.log'));
     }
     $xa4 = $x95->getTableName('tax_class');
     $xa5 = $x95->getTableName('tax_calculation');
     $xa6 = $x95->getTableName('tax_calculation_rate');
     $xa7 = $x95->getTableName('directory_country_region');
     $x98 = $x96->select();
     $x98->from($xa4)->order(array('class_id', 'tax_calculation_rate_id'));
     $x98->joinleft(array('tc' => $xa5), 'tc.product_tax_class_id = ' . $xa4 . '.class_id', 'tc.tax_calculation_rate_id');
     $x98->joinleft(array('tcr' => $xa6), 'tcr.tax_calculation_rate_id = tc.tax_calculation_rate_id', array('tcr.rate', 'tax_country_id', 'tax_region_id'));
     $x98->joinleft(array('dcr' => $xa7), 'dcr.region_id=tcr.tax_region_id', 'code');
     $xa8 = $x96->fetchAll($x98);
     $x4d = array();
     $x45 = '';
     foreach ($xa8 as $xa9) {
         if ($x45 != $xa9['class_id']) {
             $xaa = 0;
         } else {
             $xaa++;
         }
         $x45 = $xa9['class_id'];
         $x4d[$xa9['class_id']][$xaa]['rate'] = $xa9['rate'];
         $x4d[$xa9['class_id']][$xaa]['code'] = $xa9['code'];
         $x4d[$xa9['class_id']][$xaa]['country'] = $xa9['tax_country_id'];
     }
     $this->_rates = $x4d;
     if ($this->_debug) {
         echo "<br><br>------------ TAX CLASS ----------------<br>";
         $x128($x4d);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Tax rate collected", null, $this->getFilename('.log'));
     }
     $xab = $x95->getTableName('review');
     $xac = $x95->getTableName('review_store');
     $xad = $x95->getTableName('rating_option_vote');
     $xae = $x96->select()->distinct('review_id');
     $xae->from(array("r" => $xab), array("COUNT(DISTINCT r.review_id) AS count", 'entity_pk_value'));
     $xae->joinleft(array('rs' => $xac), 'rs.review_id=r.review_id', 'rs.store_id');
     $xae->joinleft(array('rov' => $xad), 'rov.review_id=r.review_id', 'AVG(rov.percent) AS score');
     $xae->where("status_id=1 and entity_id=1");
     $xae->group(array('r.entity_pk_value', 'rs.store_id'));
     $xaf = $x96->select();
     $xaf->from(array("r" => $xab), array("COUNT(DISTINCT r.review_id) AS count", 'entity_pk_value', "(SELECT 0) AS  store_id"));
     $xaf->joinleft(array('rs' => $xac), 'rs.review_id=r.review_id', array());
     $xaf->joinleft(array('rov' => $xad), 'rov.review_id=r.review_id', 'AVG(rov.percent) AS score');
     $xaf->where("status_id=1 and entity_id=1");
     $xaf->group(array('r.entity_pk_value'));
     $x98 = $x96->select()->union(array($xae, $xaf));
     $x98->order(array('entity_pk_value', 'store_id'));
     $xb0 = $x96->fetchAll($x98);
     $xb1 = array();
     foreach ($xb0 as $xb2) {
         $xb1[$xb2['entity_pk_value']][$xb2['store_id']]["count"] = $xb2["count"];
         $xb1[$xb2['entity_pk_value']][$xb2['store_id']]['score'] = $xb2['score'];
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Reviews collected", null, $this->getFilename('.log'));
     }
     $x95 = Mage::getSingleton('core/resource');
     $x96 = $x95->getConnection('core_read');
     $xb3 = $x95->getTableName('catalog_product_entity_media_gallery');
     $xb4 = $x95->getTableName('catalog_product_entity_media_gallery_value');
     $x98 = $x96->select();
     $x98->from($xb3);
     $x98->joinleft(array('cpemgv' => $xb4), 'cpemgv.value_id = ' . $xb3 . '.value_id', array('cpemgv.position', 'cpemgv.disabled'));
     $x98->where("value<>TRIM('') AND (store_id=" . $x69 . ' OR store_id=0)');
     $x98->order(array('position', 'value_id'));
     $xb5 = $x96->fetchAll($x98);
     foreach ($xb5 as $xb6) {
         if ($xb6['disabled'] != 1 && $xb6['value'] != '') {
             $xb7[$xb6['entity_id']]['src'][] = $xb6['value'];
             $xb7[$xb6['entity_id']]['disabled'][] = $xb6['disabled'];
         }
     }
     if ($this->_debug) {
         echo "<br><br>------------ IMAGES ----------------<br>";
         $x128($xb7);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Images collected", null, $this->getFilename('.log'));
     }
     $xb8 = $x95->getTableName("cataloginventory_stock_item");
     $xb9 = $x95->getTableName("core_url_rewrite");
     $x9a = $x95->getTableName('catalog_category_product');
     $xba = $x95->getTableName('catalog_category_product_index');
     $xbb = $x95->getTableName('catalog_product_index_price');
     $xbc = $x95->getTableName('catalog_product_super_link');
     $xbd = $x95->getTableName('catalog_product_link');
     $xbe = $x95->getTableName('catalog_product_bundle_selection');
     $x12c(Mage::getVersion(), '1.6.0', '<') ? $x92 = "options=''" : ($x92 = "ISNULL(options)");
     $xbf = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x69);
     if (Mage::getStoreConfig("datafeedmanager/system/disabled")) {
         $xbf->addFieldToFilter("status", array('gteq' => 1));
     } else {
         $xbf->addFieldToFilter("status", 1);
     }
     $xbf->addAttributeToFilter('type_id', array("in" => "configurable"));
     $xbf->addAttributeToFilter('visibility', array("nin" => 1));
     $xbf->addAttributeToSelect($x9d);
     $xbf->getSelect()->joinLeft($xbc . ' AS cpsl', 'cpsl.parent_id=e.entity_id ', array('child_ids' => 'GROUP_CONCAT( DISTINCT cpsl.product_id)'));
     $xbf->getSelect()->joinLeft($xb8 . ' AS stock', 'stock.product_id=e.entity_id', array('qty' => 'qty', 'is_in_stock' => 'is_in_stock', 'manage_stock' => 'manage_stock', 'use_config_manage_stock' => 'use_config_manage_stock'));
     if (Mage::getStoreConfig("datafeedmanager/system/urlrewrite")) {
         $xbf->getSelect()->joinLeft($xb9 . ' AS url', 'url.product_id=e.entity_id AND url.target_path NOT LIKE "%category%" AND is_system=1 AND ' . $x92 . ' AND url.store_id=' . $x69, array('request_path' => 'request_path'));
     }
     $xbf->getSelect()->joinLeft($x9a . ' AS categories', 'categories.product_id=e.entity_id');
     $xbf->getSelect()->joinLeft($xba . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x69, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     $xbf->getSelect()->group(array('cpsl.parent_id'));
     $xc0 = array();
     foreach ($xbf as $xc1) {
         foreach ($x11e(",", $xc1->getChildIds()) as $xc2) {
             $xc0[$xc2] = $xc1;
             $xc3[$xc2]['categories_ids'] = $xc1->getCategories_ids();
             $xc3[$xc2]['parent_id'] = $xc1->getId();
             $xc3[$xc2]['parent_sku'] = $xc1->getSku();
             $xc3[$xc2]['parent_request_path'] = $xc1->getRequestPath();
         }
     }
     $this->configurable = $xc0;
     if ($this->_debug) {
         echo "<br><br>------------ CONFIGURABLES ----------------<br>";
         echo $xbf->getSelect() . '<br><br>';
         $x128($xc3);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Relations with configurable products detected", null, $this->getFilename('.log'));
     }
     $xbf = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x69);
     if (Mage::getStoreConfig("datafeedmanager/system/disabled")) {
         $xbf->addFieldToFilter("status", array('gteq' => 1));
     } else {
         $xbf->addFieldToFilter("status", 1);
     }
     $xbf->addAttributeToFilter('type_id', array("in" => "configurable"));
     $xbf->addAttributeToFilter('visibility', array("nin" => 1));
     $xbf->getSelect()->joinLeft($xbc . ' AS cpsl', 'cpsl.parent_id=e.entity_id ');
     $xbf->getSelect()->joinLeft($xb8 . ' AS stock', 'stock.product_id=cpsl.product_id', array('qty' => 'SUM(qty)'));
     $xbf->getSelect()->group(array('cpsl.parent_id'));
     $xc4 = array();
     foreach ($xbf as $xc5) {
         $xc4[$xc5->getId()] = $xc5->getQty();
     }
     $this->configurableQty = $xc4;
     if ($this->_debug) {
         echo "<br><br>------------ CONFIGURABLES QTY ----------------<br>";
         echo $xbf->getSelect() . '<br><br>';
         $x128($xc4);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Qty for configurable products calculated", null, $this->getFilename('.log'));
     }
     $xbf = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x69);
     if (Mage::getStoreConfig("datafeedmanager/system/disabled")) {
         $xbf->addFieldToFilter("status", array('gteq' => 1));
     } else {
         $xbf->addFieldToFilter("status", 1);
     }
     $xbf->addAttributeToFilter('type_id', array("in" => "grouped"));
     $xbf->addAttributeToFilter('visibility', array("nin" => 1));
     $xbf->addAttributeToSelect($x9d);
     $xbf->getSelect()->joinLeft($xbd . ' AS cpl', 'cpl.product_id=e.entity_id AND cpl.link_type_id=3', array('child_ids' => 'GROUP_CONCAT( DISTINCT cpl.linked_product_id)'));
     $xbf->getSelect()->joinLeft($xb8 . ' AS stock', 'stock.product_id=e.entity_id', array('qty' => 'qty', 'is_in_stock' => 'is_in_stock', 'manage_stock' => 'manage_stock', 'use_config_manage_stock' => 'use_config_manage_stock'));
     if (Mage::getStoreConfig("datafeedmanager/system/urlrewrite")) {
         $xbf->getSelect()->joinLeft($xb9 . ' AS url', 'url.product_id=e.entity_id AND url.target_path NOT LIKE "%category%" AND is_system=1 AND ' . $x92 . ' AND url.store_id=' . $x69, array('request_path' => 'request_path'));
     }
     $xbf->getSelect()->joinLeft($x9a . ' AS categories', 'categories.product_id=e.entity_id');
     $xbf->getSelect()->joinLeft($xba . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x69, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     $xbf->getSelect()->group(array('cpl.product_id'));
     $xc6 = array();
     foreach ($xbf as $xc1) {
         foreach ($x11e(",", $xc1->getChildIds()) as $xc2) {
             $xc6[$xc2] = $xc1;
             $xc7[$xc2]['categories_ids'] = $xc1->getCategories_ids();
             $xc7[$xc2]['parent_id'] = $xc1->getId();
             $xc7[$xc2]['parent_sku'] = $xc1->getSku();
             $xc7[$xc2]['parent_request_path'] = $xc1->getRequestPath();
         }
     }
     $this->grouped = $xc6;
     if ($this->_debug) {
         echo "<br><br>------------ GROUPED ----------------<br>";
         echo $xbf->getSelect() . '<br><br>';
         $x128($xc7);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Relations with grouped products detected", null, $this->getFilename('.log'));
     }
     $xbf = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x69);
     if (Mage::getStoreConfig("datafeedmanager/system/disabled")) {
         $xbf->addFieldToFilter("status", array('gteq' => 1));
     } else {
         $xbf->addFieldToFilter("status", 1);
     }
     $xbf->addAttributeToFilter('type_id', array("in" => "bundle"));
     $xbf->addAttributeToFilter('visibility', array("nin" => 1));
     $xbf->addAttributeToSelect($x9d);
     $xbf->getSelect()->joinLeft($xbe . ' AS cpbs', 'cpbs.parent_product_id=e.entity_id', array('child_ids' => 'GROUP_CONCAT( DISTINCT cpbs.product_id)'));
     $xbf->getSelect()->joinLeft($xb8 . ' AS stock', 'stock.product_id=e.entity_id', array('qty' => 'qty', 'is_in_stock' => 'is_in_stock', 'manage_stock' => 'manage_stock', 'use_config_manage_stock' => 'use_config_manage_stock'));
     if (Mage::getStoreConfig("datafeedmanager/system/urlrewrite")) {
         $xbf->getSelect()->joinLeft($xb9 . ' AS url', 'url.product_id=e.entity_id AND url.target_path NOT LIKE "%category%" AND is_system=1 AND ' . $x92 . ' AND url.store_id=' . $x69, array('request_path' => 'request_path'));
     }
     $xbf->getSelect()->joinLeft($x9a . ' AS categories', 'categories.product_id=e.entity_id');
     $xbf->getSelect()->joinLeft($xba . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x69, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     $xbf->getSelect()->group(array('e.entity_id'));
     $xc8 = array();
     foreach ($xbf as $xc1) {
         foreach ($x11e(",", $xc1->getChildIds()) as $xc2) {
             $xc8[$xc2] = $xc1;
             $xc9[$xc2]['parent_id'] = $xc1->getId();
             $xc9[$xc2]['parent_sku'] = $xc1->getSku();
             $xc9[$xc2]['parent_request_path'] = $xc1->getRequestPath();
             $xc9[$xc2]['categories_ids'] = $xc1->getCategories_ids();
         }
     }
     $this->bundle = $xc8;
     if ($this->_debug) {
         echo "<br><br>------------ BUNDLE ----------------<br>";
         echo $xbf->getSelect() . '<br><br>';
         $x128($xc9);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Relations with bundle products detected", null, $this->getFilename('.log'));
     }
     $xca = $x95->getTableName("catalog_product_option");
     $xcb = $x95->getTableName("catalog_product_option_title");
     $xcc = $x95->getTableName("catalog_product_option_type_value");
     $xcd = $x95->getTableName("catalog_product_option_type_title");
     $xce = $x95->getTableName("catalog_product_option_type_price");
     $xcf = $x96->select();
     $xcf->from(array("cpo" => $xca), array("product_id"));
     $xcf->joinleft(array("cpot" => $xcb), "cpot.option_id=cpo.option_id AND cpot.store_id=0", array("option" => "title", "option_id", "store_id"));
     $xcf->joinleft(array("cpotv" => $xcc), "cpotv.option_id = cpo.option_id", "sku");
     $xcf->joinleft(array("cpott" => $xcd), "cpott.option_type_id=cpotv.option_type_id AND cpott.store_id=cpot.store_id", "title AS value");
     $xcf->joinleft(array("cpotp" => $xce), "cpotp.option_type_id=cpotv.option_type_id AND cpotp.store_id=cpot.store_id", array("price", "price_type"));
     $x98 = $xcf->order(array("product_id", "cpotv.sort_order ASC"));
     $xb0 = $x96->fetchAll($x98);
     $xd0 = array();
     $xd1 = 0;
     foreach ($xb0 as $xd2) {
         $xd0[$xd2["product_id"]][$xd2["option"]]["options"][] = array("value" => $xd2["value"], "sku" => $xd2["sku"], "price" => $xd2["price"], "price_type" => $xd2["price_type"]);
         $xd1++;
     }
     $this->customOptions = $xd0;
     if ($this->_debug) {
         echo "<br><br>------------ CUSTOM OPTIONS ----------------<br>";
         echo $xcf . '<br><br>';
         $x128($xd0);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Custom options collected", null, $this->getFilename('.log'));
     }
     $xd3 = new Wyomind_Datafeedmanager_Model_MyCustomOptions();
     $xd4 = new Wyomind_Datafeedmanager_Model_MyCustomAttributes();
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Custom attributes/options scripts loaded", null, $this->getFilename('.log'));
     }
     $xbf = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x69);
     if (Mage::getStoreConfig("datafeedmanager/system/disabled")) {
         $xbf->addFieldToFilter("status", array('gteq' => 1));
     } else {
         $xbf->addFieldToFilter("status", 1);
     }
     $xbf->addAttributeToFilter("type_id", array("in" => $x89));
     $xbf->addAttributeToFilter("visibility", array("in" => $x8a));
     $xbf->addAttributeToSelect($x9d);
     $xd5 = array("eq" => "= '%s'", "neq" => "!= '%s'", "gteq" => ">= '%s'", "lteq" => "<= '%s'", "gt" => "> '%s'", "lt" => "< '%s'", "like" => "like '%s'", "nlike" => "not like '%s'", "null" => "is null", "notnull" => "is not null", "in" => "in (%s)", "nin" => "not in(%s)");
     $xd6 = '';
     $x55 = 0;
     foreach ($x8b as $x9f) {
         if ($x9f->checked) {
             if ($x9f->condition == 'in' || $x9f->condition == 'nin') {
                 if ($x9f->code == 'qty' || $x9f->code == 'is_in_stock') {
                     $xd7 = $x11e(',', $x9f->value);
                     $x9f->value = "'" . $x115($xd7, "','") . "'";
                 } else {
                     $x9f->value = $x11e(',', $x9f->value);
                 }
             }
             switch ($x9f->code) {
                 case 'qty':
                     if ($x55 > 0) {
                         $xd6 .= ' AND ';
                     }
                     $xd6 .= " qty " . $x12e($xd5[$x9f->condition], $x9f->value);
                     $x55++;
                     break;
                 case 'is_in_stock':
                     if ($x55 > 0) {
                         $xd6 .= ' AND ';
                     }
                     $xd6 .= " (is_in_stock " . $x12e($xd5[$x9f->condition], $x9f->value);
                     $xd6 .= " OR ( manage_stock " . $x12e($xd5[$x9f->condition], (int) (!$x9f->value));
                     $xd6 .= " AND use_config_manage_stock " . $x12e($xd5[$x9f->condition], (int) (!$x9f->value)) . ')';
                     $xd6 .= " OR (use_config_manage_stock " . $x12e($xd5[$x9f->condition], $x9f->value) . ' AND ' . $x6e . '=' . (int) $x9f->value . ' AND is_in_stock = ' . $x9f->value . ' )';
                     $xd6 .= ")";
                     $x55++;
                     break;
                 default:
                     $xbf->addFieldToFilter($x9f->code, array($x9f->condition => $x9f->value));
                     break;
             }
         }
     }
     $xbf->getSelect()->joinLeft($xb8 . ' AS stock', 'stock.product_id=e.entity_id', array('qty' => 'qty', 'is_in_stock' => 'is_in_stock', 'manage_stock' => 'manage_stock', 'use_config_manage_stock' => 'use_config_manage_stock'));
     if (Mage::getStoreConfig("datafeedmanager/system/urlrewrite")) {
         $xbf->getSelect()->joinLeft($xb9 . ' AS url', 'url.product_id=e.entity_id AND url.target_path NOT LIKE "%category%" AND is_system=1 AND ' . $x92 . ' AND url.store_id=' . $x69, array('request_path' => 'request_path'));
     }
     $xbf->getSelect()->joinLeft($x9a . ' AS categories', 'categories.product_id=e.entity_id');
     if ($x86[0] != '*') {
         $x5d = 0;
         $xd8 = null;
         foreach ($x86 as $x88) {
             if ($x5d > 0) {
                 $xd8 .= ',';
             }
             $xd8 .= $x12f($x11e('/', $x88));
             $x5d++;
         }
         $x7f ? $xd9 = "IN" : ($xd9 = "NOT IN");
         $xd8 = "AND categories_index.category_id " . $xd9 . " (" . $xd8 . ")";
         $xbf->getSelect()->joinInner($xba . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x69 . ' ' . $xd8, array('categories_ids' => 'GROUP_CONCAT(categories_index.category_id)'));
     } else {
         $xbf->getSelect()->joinLeft($xba . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x69, array('categories_ids' => 'GROUP_CONCAT(categories_index.category_id)'));
     }
     if ($x12c(Mage::getVersion(), '1.4.0', '>=')) {
         $xbf->getSelect()->joinLeft($xbb . ' AS price_index', 'price_index.entity_id=e.entity_id AND customer_group_id=0 AND price_index.website_id=' . Mage::getModel('core/store')->load($x69)->getWebsiteId(), array('min_price' => 'min_price', 'max_price' => 'max_price', 'tier_price' => 'tier_price', 'final_price' => 'final_price'));
     }
     if (!empty($xd6)) {
         $xbf->getSelect()->where($xd6);
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Main sql request: \n" . $xbf->getSelect(), null, $this->getFilename('.log'));
     }
     $xda = 0;
     $xdb = clone $xbf;
     $xdb->getSelect()->columns("COUNT(DISTINCT e.entity_id) As total");
     $this->_counter = $xdb->getFirstItem()->getTotal();
     $xdc = $x130($this->_counter / $this->_sqlSize);
     $x8c = '';
     $xdd = 1;
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Total items calculated ({$this->_counter} in {$xdc} queries )", null, $this->getFilename('.log'));
     }
     $x63 = $this->x13f($x63, null, $x78, true);
     if ($x78 == 1 || $x78 != 1 && !$this->_display) {
         $x63 = $this->x143($x63);
     }
     if ($this->_display) {
         if ($x78 == 1) {
             $x8d = $this->x142($x63, $x7c, $x7d) . "";
         } else {
             $x8d = $x79 . '<br>';
             $x8d .= "<table style='border:2px solid grey; font-family:arial; font-size:12px' cellspacing=0 cellpadding=0 width='100%'>";
             if ($x7a) {
                 $x8d .= $this->x144($x63, true);
             }
         }
     } else {
         if ($x78 == 1) {
             $x43->streamWrite($this->x142($x63, $x7c, $x7d) . "");
         } else {
             if ($x79 != '') {
                 $x43->streamWrite($x79 . "\r\n");
             }
             if ($x7a) {
                 $x43->streamWrite($this->x145($x63, $x5e, $x5f, $x60));
             }
         }
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Header template parsed and added", null, $this->getFilename('.log'));
     }
     while ($xda < $xdc) {
         if ($this->_debug) {
             echo "<br><br>------------ SQL ----------------<br>";
             print $xbf->getSelect();
         }
         $xbf->getSelect()->limit($this->_sqlSize, $this->_sqlSize * $xda);
         $xbf->getSelect()->group(array('e.entity_id'));
         $xda++;
         if ($this->_log) {
             Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Fetching products from " . $this->_sqlSize * ($xda - 1) . " to " . $this->_sqlSize * $xda, null, $this->getFilename('.log'));
         }
         $xd1 = 1;
         foreach ($xbf as $product) {
             if ($this->_debug) {
                 echo "<br><br>------------ PRODUCT [ SKU -> " . $product->getSku() . " | ID -> " . $product->getId() . "]---------------<br>";
                 echo "categories : " . $product->getCategoriesIds() . ", Root id: " . $x74 . "<br>";
                 foreach ($x11e(',', $product->getCategoriesIds()) as $x41 => $x94) {
                     echo $x94 . "=>" . $x66[$x94]["path"] . "<br>";
                 }
             }
             if (!$x131('safe_mode')) {
                 $x132(60);
             }
             $x51 = $x76;
             foreach ($x8e as $x41 => $exp) {
                 $value = "";
                 $this->option = 0;
                 switch ($exp['pattern']) {
                     case '{load_options}':
                         $xb0 = 1;
                         $xde = array();
                         foreach ($exp['options'] as $x41 => $option) {
                             if (isset($xd0[$product->getId()][$option])) {
                                 $xb0 = $xb0 * $x11c($xd0[$product->getId()][$option]["options"]);
                                 $xde[$x41] = 0;
                             }
                         }
                         $x3f = array();
                         for ($xaa = 1; $xaa <= $xb0; $xaa++) {
                             $xdf = $x51;
                             foreach ($exp['options'] as $x41 => $option) {
                                 if (isset($xd0[$product->getId()][$option])) {
                                     $xdf = $x116("{" . $option . "_label}", $xd0[$product->getId()][$option]["options"][$xde[$x41]]['value'], $xdf);
                                     $xdf = $x116("{" . $option . "_sku}", $xd0[$product->getId()][$option]["options"][$xde[$x41]]['sku'], $xdf);
                                     $xdf = $x116("{" . $option . "_price}", $xd0[$product->getId()][$option]["options"][$xde[$x41]]['price'], $xdf);
                                     $xdf = $x116("{" . $option . "_type}", $xd0[$product->getId()][$option]["options"][$xde[$x41]]['price_type'], $xdf);
                                     if ($x41 > 0 || $x11c($xd0[$product->getId()]) == 1 || $x11c($exp['options']) < 2) {
                                         $xde[$x41]++;
                                     }
                                     if ($xde[$x41] >= $x11c($xd0[$product->getId()][$option]["options"])) {
                                         $xde[$x41] = 0;
                                         $xde[$x41 - 1]++;
                                     }
                                 }
                             }
                             $x3f[] = $xdf;
                         }
                         if ($x11c($x3f) > 0) {
                             if ($x78 == 1) {
                                 $x51 = $x115($x3f);
                             } else {
                                 $x51 = "[" . $x115(',', $x3f) . "]";
                             }
                         }
                         $this->skipOptions($x11c($exp['options']));
                         break;
                     case '{use_options}':
                         foreach ($exp['options'] as $x41 => $option) {
                             if (isset($xd0[$product->getId()][$option])) {
                                 $xe0 = array();
                                 $xe1 = array();
                                 $xe2 = array();
                                 foreach ($xd0[$product->getId()][$option]["options"] as $x56) {
                                     $xe0[] = $x56['value'];
                                     $xe1[] = $x56['sku'];
                                     $xe2[] = $x56['price'];
                                 }
                                 $x51 = $x116("{" . $option . "_label}", $x115(',', $xe0), $x51);
                                 $x51 = $x116("{" . $option . "_sku}", $x115(',', $xe1), $x51);
                                 $x51 = $x116("{" . $option . "_price}", $x115(',', $xe2), $x51);
                             }
                         }
                         $this->skipOptions($x11c($exp['options']));
                         break;
                     case '{id}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $value = $xe3->getId();
                         break;
                     case '{inc}':
                         $value = $xdd;
                         break;
                     case '{final_price}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x47 = $xe3->getFinalePrice();
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         $value = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                         !isset($exp['options'][0]) ? $x48 = $x6d : ($x48 = $exp['options'][0]);
                         $value = $this->x140($value, $x48);
                         $value = $x133($value, 2, '.', '');
                         $this->skipOptions(2);
                         break;
                     case '{tier_price}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x47 = $xe3->getTierPrice();
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         $value = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                         !isset($exp['options'][0]) ? $x48 = $x6d : ($x48 = $exp['options'][0]);
                         $value = $this->x140($value, $x48);
                         $value = $x133($value, 2, '.', '');
                         $this->skipOptions(2);
                         break;
                     case '{min_price}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x47 = $xe3->getMinPrice();
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         $value = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                         !isset($exp['options'][0]) ? $x48 = $x6d : ($x48 = $exp['options'][0]);
                         $value = $this->x140($value, $x48);
                         $value = $x133($value, 2, '.', '');
                         $this->skipOptions(2);
                         break;
                     case '{max_price}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x47 = $xe3->getMaxPrice();
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         $value = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                         !isset($exp['options'][0]) ? $x48 = $x6d : ($x48 = $exp['options'][0]);
                         $value = $this->x140($value, $x48);
                         $value = $x133($value, 2, '.', '');
                         $this->skipOptions(2);
                         break;
                     case '{normal_price}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         if ($xe3->type_id == 'bundle') {
                             $x47 = $xe3->price;
                         } else {
                             $x47 = $xe3->getPrice();
                         }
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         $value = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                         !isset($exp['options'][0]) ? $x48 = $x6d : ($x48 = $exp['options'][0]);
                         $value = $this->x140($value, $x48);
                         $value = $x133($value, 2, '.', '');
                         $this->skipOptions(2);
                         break;
                     case '{price}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         if ($xe3->getSpecialFromDate() && !$xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xe3->type_id == "bundle") {
                                     if (($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0) {
                                         if ($xe3->price_type) {
                                             $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                         } else {
                                             $x47 = $xe3->special_price;
                                         }
                                     } else {
                                         $x47 = $xe3->price;
                                     }
                                 } else {
                                     $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $x47 = $xe3->getSpecialPrice() : ($x47 = $xe3->getPrice());
                                 }
                             } else {
                                 if ($xe3->type_id == "bundle") {
                                     $x47 = $xe3->price;
                                 } else {
                                     $x47 = $xe3->getPrice();
                                 }
                             }
                         } elseif ($xe3->getSpecialFromDate() && $xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xe3->getSpecialToDate()) {
                                 if ($xe3->type_id == "bundle") {
                                     if (($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0) {
                                         if ($xe3->price_type) {
                                             $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                         } else {
                                             $x47 = $xe3->special_price;
                                         }
                                     } else {
                                         $x47 = $xe3->price;
                                     }
                                 } else {
                                     $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $x47 = $xe3->getSpecialPrice() : ($x47 = $xe3->getPrice());
                                 }
                             } else {
                                 if ($xe3->type_id == "bundle") {
                                     $x47 = $xe3->price;
                                 } else {
                                     $x47 = $xe3->getPrice();
                                 }
                             }
                         } else {
                             if ($xe3->type_id == "bundle") {
                                 if (($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0) {
                                     if ($xe3->price_type) {
                                         $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                     } else {
                                         $x47 = $xe3->special_price;
                                     }
                                 } else {
                                     $x47 = $xe3->price;
                                 }
                             } else {
                                 $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $x47 = $xe3->getSpecialPrice() : ($x47 = $xe3->getPrice());
                             }
                         }
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         $value = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                         !isset($exp["options"][0]) ? $x48 = $x6d : ($x48 = $exp["options"][0]);
                         $value = $this->x140($value, $x48);
                         $value = $x133($value, 2, ".", "");
                         $this->skipOptions(2);
                         break;
                     case "{is_special_price}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         !isset($exp["options"][0]) ? $xe4 = 1 : ($xe4 = $exp["options"][0]);
                         !isset($exp["options"][1]) ? $xe5 = 0 : ($xe5 = $exp["options"][1]);
                         if ($xe3->getSpecialFromDate() && !$xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xe3->type_id == "bundle") {
                                     ($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0 ? $value = $xe4 : ($value = $xe5);
                                 } else {
                                     $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $value = $xe4 : ($value = $xe5);
                                 }
                             } else {
                                 if ($xe3->type_id == "bundle") {
                                     $value = $xe5;
                                 } else {
                                     $value = $xe5;
                                 }
                             }
                         } elseif ($xe3->getSpecialFromDate() && $xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xe3->getSpecialToDate()) {
                                 if ($xe3->type_id == "bundle") {
                                     ($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0 ? $value = $xe4 : ($value = $xe5);
                                 } else {
                                     $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $value = $xe4 : ($value = $xe5);
                                 }
                             } else {
                                 if ($xe3->type_id == "bundle") {
                                     $value = $xe5;
                                 } else {
                                     $value = $xe5;
                                 }
                             }
                         } else {
                             if ($xe3->type_id == "bundle") {
                                 ($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0 ? $value = $xe4 : ($value = $xe5);
                             } else {
                                 $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $value = $xe4 : ($value = $xe5);
                             }
                         }
                         $this->skipOptions(2);
                         break;
                     case "{special_price}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x47 = null;
                         if ($xe3->getSpecialFromDate() && !$xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xe3->type_id == 'bundle') {
                                     if ($xe3->price_type) {
                                         $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                     } else {
                                         $x47 = $xe3->special_price;
                                     }
                                 } else {
                                     $x47 = $xe3->getSpecial_price();
                                 }
                             }
                         } elseif ($xe3->getSpecialFromDate() && $xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xe3->getSpecialToDate()) {
                                 if ($xe3->type_id == 'bundle') {
                                     if ($xe3->price_type) {
                                         $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                     } else {
                                         $x47 = $xe3->special_price;
                                     }
                                 } else {
                                     $x47 = $xe3->getSpecial_price();
                                 }
                             }
                         } else {
                             if ($xe3->type_id == 'bundle') {
                                 if ($xe3->price_type) {
                                     $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                 } else {
                                     $x47 = $xe3->special_price;
                                 }
                             } else {
                                 $x47 = $xe3->getSpecial_price();
                             }
                         }
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         if ($x47 > 0) {
                             $value = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                             !isset($exp['options'][0]) ? $x48 = $x6d : ($x48 = $exp['options'][0]);
                             $value = $this->x140($value, $x48);
                             $value = $x133($value, 2, '.', '');
                         } else {
                             $value = "";
                         }
                         $this->skipOptions(2);
                         break;
                     case '{price_rules}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x69 = $this->getStoreId();
                         $xe6 = Mage::getResourceModel('catalogrule/rule');
                         $xe7 = Mage::app()->getLocale()->storeTimeStamp($x69);
                         $xe8 = Mage::app()->getStore($x69);
                         $xe9 = $xe8->getWebsiteId();
                         $xea = Mage::getSingleton('customer/session')->getCustomerGroupId();
                         $xeb = $xe6->getRulePrice($xe7, $xe9, $xea, $xe3->getId());
                         if ($xe3->getSpecialFromDate() && !$xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xe3->type_id == "bundle") {
                                     if (($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0) {
                                         if ($xe3->price_type) {
                                             $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                         } else {
                                             $x47 = $xe3->special_price;
                                         }
                                     } else {
                                         $x47 = $xe3->price;
                                     }
                                 } else {
                                     $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $x47 = $xe3->getSpecialPrice() : ($x47 = $xe3->getPrice());
                                 }
                             } else {
                                 if ($xe3->type_id == "bundle") {
                                     $x47 = $xe3->price;
                                 } else {
                                     $x47 = $xe3->getPrice();
                                 }
                             }
                         } elseif ($xe3->getSpecialFromDate() && $xe3->getSpecialToDate()) {
                             if ($xe3->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xe3->getSpecialToDate()) {
                                 if ($xe3->type_id == "bundle") {
                                     if (($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0) {
                                         if ($xe3->price_type) {
                                             $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                         } else {
                                             $x47 = $xe3->special_price;
                                         }
                                     } else {
                                         $x47 = $xe3->price;
                                     }
                                 } else {
                                     $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $x47 = $xe3->getSpecialPrice() : ($x47 = $xe3->getPrice());
                                 }
                             } else {
                                 if ($xe3->type_id == "bundle") {
                                     $x47 = $xe3->price;
                                 } else {
                                     $x47 = $xe3->getPrice();
                                 }
                             }
                         } else {
                             if ($xe3->type_id == "bundle") {
                                 if (($xe3->price_type || !$xe3->price_type && $xe3->special_price < $xe3->price) && $xe3->special_price > 0) {
                                     if ($xe3->price_type) {
                                         $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                                     } else {
                                         $x47 = $xe3->special_price;
                                     }
                                 } else {
                                     $x47 = $xe3->price;
                                 }
                             } else {
                                 $xe3->getSpecial_price() && $xe3->getSpecial_price() < $xe3->getPrice() ? $x47 = $xe3->getSpecialPrice() : ($x47 = $xe3->getPrice());
                             }
                         }
                         if ($xeb !== FALSE) {
                             if ($xeb < $x47) {
                                 $value = $xeb;
                             } else {
                                 $value = $x47;
                             }
                         } else {
                             $value = $x47;
                         }
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         $value = $this->x141($value, $x73, $xe3->getTaxClassId(), $x4c);
                         !isset($exp["options"][0]) ? $x48 = $x6d : ($x48 = $exp["options"][0]);
                         $value = $this->x140($value, $x48);
                         $value = $x133($value, 2, ".", "");
                         $this->skipOptions(2);
                         break;
                     case "{G:SALE_PRICE}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $xec = $x116(' ', 'T', $xe3->getSpecialFromDate());
                         $xed = $x116(' ', 'T', $xe3->getSpecialToDate());
                         if ($xe3->type_id == 'bundle' && $xe3->special_price) {
                             if ($xe3->price_type) {
                                 $x47 = $x133($xe3->price * $xe3->special_price / 100, 2, ".", "");
                             } else {
                                 $x47 = $xe3->special_price;
                             }
                         } else {
                             $x47 = $xe3->getSpecial_price();
                         }
                         !isset($exp['options'][1]) ? $x4c = false : ($x4c = $exp['options'][1]);
                         if ($x47 > 0) {
                             $x47 = $this->x141($x47, $x73, $xe3->getTaxClassId(), $x4c);
                             !isset($exp['options'][0]) ? $x48 = $x6d : ($x48 = $exp['options'][0]);
                             $x47 = $this->x140($x47, $x48);
                             $x47 = $x133($x47, 2, '.', '');
                         }
                         if ($x47 > 0) {
                             $value = "<g:sale_price><![CDATA[" . $x47 . "]]></g:sale_price>\n";
                         }
                         if ($x47 > 0 && $xed) {
                             $value .= "<g:sale_price_effective_date><![CDATA[" . $xec . "/" . $xed . "]]></g:sale_price_effective_date>";
                         }
                         $this->skipOptions(2);
                         break;
                     case "{image}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $xee = $xe3->getImage();
                         if (!isset($exp['options'][0]) || $exp['options'][0] == 0) {
                             if ($xe3->getImage() && $xe3->getImage() != 'no_selection') {
                                 $xef = 'catalog/product/' . $xe3->getImage();
                                 $value = $x72 . $x116('//', '/', $xef);
                             } else {
                                 $value = $x72 . '/catalog/product/placeholder/' . $x6c;
                             }
                         } elseif (isset($xb7[$xe3->getId()]['src'][$exp['options'][0] - 1]) && $exp['options'][0] > 0) {
                             if ($xb7[$xe3->getId()]['src'][$exp['options'][0] - 1] != $xee) {
                                 $xef = 'catalog/product/' . $xb7[$xe3->getId()]['src'][$exp['options'][0] - 1];
                                 $value = $x72 . $x116('//', '/', $xef);
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{G:IMAGE_LINK}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $xee = $xe3->getImage();
                         $xf0 = array($xe3->getSmall_image(), $xe3->getThumbnail());
                         $xf1 = '';
                         $xde = 0;
                         if ($xe3->getImage() && $xe3->getImage() != 'no_selection') {
                             $xef = 'catalog/product/' . $xe3->getImage();
                             $value = $x72 . $x116('//', '/', $xef);
                             $xf1 .= "<g:image_link><![CDATA[" . $value . "]]></g:image_link>\n";
                             $xde++;
                         }
                         $xf2 = 0;
                         while (isset($xb7[$xe3->getId()]['src'][$xf2]) && $xde < 10) {
                             if ($xb7[$xe3->getId()]['src'][$xf2] != $xee) {
                                 if ($x12d($xb7[$xe3->getId()]['src'][$xf2], $xf0) || $xb7[$xe3->getId()]['disabled'][$xf2] != 1) {
                                     $xef = 'catalog/product/' . $xb7[$xe3->getId()]['src'][$xf2];
                                     $value = $x72 . $x116('//', '/', $xef);
                                     $xf1 .= "<g:additional_image_link><![CDATA[" . $value . "]]></g:additional_image_link>\n";
                                     $xde++;
                                 }
                             }
                             $xf2++;
                         }
                         $value = $xf1;
                         break;
                     case "{url}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         if ($xe3->getRequest_path()) {
                             $value = $x71 . $xe3->getRequest_path();
                         } else {
                             $value = $xe3->getProductUrl();
                         }
                         break;
                     case "{host}":
                         $value = $x71;
                         break;
                     case "{uri}":
                         isset($exp['options'][0]) ? $xf3 = $exp['options'][0] : ($xf3 = "");
                         isset($exp['options'][1]) ? $xf4 = $exp['options'][1] : ($xf4 = "");
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         if ($xe3->getRequest_path()) {
                             $value = $xf4 . '' . $xe3->getRequest_path() . $xf3;
                         } else {
                             $value = $x116($x71, '', $xe3->getProductUrl());
                         }
                         break;
                     case '{is_in_stock}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         !isset($exp['options'][0]) ? $xf5 = 'in stock' : ($xf5 = $exp['options'][0]);
                         !isset($exp['options'][1]) ? $xf6 = "out of stock" : ($xf6 = $exp['options'][1]);
                         !isset($exp['options'][2]) ? $x6f = "available for order" : ($x6f = $exp['options'][2]);
                         if ($xe3->getManageStock() || $xe3->getUseConfigManageStock() && $x6e) {
                             if ($xe3->getIs_in_stock() > 0) {
                                 $value = $xf5;
                             } else {
                                 if ($xe3->getBackorders() || $xe3->getUseConfigBackorders() && $x6f) {
                                     $value = $x6f;
                                 } else {
                                     $value = $xf6;
                                 }
                             }
                         } else {
                             $value = $xf5;
                         }
                         $this->skipOptions(3);
                         break;
                     case '{stock_status}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $xe3->getIs_in_stock() > 0 ? $value = Mage::helper('datafeedmanager')->__('in stock') : ($value = Mage::helper('datafeedmanager')->__('out of stock'));
                         break;
                     case '{qty}':
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         !isset($exp['options'][0]) ? $xf7 = 0 : ($xf7 = $exp['options'][0]);
                         if ($product->type_id == "configurable") {
                             $value = $xc4[$product->getId()];
                             $value = $x133($value, $xf7, '.', '');
                         } else {
                             if ($exp['reference'] == "configurable") {
                                 $value = $x133($xc4[$xe3->getId()], $xf7, '.', '');
                             } else {
                                 $value = $x133($xe3->getQty(), $xf7, '.', '');
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{categories}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         !isset($exp['options'][0]) || !$exp['options'][0] || $exp['options'][0] == 'INF' ? $xf8 = INF : ($xf8 = $exp['options'][0]);
                         !isset($exp['options'][1]) ? $xf9 = 1 : ($xf9 = $exp['options'][1]);
                         !isset($exp['options'][2]) || !$exp['options'][2] || $exp['options'][2] == 'INF' ? $xfa = INF : ($xfa = $exp['options'][2]);
                         $xfb = 0;
                         $value = '';
                         $xfc = '';
                         foreach ($x11e(',', $xe3->getCategoriesIds()) as $x41 => $x94) {
                             $x7f ? $xfd = $x12d($x66[$x94]["path"], $x86) : ($xfd = !$x12d($x66[$x94]["path"], $x86));
                             if (isset($x66[$x94]) && $xfb < $xf8 && ($xfd || $x86[0] == "*")) {
                                 $xfe = 0;
                                 $xff = $x11e('/', $x66[$x94]["path"]);
                                 if ($x12d($x74, $xff)) {
                                     $x100 = "";
                                     if ($xfb > 0) {
                                         $xfc = ",";
                                     }
                                     foreach ($xff as $x101) {
                                         if (isset($x66[$x101])) {
                                             if ($x66[$x101]['level'] > $xf9 && $xfe < $xfa) {
                                                 if ($xfe > 0) {
                                                     $x100 .= ' > ';
                                                 }
                                                 $x100 .= $x66[$x101]['name'];
                                                 $xfe++;
                                             }
                                         }
                                     }
                                     $x102 = "";
                                     if (!empty($x100)) {
                                         $value .= $xfc . $x100 . $x102;
                                         $xfb++;
                                     }
                                 }
                             }
                         }
                         $this->skipOptions(3);
                         break;
                     case "{G:PRODUCT_TYPE}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         !isset($exp['options'][0]) || !$exp['options'][0] || $exp['options'][0] == 'INF' ? $xf8 = INF : ($xf8 = $exp['options'][0]);
                         !isset($exp['options'][1]) ? $xf9 = 1 : ($xf9 = $exp['options'][1]);
                         !isset($exp['options'][2]) || !$exp['options'][2] || $exp['options'][2] == 'INF' ? $xfa = INF : ($xfa = $exp['options'][2]);
                         $xfb = 0;
                         $value = '';
                         foreach ($x11e(',', $xe3->getCategoriesIds()) as $x41 => $x94) {
                             $x7f ? $xfd = $x12d($x66[$x94]["path"], $x86) : ($xfd = !$x12d($x66[$x94]["path"], $x86));
                             if (@$x66[$x94]["include_in_menu"] && isset($x66[$x94]) && $xfb < $xf8 && ($xfd || $x86[0] == "*")) {
                                 $xfe = 0;
                                 $xff = $x11e('/', $x66[$x94]["path"]);
                                 if ($x12d($x74, $xff)) {
                                     $x100 = '';
                                     $xfc = '<g:product_type><![CDATA[';
                                     foreach ($xff as $x101) {
                                         if (isset($x66[$x101])) {
                                             if ($x66[$x101]['level'] > $xf9 && $xfe < $xfa) {
                                                 if ($xfe > 0) {
                                                     $x100 .= ' > ';
                                                 }
                                                 $x100 .= $x66[$x101]['name'];
                                                 $xfe++;
                                             }
                                         }
                                     }
                                     $x102 = "]]></g:product_type>\n";
                                     if (!empty($x100)) {
                                         $value .= $xfc . $x100 . $x102;
                                         $xfb++;
                                     }
                                 }
                             }
                         }
                         $this->skipOptions(3);
                         break;
                     case "{G:GOOGLE_PRODUCT_CATEGORY}":
                         isset($exp["options"][0]) ? $x103 = $exp["options"][0] : ($x103 = 0);
                         $value = "";
                         $x104 = 0;
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         foreach ($x11e(',', $xe3->getCategoriesIds()) as $x41 => $x94) {
                             if (isset($x66[$x94]["path"]) && isset($x87[$x66[$x94]["path"]])) {
                                 if ($x104 == $x103) {
                                     $value .= "<g:google_product_category><![CDATA[" . $x87[$x66[$x94]["path"]] . "]]></g:google_product_category>\n";
                                     break;
                                 }
                                 $x104++;
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{category_mapping}":
                         isset($exp["options"][0]) ? $x103 = $exp["options"][0] : ($x103 = 0);
                         $value = "";
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x104 = 0;
                         foreach ($x11e(',', $xe3->getCategoriesIds()) as $x41 => $x94) {
                             if (isset($x87[$x66[$x94]["path"]])) {
                                 if ($x104 == $x103) {
                                     $value .= $x87[$x66[$x94]["path"]];
                                     break;
                                 }
                                 $x104++;
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{review_count}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $value = "";
                         isset($exp["options"][0]) && $exp["options"][0] == "*" ? $x105 = 0 : ($x105 = $x69);
                         if (isset($xb1[$xe3->getId()][$x105]["count"])) {
                             $x106 = $xb1[$xe3->getId()][$x105]["count"];
                             if (isset($x106)) {
                                 $value .= $x106;
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{review_average}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $value = "";
                         isset($exp["options"][0]) && $exp["options"][0] == "*" ? $x105 = 0 : ($x105 = $x69);
                         !isset($exp["options"][1]) || !$exp["options"][1] ? $x107 = 5 : ($x107 = $exp["options"][1]);
                         if (isset($xb1[$xe3->getId()][$x105]["score"])) {
                             $x108 = $x133($xb1[$xe3->getId()][$x105]["score"] * $x107 / 100, 2, ".", "");
                             if (isset($x108)) {
                                 $value .= $x108;
                             }
                         }
                         $this->skipOptions(2);
                         break;
                     case "{G:PRODUCT_REVIEW}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         isset($exp["options"][0]) && $exp["options"][0] == "*" ? $x105 = 0 : ($x105 = $x69);
                         !isset($exp["options"][1]) || !$exp["options"][1] ? $x107 = 5 : ($x107 = $exp["options"][1]);
                         $value = "";
                         if (isset($xb1[$xe3->getId()][$x105]["count"])) {
                             $x106 = $xb1[$xe3->getId()][$x105]["count"];
                             $x108 = $x133($xb1[$xe3->getId()][$x105]["score"] * $x107 / 100, 2, ".", "");
                         }
                         if (isset($x108) && $x108 > 0) {
                             $value .= "<g:product_review_average><![CDATA[" . $x108 . "]]></g:product_review_average>\n";
                         }
                         if (isset($x106) && $x106 > 0) {
                             $value .= "<g:product_review_count><![CDATA[" . $x106 . "]]></g:product_review_count>\n";
                         }
                         unset($x108);
                         unset($x106);
                         break;
                     case "{G:ITEM_GROUP_ID}":
                         if (isset($this->configurable[$product->getId()])) {
                             $xe3 = $this->checkReference('configurable', $product);
                             $value = "<g:item_group_id><![CDATA[" . $xe3->getSku() . "]]></g:item_group_id>";
                         }
                         break;
                     case "{SC:EAN}":
                         $x11d($exp['options'][0]) && $exp['options'][0] > 0 ? $x109 = $exp['options'][0] : ($x109 = 0);
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $value = $x11e(',', $xe3->getEan());
                         $value = "<g:ean><![CDATA[" . $value[$x109] . "]]></g:ean>";
                         break;
                     case "{sc:ean}":
                         $x11d($exp['options'][0]) && $exp['options'][0] > 0 ? $x109 = $exp['options'][0] : ($x109 = 0);
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $value = $x11e(',', $xe3->getEan());
                         $value = $value[$x109];
                         break;
                     case "{SC:IMAGES}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $xee = $xe3->getSmall_image();
                         $xf0 = array($xe3->getImage(), $xe3->getThumbnail());
                         $xf1 = '';
                         $xde = 0;
                         if ($xe3->getSmall_image() && $xe3->getSmall_image() != 'no_selection') {
                             $xef = $xe3->getSmall_image();
                             $value = $xef;
                             $xf1 .= "<g:image_link><![CDATA[" . $value . "]]></g:image_link>\n";
                             $xde++;
                         }
                         $xf2 = 0;
                         while (isset($xb7[$xe3->getId()]['src'][$xf2]) && $xde < 10) {
                             if ($xb7[$xe3->getId()]['src'][$xf2] != $xee) {
                                 if ($x12d($xb7[$xe3->getId()]['src'][$xf2], $xf0) || $xb7[$xe3->getId()]['disabled'][$xf2] != 1) {
                                     $xef = $xb7[$xe3->getId()]['src'][$xf2];
                                     $value = $xef;
                                     $xf1 .= "<g:additional_image_link><![CDATA[" . $value . "]]></g:additional_image_link>\n";
                                     $xde++;
                                 }
                             }
                             $xf2++;
                         }
                         $value = $xf1;
                         break;
                     case "{sc:images}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $xee = $xe3->getSmall_image();
                         if (!isset($exp['options'][0]) || $exp['options'][0] == 0) {
                             if ($xe3->getSmall_image() && $xe3->getSmall_image() != 'no_selection') {
                                 $xef = $xe3->getSmall_image();
                                 $value = $xef;
                             } else {
                                 $value = $x72 . '/catalog/product/placeholder/' . $x6c;
                             }
                         } elseif (isset($xb7[$xe3->getId()]['src'][$exp['options'][0] - 1]) && $exp['options'][0] > 0) {
                             if ($xb7[$xe3->getId()]['src'][$exp['options'][0] - 1] != $xee) {
                                 $xef = 'catalog/product/' . $xb7[$xe3->getId()]['src'][$exp['options'][0] - 1];
                                 $value = $x72 . $x116('//', '/', $xef);
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{SC:DESCRIPTION}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x10a = $xe3->getDescription() . $xe3->getShortDescription();
                         $x10b = "|<iframe(.*)</iframe>|U";
                         $x119($x10b, $x10a, $x10c);
                         if ($x10c) {
                             $x10a = $xe3->getAttributeText('manufacturer') . " " . $xe3->getName() . " - Part number: " . $xe3->getSku() . " - Category : {categories,[1],[1],[1]}";
                         } else {
                             if ($x12d("strip_tags", $exp['options'])) {
                                 $x10a = $x124('!\\<br /\\>!isU', " ", $x10a);
                                 $x10a = $x124('!\\<br/\\>!isU', " ", $x10a);
                                 $x10a = $x124('!\\<br>!isU', " ", $x10a);
                                 $x10a = $x134($x10a);
                             }
                             if ($x12d("html_entity_decode", $exp['options'])) {
                                 $x10a = $x123($x10a, ENT_QUOTES, 'UTF-8');
                             }
                             if ($x12d("htmlentities", $exp['options'])) {
                                 $x10a = $x135($x10a);
                             }
                             if ($x121($x10a) > 900) {
                                 $x10a = $x11f($x10a, 0, 900 - 3);
                                 $x10d = $x136($x10a, " ");
                                 $x10a = $x11f($x10a, 0, $x10d) . '...';
                             }
                         }
                         if ($x10a == null) {
                             $x10a = $xe3->getAttributeText('manufacturer') . " " . $xe3->getName() . " - Part number: " . $xe3->getSku() . " - Category : {categories,[1],[1],[1]}";
                         }
                         $x10a = $x124('/' . '[\\x00-\\x1F\\x7F]' . '|[\\x00-\\x7F][\\x80-\\xBF]+' . '|([\\xC0\\xC1]|[\\xF0-\\xFF])[\\x80-\\xBF]*' . '|[\\xC2-\\xDF]((?![\\x80-\\xBF])|[\\x80-\\xBF]{2,})' . '|[\\xE0-\\xEF](([\\x80-\\xBF](?![\\x80-\\xBF]))|' . '(?![\\x80-\\xBF]{2})|[\\x80-\\xBF]{3,})' . '/S', ' ', $x10a);
                         $x10a = $x116('™', '', $x10a);
                         $value = "<description><![CDATA[" . $x10a . "]]></description>";
                         $exp['options'] = array();
                         break;
                     case "{sc:description}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x10a = $xe3->getDescription() . $xe3->getShortDescription();
                         $x10b = "|<iframe(.*)</iframe>|U";
                         $x119($x10b, $x10a, $x10c);
                         if ($x10c) {
                             $x10a = $xe3->getAttributeText('manufacturer') . " " . $xe3->getName() . " - Part number: " . $xe3->getSku() . " - Category : {categories,[1],[1],[1]}";
                         } else {
                             if ($x12d("strip_tags", $exp['options'])) {
                                 $x10a = $x124('!\\<br /\\>!isU', " ", $x10a);
                                 $x10a = $x124('!\\<br/\\>!isU', " ", $x10a);
                                 $x10a = $x124('!\\<br>!isU', " ", $x10a);
                                 $x10a = $x134($x10a);
                             }
                             if ($x12d("html_entity_decode", $exp['options'])) {
                                 $x10a = $x123($x10a, ENT_QUOTES, 'UTF-8');
                             }
                             if ($x12d("htmlentities", $exp['options'])) {
                                 $x10a = $x135($x10a);
                             }
                             if ($x121($x10a) > 900) {
                                 $x10a = $x11f($x10a, 0, 900 - 3);
                                 $x10d = $x136($x10a, " ");
                                 $x10a = $x11f($x10a, 0, $x10d) . '...';
                             }
                         }
                         if ($x10a == null) {
                             $x10a = $xe3->getAttributeText('manufacturer') . " " . $xe3->getName() . " - Part number: " . $xe3->getSku() . " - Category : {categories,[1],[1],[1]}";
                         }
                         $x10a = $x124('/' . '[\\x00-\\x1F\\x7F]' . '|[\\x00-\\x7F][\\x80-\\xBF]+' . '|([\\xC0\\xC1]|[\\xF0-\\xFF])[\\x80-\\xBF]*' . '|[\\xC2-\\xDF]((?![\\x80-\\xBF])|[\\x80-\\xBF]{2,})' . '|[\\xE0-\\xEF](([\\x80-\\xBF](?![\\x80-\\xBF]))|' . '(?![\\x80-\\xBF]{2})|[\\x80-\\xBF]{3,})' . '/S', ' ', $x10a);
                         $x10a = $x116('™', '', $x10a);
                         $value = $x10a;
                         $exp['options'] = array();
                         break;
                     case "{SC:URL}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         if ($xe3->getRequest_path()) {
                             $value = "<link><![CDATA[" . $x71 . $xe3->getRequest_path() . "]]></link>";
                         } else {
                             $value = "<link><![CDATA[" . $xe3->getProductUrl() . "]]></link>";
                         }
                         break;
                     case "{sc:url}":
                         isset($exp['options'][0]) ? $xf3 = $exp['options'][0] : ($xf3 = "");
                         isset($exp['options'][1]) ? $xf4 = $exp['options'][1] : ($xf4 = "");
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         if ($xe3->getUrlKey()) {
                             $value = $x71 . $xf4 . $xe3->getRequest_path() . $xf3;
                         } else {
                             $value = $xe3->getProductUrl();
                         }
                         break;
                     case "{SC:CONDITION}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x127($xe3->getName(), "refurbished") ? $xd5 = 'refurbished' : ($xd5 = 'new');
                         $value = "<g:condition><![CDATA[" . $xd5 . "]]></g:condition>";
                         break;
                     case "{sc:condition}":
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         $x127($xe3->getName(), "refurbished") ? $xd5 = 'refurbished' : ($xd5 = 'new');
                         $value = $xd5;
                         break;
                     default:
                         $xe3 = $this->checkReference($exp['reference'], $product);
                         if ($x12d($exp['name'], $x9d)) {
                             if ($x12d($x9e[$exp['name']], array('select', 'multiselect'))) {
                                 eval('$x10f =($xe3->' . $exp['methodName'] . ");");
                                 $x10e = $x11e(',', $x10f);
                                 if ($x11c($x10e) > 1) {
                                     $value = array();
                                     foreach ($x10e as $x5d) {
                                         if (isset($xa3[$x5d][$x69])) {
                                             $value[] = $xa3[$x5d][$x69];
                                         } else {
                                             if (isset($xa3[$x5d][0])) {
                                                 $value[] = $xa3[$x5d][0];
                                             }
                                         }
                                     }
                                 } else {
                                     if (isset($xa3[$x10e[0]][$x69])) {
                                         $value = $xa3[$x10e[0]][$x69];
                                     } else {
                                         if (isset($xa3[$x10e[0]][0])) {
                                             $value = $xa3[$x10e[0]][0];
                                         }
                                     }
                                 }
                             } else {
                                 eval('$value =($xe3->' . $exp['methodName'] . ");");
                             }
                         }
                         if ($x12d(@$x9b[$exp['name']], $x9b)) {
                             $value = $x9b[$exp['name']];
                         }
                         $value = $xd4->_eval($product, $exp, $value);
                         if ($x137($value) && !$value) {
                             continue 3;
                         }
                         break;
                 }
                 if ($x11c($exp['options']) > 0) {
                     foreach ($exp['options'] as $x41 => $option) {
                         if ($x41 >= $this->option) {
                             switch ($exp['options'][$this->option]) {
                                 case "substr":
                                     if (isset($exp['options'][$this->option + 1]) && $x121($value) > $exp['options'][$this->option + 1]) {
                                         $value = $x11f($value, 0, $exp['options'][$this->option + 1] - 3);
                                         $x10d = $x136($value, " ");
                                         $value = $x11f($value, 0, $x10d) . $exp['options'][$this->option + 2];
                                     }
                                     $this->skipOptions(3);
                                     break;
                                 case "strip_tags":
                                     $x110 = " ";
                                     $value = $x124('!\\<br /\\>!isU', $x110, $value);
                                     $value = $x124('!\\<br/\\>!isU', $x110, $value);
                                     $value = $x124('!\\<br>!isU', $x110, $value);
                                     $value = $x134($value);
                                     $this->skipOptions(1);
                                     break;
                                 case "htmlentities":
                                     $value = $x135($value);
                                     $this->skipOptions(1);
                                     break;
                                 case "implode":
                                     $value = $x126($value) ? $x115($exp['options'][$this->option + 1], $value) : $value;
                                     $this->skipOptions(2);
                                     break;
                                 case "float":
                                     $value = $x133($value, $exp['options'][$this->option + 1], '.', '');
                                     $this->skipOptions(2);
                                     break;
                                 case "html_entity_decode":
                                     $value = $x123($value, ENT_QUOTES, 'UTF-8');
                                     $this->skipOptions(1);
                                     break;
                                 case "inline":
                                     $value = $x124('/(\\r\\n|\\n|\\r|\\r\\n\\t)/s', ' ', $value);
                                     $this->skipOptions(1);
                                     break;
                                 case "strtolower":
                                     $value = $x138($value, "UTF8");
                                     $this->skipOptions(1);
                                     break;
                                 case "strtoupper":
                                     $value = $x139($value, "UTF8");
                                     $this->skipOptions(1);
                                     break;
                                 case "cleaner":
                                     $value = $x124('/' . '[\\x00-\\x1F\\x7F]' . '|[\\x00-\\x7F][\\x80-\\xBF]+' . '|([\\xC0\\xC1]|[\\xF0-\\xFF])[\\x80-\\xBF]*' . '|[\\xC2-\\xDF]((?![\\x80-\\xBF])|[\\x80-\\xBF]{2,})' . '|[\\xE0-\\xEF](([\\x80-\\xBF](?![\\x80-\\xBF]))|' . '(?![\\x80-\\xBF]{2})|[\\x80-\\xBF]{3,})' . '/S', ' ', $value);
                                     $value = $x116('™', '', $value);
                                     $this->skipOptions(1);
                                     break;
                                 default:
                                     $xd3->option = $this->option;
                                     $value = $xd3->_eval($product, $exp, $value);
                                     $this->option = $xd3->option;
                                     if ($x137($value) && !$value) {
                                         continue 3;
                                     }
                                     break;
                             }
                         }
                     }
                 }
                 if ($x78 > 1 && !$this->_display) {
                     $value = $this->x146($value, $x5f, $x60);
                 }
                 $value = $x116(array("<", ">", '"', '\\'), array("__LOWERTHAN__", "__HIGHERTHAN__", "__QUOTES__", "__BACKSLASH__"), $value);
                 $x51 = $x116($exp['fullpattern'], $value, $x51);
             }
             $x51 = $this->x13f($x51, $product, $x78);
             if ($x78 == 1) {
                 if (!$this->_display) {
                     $x51 = $this->x143($x51);
                     $x51 = $this->x142($x51, $x7c, $x7d);
                 } else {
                     $x51 = $this->x142($x51, $x7c, $x7d);
                 }
             } elseif ($x78 != 1) {
                 if (!$this->_display) {
                     $x51 = $this->x145($x51, $x5e, $x5f, $x60);
                     $x51 = $this->x143($x51);
                 } else {
                     $x51 = $this->x144($x51, false);
                 }
             }
             $x51 = $x116(array("__LOWERTHAN__", "__HIGHERTHAN__", "__QUOTES__", "__BACKSLASH__"), array("<", ">", '"', '\\'), $x51);
             if (!empty($x51)) {
                 if ($x78 == 1) {
                     $x8c .= $x51 . "";
                 } else {
                     $x8c .= $x51 . "";
                 }
                 if ($this->_display) {
                     $x8d .= $x8c;
                     $x8c = '';
                 } else {
                     if ($xd1 % Mage::getStoreConfig("datafeedmanager/system/buffer") == 0) {
                         $x43->streamWrite($x8c);
                         unset($x8c);
                         $x8c = '';
                         if ($this->_log) {
                             Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" . $xdd . "/" . $this->_counter . " items added", null, $this->getFilename('.log'));
                         }
                     }
                 }
                 if ($this->_limit && $xd1 >= $this->_limit) {
                     break 2;
                 }
                 $xd1++;
                 $xdd++;
             }
         }
     }
     if (!$this->_display) {
         $x43->streamWrite($x8c);
         if ($x121($x120($x77)) > 1) {
             $x43->streamWrite($x77 . "\n");
         }
         if ($this->_log) {
             Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " . ($xdd - 1) . "/" . $this->_counter . " items added", null, $this->getFilename('.log'));
         }
     } else {
         $x8d .= $x8c;
         $x8d .= $x77 . "\n";
         if ($x78 > 1) {
             $x8d .= "</table>";
         }
         if ($this->_log) {
             Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " . $xdd . "/" . $this->_counter . " items added", null, $this->getFilename('.log'));
         }
     }
     unset($xbf);
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Footer template added", null, $this->getFilename('.log'));
     }
     if ($this->_display && !$this->_debug) {
         $x78 == 1 && !Mage::app()->getRequest()->getParam("real_time_preview") ? $x10a = "<textarea id='CodeMirror' class='CodeMirror'>" . $x8d . "</textarea>" : ($x10a = $x8d);
         if (!Mage::app()->getRequest()->getParam("real_time_preview")) {
             return "\r\n    <html>\r\n   \t <head>\r     \t\t<title>" . $this->getFeedName() . "</title>                 <link rel='stylesheet' href='" . $x70 . "skin/adminhtml/default/default/CodeMirror2/lib/codemirror.css'> \n           <link rel='stylesheet' href='" . $x70 . "skin/adminhtml/default/default/CodeMirror2/theme/default.css'>\r\n         \r\n              <script type='text/javascript' src='" . $x70 . "skin/adminhtml/default/default/CodeMirror2/lib/codemirror.js'></script>\r\n               <script type='text/javascript' src='" . $x70 . "skin/adminhtml/default/default/CodeMirror2/mode/xml/xml.js'></script> \n       \r\n               \n             </head>\r                <body>\r\n                " . $x10a . " \n              <script language='javascript'> \n                  sHtml=document.getElementById('CodeMirror');\r\n              if(typeof sHtml != 'undefined'){\r\n                      var myCodeMirror = CodeMirror(function(elt) { \n                         sHtml.parentNode.replaceChild(elt, sHtml)}, {\r                         value: sHtml.value,                         mode:  'xml',\r\n                            readOnly: true\r\n \n                  })\r\n                  } \n               \n               </script>                 </body>\r\n              </html>";
         } else {
             return $x10a;
         }
     } elseif ($this->_debug) {
         echo "<br><br>------------ XML OUTPUT ----------------<br>";
         $x10a = "<pre>" . $x122($x8d) . "</pre>";
         return $x10a;
     } else {
         $x43->streamClose();
         $x43->mv($this->getFilename(), $this->getFilename(false));
         $x43->rm($this->getFilename());
         $this->setFeedUpdatedAt(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
         $this->save();
         if ($this->_log) {
             Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Temp file closed and moved to " . $this->getFilename(false), null, $this->getFilename('.log'));
         }
         if ($x80) {
             $x111 = $x13a($x81);
             $x112 = $x13b($x111, $x82, $x83);
             $x13c($x111, true);
             if (!$x111 || !$x112) {
                 Mage::getSingleton("adminhtml/session")->addError(Mage::helper("datafeedmanager")->__("Unable to connect the ftp server, please check your credentials."));
             }
             $x113 = $x13d($x111, $x84 . $this->getFilename(false), $this->getPath() . $this->getFilename(false), FTP_BINARY);
             if (!$x113) {
                 Mage::getSingleton("adminhtml/session")->addError(Mage::helper("datafeedmanager")->__("Unable to upload the file to the FTP directory."));
             } else {
                 Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("datafeedmanager")->__("File successfully uploaded on {$x81}."));
             }
             $x13e($x111);
         }
     }
     return $this;
 }
示例#30
0
 /**
  * Debug write to file process
  *
  * @param string $str
  */
 protected function _debugWriteToFile($str)
 {
     $str = '## ' . date('Y-m-d H:i:s') . "\r\n" . $str;
     if (!$this->_debugIoAdapter) {
         $this->_debugIoAdapter = new Varien_Io_File();
         $dir = Mage::getBaseDir() . DS . $this->_debugIoAdapter->dirname($this->_debugFile);
         $this->_debugIoAdapter->checkAndCreateFolder($dir);
         $this->_debugIoAdapter->open(array('path' => $dir));
         $this->_debugFile = basename($this->_debugFile);
     }
     $this->_debugIoAdapter->streamOpen($this->_debugFile, 'a');
     $this->_debugIoAdapter->streamLock();
     $this->_debugIoAdapter->streamWrite($str);
     $this->_debugIoAdapter->streamUnlock();
     $this->_debugIoAdapter->streamClose();
 }