public function createModule($data)
 {
     $namespace = $this->_cleanString($data['namespace']);
     $module = $this->_cleanString($data['module']);
     $pool = $data['pool'];
     $version = $this->_cleanString($data['version']);
     $dependencies = array();
     if (isset($data['depends'])) {
         foreach ($data['depends'] as $dependency) {
             $dependencies[] = sprintf('%s<%s />', str_repeat(' ', 4 * 4), $dependency);
         }
     }
     $replacements = array('{{Namespace}}' => $namespace, '{{namespace}}' => strtolower($namespace), '{{Module}}' => $module, '{{module}}' => strtolower($module), '{{pool}}' => $pool, '{{version}}' => $version, '{{depends}}' => implode(PHP_EOL, $dependencies));
     $io = new Varien_Io_File();
     $tplDir = $this->getTemplateDir();
     $tmpDir = $this->getTmpModuleDir($namespace . '_' . $module);
     $io->checkAndCreateFolder($tmpDir);
     if (!$io->isWriteable($tmpDir)) {
         Mage::throwException('Module temp dir is not writeable');
     }
     @shell_exec("cp -r {$tplDir} {$tmpDir}");
     $files = $this->_getTemplateFiles($tmpDir);
     if (empty($files)) {
         Mage::throwException('Could not copy templates files to module temp dir');
     }
     $this->_replaceVars($tmpDir, $replacements);
     $dest = Mage::getBaseDir();
     if (!$io->isWriteable($dest)) {
         Mage::throwException(sprintf('Could not move module files to Magento tree. However, module structure is available in %s', $tmpDir));
     }
     @shell_exec("cp -r {$tmpDir} {$dest}");
     return true;
 }
示例#2
0
 /**
  * Check is folders exist and have writable permissions
  *
  * @return string Error message if exist
  */
 public function checkFolderPermissionsErrors()
 {
     $arrFolders = array('image_dir' => Mage::getConfig()->getOptions()->getMediaDir() . DS . Mage::helper('nwdrevslider/images')->getImageDir(), 'thumb_dir' => Mage::getConfig()->getOptions()->getMediaDir() . DS . Mage::helper('nwdrevslider/images')->getImageThumbDir(), 'admin_css_dir' => Mage::getBaseDir() . Mage::helper('nwdrevslider/css')->getAdminCssDir(), 'front_css_dir' => Mage::getBaseDir() . Mage::helper('nwdrevslider/css')->getFrontCssDir());
     $ioFile = new Varien_Io_File();
     $arrErrors = array();
     foreach ($arrFolders as $_folder) {
         try {
             if (!($ioFile->checkandcreatefolder($_folder) && $ioFile->isWriteable($_folder))) {
                 $arrErrors[] = $_folder;
             }
         } catch (Exception $e) {
             $arrErrors[] = $_folder;
             Mage::logException($e);
         }
     }
     if (!(in_array($arrFolders['admin_css_dir'], $arrErrors) || in_array($arrFolders['front_css_dir'], $arrErrors))) {
         if (!file_exists($arrFolders['admin_css_dir'] . 'statics.css')) {
             Mage::helper('nwdrevslider/css')->putStaticCss();
         }
         if (!file_exists($arrFolders['admin_css_dir'] . 'dynamic.css')) {
             Mage::helper('nwdrevslider/css')->putDynamicCss();
         }
     }
     $strError = $arrErrors ? Mage::helper('nwdrevslider')->__('Following directories not found or not writable, please change permissions to: ') . implode(' , ', $arrErrors) : '';
     return $strError;
 }
示例#3
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();
     }
 }
 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;
 }
 protected function _beforeSave()
 {
     $io = new Varien_Io_File();
     $realPath = $io->getCleanPath($this->getPath());
     /**
      * Check path is allow
      */
     if (!$io->allowedPath($realPath, Mage::getBaseDir())) {
         Mage::throwException(Mage::helper('sitemap')->__('Please define correct path'));
     }
     /**
      * Check exists and writeable path
      */
     if (!$io->fileExists($realPath, false)) {
         Mage::throwException(Mage::helper('sitemap')->__('Please create the specified folder "%s" before saving the sitemap.', Mage::helper('core')->htmlEscape($this->getPreparedFilename())));
     }
     if (!$io->isWriteable($realPath)) {
         Mage::throwException(Mage::helper('sitemap')->__('Please make sure that "%s" is writable by web-server.', $this->getPreparedFilename()));
     }
     /**
      * Check allow filename
      */
     if (!preg_match('#\\.xml$#', $this->getSitemapFilename())) {
         $this->setSitemapFilename($this->getSitemapFilename() . '.xml');
     }
     $this->setSitemapPath(rtrim(str_replace(str_replace('\\', '/', Mage::getBaseDir()), '', $realPath), '/') . '/');
     return parent::_beforeSave();
 }
示例#6
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;
 }
示例#7
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;
 }
示例#8
0
 public function checkFilePermissions()
 {
     $io = new Varien_Io_File();
     $io->checkAndCreateFolder($this->local_dir);
     if (!$io->isWriteable($this->local_dir)) {
         return 'folder is not writable';
     }
     return '';
 }
示例#9
0
 public function isDirectoryWriteable()
 {
     $base_dir = Mage::getBaseDir() . DS;
     $file = new Varien_Io_File();
     if ($file->isWriteable($base_dir)) {
         return true;
     } else {
         return false;
     }
 }
示例#10
0
 /**
  * Validate uploaded file
  *
  * @throws Mage_Core_Exception
  * @return Mage_Catalog_Model_Product_Option_Type_File
  */
 protected function _validateUploadedFile()
 {
     $option = $this->getOption();
     if (Mage::helper('aitcg/options')->checkAitOption($option)) {
         $values = Mage::app()->getRequest()->getParam('options');
         $optionValue = $values[$option->getId()];
         $runValidation = ($option->getIsRequire() || $this->_validateValue($option)) && !is_null($optionValue);
         if (!$runValidation) {
             $this->setUserValue(null);
             return $this;
         }
         $optionValue = Mage::helper('core')->jsonDecode($optionValue);
         $this->_initFilesystem();
         $model = Mage::getModel('aitcg/image');
         $src = Mage::getBaseDir('media') . DS . $model->getFullTempPath() . DS . $optionValue['config']['rand'] . '.' . Aitoc_Aitcg_Model_Image::FORMAT_PNG;
         $fileName = Mage_Core_Model_File_Uploader::getCorrectFileName(pathinfo(strtolower($src), PATHINFO_FILENAME));
         $dispersion = Mage_Core_Model_File_Uploader::getDispretionPath($fileName);
         $filePath = $dispersion;
         $fileHash = md5(file_get_contents($src));
         $filePath .= DS . $fileHash . '.' . Aitoc_Aitcg_Model_Image::FORMAT_PNG;
         $fileFullPath = $this->getQuoteTargetDir() . $filePath;
         $_width = 0;
         $_height = 0;
         $_fileSize = 0;
         if (is_readable($src)) {
             $_imageSize = getimagesize($src);
             if ($_imageSize) {
                 $_width = $_imageSize[0];
                 $_height = $_imageSize[1];
             }
             $_fileSize = filesize($src);
         }
         $manager = Mage::getModel('aitcg/image_manager');
         $template_id = $manager->addImage($values[$option->getId()], Mage::app()->getRequest()->getParam('product'), $option->getId(), $option);
         $this->setUserValue(array('type' => 'image/png', 'title' => 'custom_product_preview.png', 'quote_path' => $this->getQuoteTargetDir(true) . $filePath, 'order_path' => $this->getOrderTargetDir(true) . $filePath, 'fullpath' => $fileFullPath, 'size' => $_fileSize, 'width' => $_width, 'height' => $_height, 'secret_key' => substr($fileHash, 0, 20), Aitoc_Aitcg_Helper_Options::OPTION_DATA_KEY => array('template_id' => $template_id, Aitoc_Aitcg_Model_Sales_Order_Item_Converter::CUSTOMER_IMAGE_META_VERSION_KEY => Aitoc_Aitcg_Model_Sales_Order_Item_Converter::CUSTOMER_IMAGE_META_VERSION)));
         $path = dirname($fileFullPath);
         $io = new Varien_Io_File();
         if (!$io->isWriteable($path) && !$io->mkdir($path, 0777, true)) {
             Mage::throwException(Mage::helper('catalog')->__("Cannot create writeable directory '%s'.", $path));
         }
         @copy($src, $fileFullPath);
         return $this;
     } else {
         return parent::_validateUploadedFile();
     }
 }
示例#11
0
 /**
  * Create new sitemap file
  *
  * @param string $fileName
  * @param string $type
  * @return void
  */
 protected function _createSitemap($fileName = null, $type = self::TYPE_URL)
 {
     if (!$fileName) {
         $this->_sitemapIncrement++;
         $fileName = $this->_getCurrentSitemapFilename($this->_sitemapIncrement);
     }
     $this->_fileHandler = $this->_getFileObject();
     $this->_fileHandler->setAllowCreateFolders(true);
     $path = $this->_fileHandler->getCleanPath($this->_getBaseDir() . $this->getSitemapPath());
     $this->_fileHandler->open(array('path' => $path));
     if ($this->_fileHandler->fileExists($fileName) && !$this->_fileHandler->isWriteable($fileName)) {
         Mage::throwException(Mage::helper('Mage_Sitemap_Helper_Data')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writable by web server.', $fileName, $path));
     }
     $fileHeader = sprintf($this->_tags[$type][self::OPEN_TAG_KEY], $type);
     $this->_fileHandler->streamOpen($fileName);
     $this->_fileHandler->streamWrite($fileHeader);
     $this->_fileSize = strlen($fileHeader . sprintf($this->_tags[$type][self::CLOSE_TAG_KEY], $type));
 }
示例#12
0
 protected function _deactivateModule()
 {
     $file = Mage::getBaseDir('etc') . DS . 'modules' . DS . 'Netzarbeiter_GroupsCatalog.xml';
     $io = new Varien_Io_File();
     if (!$io->fileExists($file)) {
         $message = Mage::helper('netzarbeiter_groupscatalog2')->__("The file app/etc/modules/Netzarbeiter_GroupsCatalog.xml doesn't exist.");
         Mage::throwException($message);
     }
     $xml = simplexml_load_file($file);
     if (in_array((string) $xml->modules->Netzarbeiter_GroupsCatalog->active, array('true', '1'), true)) {
         if (!$io->isWriteable($file)) {
             $message = Mage::helper('netzarbeiter_groupscatalog2')->__('The file app/etc/modules/Netzarbeiter_GroupsCatalog.xml is not writable.<br/>' . 'Please fix it and flush the configuration cache, or deactivate the module manually in that file.');
             Mage::throwException($message);
         }
         $xml->modules->Netzarbeiter_GroupsCatalog->active = 'false';
         $xml->asXML($file);
         Mage::app()->cleanCache(Mage_Core_Model_Config::CACHE_TAG);
     }
 }
示例#13
0
 protected function _beforeSave()
 {
     $io = new Varien_Io_File();
     $realPath = $io->getCleanPath(Mage::getBaseDir() . '/' . $this->getSitemapPath());
     if (!$io->allowedPath($realPath, Mage::getBaseDir())) {
         Mage::throwException(Mage::helper('xsitemap')->__('Please define correct path'));
     }
     if (!$io->fileExists($realPath, false)) {
         Mage::throwException(Mage::helper('xsitemap')->__('Please create the specified folder "%s" before saving the sitemap.', $this->getSitemapPath()));
     }
     if (!$io->isWriteable($realPath)) {
         Mage::throwException(Mage::helper('xsitemap')->__('Please make sure that "%s" is writable by web-server.', $this->getSitemapPath()));
     }
     if (!preg_match('#^[a-zA-Z0-9_\\.]+$#', $this->getSitemapFilename())) {
         Mage::throwException(Mage::helper('xsitemap')->__('Please use only letters (a-z or A-Z), numbers (0-9) or underscore (_) in the filename. No spaces or other characters are allowed.'));
     }
     if (!preg_match('#\\.xml$#', $this->getSitemapFilename())) {
         $this->setSitemapFilename($this->getSitemapFilename() . '.xml');
     }
     $this->setSitemapPath(rtrim(str_replace(str_replace('\\', '/', Mage::getBaseDir()), '', $realPath), '/') . '/');
     return parent::_beforeSave();
 }
示例#14
0
 /**
  * Process File Queue
  * @return Mage_Catalog_Model_Product_Type_Abstract
  */
 public function processFileQueue()
 {
     if (empty($this->_fileQueue)) {
         return $this;
     }
     foreach ($this->_fileQueue as &$queueOptions) {
         if (isset($queueOptions['operation']) && ($operation = $queueOptions['operation'])) {
             switch ($operation) {
                 case 'receive_uploaded_file':
                     $src = isset($queueOptions['src_name']) ? $queueOptions['src_name'] : '';
                     $dst = isset($queueOptions['dst_name']) ? $queueOptions['dst_name'] : '';
                     /** @var $uploader Zend_File_Transfer_Adapter_Http */
                     $uploader = isset($queueOptions['uploader']) ? $queueOptions['uploader'] : null;
                     $path = dirname($dst);
                     $io = new Varien_Io_File();
                     if (!$io->isWriteable($path) && !$io->mkdir($path, 0777, true)) {
                         Mage::throwException(Mage::helper('catalog')->__("Cannot create writeable directory '%s'.", $path));
                     }
                     $uploader->setDestination($path);
                     if (empty($src) || empty($dst) || !$uploader->receive($src)) {
                         /**
                          * @todo: show invalid option
                          */
                         if (isset($queueOptions['option'])) {
                             $queueOptions['option']->setIsValid(false);
                         }
                         Mage::throwException(Mage::helper('catalog')->__("File upload failed"));
                     }
                     Mage::helper('core/file_storage_database')->saveFile($dst);
                     break;
                 case 'move_uploaded_file':
                     $src = $queueOptions['src_name'];
                     $dst = $queueOptions['dst_name'];
                     move_uploaded_file($src, $dst);
                     Mage::helper('core/file_storage_database')->saveFile($dst);
                     break;
                 default:
                     break;
             }
         }
         $queueOptions = null;
     }
     return $this;
 }
示例#15
0
 /**
  * Generate XML file
  *
  * @return ET_FeedSalidzini_Model_Feedsalidzini
  */
 public function generateXml()
 {
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $this->getPath()));
     if ($io->fileExists($this->getXmlfileFilename()) && !$io->isWriteable($this->getXmlfileFilename())) {
         Mage::throwException(Mage::helper('feedsalidzini')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $this->getXmlfileFilename(), $this->getPath()));
     }
     $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><root></root>');
     $storeId = $this->getStoreId();
     $appEmulation = Mage::getSingleton('core/app_emulation');
     $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
     /* @var $collection Mage_Catalog_Model_Resource_Product_Collection
      * @var $product Mage_Catalog_Model_Product
      * @var $categories Mage_Catalog_Model_Resource_Category_Collection
      * @var $category Mage_Catalog_Model_Category
      * @var $stockCollection Mage_CatalogInventory_Model_Resource_Stock_Item_Collection
      * @var $stockItem Mage_CatalogInventory_Model_Stock_Item
      */
     /* Collecting categories info */
     $categories = Mage::getModel('catalog/category')->getCollection();
     $categories->addIsActiveFilter();
     $categories->addNameToResult();
     $categories->addUrlRewriteToResult();
     foreach ($categories as $category) {
         $this->_tmpCategories[$category->getId()] = array('id' => $category->getId(), 'level' => $category->getLevel(), 'name' => $category->getName(), 'path' => $category->getPathIds(), 'url' => $_SERVER["SCRIPT_FILENAME"] ? str_replace($_SERVER["SCRIPT_FILENAME"] . "/", "", $category->getUrl()) : $category->getUrl(), 'parent' => $category->getParentCategory()->getId());
     }
     /* Collecting product stock info */
     $stockCollection = Mage::getModel('cataloginventory/stock_item')->getCollection();
     foreach ($stockCollection as $stockItem) {
         $this->_stock[$stockItem->getProductId()] = $stockItem->getQty();
     }
     unset($stockCollection);
     /* Subproduct collection */
     if ($this->_includeStock && $this->_emulateStock == 2) {
         /* @var $db Varien_Db_Adapter_Interface */
         $db = Mage::getSingleton('core/resource')->getConnection('core_write');
         $model = Mage::getResourceModel('catalog/product');
         $superTable = $model->getTable("catalog_product_super_link");
         $query = $db->query("SELECT * FROM " . $superTable);
         while ($row = $query->fetch()) {
             if (!isset($this->_superProducts[$row["parent_id"]])) {
                 $this->_superProducts[$row["parent_id"]] = array();
             }
             $this->_superProducts[$row["parent_id"]][] = $row["product_id"];
         }
     }
     /* Attribute collection */
     /* @var $attributes Mage_Eav_Model_Resource_Entity_Attribute_Collection
      * @var $attribute Mage_Eav_Model_Entity_Attribute
      */
     $attributes = Mage::getSingleton('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection()->addFieldToFilter('attribute_code', array('in', $this->_nameAttributes));
     foreach ($attributes as $attribute) {
         if (!in_array($attribute->getFrontendInput(), array('select', 'multiselect'))) {
             continue;
         }
         $options = $attribute->getSource()->getAllOptions();
         $this->_attributeOptions[$attribute->getAttributeCode()] = array();
         foreach ($options as $option) {
             $this->_attributeOptions[$attribute->getAttributeCode()][$option['value']] = $option['label'];
         }
     }
     /* Collecting product info */
     $collection = Mage::getModel('catalog/product')->getCollection();
     $collection->addFieldToFilter("type_id", array("in" => $this->_filterProductTypes));
     $collection->addAttributeToFilter("visibility", array("in" => $this->_filterProductVisibility));
     $collection->addStoreFilter($storeId);
     $collection->addAttributeToSelect("name");
     foreach ($this->_nameAttributes as $attr) {
         $collection->addAttributeToSelect($attr);
     }
     if (!in_array("manufacturer", $this->_nameAttributes)) {
         $collection->addAttributeToSelect("manufacturer");
     }
     $collection->addAttributeToSelect("model");
     $collection->addAttributeToSelect("price");
     $collection->addAttributeToSelect("status");
     $collection->addCategoryIds();
     $collection->addUrlRewrite();
     $collection->addFinalPrice();
     //echo $collection->getSelect();
     foreach ($collection as $product) {
         if (!$this->_shouldExport($product)) {
             continue;
         }
         $maxLevel = -1;
         if ($this->_hideDuplicates) {
             $selectedCategory = false;
             foreach ($product->getCategoryIds() as $categoryId) {
                 if (isset($this->_tmpCategories[$categoryId])) {
                     $categoryInfo = $this->_tmpCategories[$categoryId];
                     if ($categoryInfo['level'] > $maxLevel) {
                         $maxLevel = $categoryInfo['level'];
                         $selectedCategory = $categoryInfo;
                     }
                 }
             }
             $xml = $this->_addItemXml($xml, $product, $selectedCategory, $this->_stock);
         } else {
             foreach ($product->getCategoryIds() as $categoryId) {
                 if (isset($this->_tmpCategories[$categoryId]) && $this->_tmpCategories[$categoryId]['level'] > 1) {
                     $selectedCategory = $this->_tmpCategories[$categoryId];
                     $xml = $this->_addItemXml($xml, $product, $selectedCategory);
                 }
             }
         }
     }
     unset($collection);
     $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
     $io->streamOpen($this->getXmlfileFilename());
     $io->streamWrite($xml->asXML());
     $io->streamClose();
     $this->setXmlfileTime(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
     $this->save();
     return $this;
 }
示例#16
0
 /**
  * @param $source
  * @return bool|string
  */
 public function createThumbnail($source)
 {
     if (!is_file($this->getImagesPath() . $source) || !is_readable($this->getImagesPath() . $source)) {
         return false;
     }
     $io = new Varien_Io_File();
     if (!$io->isWriteable($this->getThumbnailsPath())) {
         $io->mkdir($this->getThumbnailsPath());
     }
     if (!$io->isWriteable($this->getThumbnailsPath())) {
         return false;
     }
     $image = Varien_Image_Adapter::factory('GD2');
     $image->open($this->getImagesPath() . $source);
     $width = Mage::app()->getStore()->getConfig('slider/thumbnail/width');
     $height = Mage::app()->getStore()->getConfig('slider/thumbnail/height');
     $image->keepAspectRatio(true);
     $image->resize($width, $height);
     $destination = $this->getThumbnailsPath() . pathinfo($source, PATHINFO_BASENAME);
     $image->save($destination);
     if (is_file($destination)) {
         return $destination;
     }
     return false;
 }
示例#17
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);
     /**
      * 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);
     }
     unset($collection);
     /**
      * Generate products sitemap
      */
     /**
      * Hans2103 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 = '<url><loc>' . htmlspecialchars($baseUrl . $item->getUrl()) . '</loc>';
         $image = Mage::getResourceModel('catalog/product')->getAttributeRawValue($item->getId(), 'image', $storeId);
         $imageLoc = '';
         $imageTitle = '';
         if ($image) {
             $imageLoc = str_replace('index.php/', '', Mage::getURL('media/catalog/product') . substr($image, 1));
             $imageTitle = htmlspecialchars(Mage::getResourceModel('catalog/product')->getAttributeRawValue($item->getId(), 'name', $storeId));
             $xml .= '<image:image><image:loc>' . $imageLoc . '</image:loc><image:title>' . $imageTitle . '</image:title></image:image>';
         }
         $product = Mage::getModel('catalog/product')->load($item->getId());
         $_images = $product->getMediaGalleryImages();
         foreach ($_images as $image) {
             $xml .= '<image:image><image:loc>' . $image->getUrl() . '</image:loc></image:image>';
         }
         unset($product);
         $xml .= '<lastmod>' . $date . '</lastmod><changefreq>' . $changefreq . '</changefreq><priority>' . $priority . '</priority></url>' . "\n";
         $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;
 }
示例#18
0
文件: Import.php 项目: rcclaudrey/dev
 function backup()
 {
     $x7a = "stristr";
     $x7b = "is_readable";
     $x7c = "time";
     $x7d = "file_get_contents";
     $x7e = "in_array";
     $x7f = "implode";
     $x80 = "array_key_exists";
     $x81 = "trim";
     $x82 = "str_replace";
     $x83 = "log";
     $x84 = "is_array";
     $x85 = "json_encode";
     $x86 = "json_decode";
     $x87 = "array_splice";
     $x88 = "array_unshift";
     $x89 = "count";
     $x8a = "is_numeric";
     $x8b = "array_push";
     $x8c = "strtolower";
     $x8d = "strstr";
     $x8e = "explode";
     $x8f = "addslashes";
     $x53 = array();
     $x75 = array();
     $x76 = array();
     $x51 = Mage::getSingleton("core/resource");
     $x52 = $x51->getConnection("core_read");
     $this->_tables["csi"] = Mage::getSingleton("core/resource")->getTableName("cataloginventory_stock_item");
     $this->_tables["cpe"] = Mage::getSingleton("core/resource")->getTableName("catalog_product_entity");
     $x8b($x53, "LEFT JOIN `" . $this->_tables["cpe"] . "` AS `cpe` ON `cpe`.`entity_id`=`csi`.`product_id`");
     if (Mage::helper("core")->isModuleEnabled("Wyomind_Advancedinventory")) {
         $x75[] = null;
         $x76[] = null;
         $this->_tables["ais"] = Mage::getSingleton("core/resource")->getTableName("advancedinventory_stock");
         $x77 = Mage::getModel("pointofsale/pointofsale")->getPlaces();
         foreach ($x77 as $x4d) {
             $x8b($x53, "LEFT JOIN `" . $this->_tables["ais"] . "` AS `ai_" . $x4d->getPlaceId() . "` ON `ai_" . $x4d->getPlaceId() . "`.`product_id`=`cpe`.`entity_id` AND `ai_" . $x4d->getPlaceId() . "`.`place_id`=" . $x4d->getPlaceId() . "");
             $x75[] = "ai_" . $x4d->getPlaceId() . ".`quantity_in_stock` AS `ai_stock_" . $x4d->getPlaceId() . "`";
         }
     }
     $x88($x53, "SELECT  `cpe`.`sku` " . $x7f(', ', $x75) . ", `csi`.`qty`,`csi`.`is_in_stock` FROM `" . $this->_tables["csi"] . "` AS `csi`");
     $x8b($x53, "WHERE `sku` IS NOT NULL " . $x7f(" AND ", $x76) . "");
     Mage::$x83("-------------------- BACKUP PROCESS --------------------", null, "MassStockUpate.{$x83}");
     Mage::$x83("---> MySql request : " . $x7f(' ', $x53), null, "MassStockUpate.{$x83}");
     $x62 = $x52->fetchAll($x7f(" ", $x53));
     $x31 = new Varien_Io_File();
     $x31->setAllowCreateFolders(true);
     $x3d = Mage::getStoreConfig("massstockupdate/settings/backup_file") . "-" . $x7c() . ".csv";
     $x78 = Mage::getStoreConfig("massstockupdate/settings/backup_dir");
     $x31->open(array("path" => Mage::getBaseDir() . "/" . $x78));
     if ($x31->fileExists($x3d) && !$x31->isWriteable($x3d)) {
         Mage::throwException(Mage::helper("ordersexporttool")->__("File '%s' cannot be saved. Please, make sure the directory %s' is writeable by web server.", $x3d, $this->getPath()));
     }
     $x31->streamOpen($x3d, "w");
     foreach ($x62 as $x79) {
         $x31->streamWriteCsv($x79, ";");
     }
     $x31->streamClose();
     Mage::getSingleton("core/session")->addSuccess(Mage::helper("massstockupdate")->__("Backup created :   '%s'.", $x78 . $x3d));
     Mage::$x83("---> DONE : " . $x78 . $x3d, null, "MassStockUpate.{$x83}");
     return;
 }
 protected function _beforeSave()
 {
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $pathmap = $this->getConfig()->getPathMap();
     // this is the path that will be used for save the files ( pathmap )
     $realPath = $io->getCleanPath(Mage::getBaseDir() . DS . $this->getSitemapPath());
     // this is the path that will be displayed
     $realPath_db = $realPath;
     if ($pathmap != '') {
         $realPath = $io->getCleanPath(Mage::getBaseDir() . DS . $pathmap . DS . $this->getSitemapPath());
     }
     /**
      * Check exists and writeable path
      */
     if (!$io->fileExists($realPath, false)) {
         if (!$io->checkAndCreateFolder($realPath)) {
             Mage::throwException(Mage::helper('sitemapEnhancedPlus')->__('Please create the specified folder "%s" before saving the sitemap.', Mage::helper('core')->htmlEscape($realPath)));
         }
     }
     if (!$io->isWriteable($realPath)) {
         Mage::throwException(Mage::helper('sitemapEnhancedPlus')->__('Please make sure that "%s" is writable by web-server.', $realPath));
     }
     /**
      * Check allow filename
      */
     if (preg_match('#^[a-zA-Z0-9_\\.]+$#', $this->getSitemapFilename())) {
         //Mage::throwException(Mage::helper('sitemapEnhancedPlus')->__('Please use only letters (a-z or A-Z), numbers (0-9) or underscore (_) in the filename. No spaces or other characters are allowed.'));
     }
     if ($this->getConfig()->getUseCompression()) {
         $this->setSitemapFilename($this->getHelper()->clearExtension($this->getSitemapFilename()) . '.xml.gz');
     } else {
         $this->setSitemapFilename($this->getHelper()->clearExtension($this->getSitemapFilename()) . '.xml');
     }
     if (!$this->getHelper()->isUnique($this)) {
         Mage::throwException(Mage::helper('sitemapEnhancedPlus')->__('Please select another filename/path, as another sitemap with same filename already exists on the specified location.'));
     }
     $this->setSitemapPath(rtrim(str_replace(str_replace('\\', '/', Mage::getBaseDir()), '', $realPath_db), '/') . '/');
     return Mage_Core_Model_Abstract::_beforeSave();
 }
示例#20
0
 /**
  * Create thumbnail for image and save it to thumbnails directory
  *
  * @param string $source Image path to be resized
  * @param bool $keepRation Keep aspect ratio or not
  * @return bool|string Resized filepath or false if errors were occurred
  */
 public function resizeFile($source, $keepRation = true)
 {
     if (!is_file($source) || !is_readable($source)) {
         return false;
     }
     $targetDir = $this->getThumbsPath($source);
     $io = new Varien_Io_File();
     if (!$io->isWriteable($targetDir)) {
         $io->mkdir($targetDir);
     }
     if (!$io->isWriteable($targetDir)) {
         return false;
     }
     $image = Varien_Image_Adapter::factory('GD2');
     $image->open($source);
     $width = $this->getConfigData('resize_width');
     $height = $this->getConfigData('resize_height');
     $image->keepAspectRatio($keepRation);
     $image->resize($width, $height);
     $dest = $targetDir . DS . pathinfo($source, PATHINFO_BASENAME);
     $image->save($dest);
     if (is_file($dest)) {
         return $dest;
     }
     return false;
 }
示例#21
0
 public function isWriteable($file)
 {
     $io = new Varien_Io_File();
     $io->open(array('path' => Mage::getBaseDir()));
     return $io->isWriteable($file);
 }
 /**
  * Return path of the current selected directory or root directory for startup
  * Try to create target directory if it doesn't exist
  *
  * @throws Mage_Core_Exception
  * @return string
  */
 public function getCurrentPath()
 {
     if (!$this->_currentPath) {
         $currentPath = realpath($this->getStorageRoot());
         $node = $this->_getRequest()->getParam($this->getTreeNodeName());
         if ($node) {
             $path = realpath($this->convertIdToPath($node));
             if (is_dir($path) && false !== stripos($path, $currentPath)) {
                 $currentPath = $path;
             }
         }
         $io = new Varien_Io_File();
         if (!$io->isWriteable($currentPath) && !$io->mkdir($currentPath)) {
             $message = Mage::helper('cms')->__('The directory %s is not writable by server.', $currentPath);
             Mage::throwException($message);
         }
         $this->_currentPath = $currentPath;
     }
     return $this->_currentPath;
 }
示例#23
0
 protected function _beforeSave()
 {
     $io = new Varien_Io_File();
     $pathmap = $this->getHelper()->getGeneralConf($this->getStoreId())->getPathMap();
     if ($pathmap) {
         $pathmap = DS . $pathmap;
     }
     $realPath = $io->getCleanPath(Mage::getBaseDir() . $pathmap . DS . $this->getSitemapPath());
     $realPath_save = $io->getCleanPath(Mage::getBaseDir() . DS . $this->getSitemapPath());
     $_isCompressed = $this->getHelper()->getGeneralConf($this->getStoreId())->getUsecompression();
     /**
      * Check path is allow
      */
     if (!$pathmap) {
         if (!$io->allowedPath($realPath, Mage::getBaseDir())) {
             Mage::throwException(Mage::helper('sitemap')->__('Please define correct path'));
         }
     }
     /**
      * Check exists and writeable path
      */
     if (!$io->fileExists($realPath, false)) {
         Mage::throwException(Mage::helper('sitemap')->__('Please create the specified folder "%s" before saving the sitemap.', Mage::helper('core')->htmlEscape($realPath)));
     }
     if (!$io->isWriteable($realPath)) {
         Mage::throwException(Mage::helper('sitemap')->__('Please make sure that "%s" is writable by web-server.', $realPath));
     }
     /**
      * Check allow filename
      */
     if (!preg_match('#^[a-zA-Z0-9_\\.]+$#', $this->getSitemapFilename())) {
         Mage::throwException(Mage::helper('sitemap')->__('Please use only letters (a-z or A-Z), numbers (0-9) or underscore (_) in the filename. No spaces or other characters are allowed.'));
     }
     if ($_isCompressed) {
         $this->setSitemapFilename($this->getHelper()->clearExtension($this->getSitemapFilename()) . '.xml.gz');
     } else {
         $this->setSitemapFilename($this->getHelper()->clearExtension($this->getSitemapFilename()) . '.xml');
     }
     if (!$this->getHelper()->isUnique($this)) {
         Mage::throwException(Mage::helper('sitemap')->__('Please select another filename/path, as another sitemap with same filename already exists on the specified location.'));
     }
     $this->setSitemapPath(rtrim(str_replace(str_replace('\\', '/', Mage::getBaseDir()), '', $realPath_save), '/') . '/');
     return Mage_Core_Model_Abstract::_beforeSave();
 }
 /**
  * Returns an xml file with contains the urls for
  * - categories url
  * - products in categories (with the ids of products and category)
  * - products url
  * - other cms pages
  * This can e.g. be used to create a horizontal navigation in the product view
  * @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->getOptimizedSitemapFilename()) && !$io->isWriteable($this->getOptimizedSitemapFilename())) {
         Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $this->getOptimizedSitemapFilename(), $this->getPath()));
     }
     $io->streamOpen($this->getOptimizedSitemapFilename());
     $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
     $io->streamWrite('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:narfstudios="http://www.narf-studios.de">');
     $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);
     foreach ($collection as $item) {
         $url = $baseUrl . $item->getUrl();
         $url = str_replace('/index.php', '', $url);
         $xml = sprintf('<url><narfstudios:type>category</narfstudios:type><narfstudios:catid>' . $item->getId() . '</narfstudios:catid><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($url), $date, $changefreq, $priority);
         $io->streamWrite($xml);
     }
     unset($collection);
     /**
      * Generate products in categories sitemap
      */
     $collection = Mage::getResourceModel('sitemap/catalog_category')->getCollection($storeId);
     foreach ($collection as $item) {
         $category = Mage::getModel('catalog/category')->load($item->getId());
         $pCollection = $category->getProductCollection();
         $pCollection->addAttributeToFilter('status', 1);
         $pCollection->addAttributeToFilter('visibility', 4);
         //catalog, search
         $pCollection->addAttributeToSort('name', 'asc');
         foreach ($pCollection as $product) {
             $product = Mage::getModel('catalog/product')->load($product->getId());
             $burl = Mage::getBaseUrl() . Mage::getModel('core/url_rewrite')->loadByIdPath('product/' . $product->getId() . '/' . $category->getId())->getRequestPath();
             $url = str_replace('/index.php', '', $burl);
             $xml = sprintf('<url><narfstudios:type>category_product</narfstudios:type><narfstudios:catid>' . $category->getId() . '</narfstudios:catid><narfstudios:pid>' . $product->getId() . '</narfstudios:pid><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($url), $date, $changefreq, $priority);
             $io->streamWrite($xml);
         }
     }
     /**
      * 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);
     foreach ($collection as $item) {
         $xml = sprintf('<url><narfstudios:type>product</narfstudios:type><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();
     parent::generateXml();
     return $this;
 }
示例#25
0
 /**
  * Create Writeable directory if it doesn't exist
  *
  * @param string Absolute directory path
  * @return void
  */
 protected function _createWriteableDir($path)
 {
     $io = new Varien_Io_File();
     if (!$io->isWriteable($path) && !$io->mkdir($path, 0777, true)) {
         Mage::throwException(Mage::helper('catalog')->__("Cannot create writeable directory '%s'.", $path));
     }
 }
示例#26
0
 public function transformXmlToCsv($file, $xpath, $limit = -1)
 {
     $xml = new SimpleXMLElement(file_get_contents($file));
     $xml = $xml->xpath($xpath);
     $columns = array();
     $products = array();
     foreach ($xml as $product) {
         $tmp = array();
         foreach ($product as $key => $value) {
             if (!in_array($key, $columns)) {
                 $columns[] = $key;
             }
             $tmp[$key] = (string) $value;
         }
         $products[] = $tmp;
     }
     $csv = implode(";", $columns) . "\n";
     $counter = 0;
     foreach ($products as $product) {
         if ($limit != -1 && $counter > $limit) {
             break;
         }
         $tmp = array();
         foreach ($columns as $column) {
             if (array_key_exists($column, $product)) {
                 $tmp[] = trim(str_replace("\n", " ", $product[$column]));
             } else {
                 $tmp[] = "";
             }
         }
         $csv .= implode(";", $tmp) . "\n";
         $counter++;
     }
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $realPath = $io->getCleanPath(Mage::getBaseDir() . '/var/tmp/');
     $io->open(array('path' => $realPath));
     $csv_file = "msu_" . time() . ".csv";
     if ($io->isWriteable($realPath)) {
         //var_dump($realPath.$csv_file); return;
         $io->streamOpen($realPath . $csv_file, 'w');
         $io->streamWrite($csv);
         $io->streamClose();
         return "var/tmp/" . $csv_file;
     } else {
         return array("Cannot access '{$realPath}' on this server.");
     }
 }
 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;
 }
示例#28
0
 public function generateXml()
 {
     $x11f = "strlen";
     $x120 = "implode";
     $x121 = "str_replace";
     $x122 = "utf8_encode";
     $x123 = "preg_match_all";
     $x124 = "preg_match";
     $x125 = "rtrim";
     $x126 = "is_null";
     $x127 = "number_format";
     $x128 = "count";
     $x129 = "is_numeric";
     $x12a = "explode";
     $x12b = "substr";
     $x12c = "trim";
     $x12d = "preg_split";
     $x12e = "utf8_decode";
     $x12f = "is_string";
     $x130 = "json_decode";
     $x131 = "is_array";
     $x132 = "ucwords";
     $x133 = "array_push";
     $x134 = "print_r";
     $x135 = "version_compare";
     $x136 = "in_array";
     $x137 = "sprintf";
     $x138 = "array_pop";
     $x139 = "ceil";
     $x13a = "ini_get";
     $x13b = "set_time_limit";
     $x13c = "unserialize";
     $x13d = "getType";
     $x13e = "round";
     $x13f = "str_pad";
     $x140 = "abs";
     $x141 = "floor";
     $x142 = "usort";
     $x143 = "array_shift";
     $x144 = "array_reverse";
     $x145 = "array_values";
     $x146 = "preg_replace";
     $x147 = "strip_tags";
     $x148 = "html_entity_decode";
     $x149 = "htmlspecialchars";
     $x14a = "strrpos";
     $x14b = "stristr";
     $x14c = "mb_strtolower";
     $x14d = "mb_strtoupper";
     $x14e = "htmlentities";
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> --------------- START PROCESS FOR " . strtoupper($this->getSimplegoogleshoppingFilename(false)) . "-----------------", null, $this->getSimplegoogleshoppingFilename() . '.log');
     ini_set('memory_limit', Mage::getStoreConfig("simplegoogleshopping/system/memory_limit") . 'M');
     $this->_debug = isset($_GET['debug']) ? true : false;
     $x50 = $this->_indexPhp;
     $x3d = new Varien_Io_File();
     $x3d->setAllowCreateFolders(true);
     if (!$this->_display) {
         $x3d->open(array('path' => $this->getPath()));
         if ($x3d->fileExists($this->getSimplegoogleshoppingFilename()) && !$x3d->isWriteable($this->getSimplegoogleshoppingFilename())) {
             Mage::throwException(Mage::helper('simplegoogleshopping')->__('File "\\45\\163" cannot be saved. Please, make sure the directory "\\45\\163" is writeable by web server.', $this->getSimplegoogleshoppingFilename(), $this->getPath()));
         }
         $x3d->streamOpen($this->getSimplegoogleshoppingFilename());
     }
     $x51 = array("ac" => "activation_code", "ak" => "activation_key", "bu" => "base_url", "md" => "md5", "th" => "this", "dm" => "_demo", "ext" => "sgs", "ver" => "8.1.0");
     $x12f(Mage::app()->getRequest()->getParam("store_id")) ? $x52 = Mage::app()->getRequest()->getParam("store_id") : ($x52 = $this->getStoreId());
     $x53 = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
     $x54 = Mage::getDesign()->getSkinUrl();
     $x55 = Mage::getStoreConfig("catalog/placeholder/image_placeholder", $x52);
     $x56 = Mage::getStoreConfig("currency/options/base", $x52);
     $x57 = Mage::getStoreConfig("cataloginventory/item_options/manage_stock", $x52);
     $x58 = Mage::getStoreConfig("cataloginventory/item_options/backorders", $x52);
     $x59 = Mage::app()->getStore($x52)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, false);
     $x5a = Mage::getModel('core/store')->load($x52)->getBaseUrl();
     $x5b = Mage::app()->getStore($x52)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA, false);
     $x5c = Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, $x52);
     $x5d = Mage::app()->getStore($x52)->getRootCategoryId();
     $x5e = Mage::app()->getStore()->getStoreId();
     $x5f = array("activation_key" => Mage::getStoreConfig("simplegoogleshopping/license/activation_key"), "activation_code" => Mage::getStoreConfig("simplegoogleshopping/license/activation_code"), "base_url" => Mage::getStoreConfig("web/secure/base_url"));
     $x12f(Mage::app()->getRequest()->getParam("simplegoogleshopping_xmlitempattern")) ? $x60 = Mage::app()->getRequest()->getParam("simplegoogleshopping_xmlitempattern") : ($x60 = $this->getSimplegoogleshoppingXmlitempattern());
     $x12f(Mage::app()->getRequest()->getParam("simplegoogleshopping_title")) ? $x61 = Mage::app()->getRequest()->getParam("simplegoogleshopping_title") : ($x61 = $this->getSimplegoogleshoppingTitle());
     $x12f(Mage::app()->getRequest()->getParam("simplegoogleshopping_description")) ? $x62 = Mage::app()->getRequest()->getParam("simplegoogleshopping_description") : ($x62 = $this->getSimplegoogleshoppingDescription());
     $x12f(Mage::app()->getRequest()->getParam("simplegoogleshopping_categories")) ? $x63 = $x130(Mage::app()->getRequest()->getParam("simplegoogleshopping_categories")) : ($x63 = $x130($this->getSimplegoogleshoppingCategories()));
     $x12f(Mage::app()->getRequest()->getParam("category_filter")) ? $x64 = Mage::app()->getRequest()->getParam("category_filter") : ($x64 = $this->getSimplegoogleshoppingCategoryFilter());
     $x65 = array();
     $x66 = array();
     if ($x131($x63)) {
         foreach ($x63 as $x67) {
             if ($x67->checked) {
                 $x65[] = $x67->line;
             }
         }
         foreach ($x63 as $x67) {
             if ($x67->mapping != "") {
                 $x66[$x67->line] = $x67->mapping;
             }
         }
     }
     if ($x128($x65) < 1) {
         $x65[] = '*';
     }
     $x12f(Mage::app()->getRequest()->getParam("simplegoogleshopping_type_ids")) ? $x68 = $x12a(',', Mage::app()->getRequest()->getParam("simplegoogleshopping_type_ids")) : ($x68 = $x12a(',', $this->getSimplegoogleshoppingTypeIds()));
     $x12f(Mage::app()->getRequest()->getParam("simplegoogleshopping_visibility")) ? $x69 = $x12a(',', Mage::app()->getRequest()->getParam("simplegoogleshopping_visibility")) : ($x69 = $x12a(',', $this->getSimplegoogleshoppingVisibility()));
     $x12f(Mage::app()->getRequest()->getParam("simplegoogleshopping_attributes")) ? $x6a = $x130(Mage::app()->getRequest()->getParam("simplegoogleshopping_attributes")) : ($x6a = $x130($this->getSimplegoogleshoppingAttributes()));
     $x12f(Mage::app()->getRequest()->getParam("simplegoogleshopping_attribute_sets")) ? $x6b = $x12a(',', Mage::app()->getRequest()->getParam("simplegoogleshopping_attribute_sets")) : ($x6b = $x12a(',', $this->getSimplegoogleshoppingAttributeSets()));
     if ($x5f[$x51['ac']] != $x51["md"]($x51["md"]($x5f[$x51['ak']]) . $x51["md"]($x5f[$x51['bu']]) . $x51["md"]($x51["ext"]) . $x51["md"]($x51["ver"]))) {
         ${$x51}["ext"] = "valid";
         ${$x51}["th"]->{$x51}["dm"] = true;
     } else {
         ${$x51}["th"]->{$x51}["dm"] = false;
         ${$x51}["ext"] = "valid";
     }
     $x6c = '';
     $x6d = '';
     header("Content-Type: text/html; charset=utf-8");
     $x6c = '<?xml version="1.0" encoding="utf-8" ?>' . "\n";
     $x6c .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">' . "\n";
     $x6c .= '<channel>' . "\n";
     $x6c .= '<title>' . $x61 . "</title>\n";
     $x6c .= '<link>' . $x12b($x59, 0, -1) . "</link>\n";
     $x6c .= '<description>' . $x62 . "</description>\n";
     if (!isset(${$x51}["ext"]) || ${$x51}["th"]->{$x51}["dm"]) {
         ${$x51}["th"]->{$x51}["dm"] = true;
         return ${$x51}["th"];
     }
     if ($this->_display) {
         $x6d = $this->x155($x6c);
     } else {
         $x3d->streamWrite($this->x155($x6c));
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " . $this->getSimplegoogleshoppingFilename() . " created and opened", null, $this->getSimplegoogleshoppingFilename() . '.log');
     }
     $x39 = '/{([a-zA-Z_0-9:]+)(\\sparent|\\sgrouped|\\sconfigurable|\\sbundle)?([^}|]*)(\\s?\\|\\s?)?(([a-zA-Z_0-9:]+)(\\sparent|\\sgrouped|\\sconfigurable|\\sbundle)?([^}|]*))?(\\s?\\|\\s?)?(([a-zA-Z_0-9:]+)(\\sparent|\\sgrouped|\\sconfigurable|\\sbundle)?([^}|]*))?(\\s?\\|\\s?)?(([a-zA-Z_0-9:]+)(\\sparent|\\sgrouped|\\sconfigurable|\\sbundle)?([^}|]*))?}/';
     $x123($x39, $x60, $x3a);
     foreach ($x3a[6] as $x3b => $x6e) {
         if ($x6e != "") {
             $x3a[0][] = $x3a[0][$x3b];
             $x3a[1][] = $x6e;
             $x3a[2][] = $x3a[7][$x3b];
             $x3a[3][] = $x3a[8][$x3b];
             $x3a[4][] = $x3a[9][$x3b];
         }
     }
     foreach ($x3a[11] as $x3b => $x6e) {
         if ($x6e != "") {
             $x3a[0][] = $x3a[0][$x3b];
             $x3a[1][] = $x6e;
             $x3a[2][] = $x3a[7][$x3b];
             $x3a[3][] = $x3a[8][$x3b];
             $x3a[4][] = $x3a[9][$x3b];
         }
     }
     foreach ($x3a[16] as $x3b => $x6e) {
         if ($x6e != "") {
             $x3a[0][] = $x3a[0][$x3b];
             $x3a[1][] = $x6e;
             $x3a[2][] = $x3a[7][$x3b];
             $x3a[3][] = $x3a[8][$x3b];
             $x3a[4][] = $x3a[9][$x3b];
         }
     }
     $x3a[0][] = "{categories,[1],[1],[1]}";
     $x3a[1][] = "categories";
     $x3a[2][] = "";
     $x3a[3][] = ",[1],[1],[1]";
     $x6f = array();
     $x70 = array();
     foreach ($x3a[1] as $x3b => $x6e) {
         $x6f[$x3b]['methodName'] = "get" . $x121(' ', '', $x132($x12c($x6e)) . '()');
         $x6f[$x3b]['pattern'] = "{" . $x12c($x6e) . "}";
         $x6f[$x3b]['fullpattern'] = $x3a[0][$x3b];
         $x6f[$x3b]['name'] = $x12c($x6e);
         $x6f[$x3b]['reference'] = $x12c($x3a[2][$x3b]);
         if (empty($x6f[$x3b]['reference'])) {
             $x6f[$x3b]['reference'] = 'self';
         }
         switch ($x6f[$x3b]['name']) {
             case 'url':
                 $x133($x70, 'url_key');
                 break;
             case 'uri':
                 $x133($x70, 'url_key');
                 break;
             case 'G:IMAGE_LINK':
                 $x133($x70, 'image');
                 $x133($x70, 'small_image');
                 $x133($x70, 'thumbnail');
                 break;
             case 'SC:IMAGES':
                 $x133($x70, 'image');
                 $x133($x70, 'small_image');
                 $x133($x70, 'thumbnail');
                 break;
             case 'SC:DESCRIPTION':
                 $x133($x70, 'description');
                 $x133($x70, 'short_description');
                 $x133($x70, 'manufacturer');
                 $x133($x70, 'name');
                 $x133($x70, 'sku');
                 break;
             case 'SC:EAN':
                 $x133($x70, 'ean');
                 break;
             case 'SC:URL':
                 $x133($x70, 'url_key');
                 $x133($x70, 'url');
                 break;
             default:
                 $x133($x70, $x6f[$x3b]['name']);
         }
         $x6f[$x3b]["value"] = '$product->get' . $x6f[$x3b]['name'] . "()";
         $x6f[$x3b]["getText"] = 'getAttributeText(\'' . $x12c($x6e) . '\')';
         $x71 = '/\\[([^\\]]+)\\]/';
         $x123($x71, $x3a[3][$x3b], $x72);
         $x6f[$x3b]["options"] = $x72[1];
     }
     if ($this->_debug) {
         echo "----------------------------------------------<br>\r\n                   ------------ DEBUG MODE ----------------<br> \n                   ----------------------------------------------<br><br>";
         echo "<br><br>------------ ATTRIBUTES ----------------<br>";
         $x134($x6f);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Product template analyzed", null, $this->getSimplegoogleshoppingFilename() . '.log');
     $x73 = Mage::getModel('catalog/category')->getCollection()->setStoreId($x52)->addAttributeToSelect('name', 'store_id')->addAttributeToSelect('is_active')->addAttributeToSelect('include_in_menu');
     $x74 = array();
     foreach ($x73 as $x75) {
         $x74[$x75->getId()]['name'] = $x75->getName();
         $x74[$x75->getId()]['path'] = $x75->getPath();
         $x74[$x75->getId()]['level'] = $x75->getLevel();
         if ($x135(Mage::getVersion(), '1.6.0', '<') || Mage::getStoreConfig("simplegoogleshopping/system/include_in_menu")) {
             $x74[$x75->getId()]['include_in_menu'] = true;
         } else {
             $x74[$x75->getId()]['include_in_menu'] = $x75->getIncludeInMenu();
         }
     }
     if ($this->_debug) {
         echo "<br><br>------------ CATEGORIES ----------------<br>";
         $x134($x74);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Categories collected", null, $this->getSimplegoogleshoppingFilename() . '.log');
     $x76 = Mage::getSingleton('core/resource');
     $x77 = $x76->getConnection('core_read');
     $x78 = $x76->getTableName('eav_entity_type');
     $x79 = $x77->select()->from($x78)->where('entity_type_code=\'catalog_product\'');
     $x7a = $x77->fetchAll($x79);
     $x7b = $x7a[0]['entity_type_id'];
     $x76 = Mage::getSingleton('core/resource');
     $x77 = $x76->getConnection('core_read');
     $x7c = $x76->getTableName('directory_currency_rate');
     $x79 = $x77->select()->from($x7c)->where('currency_from=\'' . $x56 . '\'');
     $x41 = $x77->fetchAll($x79);
     $x7d = array();
     foreach ($x41 as $x40) {
         $x7d[$x40['currency_to']] = $x40['rate'];
     }
     $this->_currencies = $x7d;
     if ($this->_debug) {
         echo "<br><br>------------ CURRENCIES ----------------<br>";
         $x134($x7d);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Currencies rate collected", null, $this->getSimplegoogleshoppingFilename() . '.log');
     $x7e = Mage::getResourceModel('eav/entity_attribute_collection')->setEntityTypeFilter($x7b)->addSetInfo()->getData();
     $x7f = array();
     $x80 = array();
     foreach ($x7e as $x3b => $x6e) {
         if ($x136($x6e['attribute_code'], $x70)) {
             $x133($x7f, $x6e['attribute_code']);
             $x80[$x6e['attribute_code']] = $x6e['frontend_input'];
         }
     }
     if (!$x136('special_price', $x7f)) {
         $x7f[] = 'special_price';
     }
     if (!$x136('special_from_date', $x7f)) {
         $x7f[] = 'special_from_date';
     }
     if (!$x136('special_to_date', $x7f)) {
         $x7f[] = 'special_to_date';
     }
     if (!$x136('price_type', $x7f)) {
         $x7f[] = 'price_type';
     }
     if (!$x136('price', $x7f)) {
         $x7f[] = 'price';
     }
     $x7f[] = 'tax_class_id';
     foreach ($x6a as $x81) {
         if (!$x136($x81->code, $x7f) && $x81->checked) {
             if (!$x136($x81->code, array("is_in_stock", "qty", "entity_id", "created_at", "updated_at"))) {
                 $x7f[] = $x81->code;
             }
         }
     }
     if ($this->_debug) {
         echo "<br><br>------------ ATTRIBUTES ----------------<br>";
         $x134($x7f);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> List of required attributes collected", null, $this->getSimplegoogleshoppingFilename() . '.log');
     $x76 = Mage::getSingleton('core/resource');
     $x77 = $x76->getConnection('core_read');
     $x82 = $x76->getTableName('eav_attribute_option_value');
     $x79 = $x77->select();
     $x79->from($x82);
     $x79->where("store_id=" . $x52 . ' OR store_id=0');
     $x79->order(array('option_id', 'store_id'));
     $x83 = $x77->fetchAll($x79);
     foreach ($x83 as $x84) {
         $x85[$x84['option_id']][$x84['store_id']] = $x84['value'];
     }
     if ($this->_debug) {
         echo "<br><br>------------ ATTRIBUTES LABEL ----------------<br>";
         $x134($x85);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> List of attribute labels collected", null, $this->getSimplegoogleshoppingFilename() . '.log');
     $x86 = $x76->getTableName('tax_class');
     $x87 = $x76->getTableName('tax_calculation');
     $x88 = $x76->getTableName('tax_calculation_rate');
     $x89 = $x76->getTableName('directory_country_region');
     $x8a = $x76->getTableName('customer_group');
     $x79 = $x77->select();
     $x79->from($x86)->order(array('class_id', 'tax_calculation_rate_id'));
     $x79->joinleft(array('tc' => $x87), 'tc.product_tax_class_id = ' . $x86 . '.class_id', 'tc.tax_calculation_rate_id');
     $x79->joinleft(array('tcr' => $x88), 'tcr.tax_calculation_rate_id = tc.tax_calculation_rate_id', array('tcr.rate', 'tax_country_id', 'tax_region_id'));
     $x79->joinleft(array('dcr' => $x89), 'dcr.region_id=tcr.tax_region_id', 'code');
     $x79->joinInner(array('cg' => $x8a), 'cg.tax_class_id=tc.customer_tax_class_id AND cg.customer_group_code="NOT LOGGED IN"');
     $x8b = $x77->fetchAll($x79);
     $x45 = array();
     $x8c = '';
     foreach ($x8b as $x8d) {
         if ($x8c != $x8d['class_id']) {
             $x8e = 0;
         } else {
             $x8e++;
         }
         $x8c = $x8d['class_id'];
         $x45[$x8d['class_id']][$x8e]['rate'] = $x8d['rate'];
         $x45[$x8d['class_id']][$x8e]['code'] = $x8d['code'];
         $x45[$x8d['class_id']][$x8e]['country'] = $x8d['tax_country_id'];
     }
     $this->_rates = $x45;
     if ($this->_debug) {
         echo "<br><br>------------ TAX CLASS ----------------<br>";
         $x134($x45);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Tax rate collected", null, $this->getSimplegoogleshoppingFilename() . '.log');
     $x8f = $x76->getTableName('review');
     $x90 = $x76->getTableName('review_store');
     $x91 = $x76->getTableName('rating_option_vote');
     $x92 = $x77->select()->distinct('review_id');
     $x92->from(array("r" => $x8f), array("COUNT(DISTINCT r.review_id) AS count", 'entity_pk_value'));
     $x92->joinleft(array('rs' => $x90), 'rs.review_id=r.review_id', 'rs.store_id');
     $x92->joinleft(array('rov' => $x91), 'rov.review_id=r.review_id', 'AVG(rov.percent) AS score');
     $x92->where("status_id=1 and entity_id=1");
     $x92->group(array('r.entity_pk_value', 'rs.store_id'));
     $x93 = $x77->select();
     $x93->from(array("r" => $x8f), array("COUNT(DISTINCT r.review_id) AS count", 'entity_pk_value', "(SELECT 0) AS  store_id"));
     $x93->joinleft(array('rs' => $x90), 'rs.review_id=r.review_id', array());
     $x93->joinleft(array('rov' => $x91), 'rov.review_id=r.review_id', 'AVG(rov.percent) AS score');
     $x93->where("status_id=1 and entity_id=1");
     $x93->group(array('r.entity_pk_value'));
     $x79 = $x77->select()->union(array($x92, $x93));
     $x79->order(array('entity_pk_value', 'store_id'));
     $x94 = $x77->fetchAll($x79);
     $x95 = array();
     foreach ($x94 as $x96) {
         $x95[$x96['entity_pk_value']][$x96['store_id']]["count"] = $x96["count"];
         $x95[$x96['entity_pk_value']][$x96['store_id']]['score'] = $x96['score'];
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Reviews collected", null, $this->getSimplegoogleshoppingFilename() . '.log');
     $x76 = Mage::getSingleton('core/resource');
     $x77 = $x76->getConnection('core_read');
     $x97 = $x76->getTableName('catalog_product_entity_media_gallery');
     $x98 = $x76->getTableName('catalog_product_entity_media_gallery_value');
     $x79 = $x77->select(array("DISTINCT value"));
     $x79->from($x97);
     $x79->joinleft(array('cpemgv' => $x98), 'cpemgv.value_id = ' . $x97 . '.value_id', array('cpemgv.position', 'cpemgv.disabled'));
     $x79->where("value<>TRIM('') AND (store_id=" . $x52 . ' OR store_id=0)');
     $x79->order(array('position', 'value_id'));
     $x79->group(array('value_id'));
     $x99 = $x77->fetchAll($x79);
     foreach ($x99 as $x9a) {
         $x9b[$x9a['entity_id']]['src'][] = $x9a['value'];
         $x9b[$x9a['entity_id']]['disabled'][] = $x9a['disabled'];
     }
     if ($this->_debug) {
         echo "<br><br>------------ IMAGES ----------------<br>";
         $x134($x9b);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Images collected", null, $this->getSimplegoogleshoppingFilename() . '.log');
     Mage::app()->setCurrentStore($x52);
     $x9c = $x76->getTableName("cataloginventory_stock_item");
     $x9d = $x76->getTableName("core_url_rewrite");
     $x7c = $x76->getTableName('catalog_category_product');
     $x9e = $x76->getTableName('catalog_category_product_index');
     $x9f = $x76->getTableName('catalog_product_index_price');
     $xa0 = $x76->getTableName('catalog_product_super_link');
     $xa1 = $x76->getTableName('catalog_product_link');
     $xa2 = $x76->getTableName('catalog_product_bundle_selection');
     $x135(Mage::getVersion(), '1.6.0', '<') ? $x72 = "options=''" : ($x72 = "ISNULL(options)");
     switch (Mage::getStoreConfig("simplegoogleshopping/system/urlrewrite")) {
         case 1:
             $xa3 = "AND url.target_path NOT LIKE '%category%'";
             $xa4 = 'MAX';
             break;
         default:
             $xa3 = "AND url.target_path LIKE '%category%'";
             $xa4 = 'GROUP_CONCAT';
             break;
             break;
     }
     $xa5 = Mage::getModel('simplegoogleshopping/product_collection')->getCollection()->addStoreFilter($x52);
     $xa5->addAttributeToFilter('status', 1);
     $xa5->addAttributeToFilter('type_id', array("in" => "configurable"));
     $xa5->addAttributeToFilter('visibility', array("nin" => 1));
     $xa5->addAttributeToSelect($x7f, true);
     $xa5->getSelect()->joinLeft($xa0 . ' AS cpsl', 'cpsl.parent_id=e.entity_id ', array('child_ids' => 'GROUP_CONCAT( DISTINCT cpsl.product_id)'));
     $xa5->getSelect()->joinLeft($x9c . ' 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', 'backorders' => 'backorders', 'use_config_backorders' => 'use_config_backorders'));
     $xa5->getSelect()->joinLeft($x9d . ' AS url', 'url.product_id=e.entity_id ' . $xa3 . ' AND is_system=1 AND ' . $x72 . ' AND url.store_id=' . $x52, array('request_path' => $xa4 . '(DISTINCT request_path)'));
     $xa5->getSelect()->joinLeft($x7c . ' AS categories', 'categories.product_id=e.entity_id');
     $xa5->getSelect()->joinLeft($x9e . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x52, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     $xa5->getSelect()->group(array('cpsl.parent_id'));
     $xa6 = array();
     foreach ($xa5 as $xa7) {
         foreach ($x12a(",", $xa7->getChildIds()) as $xa8) {
             $xa6[$xa8] = $xa7;
             $xa9[$xa8]['categories_ids'] = $xa7->getCategories_ids();
             $xa9[$xa8]['parent_id'] = $xa7->getId();
             $xa9[$xa8]['parent_sku'] = $xa7->getSku();
             $xa9[$xa8]['parent_request_path'] = $xa7->getRequestPath();
         }
     }
     $this->configurable = $xa6;
     if ($this->_debug) {
         echo "<br><br>------------ CONFIGURABLES ----------------<br>";
         echo $xa5->getSelect() . '<br><br>';
         $x134($xa9);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Relations with configurable products detected", null, $this->getSimplegoogleshoppingFilename() . '.log');
     $xa5 = Mage::getModel('simplegoogleshopping/product_collection')->getCollection()->addStoreFilter($x52);
     $xa5->addAttributeToFilter('status', 1);
     $xa5->addAttributeToFilter('type_id', array("in" => "configurable"));
     $xa5->addAttributeToFilter('visibility', array("nin" => 1));
     $xa5->getSelect()->joinLeft($xa0 . ' AS cpsl', 'cpsl.parent_id=e.entity_id ');
     $xa5->getSelect()->joinLeft($x9c . ' AS stock', 'stock.product_id=cpsl.product_id', array('qty' => 'SUM(stock.qty)'));
     $xa5->getSelect()->group(array('cpsl.parent_id'));
     $xaa = array();
     foreach ($xa5 as $xab) {
         $xaa[$xab->getId()] = $xab->getQty();
     }
     $this->configurableQty = $xaa;
     if ($this->_debug) {
         echo "<br><br>------------ CONFIGURABLES QTY ----------------<br>";
         echo $xa5->getSelect() . '<br><br>';
         $x134($xaa);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Qty for configurable products calculated", null, $this->getSimplegoogleshoppingFilename() . '.log');
     $xa5 = Mage::getModel('simplegoogleshopping/product_collection')->getCollection()->addStoreFilter($x52);
     $xa5->addAttributeToFilter('status', 1);
     $xa5->addAttributeToFilter('type_id', array("in" => "grouped"));
     $xa5->addAttributeToFilter('visibility', array("nin" => 1));
     $xa5->addAttributeToSelect($x7f, true);
     $xa5->getSelect()->joinLeft($xa1 . ' AS cpl', 'cpl.product_id=e.entity_id AND cpl.link_type_id=3', array('child_ids' => 'GROUP_CONCAT( DISTINCT cpl.linked_product_id)'));
     $xa5->getSelect()->joinLeft($x9c . ' 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', 'backorders' => 'backorders', 'use_config_backorders' => 'use_config_backorders'));
     $xa5->getSelect()->joinLeft($x9d . ' AS url', 'url.product_id=e.entity_id ' . $xa3 . ' AND is_system=1 AND ' . $x72 . ' AND url.store_id=' . $x52, array('request_path' => $xa4 . '(DISTINCT request_path)'));
     $xa5->getSelect()->joinLeft($x7c . ' AS categories', 'categories.product_id=e.entity_id');
     $xa5->getSelect()->joinLeft($x9e . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x52, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     $xa5->getSelect()->group(array('cpl.product_id'));
     $xac = array();
     foreach ($xa5 as $xa7) {
         foreach ($x12a(",", $xa7->getChildIds()) as $xa8) {
             $xac[$xa8] = $xa7;
             $xad[$xa8]['categories_ids'] = $xa7->getCategories_ids();
             $xad[$xa8]['parent_id'] = $xa7->getId();
             $xad[$xa8]['parent_sku'] = $xa7->getSku();
             $xad[$xa8]['parent_request_path'] = $xa7->getRequestPath();
         }
     }
     $this->grouped = $xac;
     if ($this->_debug) {
         echo "<br><br>------------ GROUPED ----------------<br>";
         echo $xa5->getSelect() . '<br><br>';
         $x134($xad);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Relations with grouped products detected", null, $this->getSimplegoogleshoppingFilename() . '.log');
     $xa5 = Mage::getModel('simplegoogleshopping/product_collection')->getCollection()->addStoreFilter($x52);
     $xa5->addAttributeToFilter('status', 1);
     $xa5->addAttributeToFilter('type_id', array("in" => "bundle"));
     $xa5->addAttributeToFilter('visibility', array("nin" => 1));
     $xa5->addAttributeToSelect($x7f, true);
     $xa5->getSelect()->joinLeft($xa2 . ' AS cpbs', 'cpbs.parent_product_id=e.entity_id', array('child_ids' => 'GROUP_CONCAT( DISTINCT cpbs.product_id)'));
     $xa5->getSelect()->joinLeft($x9c . ' 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', 'backorders' => 'backorders', 'use_config_backorders' => 'use_config_backorders'));
     $xa5->getSelect()->joinLeft($x9d . ' AS url', 'url.product_id=e.entity_id ' . $xa3 . ' AND is_system=1 AND ' . $x72 . ' AND url.store_id=' . $x52, array('request_path' => $xa4 . '(DISTINCT request_path)'));
     $xa5->getSelect()->joinLeft($x7c . ' AS categories', 'categories.product_id=e.entity_id');
     $xa5->getSelect()->joinLeft($x9e . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x52, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     $xa5->getSelect()->group(array('e.entity_id'));
     $xae = array();
     foreach ($xa5 as $xa7) {
         foreach ($x12a(",", $xa7->getChildIds()) as $xa8) {
             $xae[$xa8] = $xa7;
             $xaf[$xa8]['parent_id'] = $xa7->getId();
             $xaf[$xa8]['parent_sku'] = $xa7->getSku();
             $xaf[$xa8]['parent_request_path'] = $xa7->getRequestPath();
             $xaf[$xa8]['categories_ids'] = $xa7->getCategories_ids();
         }
     }
     $this->bundle = $xae;
     if ($this->_debug) {
         echo "<br><br>------------ BUNDLE ----------------<br>";
         echo $xa5->getSelect() . '<br><br>';
         $x134($xaf);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Relations with bundle products detected", null, $this->getSimplegoogleshoppingFilename() . '.log');
     $xb0 = $x76->getTableName("catalog_product_option");
     $xb1 = $x76->getTableName("catalog_product_option_title");
     $xb2 = $x76->getTableName("catalog_product_option_type_value");
     $xb3 = $x76->getTableName("catalog_product_option_type_title");
     $xb4 = $x76->getTableName("catalog_product_option_type_price");
     $xb5 = $x77->select();
     $xb5->from(array("cpo" => $xb0), array("product_id"));
     $xb5->joinleft(array("cpot" => $xb1), "cpot.option_id=cpo.option_id AND cpot.store_id=0", array("option" => "title", "option_id", "store_id"));
     $xb5->joinleft(array("cpotv" => $xb2), "cpotv.option_id = cpo.option_id", "sku");
     $xb5->joinleft(array("cpott" => $xb3), "cpott.option_type_id=cpotv.option_type_id AND cpott.store_id=cpot.store_id", "title AS value");
     $xb5->joinleft(array("cpotp" => $xb4), "cpotp.option_type_id=cpotv.option_type_id AND cpotp.store_id=cpot.store_id", array("price", "price_type"));
     $x79 = $xb5->order(array("product_id", "cpotv.sort_order ASC"));
     $x94 = $x77->fetchAll($x79);
     $xb6 = array();
     $xb7 = 0;
     foreach ($x94 as $xb8) {
         $xb6[$xb8["product_id"]][$xb8["option"]]["options"][] = array("value" => $xb8["value"], "sku" => $xb8["sku"], "price" => $xb8["price"], "price_type" => $xb8["price_type"]);
         $xb7++;
     }
     $this->customOptions = $xb6;
     if ($this->_debug) {
         echo "<br><br>------------ CUSTOM OPTIONS ----------------<br>";
         echo $xb5 . '<br><br>';
         $x134($xb6);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Custom options collected", null, $this->getSimplegoogleshoppingFilename() . '.log');
     if (Mage::helper("core")->isModuleEnabled("Wyomind_Googlemerchantpromotions")) {
         $xb9 = Mage::getResourceModel('salesrule/rule_collection')->setOrder('sort_order', 'ASC')->addFieldToFilter("transferable_to_google_merchant", 1)->load();
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Promotions rules collected", null, $this->getSimplegoogleshoppingFilename() . '.log');
     }
     $xba = Mage::getModel('simplegoogleshopping/product_collection')->getCollection()->addStoreFilter($x52);
     if (Mage::getStoreConfig("simplegoogleshopping/system/disabled")) {
         $xba->addFieldToFilter("status", array('gteq' => 1));
     } else {
         $xba->addFieldToFilter("status", 1);
     }
     $xba->addAttributeToFilter("type_id", array("in" => $x68));
     $xba->addAttributeToFilter("visibility", array("in" => $x69));
     if ($x6b[0] != '*') {
         $xba->addAttributeToFilter("attribute_set_id", array("in" => $x6b));
     }
     $xba->addAttributeToSelect($x7f, true);
     $xbb = 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)");
     $xbc = '';
     $x36 = 0;
     $xbd = array();
     foreach ($x6a as $x81) {
         if ($x81->checked) {
             if ($x81->condition == 'in' || $x81->condition == 'nin') {
                 if ($x81->code == 'qty' || $x81->code == 'is_in_stock') {
                     $xbe = $x12a(',', $x81->value);
                     $x81->value = "'" . $x120($xbe, "','") . "'";
                 } else {
                     $x81->value = $x12a(',', $x81->value);
                 }
             }
             switch ($x81->code) {
                 case 'qty':
                     if ($x36 > 0) {
                         $xbc .= ' ' . $x81->statement . ' ';
                     }
                     $xbc .= " qty " . $x137($xbb[$x81->condition], $x81->value);
                     $x36++;
                     break;
                 case 'is_in_stock':
                     if ($x36 > 0) {
                         $xbc .= ' ' . $x81->statement . ' ';
                     }
                     $xbc .= " (IF(";
                     $xbc .= "(use_config_manage_stock=1 AND {$x57}=0)";
                     $xbc .= " OR ";
                     $xbc .= '(use_config_manage_stock=0 AND manage_stock=0)';
                     $xbc .= " OR ";
                     $xbc .= "(use_config_manage_stock=1 AND {$x57}=1 AND is_in_stock=1 )";
                     $xbc .= " OR ";
                     $xbc .= "(use_config_manage_stock=0 AND manage_stock=1 AND is_in_stock=1 )";
                     $xbc .= ",'1','0')" . $x137($xbb[$x81->condition], $x81->value) . ")";
                     $x36++;
                     break;
                 default:
                     if ($x81->statement == "AND") {
                         if ($x128($xbd)) {
                             $xba->addFieldToFilter($xbd);
                         }
                         $xbd = array();
                     }
                     if ($x81->condition == "in") {
                         $xbf = true;
                         $xc0 = array();
                         foreach ($x81->value as $xc1) {
                             if (!$x129($xc1)) {
                                 $xbf = true;
                             }
                         }
                         if ($xbf) {
                             foreach ($x81->value as $xc1) {
                                 $xc0[] = array(array("finset" => $xc1));
                             }
                             $xbd[] = array("attribute" => $x81->code, $xc0);
                         } else {
                             $xbd[] = array("attribute" => $x81->code, $x81->condition => $x81->value);
                         }
                     } else {
                         $xbd[] = array("attribute" => $x81->code, $x81->condition => $x81->value);
                     }
                     break;
             }
         }
     }
     if ($x128($xbd)) {
         $xba->addFieldToFilter($xbd);
     }
     $xba->getSelect()->joinLeft($x9c . ' 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', 'backorders' => 'backorders', 'use_config_backorders' => 'use_config_backorders'));
     $xba->getSelect()->joinLeft($x9d . ' AS url', 'url.product_id=e.entity_id ' . $xa3 . ' AND is_system=1 AND ' . $x72 . ' AND url.store_id=' . $x52, array('request_path' => $xa4 . '(DISTINCT request_path)'));
     $xba->getSelect()->joinLeft($x7c . ' AS categories', 'categories.product_id=e.entity_id');
     if ($x65[0] != '*') {
         $xc1 = 0;
         $xc2 = null;
         foreach ($x65 as $x67) {
             if ($xc1 > 0) {
                 $xc2 .= ',';
             }
             $xc2 .= $x138($x12a('/', $x67));
             $xc1++;
         }
         $x64 ? $xc3 = "IN" : ($xc3 = "NOT IN");
         $xc2 = "AND categories_index.category_id " . $xc3 . " (" . $xc2 . ")";
         $xba->getSelect()->joinInner($x9e . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x52 . ' ' . $xc2, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     } else {
         $xba->getSelect()->joinLeft($x9e . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x52, array('categories_ids' => 'GROUP_CONCAT(DISTINCT categories_index.category_id)'));
     }
     if ($x135(Mage::getVersion(), '1.4.0', '>=')) {
         $xba->getSelect()->joinLeft($x9f . ' 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($x52)->getWebsiteId(), array('min_price' => 'min_price', 'max_price' => 'max_price', 'tier_price' => 'tier_price', 'final_price' => 'final_price'));
     }
     if (!empty($xbc)) {
         $xba->getSelect()->where($xbc);
     }
     $xba->getSelect()->group("e.entity_type_id");
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Main sql request: \n" . $xba->getSelect(), null, $this->getSimplegoogleshoppingFilename() . '.log');
     }
     if ($this->_debug) {
         echo "<br><br>------------ MAIN SQL REQUEST ----------------<br>";
         echo $xba->getSelect();
     }
     $xc4 = 0;
     $xc5 = clone $xba;
     $xc5->getSelect()->columns("COUNT(DISTINCT e.entity_id) As total");
     $this->_counter = $xc5->getFirstItem()->getTotal();
     $xc6 = $x139($this->_counter / $this->_sqlSize);
     $x6c = '';
     $xc7 = 1;
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Total items calculated ({$this->_counter} in {$xc6} queries )", null, $this->getSimplegoogleshoppingFilename() . '.log');
     while ($xc4 < $xc6) {
         $xa5 = clone $xba;
         if ($this->_debug) {
             echo "<br><br>------------ SQL ----------------<br>";
             print $xa5->getSelect();
         }
         $xa5->getSelect()->limit($this->_sqlSize, $this->_sqlSize * $xc4);
         $xa5->getSelect()->group(array('e.entity_id'));
         $xc4++;
         if ($this->_sqlSize * $xc4 > $this->_counter) {
             $xc8 = $this->_counter;
         } else {
             $xc8 = $this->_sqlSize * $xc4;
         }
         if ($this->_log) {
             Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Fetching products from " . ($this->_sqlSize * ($xc4 - 1) + 1) . " to " . $xc8, null, $this->getSimplegoogleshoppingFilename() . '.log');
         }
         $xb7 = 1;
         foreach ($xa5 as $product) {
             if ($this->_debug) {
                 echo "<br><br>------------ PRODUCT [ SKU -> " . $product->getSku() . " | ID -> " . $product->getId() . "]---------------<br>";
                 echo "categories : " . $product->getCategoriesIds() . ", Root id: " . $x5d . "<br>";
                 foreach ($x12a(',', $product->getCategoriesIds()) as $x3b => $x75) {
                     echo $x75 . "=>" . $x74[$x75]["path"] . "<br>";
                 }
             }
             if (!$x13a('safe_mode')) {
                 $x13b(60);
             }
             $x49 = $x60;
             foreach ($x6f as $x3b => $xc9) {
                 $x4b = "";
                 switch ($xc9['pattern']) {
                     case '{G:PROMOTION_ID}':
                         $x4b = "";
                         $xca = clone $xb9;
                         foreach ($xca as $xcb) {
                             if ($xcb->getIsActive()) {
                                 $xcc = $x13c($xcb->getConditions_serialized());
                                 $xcc = $xcc["conditions"];
                                 $xcd = $xcb->getConditions();
                                 $xce = $xcd->getAggregator() === 'all';
                                 $xcf = (bool) $xcd->getValue();
                                 $xd0 = $xce ? true : false;
                                 $xd0 = !$x128($xcd->getConditions()) ? true : $xd0;
                                 $xd1 = 0;
                                 foreach ($xcd->getConditions() as $xd2) {
                                     $xd3 = array("salesrule/rule_condition_product_subselect", "salesrule/rule_condition_address");
                                     if (!$x136($xd2->{$x13d}(), $xd3)) {
                                         $xd4 = $xd2->validate($product);
                                         if ($xce && $xd4 !== $xcf) {
                                             $xd0 = false;
                                         } elseif (!$xce && $xd4 === $xcf) {
                                             $xd0 = true;
                                             break;
                                         }
                                     } else {
                                         if ($xd2->getAttribute() == "base_subtotal") {
                                         }
                                     }
                                     $xd1++;
                                 }
                                 $xd5 = $x13c($xcb->getActions_serialized());
                                 $xd5 = $xd5["conditions"];
                                 $xd6 = $xcb->getActions();
                                 $xce = $xd6->getAggregator() === 'all';
                                 $xcf = (bool) $xd6->getValue();
                                 $xd7 = $xce ? true : false;
                                 $xd7 = !$x128($xd6->getConditions()) ? true : $xd7;
                                 $xd1 = 0;
                                 foreach ($xd6->getConditions() as $x51) {
                                     $xd4 = $x51->validate($product);
                                     if ($xce && $xd4 !== $xcf) {
                                         $xd7 = false;
                                     } elseif (!$xce && $xd4 === $xcf) {
                                         $xd7 = true;
                                         break;
                                     }
                                     $xd1++;
                                 }
                                 if ($xd7 && $xd0) {
                                     $x4b = "<g:promotion_id><![CDATA[" . $xcb->getData('rule_id') . "]]></g:promotion_id>";
                                     break;
                                 }
                             }
                         }
                         break;
                     case "{load_options}":
                         $x94 = 1;
                         $xd8 = array();
                         foreach ($xc9['options'] as $x3b => $xd9) {
                             if (isset($xb6[$product->getId()][$xd9])) {
                                 $x94 = $x94 * $x128($xb6[$product->getId()][$xd9]["options"]);
                                 $xd8[$x3b] = 0;
                             }
                         }
                         $x39 = array();
                         for ($x8e = 1; $x8e <= $x94; $x8e++) {
                             $xda = $x49;
                             foreach ($xc9['options'] as $x3b => $xd9) {
                                 if (isset($xb6[$product->getId()][$xd9])) {
                                     $xda = $x121("{" . $xd9 . "_label}", $xb6[$product->getId()][$xd9]["options"][$xd8[$x3b]]['value'], $xda);
                                     $xda = $x121("{" . $xd9 . "_sku}", $xb6[$product->getId()][$xd9]["options"][$xd8[$x3b]]['sku'], $xda);
                                     $xda = $x121("{" . $xd9 . "_price}", $xb6[$product->getId()][$xd9]["options"][$xd8[$x3b]]['price'], $xda);
                                     $xda = $x121("{" . $xd9 . "_type}", $xb6[$product->getId()][$xd9]["options"][$xd8[$x3b]]['price_type'], $xda);
                                     if ($x3b > 0 || $x128($xb6[$product->getId()]) == 1 || $x128($xc9['options']) < 2) {
                                         $xd8[$x3b]++;
                                     }
                                     if ($xd8[$x3b] >= $x128($xb6[$product->getId()][$xd9]["options"])) {
                                         $xd8[$x3b] = 0;
                                         $xd8[$x3b - 1]++;
                                     }
                                 }
                             }
                             $x39[] = $xda;
                         }
                         if ($x128($x39) > 0) {
                             $x49 = $x120("</item>\n<item>", $x39);
                         }
                         break;
                     case "{use_options}":
                         foreach ($xc9['options'] as $x3b => $xd9) {
                             if (isset($xb6[$product->getId()][$xd9])) {
                                 $xdb = array();
                                 $xdc = array();
                                 $xdd = array();
                                 foreach ($xb6[$product->getId()][$xd9]["options"] as $x4d) {
                                     $xdb[] = $x4d['value'];
                                     $xdc[] = $x4d['sku'];
                                     $xdd[] = $x4d['price'];
                                 }
                                 $x49 = $x121("{" . $xd9 . "_label}", $x120(',', $xdb), $x49);
                                 $x49 = $x121("{" . $xd9 . "_sku}", $x120(',', $xdc), $x49);
                                 $x49 = $x121("{" . $xd9 . "_price}", $x120(',', $xdd), $x49);
                             }
                         }
                         break;
                     case '{inc}':
                         $x4b = $xc7;
                         break;
                     case '{final_price}':
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $x3f = $xde->getFinalePrice();
                         !isset($xc9['options'][1]) ? $x44 = false : ($x44 = $xc9['options'][1]);
                         $x4b = $this->x153($x3f, $x5c, $xde->getTaxClassId(), $x44);
                         !isset($xc9['options'][0]) ? $x40 = $x56 : ($x40 = $xc9['options'][0]);
                         $x4b = $this->x152($x4b, $x40);
                         $x4b = $x127($x4b, 2, '.', '');
                         break;
                     case '{tier_price}':
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $x3f = $xde->getTierPrice();
                         !isset($xc9['options'][1]) ? $x44 = false : ($x44 = $xc9['options'][1]);
                         $x4b = $this->x153($x3f, $x5c, $xde->getTaxClassId(), $x44);
                         !isset($xc9['options'][0]) ? $x40 = $x56 : ($x40 = $xc9['options'][0]);
                         $x4b = $this->x152($x4b, $x40);
                         $x4b = $x127($x4b, 2, '.', '');
                         break;
                     case '{min_price}':
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $x3f = $xde->getMinPrice();
                         !isset($xc9['options'][1]) ? $x44 = false : ($x44 = $xc9['options'][1]);
                         $x4b = $this->x153($x3f, $x5c, $xde->getTaxClassId(), $x44);
                         !isset($xc9['options'][0]) ? $x40 = $x56 : ($x40 = $xc9['options'][0]);
                         $x4b = $this->x152($x4b, $x40);
                         $x4b = $x127($x4b, 2, '.', '');
                         break;
                     case '{max_price}':
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $x3f = $xde->getMaxPrice();
                         !isset($xc9['options'][1]) ? $x44 = false : ($x44 = $xc9['options'][1]);
                         $x4b = $this->x153($x3f, $x5c, $xde->getTaxClassId(), $x44);
                         !isset($xc9['options'][0]) ? $x40 = $x56 : ($x40 = $xc9['options'][0]);
                         $x4b = $this->x152($x4b, $x40);
                         $x4b = $x127($x4b, 2, '.', '');
                         break;
                     case '{normal_price}':
                         $xde = $this->checkReference($xc9['reference'], $product);
                         if ($xde->type_id == 'bundle') {
                             $x3f = $xde->price;
                         } else {
                             $x3f = $xde->getPrice();
                         }
                         !isset($xc9['options'][1]) ? $x44 = false : ($x44 = $xc9['options'][1]);
                         $x4b = $this->x153($x3f, $x5c, $xde->getTaxClassId(), $x44);
                         !isset($xc9['options'][0]) ? $x40 = $x56 : ($x40 = $xc9['options'][0]);
                         $x4b = $this->x152($x4b, $x40);
                         $x4b = $x127($x4b, 2, '.', '');
                         break;
                     case '{price}':
                         $xde = $this->checkReference($xc9['reference'], $product);
                         if ($xde->getSpecialFromDate() && !$xde->getSpecialToDate()) {
                             if ($xde->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xde->type_id == "bundle") {
                                     if (($xde->price_type || !$xde->price_type && $xde->special_price < $xde->price) && $xde->special_price > 0) {
                                         if ($xde->price_type) {
                                             $x3f = $x127($xde->price * $xde->special_price / 100, 2, ".", "");
                                         } else {
                                             $x3f = $xde->special_price;
                                         }
                                     } else {
                                         $x3f = $xde->price;
                                     }
                                 } else {
                                     $xde->getSpecial_price() && $xde->getSpecial_price() < $xde->getPrice() ? $x3f = $xde->getSpecialPrice() : ($x3f = $xde->getPrice());
                                 }
                             } else {
                                 if ($xde->type_id == "bundle") {
                                     $x3f = $xde->price;
                                 } else {
                                     $x3f = $xde->getPrice();
                                 }
                             }
                         } elseif ($xde->getSpecialFromDate() && $xde->getSpecialToDate()) {
                             if ($xde->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xde->getSpecialToDate()) {
                                 if ($xde->type_id == "bundle") {
                                     if (($xde->price_type || !$xde->price_type && $xde->special_price < $xde->price) && $xde->special_price > 0) {
                                         if ($xde->price_type) {
                                             $x3f = $x127($xde->price * $xde->special_price / 100, 2, ".", "");
                                         } else {
                                             $x3f = $xde->special_price;
                                         }
                                     } else {
                                         $x3f = $xde->price;
                                     }
                                 } else {
                                     $xde->getSpecial_price() && $xde->getSpecial_price() < $xde->getPrice() ? $x3f = $xde->getSpecialPrice() : ($x3f = $xde->getPrice());
                                 }
                             } else {
                                 if ($xde->type_id == "bundle") {
                                     $x3f = $xde->price;
                                 } else {
                                     $x3f = $xde->getPrice();
                                 }
                             }
                         } else {
                             if ($xde->type_id == "bundle") {
                                 if (($xde->price_type || !$xde->price_type && $xde->special_price < $xde->price) && $xde->special_price > 0) {
                                     if ($xde->price_type) {
                                         $x3f = $x127($xde->price * $xde->special_price / 100, 2, ".", "");
                                     } else {
                                         $x3f = $xde->special_price;
                                     }
                                 } else {
                                     $x3f = $xde->price;
                                 }
                             } else {
                                 $xde->getSpecial_price() && $xde->getSpecial_price() < $xde->getPrice() ? $x3f = $xde->getSpecialPrice() : ($x3f = $xde->getPrice());
                             }
                         }
                         !isset($xc9['options'][1]) ? $x44 = false : ($x44 = $xc9['options'][1]);
                         $x4b = $this->x153($x3f, $x5c, $xde->getTaxClassId(), $x44);
                         !isset($xc9["options"][0]) ? $x40 = $x56 : ($x40 = $xc9["options"][0]);
                         $x4b = $this->x152($x4b, $x40);
                         $x4b = $x127($x4b, 2, ".", "");
                         break;
                     case "{is_special_price}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         !isset($xc9["options"][0]) ? $xcf = 1 : ($xcf = $xc9["options"][0]);
                         !isset($xc9["options"][1]) ? $xdf = 0 : ($xdf = $xc9["options"][1]);
                         if ($xde->getSpecialFromDate() && !$xde->getSpecialToDate()) {
                             if ($xde->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xde->type_id == "bundle") {
                                     ($xde->price_type || !$xde->price_type && $xde->special_price < $xde->price) && $xde->special_price > 0 ? $x4b = $xcf : ($x4b = $xdf);
                                 } else {
                                     $xde->getSpecial_price() && $xde->getSpecial_price() < $xde->getPrice() ? $x4b = $xcf : ($x4b = $xdf);
                                 }
                             } else {
                                 if ($xde->type_id == "bundle") {
                                     $x4b = $xdf;
                                 } else {
                                     $x4b = $xdf;
                                 }
                             }
                         } elseif ($xde->getSpecialFromDate() && $xde->getSpecialToDate()) {
                             if ($xde->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xde->getSpecialToDate()) {
                                 if ($xde->type_id == "bundle") {
                                     ($xde->price_type || !$xde->price_type && $xde->special_price < $xde->price) && $xde->special_price > 0 ? $x4b = $xcf : ($x4b = $xdf);
                                 } else {
                                     $xde->getSpecial_price() && $xde->getSpecial_price() < $xde->getPrice() ? $x4b = $xcf : ($x4b = $xdf);
                                 }
                             } else {
                                 if ($xde->type_id == "bundle") {
                                     $x4b = $xdf;
                                 } else {
                                     $x4b = $xdf;
                                 }
                             }
                         } else {
                             if ($xde->type_id == "bundle") {
                                 ($xde->price_type || !$xde->price_type && $xde->special_price < $xde->price) && $xde->special_price > 0 ? $x4b = $xcf : ($x4b = $xdf);
                             } else {
                                 $xde->getSpecial_price() && $xde->getSpecial_price() < $xde->getPrice() ? $x4b = $xcf : ($x4b = $xdf);
                             }
                         }
                         break;
                     case "{special_price}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $x3f = null;
                         if ($xde->getSpecialFromDate() && !$xde->getSpecialToDate()) {
                             if ($xde->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xde->type_id == 'bundle') {
                                     if ($xde->price_type) {
                                         $x3f = $x127($xde->price * $xde->special_price / 100, 2, ".", "");
                                     } else {
                                         $x3f = $xde->special_price;
                                     }
                                 } else {
                                     $x3f = $xde->getSpecial_price();
                                 }
                             }
                         } elseif ($xde->getSpecialFromDate() && $xde->getSpecialToDate()) {
                             if ($xde->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xde->getSpecialToDate()) {
                                 if ($xde->type_id == 'bundle') {
                                     if ($xde->price_type) {
                                         $x3f = $x127($xde->price * $xde->special_price / 100, 2, ".", "");
                                     } else {
                                         $x3f = $xde->special_price;
                                     }
                                 } else {
                                     $x3f = $xde->getSpecial_price();
                                 }
                             }
                         } else {
                             if ($xde->type_id == 'bundle') {
                                 if ($xde->price_type) {
                                     $x3f = $x127($xde->price * $xde->special_price / 100, 2, ".", "");
                                 } else {
                                     $x3f = $xde->special_price;
                                 }
                             } else {
                                 $x3f = $xde->getSpecial_price();
                             }
                         }
                         !isset($xc9['options'][1]) ? $x44 = false : ($x44 = $xc9['options'][1]);
                         if ($x3f > 0) {
                             $x4b = $this->x153($x3f, $x5c, $xde->getTaxClassId(), $x44);
                             !isset($xc9['options'][0]) ? $x40 = $x56 : ($x40 = $xc9['options'][0]);
                             $x4b = $this->x152($x4b, $x40);
                             $x4b = $x127($x4b, 2, '.', '');
                         } else {
                             $x4b = "";
                         }
                         break;
                     case '{price_rules}':
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $x52 = $this->getStoreId();
                         $xe0 = Mage::getResourceModel('catalogrule/rule');
                         $xe1 = Mage::app()->getLocale()->storeTimeStamp($x52);
                         $xe2 = Mage::app()->getStore($x52);
                         $xe3 = $xe2->getWebsiteId();
                         $xe4 = Mage::getSingleton('customer/session')->getCustomerGroupId();
                         $xe5 = $xe0->getRulePrice($xe1, $xe3, $xe4, $xde->getId());
                         if ($xe5 !== false) {
                             $xe6 = $x137('%.2f', $x13e($xe5, 2));
                         } else {
                             $xe6 = $xde->getPrice();
                         }
                         if ($xde->getSpecialFromDate() && !$xde->getSpecialToDate()) {
                             if ($xde->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xde->type_id == "bundle") {
                                     if (($xde->price_type || !$xde->price_type && $xde->special_price < $xde->price) && $xde->special_price > 0) {
                                         if ($xde->price_type) {
                                             $x3f = $x127($xde->price * $xde->special_price / 100, 2, ".", "");
                                         } else {
                                             $x3f = $xde->special_price;
                                         }
                                     } else {
                                         $x3f = $xde->price;
                                     }
                                 } else {
                                     $xde->getSpecial_price() && $xde->getSpecial_price() < $xde->getPrice() ? $x3f = $xde->getSpecialPrice() : ($x3f = $xe6);
                                 }
                             } else {
                                 if ($xde->type_id == "bundle") {
                                     $x3f = $xde->price;
                                 } else {
                                     $x3f = $xe6;
                                 }
                             }
                         } elseif ($xde->getSpecialFromDate() && $xde->getSpecialToDate()) {
                             if ($xde->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xde->getSpecialToDate()) {
                                 if ($xde->type_id == "bundle") {
                                     if (($xde->price_type || !$xde->price_type && $xde->special_price < $xde->price) && $xde->special_price > 0) {
                                         if ($xde->price_type) {
                                             $x3f = $x127($xde->price * $xde->special_price / 100, 2, ".", "");
                                         } else {
                                             $x3f = $xde->special_price;
                                         }
                                     } else {
                                         $x3f = $xde->price;
                                     }
                                 } else {
                                     $xde->getSpecial_price() && $xde->getSpecial_price() < $xde->getPrice() ? $x3f = $xde->getSpecialPrice() : ($x3f = $xe6);
                                 }
                             } else {
                                 if ($xde->type_id == "bundle") {
                                     $x3f = $xde->price;
                                 } else {
                                     $x3f = $xe6;
                                 }
                             }
                         } else {
                             if ($xde->type_id == "bundle") {
                                 if (($xde->price_type || !$xde->price_type && $xde->special_price < $xde->price) && $xde->special_price > 0) {
                                     if ($xde->price_type) {
                                         $x3f = $x127($xde->price * $xde->special_price / 100, 2, ".", "");
                                     } else {
                                         $x3f = $xde->special_price;
                                     }
                                 } else {
                                     $x3f = $xde->price;
                                 }
                             } else {
                                 $xde->getSpecial_price() && $xde->getSpecial_price() < $xde->getPrice() ? $x3f = $xde->getSpecialPrice() : ($x3f = $xe6);
                             }
                         }
                         !isset($xc9['options'][1]) ? $x44 = false : ($x44 = $xc9['options'][1]);
                         $x4b = $this->x153($x3f, $x5c, $xde->getTaxClassId(), $x44);
                         !isset($xc9["options"][0]) ? $x40 = $x56 : ($x40 = $xc9["options"][0]);
                         $x4b = $this->x152($x4b, $x40);
                         $x4b = $x127($x4b, 2, ".", "");
                         break;
                     case "{G:SALE_PRICE}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $xe7 = Mage::getSingleton('core/date')->getGmtOffset("hours");
                         if ($xe7 > 0) {
                             $xe8 = "+";
                             $xe9 = $x13f($x140($x141($xe7)), 2, 0, STR_PAD_LEFT) . ':' . $x13f(($x140($xe7) - $x141($x140($xe7))) * 60, 2, 0, STR_PAD_LEFT);
                         } else {
                             $xe8 = "";
                             $xe9 = '-' . $x13f($x140($x141($xe7)), 2, 0, STR_PAD_LEFT) . ':' . $x13f(($x140($xe7) - $x141($x140($xe7))) * 60, 2, 0, STR_PAD_LEFT);
                         }
                         $xea = $x12b($x121(' ', 'T', $xde->getSpecialFromDate()), 0, -3);
                         $xeb = $x12b($x121(' ', 'T', $xde->getSpecialToDate()), 0, -3);
                         if ($xde->type_id == 'bundle' && $xde->special_price) {
                             if ($xde->price_type) {
                                 $x3f = $x127($xde->price * $xde->special_price / 100, 2, ".", "");
                             } else {
                                 $x3f = $xde->special_price;
                             }
                         } else {
                             $x3f = $xde->getSpecial_price();
                         }
                         !isset($xc9['options'][1]) ? $x44 = false : ($x44 = $xc9['options'][1]);
                         if ($x3f > 0) {
                             $x3f = $this->x153($x3f, $x5c, $xde->getTaxClassId(), $x44);
                             !isset($xc9['options'][0]) ? $x40 = $x56 : ($x40 = $xc9['options'][0]);
                             $x3f = $this->x152($x3f, $x40);
                             $x3f = $x127($x3f, 2, '.', '');
                         }
                         if ($x3f > 0) {
                             $x4b = "<g:sale_price><![CDATA[" . $x3f . " " . $x40 . "]]></g:sale_price>\n";
                         }
                         if ($x3f > 0 && $xeb) {
                             $x4b .= "<g:sale_price_effective_date><![CDATA[" . $xea . $xe8 . $xe9 . "/" . $xeb . $xe8 . $xe9 . "]]></g:sale_price_effective_date>\n";
                         }
                         break;
                     case "{image}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $xec = $xde->getImage();
                         if (!isset($xc9['options'][0]) || $xc9['options'][0] == 0) {
                             if ($xde->getImage() && $xde->getImage() != 'no_selection') {
                                 $xed = 'catalog/product/' . $xde->getImage();
                                 $x4b = $x5b . $x121('//', '/', $xed);
                             } else {
                                 $x4b = $x5b . '/catalog/product/placeholder/' . $x55;
                             }
                         } elseif (isset($x9b[$xde->getId()]['src'][$xc9['options'][0] - 1]) && $xc9['options'][0] > 0) {
                             if ($x9b[$xde->getId()]['src'][$xc9['options'][0] - 1] != $xec) {
                                 $xed = 'catalog/product/' . $x9b[$xde->getId()]['src'][$xc9['options'][0] - 1];
                                 $x4b = $x5b . $x121('//', '/', $xed);
                             }
                         }
                         break;
                     case "{G:IMAGE_LINK}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $xec = $xde->getImage();
                         $xee = array($xde->getSmall_image(), $xde->getThumbnail());
                         $xef = '';
                         $xd8 = 0;
                         if ($xde->getImage() && $xde->getImage() != 'no_selection') {
                             $xed = 'catalog/product/' . $xde->getImage();
                             $x4b = $x5b . $x121('//', '/', $xed);
                             $xef .= "<g:image_link><![CDATA[" . $x4b . "]]></g:image_link>\n";
                             $xd8++;
                         }
                         $xd1 = 0;
                         while (isset($x9b[$xde->getId()]['src'][$xd1]) && $xd8 < 10) {
                             if ($x9b[$xde->getId()]['src'][$xd1] != $xec) {
                                 if ($x136($x9b[$xde->getId()]['src'][$xd1], $xee) || $x9b[$xde->getId()]['disabled'][$xd1] != 1) {
                                     $xed = 'catalog/product/' . $x9b[$xde->getId()]['src'][$xd1];
                                     $x4b = $x5b . $x121('//', '/', $xed);
                                     $xef .= "<g:additional_image_link><![CDATA[" . $x4b . "]]></g:additional_image_link>\n";
                                     $xd8++;
                                 }
                             }
                             $xd1++;
                         }
                         $x4b = $xef;
                         break;
                     case "{url}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         if ($xde->getRequest_path()) {
                             if (Mage::getStoreConfig("simplegoogleshopping/system/urlrewrite") == 2) {
                                 $xf0 = $x12a(",", $xde->getRequest_path());
                                 $x142($xf0, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x14f'));
                                 $x4b = $x5a . $x138($xf0);
                             } elseif (Mage::getStoreConfig("simplegoogleshopping/system/urlrewrite") == 3) {
                                 $xf0 = $x12a(",", $xde->getRequest_path());
                                 $x142($xf0, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x14f'));
                                 $x4b = $x5a . $x143($xf0);
                             } else {
                                 $x4b = $x5a . $xde->getRequest_path();
                             }
                         } else {
                             $x4b = $xde->getProductUrl();
                         }
                         break;
                     case "{host}":
                         $x4b = $x5a;
                         break;
                     case "{uri}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         if ($xde->getRequest_path()) {
                             if (Mage::getStoreConfig("simplegoogleshopping/system/urlrewrite") == 2) {
                                 $xf0 = $x12a(",", $xde->getRequest_path());
                                 $x142($xf0, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x14f'));
                                 $x4b = $x138($xf0);
                             } elseif (Mage::getStoreConfig("simplegoogleshopping/system/urlrewrite") == 3) {
                                 $xf0 = $x12a(",", $xde->getRequest_path());
                                 $x142($xf0, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x14f'));
                                 $x4b = $x143($xf0);
                             } else {
                                 $x4b = $xde->getRequest_path();
                             }
                         } else {
                             $x4b = $x121($x5a, '', $xde->getProductUrl());
                         }
                         break;
                     case '{is_in_stock}':
                         $xde = $this->checkReference($xc9['reference'], $product);
                         !isset($xc9['options'][0]) ? $xf1 = 'in stock' : ($xf1 = $xc9['options'][0]);
                         !isset($xc9['options'][1]) ? $xf2 = "out of stock" : ($xf2 = $xc9['options'][1]);
                         !isset($xc9['options'][2]) ? $xf3 = "available for order" : ($xf3 = $xc9['options'][2]);
                         if ($xde->getManageStock() && !$xde->getUseConfigManageStock() && !$x57 || $xde->getUseConfigManageStock() && $x57 || $xde->getManageStock()) {
                             if ($xde->getIsInStock() > 0) {
                                 if ($product->type_id == "configurable") {
                                     $xf4 = $xaa[$product->getId()];
                                 } else {
                                     $xf4 = $xde->getQty();
                                 }
                                 if ($xf4 > 0) {
                                     $x4b = $xf1;
                                 } else {
                                     if ($xde->getBackorders() || $xde->getUseConfigBackorders() && $x58) {
                                         $x4b = $xf3;
                                     } else {
                                         $x4b = $xf2;
                                     }
                                 }
                             } else {
                                 $x4b = $xf2;
                             }
                         } else {
                             $x4b = $xf1;
                         }
                         break;
                     case '{stock_status}':
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $xde->getIs_in_stock() > 0 ? $x4b = 'in stock' : ($x4b = 'out of stock');
                         break;
                     case '{qty}':
                         $xde = $this->checkReference($xc9['reference'], $product);
                         !isset($xc9['options'][0]) ? $xf5 = 0 : ($xf5 = $xc9['options'][0]);
                         if ($product->type_id == "configurable") {
                             $x4b = $xaa[$product->getId()];
                             $x4b = $x127($x4b, $xf5, '.', '');
                         } else {
                             if ($xc9['reference'] == "configurable") {
                                 $x4b = $x127($xaa[$xde->getId()], $xf5, '.', '');
                             } else {
                                 $x4b = $x127($xde->getQty(), $xf5, '.', '');
                             }
                         }
                         break;
                     case "{categories_v1}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         !isset($xc9['options'][0]) || !$xc9['options'][0] || $xc9['options'][0] == 'INF' ? $xf6 = INF : ($xf6 = $xc9['options'][0]);
                         !isset($xc9['options'][1]) ? $xf7 = 1 : ($xf7 = $xc9['options'][1]);
                         !isset($xc9['options'][2]) || !$xc9['options'][2] || $xc9['options'][2] == 'INF' ? $xf8 = INF : ($xf8 = $xc9['options'][2]);
                         $xf9 = 0;
                         $x4b = '';
                         $xfa = '';
                         foreach ($x12a(',', $xde->getCategoriesIds()) as $x3b => $x75) {
                             $x64 ? $xfb = $x136($x74[$x75]["path"], $x65) : ($xfb = !$x136($x74[$x75]["path"], $x65));
                             if (isset($x74[$x75]) && $xf9 < $xf6 && ($xfb || $x65[0] == "*")) {
                                 $xfc = 0;
                                 $xfd = $x12a('/', $x74[$x75]["path"]);
                                 if ($x136($x5d, $xfd)) {
                                     $xfe = "";
                                     if ($xf9 > 0) {
                                         $xfa = ",";
                                     }
                                     foreach ($xfd as $xff) {
                                         if (isset($x74[$xff])) {
                                             if ($x74[$xff]['level'] > $xf7 && $xfc < $xf8) {
                                                 if ($xfc > 0) {
                                                     $xfe .= '>';
                                                 }
                                                 $xfe .= $x74[$xff]['name'];
                                                 $xfc++;
                                             }
                                         }
                                     }
                                     $x100 = "";
                                     if (!empty($xfe)) {
                                         $x4b .= $xfa . $xfe . $x100;
                                         $xf9++;
                                     }
                                 }
                             }
                         }
                         break;
                     case "{categories}":
                         $x101 = null;
                         $xf6 = INF;
                         $xf7 = 1;
                         $x102 = INF;
                         $x103 = ', ';
                         $x104 = " > ";
                         if ($x128($xc9['options']) == 1) {
                             !isset($xc9['options'][0]) ? $x101 = "last" : ($x101 = $xc9['options'][0]);
                             $xf6 = 1;
                         } elseif ($x128($xc9['options']) == 2) {
                             !isset($xc9['options'][0]) ? $x103 = ', ' : ($x103 = $xc9['options'][0]);
                             !isset($xc9['options'][1]) ? $x104 = " > " : ($x104 = $xc9['options'][1]);
                         } elseif ($x128($xc9['options']) > 2) {
                             !isset($xc9['options'][0]) || !$xc9['options'][0] || $xc9['options'][0] == 'INF' ? $xf6 = INF : ($xf6 = $xc9['options'][0]);
                             !isset($xc9['options'][1]) ? $xf7 = 1 : ($xf7 = $xc9['options'][1]);
                             !isset($xc9['options'][2]) || !$xc9['options'][2] || $xc9['options'][2] == 'INF' ? $x102 = INF : ($x102 = $xc9['options'][2]);
                             !isset($xc9['options'][3]) ? $x103 = ', ' : ($x103 = $xc9['options'][3]);
                             !isset($xc9['options'][4]) ? $x104 = " > " : ($x104 = $xc9['options'][4]);
                         }
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $xed = 0;
                         $x105 = array();
                         foreach ($x12a(',', $xde->getCategoriesIds()) as $x3b => $x75) {
                             $x64 ? $xfb = $x136(@$x74[$x75]["path"], $x65) : ($xfb = !$x136(@$x74[$x75]["path"], $x65));
                             if (isset($x74[$x75]) && ($xfb || $x65[0] == "*")) {
                                 $xed++;
                                 $x105[$xed] = array();
                                 $xfd = $x12a('/', $x74[$x75]["path"]);
                                 if ($x136($x5d, $xfd)) {
                                     foreach ($xfd as $xff) {
                                         if (isset($x74[$xff]) && $x74[$xff]['name'] != null) {
                                             $x105[$xed][] = $x74[$xff]['name'];
                                         }
                                     }
                                 }
                             }
                         }
                         $x106 = array();
                         $x142($x105, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x14fArray'));
                         if ($x101 == "last") {
                             $x105 = $x144($x105);
                         }
                         $xde->setCategoriesArray($x105);
                         $x107 = 0;
                         foreach ($x105 as $x3b => $xfc) {
                             if ($x107 < $xf6) {
                                 foreach ($xfc as $x108 => $x109) {
                                     if ($x108 >= $xf7 && $x108 <= $x102) {
                                         if (!isset($x106[$x107])) {
                                             $x106[$x107] = array();
                                         }
                                         $x106[$x107][] .= $x109;
                                     }
                                 }
                                 if ($x128($x106[$x107])) {
                                     $x107++;
                                 }
                             }
                         }
                         $x4b = null;
                         foreach ($x145($x106) as $x3b => $x10a) {
                             if ($x3b > 0) {
                                 $x4b .= $x103;
                             }
                             $x4b .= $x120($x104, $x10a);
                         }
                         break;
                     case "{G:PRODUCT_TYPE_v1}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         !isset($xc9['options'][0]) || !$xc9['options'][0] || $xc9['options'][0] == 'INF' ? $xf6 = INF : ($xf6 = $xc9['options'][0]);
                         !isset($xc9['options'][1]) ? $xf7 = 1 : ($xf7 = $xc9['options'][1]);
                         !isset($xc9['options'][2]) || !$xc9['options'][2] || $xc9['options'][2] == 'INF' ? $xf8 = INF : ($xf8 = $xc9['options'][2]);
                         $xf9 = 0;
                         $x4b = '';
                         foreach ($x12a(',', $xde->getCategoriesIds()) as $x3b => $x75) {
                             $x64 ? $xfb = $x136($x74[$x75]["path"], $x65) : ($xfb = !$x136($x74[$x75]["path"], $x65));
                             if (@$x74[$x75]["include_in_menu"] && isset($x74[$x75]) && $xf9 < $xf6 && ($xfb || $x65[0] == "*")) {
                                 $xfc = 0;
                                 $xfd = $x12a('/', $x74[$x75]["path"]);
                                 if ($x136($x5d, $xfd)) {
                                     $xfe = '';
                                     $xfa = '<g:product_type><![CDATA[';
                                     foreach ($xfd as $xff) {
                                         if (isset($x74[$xff])) {
                                             if ($x74[$xff]['level'] > $xf7 && $xfc < $xf8) {
                                                 if ($xfc > 0) {
                                                     $xfe .= ' > ';
                                                 }
                                                 $xfe .= $x74[$xff]['name'];
                                                 $xfc++;
                                             }
                                         }
                                     }
                                     $x100 = "]]></g:product_type>\n";
                                     if (!empty($xfe)) {
                                         $x4b .= $xfa . $xfe . $x100;
                                         $xf9++;
                                     }
                                 }
                             }
                         }
                         break;
                     case "{G:PRODUCT_TYPE}":
                         $x103 = "]]></g:product_type>\n<g:product_type><![CDATA[";
                         $x104 = " > ";
                         !isset($xc9['options'][0]) || !$xc9['options'][0] || $xc9['options'][0] == 'INF' ? $xf6 = INF : ($xf6 = $xc9['options'][0]);
                         !isset($xc9['options'][1]) ? $xf7 = 1 : ($xf7 = $xc9['options'][1]);
                         !isset($xc9['options'][2]) || !$xc9['options'][2] || $xc9['options'][2] == 'INF' ? $x102 = INF : ($x102 = $xc9['options'][2]);
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $xed = 0;
                         $x105 = array();
                         foreach ($x12a(',', $xde->getCategoriesIds()) as $x3b => $x75) {
                             $x64 ? $xfb = $x136(@$x74[$x75]["path"], $x65) : ($xfb = !$x136(@$x74[$x75]["path"], $x65));
                             if (isset($x74[$x75]) && ($xfb || $x65[0] == "*")) {
                                 $xed++;
                                 $x105[$xed] = array();
                                 $xfd = $x12a('/', $x74[$x75]["path"]);
                                 if ($x136($x5d, $xfd)) {
                                     foreach ($xfd as $xff) {
                                         if (isset($x74[$xff]) && $x74[$xff]['name'] != null) {
                                             $x105[$xed][] = $x74[$xff]['name'];
                                         }
                                     }
                                 }
                             }
                         }
                         $x106 = array();
                         $x142($x105, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x14fArray'));
                         foreach ($x105 as $x3b => $xfc) {
                             if ($x3b < $xf6) {
                                 foreach ($xfc as $x108 => $x109) {
                                     if ($x108 >= $xf7 && $x108 <= $x102) {
                                         if (!isset($x106[$x3b])) {
                                             $x106[$x3b] = array();
                                         }
                                         $x106[$x3b][] .= $x109;
                                     }
                                 }
                             }
                         }
                         $x4b = null;
                         foreach ($x145($x106) as $x3b => $x10a) {
                             if ($x3b > 0) {
                                 $x4b .= $x103;
                             }
                             $x4b .= $x120($x104, $x10a);
                         }
                         if ($x106) {
                             $x4b = "<g:product_type><![CDATA[" . $x4b . "]]></g:product_type>\n";
                         }
                         break;
                     case "{G:GOOGLE_PRODUCT_CATEGORY}":
                         $x10b = array();
                         !isset($xc9['options'][0]) ? $x101 = "longest" : ($x101 = $xc9['options'][0]);
                         $xde = $this->checkReference($xc9['reference'], $product);
                         foreach ($x12a(',', $xde->getCategoriesIds()) as $x3b => $x75) {
                             if (isset($x74[$x75]["path"]) && isset($x66[$x74[$x75]["path"]])) {
                                 $x10b[] = $x66[$x74[$x75]["path"]];
                             }
                         }
                         $x142($x10b, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x14f'));
                         if ($x101 == "shortest") {
                             $x10b = $x144($x10b);
                         }
                         $x10c = $x143($x10b);
                         if ($x10c != "") {
                             $x4b = "<g:google_product_category><![CDATA[" . $x10c . "]]></g:google_product_category>\n";
                         }
                         break;
                     case "{category_mapping}":
                         isset($xc9["options"][0]) ? $x10d = $xc9["options"][0] : ($x10d = 0);
                         $x4b = "";
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $x10e = 0;
                         foreach ($x12a(',', $xde->getCategoriesIds()) as $x3b => $x75) {
                             if (isset($x66[$x74[$x75]["path"]])) {
                                 if ($x10e == $x10d) {
                                     $x4b .= $x66[$x74[$x75]["path"]];
                                     break;
                                 }
                                 $x10e++;
                             }
                         }
                         break;
                     case "{review_count}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $x4b = "";
                         isset($xc9["options"][0]) && $xc9["options"][0] == "*" ? $x10f = 0 : ($x10f = $x52);
                         if (isset($x95[$xde->getId()][$x10f]["count"])) {
                             $x110 = $x95[$xde->getId()][$x10f]["count"];
                             if (isset($x110)) {
                                 $x4b .= $x110;
                             }
                         }
                         break;
                     case "{review_average}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $x4b = "";
                         isset($xc9["options"][0]) && $xc9["options"][0] == "*" ? $x10f = 0 : ($x10f = $x52);
                         !isset($xc9["options"][1]) || !$xc9["options"][1] ? $x111 = 5 : ($x111 = $xc9["options"][1]);
                         if (isset($x95[$xde->getId()][$x10f]["score"])) {
                             $x112 = $x127($x95[$xde->getId()][$x10f]["score"] * $x111 / 100, 2, ".", "");
                             if (isset($x112)) {
                                 $x4b .= $x112;
                             }
                         }
                         break;
                     case "{G:PRODUCT_REVIEW}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         isset($xc9["options"][0]) && $xc9["options"][0] == "*" ? $x10f = 0 : ($x10f = $x52);
                         !isset($xc9["options"][1]) || !$xc9["options"][1] ? $x111 = 5 : ($x111 = $xc9["options"][1]);
                         $x4b = "";
                         if (isset($x95[$xde->getId()][$x10f]["count"])) {
                             $x110 = $x95[$xde->getId()][$x10f]["count"];
                             $x112 = $x127($x95[$xde->getId()][$x10f]["score"] * $x111 / 100, 2, ".", "");
                         }
                         if (isset($x112) && $x112 > 0) {
                             $x4b .= "<g:product_review_average><![CDATA[" . $x112 . "]]></g:product_review_average>\n";
                         }
                         if (isset($x110) && $x110 > 0) {
                             $x4b .= "<g:product_review_count><![CDATA[" . $x110 . "]]></g:product_review_count>\n";
                         }
                         unset($x112);
                         unset($x110);
                         break;
                     case "{G:ITEM_GROUP_ID}":
                         if (isset($this->configurable[$product->getId()])) {
                             $xde = $this->checkReference('configurable', $product);
                             $x4b = "<g:item_group_id><![CDATA[" . $xde->getSku() . "]]></g:item_group_id>";
                         }
                         break;
                     case "{SC:EAN}":
                         $x129($xc9['options'][0]) && $xc9['options'][0] > 0 ? $x113 = $xc9['options'][0] : ($x113 = 0);
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $x4b = $x12a(',', $xde->getEan());
                         $x4b = "<g:ean><![CDATA[" . $x4b[$x113] . "]]></g:ean>";
                         break;
                     case "{SC:IMAGES}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $xec = $xde->getSmall_image();
                         $xee = array($xde->getImage(), $xde->getThumbnail());
                         $xef = '';
                         $xd8 = 0;
                         if ($xde->getSmall_image() && $xde->getSmall_image() != 'no_selection') {
                             $xed = $xde->getSmall_image();
                             $x4b = $xed;
                             $xef .= "<g:image_link><![CDATA[" . $x4b . "]]></g:image_link>\n";
                             $xd8++;
                         }
                         $xd1 = 0;
                         while (isset($x9b[$xde->getId()]['src'][$xd1]) && $xd8 < 10) {
                             if ($x9b[$xde->getId()]['src'][$xd1] != $xec) {
                                 if ($x136($x9b[$xde->getId()]['src'][$xd1], $xee) || $x9b[$xde->getId()]['disabled'][$xd1] != 1) {
                                     $xed = $x9b[$xde->getId()]['src'][$xd1];
                                     $x4b = $xed;
                                     $xef .= "<g:additional_image_link><![CDATA[" . $x4b . "]]></g:additional_image_link>\n";
                                     $xd8++;
                                 }
                             }
                             $xd1++;
                         }
                         $x4b = $xef;
                         break;
                     case "{SC:DESCRIPTION}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $x114 = $xde->getDescription() . $xde->getShortDescription();
                         $x115 = "|<iframe(.*)</iframe>|U";
                         $x124($x115, $x114, $x116);
                         if ($x116) {
                             $x114 = $xde->getAttributeText('manufacturer') . " " . $xde->getName() . " - Part number: " . $xde->getSku() . " - Category : {categories,[1],[1],[1]}";
                         } else {
                             if ($x136("strip_tags", $xc9['options'])) {
                                 $x114 = $x146('!\\<br /\\>!isU', " ", $x114);
                                 $x114 = $x146('!\\<br/\\>!isU', " ", $x114);
                                 $x114 = $x146('!\\<br>!isU', " ", $x114);
                                 $x114 = $x147($x114);
                             }
                             if ($x136("html_entity_decode", $xc9['options'])) {
                                 $x114 = $x148($x114, ENT_QUOTES, 'UTF-8');
                             }
                             if ($x136("htmlentities", $xc9['options'])) {
                                 $x114 = $x149($x114);
                             }
                             if ($x11f($x114) > 900) {
                                 $x114 = $x12b($x114, 0, 900 - 3);
                                 $x117 = $x14a($x114, " ");
                                 $x114 = $x12b($x114, 0, $x117) . '...';
                             }
                         }
                         if ($x114 == null) {
                             $x114 = $xde->getAttributeText('manufacturer') . " " . $xde->getName() . " - Part number: " . $xde->getSku() . " - Category : {categories,[1],[1],[1]}";
                         }
                         $x114 = $x146('/' . '[\\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', ' ', $x114);
                         $x114 = $x121('™ ', '', $x114);
                         $x4b = "<description><![CDATA[" . $x114 . "]]></description>";
                         break;
                     case "{SC:URL}":
                         isset($xc9['options'][0]) ? $x118 = $xc9['options'][0] : ($x118 = "");
                         isset($xc9['options'][1]) ? $x119 = $xc9['options'][1] : ($x119 = "");
                         $xde = $this->checkReference($xc9['reference'], $product);
                         if ($xde->getRequest_path()) {
                             $x4b = "<link><![CDATA[" . $x5a . $x119 . $xde->getRequest_path() . $x118 . "]]></link>";
                         } else {
                             $x4b = "<link><![CDATA[" . $xde->getProductUrl() . "]]></link>";
                         }
                         break;
                     case "{SC:CONDITION}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $x14b($xde->getName(), "refurbished") ? $xbb = 'refurbished' : ($xbb = 'new');
                         $x4b = "<g:condition><![CDATA[" . $xbb . "]]></g:condition>";
                         break;
                     case "{sc:condition}":
                         $xde = $this->checkReference($xc9['reference'], $product);
                         $x14b($xde->getName(), "refurbished") ? $xbb = 'refurbished' : ($xbb = 'new');
                         $x4b = $xbb;
                         break;
                     default:
                         $xde = $this->checkReference($xc9['reference'], $product);
                         if ($x136($xc9['name'], $x7f)) {
                             if ($x136($x80[$xc9['name']], array('select', 'multiselect'))) {
                                 eval('$x11b =($xde->' . $xc9['methodName'] . ");");
                                 $x11a = $x12a(',', $x11b);
                                 if ($x128($x11a) > 1) {
                                     $x4b = array();
                                     foreach ($x11a as $xc1) {
                                         if (isset($x85[$xc1][$x52])) {
                                             $x4b[] = $x85[$xc1][$x52];
                                         } else {
                                             if (isset($x85[$xc1][0])) {
                                                 $x4b[] = $x85[$xc1][0];
                                             }
                                         }
                                     }
                                 } else {
                                     if (isset($x85[$x11a[0]][$x52])) {
                                         $x4b = $x85[$x11a[0]][$x52];
                                     } else {
                                         if (isset($x85[$x11a[0]][0])) {
                                             $x4b = $x85[$x11a[0]][0];
                                         }
                                     }
                                 }
                             } else {
                                 eval('$x4b =($xde->' . $xc9['methodName'] . ");");
                             }
                         }
                         if ($x136(@$x7d[$xc9['name']], $x7d)) {
                             $x4b = $x7d[$xc9['name']];
                         }
                         $x4b = $x146('/' . '[\\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', ' ', $x4b);
                         $x4b = $x121('™ ', '', $x4b);
                         $x11c = 0;
                         if ($x128($xc9['options']) > 0) {
                             while (isset($xc9['options'][$x11c])) {
                                 switch ($xc9['options'][$x11c]) {
                                     case "substr":
                                         if (isset($xc9['options'][$x11c + 1]) && $x11f($x4b) > $xc9['options'][$x11c + 1]) {
                                             $x4b = $x12b($x4b, 0, $xc9['options'][$x11c + 1] - 3);
                                             $x117 = $x14a($x4b, " ");
                                             $x4b = $x12b($x4b, 0, $x117) . $xc9['options'][$x11c + 2];
                                         }
                                         $x11c++;
                                         $x11c++;
                                         break;
                                     case "htmlentities":
                                         $x4b = $x149($x4b);
                                         break;
                                     case "strip_tags":
                                         $x11d = " ";
                                         $x4b = $x146('!\\<br /\\>!isU', $x11d, $x4b);
                                         $x4b = $x146('!\\<br/\\>!isU', $x11d, $x4b);
                                         $x4b = $x146('!\\<br>!isU', $x11d, $x4b);
                                         $x4b = $x147($x4b);
                                         break;
                                     case "{$x120}":
                                         $x4b = $x131($x4b) ? $x120($xc9['options'][$x11c + 1], $x4b) : $x4b;
                                         $x11c++;
                                         break;
                                     case "float":
                                         $x4b = $x127($x4b, $xc9['options'][$x11c + 1], '.', '');
                                         $x11c++;
                                         break;
                                     case "html_entity_decode":
                                         $x4b = $x148($x4b, ENT_QUOTES, 'UTF-8');
                                         break;
                                     case "inline":
                                         $x4b = $x146('/(\\r\\n|\\n|\\r|\\r\\n|\\t)/s', '', $x4b);
                                         break;
                                     case "strtolower":
                                         $x4b = $x14c($x4b, "UTF8");
                                         break;
                                     case "strtoupper":
                                         $x4b = $x14d($x4b, "UTF8");
                                         break;
                                     case "cleaner":
                                         $x4b = $x146('/' . '[\\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', ' ', $x4b);
                                         $x4b = $x121('™ ', '', $x4b);
                                         break;
                                     default:
                                         if ($x14b($xc9['options'][$x11c], "%s")) {
                                             $xd9 = $x121("%s", '$x4b', $xc9['options'][$x11c]);
                                             eval('$x4b=' . $xd9 . '; ');
                                         } else {
                                             eval('$x4b=' . $xc9['options'][$x11c] . '($x4b); ');
                                         }
                                         break;
                                 }
                                 $x11c++;
                             }
                         }
                         break;
                 }
                 $x4b = $x121(array("<", ">", '"', '\\'), array("__LOWERTHAN__", "__HIGHERTHAN__", "__QUOTES__", "__BACKSLASH__"), $x4b);
                 if ($x131($x4b)) {
                     $x4b = $x120(",", $x4b);
                 }
                 if ($x4b != "") {
                     $x49 = $x121($xc9['fullpattern'], $x4b, $x49);
                 }
             }
             foreach ($x6f as $x11e) {
                 $x49 = $x121($x11e['fullpattern'], "", $x49);
             }
             $x49 = $this->x151($x49, $product);
             $x49 = $this->x155($x49);
             $x49 = $this->x154($x49);
             $x49 = $x121(array("__LOWERTHAN__", "__HIGHERTHAN__", "__QUOTES__", "__BACKSLASH__"), array("<", ">", '"', '\\'), $x49);
             if (!empty($x49)) {
                 $x6c .= "<item>";
                 $x6c .= "\n" . $x49 . "\n";
                 $x6c .= "</item>" . "\n";
                 $xb7++;
                 $this->_inc = $xc7;
                 $xc7++;
             }
             if ($this->_display) {
                 $x6d .= $x6c;
                 $x6c = '';
             } else {
                 if ($xb7 % Mage::getStoreConfig("simplegoogleshopping/system/buffer") == 0) {
                     $x3d->streamWrite($x6c);
                     unset($x6c);
                     $x6c = '';
                     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" . $xc7 . "/" . $this->_counter . " items added", null, $this->getSimplegoogleshoppingFilename() . '.log');
                 }
             }
             if ($this->_limit && $xc7 > $this->_limit) {
                 break 2;
             }
         }
     }
     $x6c .= '</channel>' . "\n";
     $x6c .= '</rss>';
     if (!$this->_display) {
         $x3d->streamWrite($x6c);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " . ($xc7 - 1) . "/" . $this->_counter . " items added", null, $this->getSimplegoogleshoppingFilename() . '.log');
     unset($xa5);
     $x6d .= $x6c;
     if ($this->_display && !$this->_debug) {
         !Mage::app()->getRequest()->getParam("real_time_preview") ? $x114 = "<textarea id='CodeMirror' class='CodeMirror'>" . $x6d . "</textarea>" : ($x114 = $x6d);
         if (!Mage::app()->getRequest()->getParam("real_time_preview")) {
             return " \n    \t <html> \n   \t\t<head>\r\n    \t\t<title>" . $this->getSimplegoogleshoppingFilename() . "</title>\r\n             <link rel='stylesheet' href='" . $x59 . "skin/adminhtml/default/default/CodeMirror2/lib/codemirror.css'>\r                <link rel='stylesheet' href='" . $x59 . "skin/adminhtml/default/default/CodeMirror2/theme/default.css'>\r\n         \n              <script type='text/javascript' src='" . $x59 . "skin/adminhtml/default/default/CodeMirror2/lib/codemirror.js'></script>\r\n                <script type='text/javascript' src='" . $x59 . "skin/adminhtml/default/default/CodeMirror2/mode/xml/xml.js'></script>\r     \r\n \n        \n             \r             </head> \n               <body>\r\n               " . $x114 . "\r\n              <script language='javascript'>\r\n            sHtml=document.getElementById('CodeMirror'); \n               if(typeof sHtml != 'undefined'){\r\n                    var myCodeMirror = CodeMirror(function(elt) {\r\n                        sHtml.parentNode.replaceChild(elt, sHtml)}, {\r                         value: sHtml.value,\r                            mode:  'xml',\r\n                          readOnly: true \n \n                    })\r                     }\r\n             \n              </script>\r\n                </body>\r\n              </html>";
         } else {
             return $x114;
         }
     } elseif ($this->_debug) {
         echo "<br><br>------------ XML OUTPUT ----------------<br>";
         $x114 = "<pre>" . $x14e($x6d) . "</pre>";
         return $x114;
     } else {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> File closed", null, $this->getSimplegoogleshoppingFilename() . '.log');
         $x3d->streamClose();
         $this->setSimplegoogleshopping_time(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
         $this->save();
     }
     Mage::app()->setCurrentStore(0);
     return $this;
 }
 public function generateXml()
 {
     $x147 = "str_replace";
     $x148 = "utf8_encode";
     $x149 = "preg_match_all";
     $x14a = "preg_match";
     $x14b = "is_null";
     $x14c = "number_format";
     $x14d = "is_numeric";
     $x14e = "preg_split";
     $x14f = "utf8_decode";
     $x150 = "is_string";
     $x151 = "json_decode";
     $x152 = "is_array";
     $x153 = "array_push";
     $x154 = "print_r";
     $x155 = "version_compare";
     $x156 = "in_array";
     $x157 = "array_pop";
     $x158 = "str_pad";
     $x159 = "array_shift";
     $x15a = "array_reverse";
     $x15b = "array_values";
     $x15c = "preg_replace";
     $x15d = "strip_tags";
     $x15e = "html_entity_decode";
     $x15f = "mb_strtolower";
     $x160 = "mb_strtoupper";
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> --------------- START PROCESS FOR " . strtoupper($this->x165(false)) . "-----------------", null, $this->x165('.log'));
     ini_set('memory_limit', Mage::getStoreConfig("simplegoogleshopping/system/memory_limit") . 'M');
     $this->_debug = isset($_GET['debug']) ? true : false;
     include Mage::getBaseDir() . "/lib/Wyomind/Google/Requirements.php";
     $x3a = new Varien_Io_File();
     $x4f = new Varien_Io_File();
     $x52 = Mage::getBaseDir() . DS . 'var' . DS . 'tmp' . DS;
     $x53 = $x52 . "sgs_" . $this->getSimplegoogleshoppingId() . ".flag";
     $x3a->setAllowCreateFolders(true);
     if (!$this->_display) {
         $x3a->open(array('path' => $this->getPath()));
         if ($x3a->fileExists($this->x165()) && !$x3a->isWriteable($this->x165())) {
             Mage::throwException(Mage::helper('simplegoogleshopping')->__('File "\\x25\\x73" cannot be saved. Please, make sure the directory "\\x25\\x73" is writeable by web server.', $this->x165(), $this->getPath()));
         }
         $x3a->streamOpen($this->x165());
         $x4f->open(array('path' => $x52));
         if ($x4f->fileExists($x53, false)) {
             $x4f->streamOpen($x53, 'r');
             $x4d = $x4f->streamReadCsv(";");
             $x54 = $x4f->streamStat();
             if ($x4d[0] == "PROCESSING") {
                 $x55 = $x54["mtime"];
                 $x56 = $x4d[3];
                 if (!(Mage::getSingleton('core/date')->gmtTimestamp() > $x55 + $x56 * 10 || Mage::getSingleton('core/date')->gmtTimestamp() > $x55 + $x56 * 2)) {
                     Mage::throwException(Mage::helper('simplegoogleshopping')->__('File "\\x25\\x73" is already processing. Please wait the end of the process.', $this->x165(), $this->getPath()));
                 }
             }
         } else {
             $x4f->streamOpen($x53);
         }
     }
     $x57 = array("ac" => "activation_code", "ak" => "activation_key", "bu" => "base_url", "md" => "md5", "th" => "this", "dm" => "_demo", "ext" => "sgs", "ver" => "9.0.1");
     $x150(Mage::app()->getRequest()->getParam("store_id")) ? $x58 = Mage::app()->getRequest()->getParam("store_id") : ($x58 = $this->getStoreId());
     $x59 = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
     $x5a = Mage::getDesign()->getSkinUrl();
     $x5b = Mage::getStoreConfig("catalog/placeholder/image_placeholder", $x58);
     $x5c = Mage::getStoreConfig("currency/options/base", $x58);
     $x5d = Mage::getStoreConfig("cataloginventory/item_options/manage_stock", $x58);
     $x5e = Mage::getStoreConfig("cataloginventory/item_options/backorders", $x58);
     $x5f = Mage::app()->getStore($x58)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, false);
     $x60 = Mage::getModel('core/store')->load($x58)->getBaseUrl();
     $x61 = Mage::app()->getStore($x58)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA, false);
     $x62 = Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, $x58);
     $x63 = Mage::app()->getStore($x58)->getRootCategoryId();
     $x64 = Mage::app()->getStore()->getStoreId();
     $x65 = array("activation_key" => Mage::getStoreConfig("simplegoogleshopping/license/activation_key"), "activation_code" => Mage::getStoreConfig("simplegoogleshopping/license/activation_code"), "base_url" => Mage::getStoreConfig("web/secure/base_url"));
     $x150(Mage::app()->getRequest()->getParam("simplegoogleshopping_xmlitempattern")) ? $x66 = Mage::app()->getRequest()->getParam("simplegoogleshopping_xmlitempattern") : ($x66 = $this->getSimplegoogleshoppingXmlitempattern());
     $x150(Mage::app()->getRequest()->getParam("simplegoogleshopping_title")) ? $x67 = Mage::app()->getRequest()->getParam("simplegoogleshopping_title") : ($x67 = $this->getSimplegoogleshoppingTitle());
     $x150(Mage::app()->getRequest()->getParam("simplegoogleshopping_description")) ? $x68 = Mage::app()->getRequest()->getParam("simplegoogleshopping_description") : ($x68 = $this->getSimplegoogleshoppingDescription());
     $x150(Mage::app()->getRequest()->getParam("simplegoogleshopping_categories")) ? $x69 = $x151(Mage::app()->getRequest()->getParam("simplegoogleshopping_categories")) : ($x69 = $x151($this->getSimplegoogleshoppingCategories()));
     $x150(Mage::app()->getRequest()->getParam("category_filter")) ? $x6a = Mage::app()->getRequest()->getParam("category_filter") : ($x6a = $this->getSimplegoogleshoppingCategoryFilter());
     $x150(Mage::app()->getRequest()->getParam("category_type")) ? $x6b = Mage::app()->getRequest()->getParam("category_type") : ($x6b = $this->getSimplegoogleshoppingCategoryType());
     $x6c = array();
     $x6d = array();
     if ($x152($x69)) {
         foreach ($x69 as $x6e) {
             if ($x6e->checked) {
                 $x6c[] = $x6e->line;
             }
         }
         foreach ($x69 as $x6e) {
             if ($x6e->mapping != "") {
                 $x6d[$x6e->line] = $x6e->mapping;
             }
         }
     }
     if (count($x6c) < 1) {
         $x6c[] = '*';
     }
     $x150(Mage::app()->getRequest()->getParam("simplegoogleshopping_type_ids")) ? $x6f = explode(',', Mage::app()->getRequest()->getParam("simplegoogleshopping_type_ids")) : ($x6f = explode(',', $this->getSimplegoogleshoppingTypeIds()));
     $x150(Mage::app()->getRequest()->getParam("simplegoogleshopping_visibility")) ? $x70 = explode(',', Mage::app()->getRequest()->getParam("simplegoogleshopping_visibility")) : ($x70 = explode(',', $this->getSimplegoogleshoppingVisibility()));
     $x150(Mage::app()->getRequest()->getParam("simplegoogleshopping_attributes")) ? $x71 = $x151(Mage::app()->getRequest()->getParam("simplegoogleshopping_attributes")) : ($x71 = $x151($this->getSimplegoogleshoppingAttributes()));
     $x150(Mage::app()->getRequest()->getParam("simplegoogleshopping_attribute_sets")) ? $x72 = explode(',', Mage::app()->getRequest()->getParam("simplegoogleshopping_attribute_sets")) : ($x72 = explode(',', $this->getSimplegoogleshoppingAttributeSets()));
     if ($x65[$x57['ac']] != $x57["md"]($x57["md"]($x65[$x57['ak']]) . $x57["md"]($x65[$x57['bu']]) . $x57["md"]($x57["ext"]) . $x57["md"]($x57["ver"]))) {
         ${$x57}["ext"] = "valid";
         ${$x57}["th"]->{$x57}["dm"] = true;
     } else {
         ${$x57}["th"]->{$x57}["dm"] = false;
         ${$x57}["ext"] = "valid";
     }
     $x73 = '';
     $x74 = '';
     header("Content-Type: text/html; charset=utf-8");
     $x73 = '<?xml version="1.0" encoding="utf-8" ?>' . "\n";
     $x73 .= '<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">' . "\n";
     $x73 .= '<channel>' . "\n";
     $x73 .= '<title>' . $x67 . "</title>\n";
     $x73 .= '<link>' . substr($x5f, 0, -1) . "</link>\n";
     $x73 .= '<description>' . $x68 . "</description>\n";
     if (!isset(${$x57}["ext"]) || ${$x57}["th"]->{$x57}["dm"]) {
         ${$x57}["th"]->{$x57}["dm"] = true;
         return ${$x57}["th"];
     }
     if ($this->_display) {
         $x74 = $this->x169($x73);
     } else {
         $x3a->streamWrite($this->x169($x73));
         $this->x16a($x4f, $x53, "PROCESSINGØ;100;˜");
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " . $this->x165() . " created and opened", null, $this->x165('.log'));
     }
     $x35 = '/{([a-zA-Z_0-9:]+)(\\sparent|\\sgrouped|\\sconfigurable|\\sbundle)?([^}|]*)(\\s?\\|\\s?)?(([a-zA-Z_0-9:]+)(\\sparent|\\sgrouped|\\sconfigurable|\\sbundle)?([^}|]*))?(\\s?\\|\\s?)?(([a-zA-Z_0-9:]+)(\\sparent|\\sgrouped|\\sconfigurable|\\sbundle)?([^}|]*))?(\\s?\\|\\s?)?(([a-zA-Z_0-9:]+)(\\sparent|\\sgrouped|\\sconfigurable|\\sbundle)?([^}|]*))?}/';
     $x149($x35, $x66, $x36);
     foreach ($x36[6] as $x37 => $x75) {
         if ($x75 != "") {
             $x36[0][] = $x36[0][$x37];
             $x36[1][] = $x75;
             $x36[2][] = $x36[7][$x37];
             $x36[3][] = $x36[8][$x37];
             $x36[4][] = $x36[9][$x37];
         }
     }
     foreach ($x36[11] as $x37 => $x75) {
         if ($x75 != "") {
             $x36[0][] = $x36[0][$x37];
             $x36[1][] = $x75;
             $x36[2][] = $x36[7][$x37];
             $x36[3][] = $x36[8][$x37];
             $x36[4][] = $x36[9][$x37];
         }
     }
     foreach ($x36[16] as $x37 => $x75) {
         if ($x75 != "") {
             $x36[0][] = $x36[0][$x37];
             $x36[1][] = $x75;
             $x36[2][] = $x36[7][$x37];
             $x36[3][] = $x36[8][$x37];
             $x36[4][] = $x36[9][$x37];
         }
     }
     $x36[0][] = "{categories,[1],[1],[1]}";
     $x36[1][] = "categories";
     $x36[2][] = "";
     $x36[3][] = ",[1],[1],[1]";
     $x76 = array();
     $x77 = array();
     foreach ($x36[1] as $x37 => $x75) {
         $x76[$x37]['methodName'] = "get" . $x147(' ', '', ucwords(trim($x75)) . '()');
         $x76[$x37]['pattern'] = "{" . trim($x75) . "}";
         $x76[$x37]['fullpattern'] = $x36[0][$x37];
         $x76[$x37]['name'] = trim($x75);
         $x76[$x37]['reference'] = trim($x36[2][$x37]);
         if (empty($x76[$x37]['reference'])) {
             $x76[$x37]['reference'] = 'self';
         }
         switch ($x76[$x37]['name']) {
             case 'url':
                 $x153($x77, 'url_key');
                 break;
             case 'uri':
                 $x153($x77, 'url_key');
                 break;
             case 'G:ID':
                 $x153($x77, 'sku');
                 break;
             case 'G:TITLE':
                 $x153($x77, 'name');
                 break;
             case 'G:DESCRIPTION':
                 $x153($x77, 'short_description');
                 $x153($x77, 'description');
                 break;
             case 'G:IMAGE_LINK':
                 $x153($x77, 'image');
                 $x153($x77, 'small_image');
                 $x153($x77, 'thumbnail');
                 break;
             case 'SC:IMAGES':
                 $x153($x77, 'image');
                 $x153($x77, 'small_image');
                 $x153($x77, 'thumbnail');
                 break;
             case 'SC:DESCRIPTION':
                 $x153($x77, 'description');
                 $x153($x77, 'short_description');
                 $x153($x77, 'manufacturer');
                 $x153($x77, 'name');
                 $x153($x77, 'sku');
                 break;
             case 'SC:EAN':
                 $x153($x77, 'ean');
                 break;
             case 'SC:URL':
                 $x153($x77, 'url_key');
                 $x153($x77, 'url');
                 break;
             default:
                 $x153($x77, $x76[$x37]['name']);
         }
         $x76[$x37]["value"] = '$product->get' . $x76[$x37]['name'] . "()";
         $x76[$x37]["getText"] = 'getAttributeText(\'' . trim($x75) . '\')';
         $x78 = '/\\[([^\\]]+)\\]/';
         $x149($x78, $x36[3][$x37], $x79);
         $x76[$x37]["options"] = $x79[1];
     }
     if ($this->_debug) {
         echo "----------------------------------------------<br>\r                   ------------ DEBUG MODE ----------------<br>\r\n                   ----------------------------------------------<br><br>";
         echo "<br><br>------------ ATTRIBUTES ----------------<br>";
         $x154($x76);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Product template analyzed", null, $this->x165('.log'));
     $x7a = Mage::getModel('catalog/category')->getCollection()->setStoreId($x58)->addAttributeToSelect('name', 'store_id')->addAttributeToSelect('is_active')->addAttributeToSelect('include_in_menu');
     $x7b = array();
     foreach ($x7a as $x7c) {
         $x7b[$x7c->getId()]['name'] = $x7c->getName();
         $x7b[$x7c->getId()]['path'] = $x7c->getPath();
         $x7b[$x7c->getId()]['level'] = $x7c->getLevel();
         if ($x155(Mage::getVersion(), '1.6.0', '<') || Mage::getStoreConfig("simplegoogleshopping/system/include_in_menu")) {
             $x7b[$x7c->getId()]['include_in_menu'] = true;
         } else {
             $x7b[$x7c->getId()]['include_in_menu'] = $x7c->getIncludeInMenu();
         }
     }
     if ($this->_debug) {
         echo "<br><br>------------ CATEGORIES ----------------<br>";
         $x154($x7b);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Categories collected", null, $this->x165('.log'));
     $x7d = Mage::getSingleton('core/resource');
     $x7e = $x7d->getConnection('core_read');
     $x7f = $x7d->getTableName('eav_entity_type');
     $x80 = $x7e->select()->from($x7f)->where('entity_type_code=\'catalog_product\'');
     $x81 = $x7e->fetchAll($x80);
     $x82 = $x81[0]['entity_type_id'];
     $x7d = Mage::getSingleton('core/resource');
     $x7e = $x7d->getConnection('core_read');
     $x83 = $x7d->getTableName('directory_currency_rate');
     $x80 = $x7e->select()->from($x83)->where('currency_from=\'' . $x5c . '\'');
     $x40 = $x7e->fetchAll($x80);
     $x84 = array();
     foreach ($x40 as $x3f) {
         $x84[$x3f['currency_to']] = $x3f['rate'];
     }
     $this->_currencies = $x84;
     if ($this->_debug) {
         echo "<br><br>------------ CURRENCIES ----------------<br>";
         $x154($x84);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Currencies rate collected", null, $this->x165('.log'));
     $x85 = Mage::getResourceModel('eav/entity_attribute_collection')->setEntityTypeFilter($x82)->addSetInfo()->getData();
     $x86 = array();
     $x87 = array();
     foreach ($x85 as $x37 => $x75) {
         if ($x156($x75['attribute_code'], $x77)) {
             $x153($x86, $x75['attribute_code']);
             $x87[$x75['attribute_code']] = $x75['frontend_input'];
         }
     }
     if (!$x156('special_price', $x86)) {
         $x86[] = 'special_price';
     }
     if (!$x156('special_from_date', $x86)) {
         $x86[] = 'special_from_date';
     }
     if (!$x156('special_to_date', $x86)) {
         $x86[] = 'special_to_date';
     }
     if (!$x156('price_type', $x86)) {
         $x86[] = 'price_type';
     }
     if (!$x156('price', $x86)) {
         $x86[] = 'price';
     }
     $x86[] = 'tax_class_id';
     foreach ($x71 as $x88) {
         if (!$x156($x88->code, $x86) && $x88->checked) {
             if (!$x156($x88->code, array("is_in_stock", "qty", "entity_id", "created_at", "updated_at"))) {
                 $x86[] = $x88->code;
             }
         }
     }
     if ($this->_debug) {
         echo "<br><br>------------ ATTRIBUTES ----------------<br>";
         $x154($x86);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> List of required attributes collected", null, $this->x165('.log'));
     $x7d = Mage::getSingleton('core/resource');
     $x7e = $x7d->getConnection('core_read');
     $x89 = $x7d->getTableName('eav_attribute_option_value');
     $x80 = $x7e->select();
     $x80->from($x89);
     $x80->where("store_id=" . $x58 . ' OR store_id=0');
     $x80->order(array('option_id', 'store_id'));
     $x8a = $x7e->fetchAll($x80);
     foreach ($x8a as $x8b) {
         $x8c[$x8b['option_id']][$x8b['store_id']] = $x8b['value'];
     }
     if ($this->_debug) {
         echo "<br><br>------------ ATTRIBUTES LABEL ----------------<br>";
         $x154($x8c);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> List of attribute labels collected", null, $this->x165('.log'));
     $x8d = $x7d->getTableName('tax_class');
     $x8e = $x7d->getTableName('tax_calculation');
     $x8f = $x7d->getTableName('tax_calculation_rate');
     $x90 = $x7d->getTableName('directory_country_region');
     $x91 = $x7d->getTableName('customer_group');
     $x80 = $x7e->select();
     $x80->from($x8d)->order(array('class_id', 'tax_calculation_rate_id'));
     $x80->joinleft(array('tc' => $x8e), 'tc.product_tax_class_id = ' . $x8d . '.class_id', 'tc.tax_calculation_rate_id');
     $x80->joinleft(array('tcr' => $x8f), 'tcr.tax_calculation_rate_id = tc.tax_calculation_rate_id', array('tcr.rate', 'tax_country_id', 'tax_region_id'));
     $x80->joinleft(array('dcr' => $x90), 'dcr.region_id=tcr.tax_region_id', 'code');
     $x80->joinInner(array('cg' => $x91), 'cg.tax_class_id=tc.customer_tax_class_id AND cg.customer_group_code="NOT LOGGED IN"');
     $x92 = $x7e->fetchAll($x80);
     $x44 = array();
     $x3c = '';
     foreach ($x92 as $x93) {
         if ($x3c != $x93['class_id']) {
             $x94 = 0;
         } else {
             $x94++;
         }
         $x3c = $x93['class_id'];
         $x44[$x93['class_id']][$x94]['rate'] = $x93['rate'];
         $x44[$x93['class_id']][$x94]['code'] = $x93['code'];
         $x44[$x93['class_id']][$x94]['country'] = $x93['tax_country_id'];
     }
     $this->_rates = $x44;
     if ($this->_debug) {
         echo "<br><br>------------ TAX CLASS ----------------<br>";
         $x154($x44);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Tax rate collected", null, $this->x165('.log'));
     $x95 = $x7d->getTableName('review');
     $x96 = $x7d->getTableName('review_store');
     $x97 = $x7d->getTableName('rating_option_vote');
     $x98 = $x7e->select()->distinct('review_id');
     $x98->from(array("r" => $x95), array("COUNT(DISTINCT r.review_id) AS count", 'entity_pk_value'));
     $x98->joinleft(array('rs' => $x96), 'rs.review_id=r.review_id', 'rs.store_id');
     $x98->joinleft(array('rov' => $x97), 'rov.review_id=r.review_id', 'AVG(rov.percent) AS score');
     $x98->where("status_id=1 and entity_id=1");
     $x98->group(array('r.entity_pk_value', 'rs.store_id'));
     $x99 = $x7e->select();
     $x99->from(array("r" => $x95), array("COUNT(DISTINCT r.review_id) AS count", 'entity_pk_value', "(SELECT 0) AS  store_id"));
     $x99->joinleft(array('rs' => $x96), 'rs.review_id=r.review_id', array());
     $x99->joinleft(array('rov' => $x97), 'rov.review_id=r.review_id', 'AVG(rov.percent) AS score');
     $x99->where("status_id=1 and entity_id=1");
     $x99->group(array('r.entity_pk_value'));
     $x80 = $x7e->select()->union(array($x98, $x99));
     $x80->order(array('entity_pk_value', 'store_id'));
     $x9a = $x7e->fetchAll($x80);
     $x9b = array();
     foreach ($x9a as $x9c) {
         $x9b[$x9c['entity_pk_value']][$x9c['store_id']]["count"] = $x9c["count"];
         $x9b[$x9c['entity_pk_value']][$x9c['store_id']]['score'] = $x9c['score'];
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Reviews collected", null, $this->x165('.log'));
     $x7d = Mage::getSingleton('core/resource');
     $x7e = $x7d->getConnection('core_read');
     $x9d = $x7d->getTableName('catalog_product_entity_media_gallery');
     $x9e = $x7d->getTableName('catalog_product_entity_media_gallery_value');
     $x80 = $x7e->select(array("DISTINCT value"));
     $x80->from($x9d);
     $x80->joinleft(array('cpemgv' => $x9e), 'cpemgv.value_id = ' . $x9d . '.value_id', array('cpemgv.position', 'cpemgv.disabled'));
     $x80->where("value<>TRIM('') AND (store_id=" . $x58 . ' OR store_id=0)');
     $x80->order(array('position', 'value_id'));
     $x80->group(array('value_id'));
     $x9f = $x7e->fetchAll($x80);
     foreach ($x9f as $xa0) {
         if ($xa0['disabled'] != 1 && $xa0['value'] != '') {
             if (!$x156($xa0['value'], $xa1[$xa0['entity_id']]['src'])) {
                 $xa1[$xa0['entity_id']]['src'][] = $xa0['value'];
                 $xa1[$xa0['entity_id']]['disabled'][] = $xa0['disabled'];
             }
         }
     }
     if ($this->_debug) {
         echo "<br><br>------------ IMAGES ----------------<br>";
         $x154($xa1);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Images collected", null, $this->x165('.log'));
     Mage::app()->setCurrentStore($x58);
     $xa2 = $x7d->getTableName("cataloginventory_stock_item");
     $xa3 = $x7d->getTableName("core_url_rewrite");
     $x83 = $x7d->getTableName('catalog_category_product');
     $xa4 = $x7d->getTableName('catalog_category_product_index');
     $xa5 = $x7d->getTableName('catalog_product_index_price');
     $xa6 = $x7d->getTableName('catalog_product_super_link');
     $xa7 = $x7d->getTableName('catalog_product_link');
     $xa8 = $x7d->getTableName('catalog_product_bundle_selection');
     $x155(Mage::getVersion(), '1.6.0', '<') ? $x79 = "options=''" : ($x79 = "ISNULL(options)");
     switch (Mage::getStoreConfig("simplegoogleshopping/system/urlrewrite")) {
         case 1:
             $xa9 = "AND url.target_path NOT LIKE '%category%'";
             $xaa = 'MAX';
             break;
         default:
             $xa9 = "AND url.target_path LIKE '%category%'";
             $xaa = 'GROUP_CONCAT';
             break;
             break;
     }
     $xab = Mage::getModel('simplegoogleshopping/product_collection')->getCollection()->addStoreFilter($x58);
     $xab->addAttributeToFilter('status', 1);
     $xab->addAttributeToFilter('type_id', array("in" => "configurable"));
     $xab->addAttributeToFilter('visibility', array("nin" => 1));
     $xab->addAttributeToSelect($x86, true);
     $xab->getSelect()->joinLeft($xa6 . ' AS cpsl', 'cpsl.parent_id=e.entity_id ', array('child_ids' => 'GROUP_CONCAT( DISTINCT cpsl.product_id)'));
     $xab->getSelect()->joinLeft($xa2 . ' 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', 'backorders' => 'backorders', 'use_config_backorders' => 'use_config_backorders'));
     $xab->getSelect()->joinLeft($xa3 . ' AS url', 'url.product_id=e.entity_id ' . $xa9 . ' AND is_system=1 AND ' . $x79 . ' AND url.store_id=' . $x58, array('request_path' => $xaa . '(DISTINCT request_path)'));
     $xab->getSelect()->joinLeft($x83 . ' AS categories', 'categories.product_id=e.entity_id');
     $xab->getSelect()->joinLeft($xa4 . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x58, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     $xab->getSelect()->group(array('cpsl.parent_id'));
     $xac = array();
     foreach ($xab as $xad) {
         foreach (explode(",", $xad->getChildIds()) as $xae) {
             $xac[$xae] = $xad;
             $xaf[$xae]['categories_ids'] = $xad->getCategories_ids();
             $xaf[$xae]['parent_id'] = $xad->getId();
             $xaf[$xae]['parent_sku'] = $xad->getSku();
             $xaf[$xae]['parent_request_path'] = $xad->getRequestPath();
         }
     }
     $this->configurable = $xac;
     if ($this->_debug) {
         echo "<br><br>------------ CONFIGURABLES ----------------<br>";
         echo $xab->getSelect() . '<br><br>';
         $x154($xaf);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Relations with configurable products detected", null, $this->x165('.log'));
     $xab = Mage::getModel('simplegoogleshopping/product_collection')->getCollection()->addStoreFilter($x58);
     $xab->addAttributeToFilter('status', 1);
     $xab->addAttributeToFilter('type_id', array("in" => "configurable"));
     $xab->addAttributeToFilter('visibility', array("nin" => 1));
     $xab->getSelect()->joinLeft($xa6 . ' AS cpsl', 'cpsl.parent_id=e.entity_id ');
     $xab->getSelect()->joinLeft($xa2 . ' AS stock', 'stock.product_id=cpsl.product_id', array('qty' => 'SUM(stock.qty)'));
     $xab->getSelect()->group(array('cpsl.parent_id'));
     $xb0 = array();
     foreach ($xab as $xb1) {
         $xb0[$xb1->getId()] = $xb1->getQty();
     }
     $this->configurableQty = $xb0;
     if ($this->_debug) {
         echo "<br><br>------------ CONFIGURABLES QTY ----------------<br>";
         echo $xab->getSelect() . '<br><br>';
         $x154($xb0);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Qty for configurable products calculated", null, $this->x165('.log'));
     $xa6 = $x7d->getTableName("catalog_product_super_link");
     $xb2 = $x7d->getTableName("catalog_product_super_attribute");
     $xb3 = $x7d->getTableName("catalog_product_entity_int");
     $xb4 = $x7d->getTableName("catalog_product_super_attribute_pricing");
     $xb5 = $x7e->select();
     $xb5->from(array("cpsl" => $xa6), array("parent_id", "product_id"));
     $xb5->joinleft(array("cpsa" => $xb2), "cpsa.product_id = cpsl.parent_id", array("attribute_id"));
     $xb5->joinleft(array("cpei" => $xb3), "cpei.entity_id = cpsl.product_id AND cpei.attribute_id = cpsa.attribute_id", array("value" => "value"));
     $xb5->joinleft(array("cpsap" => $xb4), "cpsap.product_super_attribute_id = cpsa.product_super_attribute_id AND cpei.value = cpsap.value_index", array("pricing_value" => "pricing_value", "is_percent" => "is_percent"));
     $xb5->order(array("cpsl.parent_id", "cpsl.product_id"));
     $xb5->group(array("cpsl.parent_id", "cpsl.product_id", "cpsa.attribute_id"));
     $xb6 = $x7e->fetchAll($xb5);
     $xb7 = array();
     foreach ($xb6 as $xb1) {
         $xb7[$xb1["parent_id"]][$xb1["product_id"]][$xb1['attribute_id']]['attribute_id'] = $xb1["attribute_id"];
         $xb7[$xb1["parent_id"]][$xb1["product_id"]][$xb1['attribute_id']]['value'] = $xb1["value"];
         $xb7[$xb1["parent_id"]][$xb1["product_id"]][$xb1['attribute_id']]['pricing_value'] = $xb1["pricing_value"];
         $xb7[$xb1["parent_id"]][$xb1["product_id"]][$xb1['attribute_id']]['is_percent'] = $xb1["is_percent"];
     }
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  Configurable prices collected", null, $this->x165('.log'));
     }
     $this->configurablePrices = $xb7;
     if ($this->_debug) {
         echo "<br><br>------------ CONFIGURABLES PRICES ----------------<br>";
         echo $xb5 . '<br><br>';
         $x154($xb7);
     }
     $xab = Mage::getModel('simplegoogleshopping/product_collection')->getCollection()->addStoreFilter($x58);
     $xab->addAttributeToFilter('status', 1);
     $xab->addAttributeToFilter('type_id', array("in" => "grouped"));
     $xab->addAttributeToFilter('visibility', array("nin" => 1));
     $xab->addAttributeToSelect($x86, true);
     $xab->getSelect()->joinLeft($xa7 . ' AS cpl', 'cpl.product_id=e.entity_id AND cpl.link_type_id=3', array('child_ids' => 'GROUP_CONCAT( DISTINCT cpl.linked_product_id)'));
     $xab->getSelect()->joinLeft($xa2 . ' 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', 'backorders' => 'backorders', 'use_config_backorders' => 'use_config_backorders'));
     $xab->getSelect()->joinLeft($xa3 . ' AS url', 'url.product_id=e.entity_id ' . $xa9 . ' AND is_system=1 AND ' . $x79 . ' AND url.store_id=' . $x58, array('request_path' => $xaa . '(DISTINCT request_path)'));
     $xab->getSelect()->joinLeft($x83 . ' AS categories', 'categories.product_id=e.entity_id');
     $xab->getSelect()->joinLeft($xa4 . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x58, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     $xab->getSelect()->group(array('cpl.product_id'));
     $xb8 = array();
     foreach ($xab as $xad) {
         foreach (explode(",", $xad->getChildIds()) as $xae) {
             $xb8[$xae] = $xad;
             $xb9[$xae]['categories_ids'] = $xad->getCategories_ids();
             $xb9[$xae]['parent_id'] = $xad->getId();
             $xb9[$xae]['parent_sku'] = $xad->getSku();
             $xb9[$xae]['parent_request_path'] = $xad->getRequestPath();
         }
     }
     $this->grouped = $xb8;
     if ($this->_debug) {
         echo "<br><br>------------ GROUPED ----------------<br>";
         echo $xab->getSelect() . '<br><br>';
         $x154($xb9);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Relations with grouped products detected", null, $this->x165('.log'));
     $xab = Mage::getModel('simplegoogleshopping/product_collection')->getCollection()->addStoreFilter($x58);
     $xab->addAttributeToFilter('status', 1);
     $xab->addAttributeToFilter('type_id', array("in" => "bundle"));
     $xab->addAttributeToFilter('visibility', array("nin" => 1));
     $xab->addAttributeToSelect($x86, true);
     $xab->getSelect()->joinLeft($xa8 . ' AS cpbs', 'cpbs.parent_product_id=e.entity_id', array('child_ids' => 'GROUP_CONCAT( DISTINCT cpbs.product_id)'));
     $xab->getSelect()->joinLeft($xa2 . ' 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', 'backorders' => 'backorders', 'use_config_backorders' => 'use_config_backorders'));
     $xab->getSelect()->joinLeft($xa3 . ' AS url', 'url.product_id=e.entity_id ' . $xa9 . ' AND is_system=1 AND ' . $x79 . ' AND url.store_id=' . $x58, array('request_path' => $xaa . '(DISTINCT request_path)'));
     $xab->getSelect()->joinLeft($x83 . ' AS categories', 'categories.product_id=e.entity_id');
     $xab->getSelect()->joinLeft($xa4 . ' AS categories_index', 'categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x58, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     $xab->getSelect()->group(array('e.entity_id'));
     $xba = array();
     foreach ($xab as $xad) {
         foreach (explode(",", $xad->getChildIds()) as $xae) {
             $xba[$xae] = $xad;
             $xbb[$xae]['parent_id'] = $xad->getId();
             $xbb[$xae]['parent_sku'] = $xad->getSku();
             $xbb[$xae]['parent_request_path'] = $xad->getRequestPath();
             $xbb[$xae]['categories_ids'] = $xad->getCategories_ids();
         }
     }
     $this->bundle = $xba;
     if ($this->_debug) {
         echo "<br><br>------------ BUNDLE ----------------<br>";
         echo $xab->getSelect() . '<br><br>';
         $x154($xbb);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Relations with bundle products detected", null, $this->x165('.log'));
     $xbc = $x7d->getTableName("catalog_product_option");
     $xbd = $x7d->getTableName("catalog_product_option_title");
     $xbe = $x7d->getTableName("catalog_product_option_type_value");
     $xbf = $x7d->getTableName("catalog_product_option_type_title");
     $xc0 = $x7d->getTableName("catalog_product_option_type_price");
     $xc1 = $x7e->select();
     $xc1->from(array("cpo" => $xbc), array("product_id"));
     $xc1->joinleft(array("cpot" => $xbd), "cpot.option_id=cpo.option_id AND cpot.store_id=0", array("option" => "title", "option_id", "store_id"));
     $xc1->joinleft(array("cpotv" => $xbe), "cpotv.option_id = cpo.option_id", array("sku", "id" => "option_type_id"));
     $xc1->joinleft(array("cpott" => $xbf), "cpott.option_type_id=cpotv.option_type_id AND cpott.store_id=cpot.store_id", "title AS value");
     $xc1->joinleft(array("cpotp" => $xc0), "cpotp.option_type_id=cpotv.option_type_id AND cpotp.store_id=cpot.store_id", array("price", "price_type"));
     $x80 = $xc1->order(array("product_id", "cpotv.sort_order ASC"));
     $x9a = $x7e->fetchAll($x80);
     $xc2 = array();
     $xc3 = 0;
     foreach ($x9a as $xc4) {
         $xc2[$xc4["product_id"]][$xc4["option"]]["options"][] = array("value" => $xc4["value"], "sku" => $xc4["sku"], "price" => $xc4["price"], "price_type" => $xc4["price_type"]);
         $xc3++;
     }
     $this->customOptions = $xc2;
     if ($this->_debug) {
         echo "<br><br>------------ CUSTOM OPTIONS ----------------<br>";
         echo $xc1 . '<br><br>';
         $x154($xc2);
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Custom options collected", null, $this->x165('.log'));
     if (Mage::helper("core")->isModuleEnabled("Wyomind_Googlemerchantpromotions")) {
         $xc5 = Mage::getResourceModel('salesrule/rule_collection')->setOrder('sort_order', 'ASC')->addFieldToFilter("transferable_to_google_merchant", 1)->load();
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Promotions rules collected", null, $this->x165('.log'));
     }
     $xc6 = Mage::getModel('simplegoogleshopping/product_collection')->getCollection()->addStoreFilter($x58);
     if (Mage::getStoreConfig("simplegoogleshopping/system/disabled")) {
         $xc6->addFieldToFilter("status", array('gteq' => 1));
     } else {
         $xc6->addFieldToFilter("status", 1);
     }
     $xc6->addAttributeToFilter("type_id", array("in" => $x6f));
     $xc6->addAttributeToFilter("visibility", array("in" => $x70));
     if ($x72[0] != '*') {
         $xc6->addAttributeToFilter("attribute_set_id", array("in" => $x72));
     }
     $xc6->addAttributeToSelect($x86, true);
     $xc7 = 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)");
     $xc8 = '';
     $x32 = 0;
     $xc9 = array();
     foreach ($x71 as $x88) {
         if ($x88->checked) {
             if ($x88->condition == 'in' || $x88->condition == 'nin') {
                 if ($x88->code == 'qty' || $x88->code == 'is_in_stock') {
                     $xca = explode(',', $x88->value);
                     $x88->value = "'" . implode($xca, "','") . "'";
                 } else {
                     $x88->value = explode(',', $x88->value);
                 }
             }
             switch ($x88->code) {
                 case 'qty':
                     if ($x32 > 0) {
                         $xc8 .= ' ' . $x88->statement . ' ';
                     }
                     $xc8 .= " qty " . sprintf($xc7[$x88->condition], $x88->value);
                     $x32++;
                     break;
                 case 'is_in_stock':
                     if ($x32 > 0) {
                         $xc8 .= ' ' . $x88->statement . ' ';
                     }
                     $xc8 .= " (IF(";
                     $xc8 .= "(use_config_manage_stock=1 AND {$x5d}=0)";
                     $xc8 .= " OR ";
                     $xc8 .= '(use_config_manage_stock=0 AND manage_stock=0)';
                     $xc8 .= " OR ";
                     $xc8 .= "(use_config_manage_stock=1 AND {$x5d}=1 AND is_in_stock=1 )";
                     $xc8 .= " OR ";
                     $xc8 .= "(use_config_manage_stock=0 AND manage_stock=1 AND is_in_stock=1 )";
                     $xc8 .= ",'1','0')" . sprintf($xc7[$x88->condition], $x88->value) . ")";
                     $x32++;
                     break;
                 default:
                     if ($x88->statement == "AND") {
                         if (count($xc9)) {
                             $xc6->addFieldToFilter($xc9);
                         }
                         $xc9 = array();
                     }
                     if ($x88->condition == "in") {
                         $xcb = true;
                         $xcc = array();
                         foreach ($x88->value as $xcd) {
                             if (!$x14d($xcd)) {
                                 $xcb = true;
                             }
                         }
                         if ($xcb) {
                             foreach ($x88->value as $xcd) {
                                 $xcc[] = array(array("finset" => $xcd));
                             }
                             $xc9[] = array("attribute" => $x88->code, $xcc);
                         } else {
                             $xc9[] = array("attribute" => $x88->code, $x88->condition => $x88->value);
                         }
                     } else {
                         $xc9[] = array("attribute" => $x88->code, $x88->condition => $x88->value);
                     }
                     break;
             }
         }
     }
     if (count($xc9)) {
         $xc6->addFieldToFilter($xc9);
     }
     $xc6->getSelect()->joinLeft($xa2 . ' 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', 'backorders' => 'backorders', 'use_config_backorders' => 'use_config_backorders'));
     $xc6->getSelect()->joinLeft($xa3 . ' AS url', 'url.product_id=e.entity_id ' . $xa9 . ' AND is_system=1 AND ' . $x79 . ' AND url.store_id=' . $x58, array('request_path' => $xaa . '(DISTINCT request_path)'));
     if ($x6c[0] != '*') {
         $xcd = 0;
         $xce = null;
         foreach ($x6c as $x6e) {
             if ($xcd > 0) {
                 $xce .= ',';
             }
             $xce .= $x157(explode('/', $x6e));
             $xcd++;
         }
         $x6a ? $xcf = "IN" : ($xcf = "NOT IN");
         $xc6->getSelect()->joinLeft($xa6 . ' AS cpsl', 'cpsl.product_id=e.entity_id ', array('parent_id' => 'parent_id'));
         switch ($x6b) {
             case 0:
                 $xd0 = "categories.product_id=e.entity_id";
                 break;
             case 1:
                 $xd0 = "categories.product_id=e.entity_id OR categories.product_id=cpsl.parent_id";
                 break;
             case 2:
                 $xd0 = "categories.product_id=cpsl.parent_id ";
                 break;
         }
         if ($x155(Mage::getVersion(), '1.12.0', '<=')) {
             $xce = "AND categories_index.category_id " . $xcf . " (" . $xce . ")";
             $xc6->getSelect()->joinLeft($x83 . ' AS categories', $xd0, array());
             $xc6->getSelect()->joinInner($xa4 . ' AS categories_index', '((categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id)) AND categories_index.store_id=' . $x58 . ' ' . $xce, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
         } else {
             $xce = "AND categories.category_id " . $xcf . " (" . $xce . ")";
             $xc6->getSelect()->joinInner($x83 . ' AS categories', $xd0 . ' ' . $xce, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories.category_id)'));
         }
     } else {
         $xc6->getSelect()->joinLeft($x83 . ' AS categories', 'categories.product_id=e.entity_id');
         $xc6->getSelect()->joinLeft($xa4 . ' AS categories_index', '((categories_index.category_id=categories.category_id AND categories_index.product_id=categories.product_id) ) AND categories_index.store_id=' . $x58, array('categories_ids' => 'GROUP_CONCAT(DISTINCT categories_index.category_id)'));
     }
     if ($x155(Mage::getVersion(), '1.4.0', '>=')) {
         $xc6->getSelect()->joinLeft($xa5 . ' 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($x58)->getWebsiteId(), array('min_price' => 'min_price', 'max_price' => 'max_price', 'tier_price' => 'tier_price', 'final_price' => 'final_price'));
     }
     if (!empty($xc8)) {
         $xc6->getSelect()->where($xc8);
     }
     $xc6->getSelect()->group("e.entity_type_id");
     if ($this->_log) {
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Main sql request: \n" . $xc6->getSelect(), null, $this->x165('.log'));
     }
     if ($this->_debug) {
         echo "<br><br>------------ MAIN SQL REQUEST ----------------<br>";
         echo $xc6->getSelect();
     }
     $xd1 = 0;
     $xd2 = clone $xc6;
     $xd2->getSelect()->columns("COUNT(DISTINCT e.entity_id) As total");
     $this->_counter = $xd2->getFirstItem()->getTotal();
     $xd3 = ceil($this->_counter / $this->_sqlSize);
     $x73 = '';
     $xd4 = 1;
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Total items calculated ({$this->_counter} in {$xd3} queries )", null, $this->x165('.log'));
     $xc6->getSelect()->group(array('e.entity_id'))->order('e.entity_id');
     $xd5 = time(true);
     $xd6 = 0;
     while ($xd1 < $xd3) {
         $xab = clone $xc6;
         if ($this->_debug) {
             echo "<br><br>------------ SQL ----------------<br>";
             print $xab->getSelect();
         }
         $xab->getSelect()->limit($this->_sqlSize, $this->_sqlSize * $xd1);
         $xd1++;
         if ($this->_sqlSize * $xd1 > $this->_counter) {
             $xd7 = $this->_counter;
         } else {
             $xd7 = $this->_sqlSize * $xd1;
         }
         if ($this->_log) {
             Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Fetching products from " . ($this->_sqlSize * ($xd1 - 1) + 1) . " to " . $xd7, null, $this->x165('.log'));
         }
         $xc3 = 1;
         foreach ($xab as $product) {
             if ($this->_debug) {
                 echo "<br><br>------------ PRODUCT [ SKU -> " . $product->getSku() . " | ID -> " . $product->getId() . "]---------------<br>";
                 echo "categories : " . $product->getCategoriesIds() . ", Root id: " . $x63 . "<br>";
                 foreach (explode(',', $product->getCategoriesIds()) as $x37 => $x7c) {
                     echo $x7c . "=>" . $x7b[$x7c]["path"] . "<br>";
                 }
             }
             $x48 = $x66;
             foreach ($x76 as $x37 => $xd8) {
                 $x4a = "";
                 switch ($xd8['pattern']) {
                     case '{G:ID}':
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $xd8['options'][0] != "id" ? $xda = $xd9->getSku() : ($xda = $xd9->getId());
                         $x4a = "<g:id><![CDATA[" . $xda . "]]></g:id>";
                         break;
                     case '{G:TITLE}':
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x39 = $xd9->getName();
                         if (strlen($x39) > 900) {
                             $x39 = substr($x39, 0, 150, -3);
                             $xdb = strrpos($x39, " ");
                             $x39 = substr($x39, 0, $xdb) . "...";
                         }
                         $x4a = "<title><![CDATA[" . $x39 . "]]></title>";
                         break;
                     case '{G:DESCRIPTION}':
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $xd8['options'][0] != "short" ? $xdc = $xd9->getDescription() : ($xdc = $xd9->getShortDescription());
                         $x4a = "<description><![CDATA[" . $xdc . "]]></description>";
                         break;
                     case '{G:PROMOTION_ID}':
                         $x4a = "";
                         $xdd = clone $xc5;
                         foreach ($xdd as $xde) {
                             if ($xde->getIsActive()) {
                                 $xdf = unserialize($xde->getConditions_serialized());
                                 $xdf = $xdf["conditions"];
                                 $xe0 = $xde->getConditions();
                                 $xe1 = $xe0->getAggregator() === 'all';
                                 $xe2 = (bool) $xe0->getValue();
                                 $xe3 = $xe1 ? true : false;
                                 $xe3 = !count($xe0->getConditions()) ? true : $xe3;
                                 $xe4 = 0;
                                 foreach ($xe0->getConditions() as $xe5) {
                                     $xe6 = array("salesrule/rule_condition_product_subselect", "salesrule/rule_condition_address");
                                     if (!$x156($xe5->getType(), $xe6)) {
                                         $xe7 = $xe5->validate($product);
                                         if ($xe1 && $xe7 !== $xe2) {
                                             $xe3 = false;
                                         } elseif (!$xe1 && $xe7 === $xe2) {
                                             $xe3 = true;
                                             break;
                                         }
                                     } else {
                                         if ($xe5->getAttribute() == "base_subtotal") {
                                         }
                                     }
                                     $xe4++;
                                 }
                                 $xe8 = unserialize($xde->getActions_serialized());
                                 $xe8 = $xe8["conditions"];
                                 $xe9 = $xde->getActions();
                                 $xe1 = $xe9->getAggregator() === 'all';
                                 $xe2 = (bool) $xe9->getValue();
                                 $xea = $xe1 ? true : false;
                                 $xea = !count($xe9->getConditions()) ? true : $xea;
                                 $xe4 = 0;
                                 foreach ($xe9->getConditions() as $x57) {
                                     $xe7 = $x57->validate($product);
                                     if ($xe1 && $xe7 !== $xe2) {
                                         $xea = false;
                                     } elseif (!$xe1 && $xe7 === $xe2) {
                                         $xea = true;
                                         break;
                                     }
                                     $xe4++;
                                 }
                                 if ($xea && $xe3) {
                                     $x4a = "<g:promotion_id><![CDATA[" . $xde->getData('rule_id') . "]]></g:promotion_id>";
                                     break;
                                 }
                             }
                         }
                         break;
                     case "{load_options}":
                         $x9a = 1;
                         $xeb = array();
                         foreach ($xd8['options'] as $x37 => $xec) {
                             if (isset($xc2[$product->getId()][$xec])) {
                                 $x9a = $x9a * count($xc2[$product->getId()][$xec]["options"]);
                                 $xeb[$x37] = 0;
                             }
                         }
                         $x35 = array();
                         for ($x94 = 1; $x94 <= $x9a; $x94++) {
                             $xed = $x48;
                             foreach ($xd8['options'] as $x37 => $xec) {
                                 if (isset($xc2[$product->getId()][$xec])) {
                                     $xed = $x147("{" . $xec . "_label}", $xc2[$product->getId()][$xec]["options"][$xeb[$x37]]['value'], $xed);
                                     $xed = $x147("{" . $xec . "_sku}", $xc2[$product->getId()][$xec]["options"][$xeb[$x37]]['sku'], $xed);
                                     $xed = $x147("{" . $xec . "_price}", $xc2[$product->getId()][$xec]["options"][$xeb[$x37]]['price'], $xed);
                                     $xed = $x147("{" . $xec . "_type}", $xc2[$product->getId()][$xec]["options"][$xeb[$x37]]['price_type'], $xed);
                                     $xed = $x147("{" . $xec . "_id}", $xc2[$product->getId()][$xec]["options"][$xeb[$x37]]['id'], $xed);
                                     if ($x37 > 0 || count($xc2[$product->getId()]) == 1 || count($xd8['options']) < 2) {
                                         $xeb[$x37]++;
                                     }
                                     if ($xeb[$x37] >= count($xc2[$product->getId()][$xec]["options"])) {
                                         $xeb[$x37] = 0;
                                         $xeb[$x37 - 1]++;
                                     }
                                 }
                             }
                             $x35[] = $xed;
                         }
                         if (count($x35) > 0) {
                             $x48 = implode("</item>\n<item>", $x35);
                         }
                         break;
                     case "{use_options}":
                         foreach ($xd8['options'] as $x37 => $xec) {
                             if (isset($xc2[$product->getId()][$xec])) {
                                 $xee = array();
                                 $xef = array();
                                 $xf0 = array();
                                 $xf1 = array();
                                 foreach ($xc2[$product->getId()][$xec]["options"] as $x4c) {
                                     $xee[] = $x4c['value'];
                                     $xef[] = $x4c['sku'];
                                     $xf0[] = $x4c['price'];
                                     $xf1[] = $x4c['id'];
                                 }
                                 $x48 = $x147("{" . $xec . "_label}", implode(',', $xee), $x48);
                                 $x48 = $x147("{" . $xec . "_sku}", implode(',', $xef), $x48);
                                 $x48 = $x147("{" . $xec . "_price}", implode(',', $xf0), $x48);
                                 $x48 = $x147("{" . $xec . "_id}", implode(',', $xf1), $x48);
                             }
                         }
                         break;
                     case '{inc}':
                         $x4a = $xd4;
                         break;
                     case '{min_price}':
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x3e = $xd9->getMinPrice();
                         !isset($xd8['options'][1]) ? $x43 = false : ($x43 = $xd8['options'][1]);
                         if ($xd9->getTypeId() == "configurable") {
                             if (isset($this->configurablePrices[$xd9->getId()][$product->getId()])) {
                                 $xf2 = 0;
                                 foreach ($this->configurablePrices[$xd9->getId()][$product->getId()] as $xf3) {
                                     if ($xf3["is_percent"]) {
                                         $xf2 += $xf3["pricing_value"] / 100 * $x3e;
                                     } else {
                                         $xf2 += $xf3["pricing_value"];
                                     }
                                 }
                                 $x3e += $xf2;
                             }
                         }
                         $x4a = $this->x167($x3e, $x62, $xd9->getTaxClassId(), $x43);
                         !isset($xd8['options'][0]) ? $x3f = $x5c : ($x3f = $xd8['options'][0]);
                         $x4a = $this->x166($x4a, $x3f);
                         $x4a = $x14c($x4a, 2, '.', '');
                         break;
                     case '{max_price}':
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x3e = $xd9->getMaxPrice();
                         !isset($xd8['options'][1]) ? $x43 = false : ($x43 = $xd8['options'][1]);
                         if ($xd9->getTypeId() == "configurable") {
                             if (isset($this->configurablePrices[$xd9->getId()][$product->getId()])) {
                                 $xf2 = 0;
                                 foreach ($this->configurablePrices[$xd9->getId()][$product->getId()] as $xf3) {
                                     if ($xf3["is_percent"]) {
                                         $xf2 += $xf3["pricing_value"] / 100 * $x3e;
                                     } else {
                                         $xf2 += $xf3["pricing_value"];
                                     }
                                 }
                                 $x3e += $xf2;
                             }
                         }
                         $x4a = $this->x167($x3e, $x62, $xd9->getTaxClassId(), $x43);
                         !isset($xd8['options'][0]) ? $x3f = $x5c : ($x3f = $xd8['options'][0]);
                         $x4a = $this->x166($x4a, $x3f);
                         $x4a = $x14c($x4a, 2, '.', '');
                         break;
                     case '{normal_price}':
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         if ($xd9->type_id == 'bundle') {
                             $x3e = $xd9->price;
                         } else {
                             $x3e = $xd9->getPrice();
                         }
                         if ($xd9->getTypeId() == "configurable") {
                             if (isset($this->configurablePrices[$xd9->getId()][$product->getId()])) {
                                 $xf2 = 0;
                                 foreach ($this->configurablePrices[$xd9->getId()][$product->getId()] as $xf3) {
                                     if ($xf3["is_percent"]) {
                                         $xf2 += $xf3["pricing_value"] / 100 * $x3e;
                                     } else {
                                         $xf2 += $xf3["pricing_value"];
                                     }
                                 }
                                 $x3e += $xf2;
                             }
                         }
                         !isset($xd8['options'][1]) ? $x43 = false : ($x43 = $xd8['options'][1]);
                         $x4a = $this->x167($x3e, $x62, $xd9->getTaxClassId(), $x43);
                         !isset($xd8['options'][0]) ? $x3f = $x5c : ($x3f = $xd8['options'][0]);
                         $x4a = $this->x166($x4a, $x3f);
                         $x4a = $x14c($x4a, 2, '.', '');
                         break;
                     case '{price}':
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         if ($xd9->getSpecialFromDate() && !$xd9->getSpecialToDate()) {
                             if ($xd9->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xd9->type_id == "bundle") {
                                     if (($xd9->price_type || !$xd9->price_type && $xd9->special_price < $xd9->price) && $xd9->special_price > 0) {
                                         if ($xd9->price_type) {
                                             $x3e = $x14c($xd9->price * $xd9->special_price / 100, 2, ".", "");
                                         } else {
                                             $x3e = $xd9->special_price;
                                         }
                                     } else {
                                         $x3e = $xd9->price;
                                     }
                                 } else {
                                     $xd9->getSpecial_price() && $xd9->getSpecial_price() < $xd9->getPrice() ? $x3e = $xd9->getSpecialPrice() : ($x3e = $xd9->getPrice());
                                 }
                             } else {
                                 if ($xd9->type_id == "bundle") {
                                     $x3e = $xd9->price;
                                 } else {
                                     $x3e = $xd9->getPrice();
                                 }
                             }
                         } elseif ($xd9->getSpecialFromDate() && $xd9->getSpecialToDate()) {
                             if ($xd9->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xd9->getSpecialToDate()) {
                                 if ($xd9->type_id == "bundle") {
                                     if (($xd9->price_type || !$xd9->price_type && $xd9->special_price < $xd9->price) && $xd9->special_price > 0) {
                                         if ($xd9->price_type) {
                                             $x3e = $x14c($xd9->price * $xd9->special_price / 100, 2, ".", "");
                                         } else {
                                             $x3e = $xd9->special_price;
                                         }
                                     } else {
                                         $x3e = $xd9->price;
                                     }
                                 } else {
                                     $xd9->getSpecial_price() && $xd9->getSpecial_price() < $xd9->getPrice() ? $x3e = $xd9->getSpecialPrice() : ($x3e = $xd9->getPrice());
                                 }
                             } else {
                                 if ($xd9->type_id == "bundle") {
                                     $x3e = $xd9->price;
                                 } else {
                                     $x3e = $xd9->getPrice();
                                 }
                             }
                         } else {
                             if ($xd9->type_id == "bundle") {
                                 if (($xd9->price_type || !$xd9->price_type && $xd9->special_price < $xd9->price) && $xd9->special_price > 0) {
                                     if ($xd9->price_type) {
                                         $x3e = $x14c($xd9->price * $xd9->special_price / 100, 2, ".", "");
                                     } else {
                                         $x3e = $xd9->special_price;
                                     }
                                 } else {
                                     $x3e = $xd9->price;
                                 }
                             } else {
                                 $xd9->getSpecial_price() && $xd9->getSpecial_price() < $xd9->getPrice() ? $x3e = $xd9->getSpecialPrice() : ($x3e = $xd9->getPrice());
                             }
                         }
                         if ($xd9->getTypeId() == "configurable") {
                             if (isset($this->configurablePrices[$xd9->getId()][$product->getId()])) {
                                 $xf2 = 0;
                                 foreach ($this->configurablePrices[$xd9->getId()][$product->getId()] as $xf3) {
                                     if ($xf3["is_percent"]) {
                                         $xf2 += $xf3["pricing_value"] / 100 * $x3e;
                                     } else {
                                         $xf2 += $xf3["pricing_value"];
                                     }
                                 }
                                 $x3e += $xf2;
                             }
                         }
                         !isset($xd8['options'][1]) ? $x43 = false : ($x43 = $xd8['options'][1]);
                         $x4a = $this->x167($x3e, $x62, $xd9->getTaxClassId(), $x43);
                         !isset($xd8["options"][0]) ? $x3f = $x5c : ($x3f = $xd8["options"][0]);
                         $x4a = $this->x166($x4a, $x3f);
                         $x4a = $x14c($x4a, 2, ".", "");
                         break;
                     case "{is_special_price}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         !isset($xd8["options"][0]) ? $xe2 = 1 : ($xe2 = $xd8["options"][0]);
                         !isset($xd8["options"][1]) ? $xf4 = 0 : ($xf4 = $xd8["options"][1]);
                         if ($xd9->getSpecialFromDate() && !$xd9->getSpecialToDate()) {
                             if ($xd9->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xd9->type_id == "bundle") {
                                     ($xd9->price_type || !$xd9->price_type && $xd9->special_price < $xd9->price) && $xd9->special_price > 0 ? $x4a = $xe2 : ($x4a = $xf4);
                                 } else {
                                     $xd9->getSpecial_price() && $xd9->getSpecial_price() < $xd9->getPrice() ? $x4a = $xe2 : ($x4a = $xf4);
                                 }
                             } else {
                                 if ($xd9->type_id == "bundle") {
                                     $x4a = $xf4;
                                 } else {
                                     $x4a = $xf4;
                                 }
                             }
                         } elseif ($xd9->getSpecialFromDate() && $xd9->getSpecialToDate()) {
                             if ($xd9->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xd9->getSpecialToDate()) {
                                 if ($xd9->type_id == "bundle") {
                                     ($xd9->price_type || !$xd9->price_type && $xd9->special_price < $xd9->price) && $xd9->special_price > 0 ? $x4a = $xe2 : ($x4a = $xf4);
                                 } else {
                                     $xd9->getSpecial_price() && $xd9->getSpecial_price() < $xd9->getPrice() ? $x4a = $xe2 : ($x4a = $xf4);
                                 }
                             } else {
                                 if ($xd9->type_id == "bundle") {
                                     $x4a = $xf4;
                                 } else {
                                     $x4a = $xf4;
                                 }
                             }
                         } else {
                             if ($xd9->type_id == "bundle") {
                                 ($xd9->price_type || !$xd9->price_type && $xd9->special_price < $xd9->price) && $xd9->special_price > 0 ? $x4a = $xe2 : ($x4a = $xf4);
                             } else {
                                 $xd9->getSpecial_price() && $xd9->getSpecial_price() < $xd9->getPrice() ? $x4a = $xe2 : ($x4a = $xf4);
                             }
                         }
                         break;
                     case "{special_price}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x3e = null;
                         if ($xd9->getSpecialFromDate() && !$xd9->getSpecialToDate()) {
                             if ($xd9->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xd9->type_id == 'bundle') {
                                     if ($xd9->price_type) {
                                         $x3e = $x14c($xd9->price * $xd9->special_price / 100, 2, ".", "");
                                     } else {
                                         $x3e = $xd9->special_price;
                                     }
                                 } else {
                                     $x3e = $xd9->getSpecial_price();
                                 }
                             }
                         } elseif ($xd9->getSpecialFromDate() && $xd9->getSpecialToDate()) {
                             if ($xd9->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xd9->getSpecialToDate()) {
                                 if ($xd9->type_id == 'bundle') {
                                     if ($xd9->price_type) {
                                         $x3e = $x14c($xd9->price * $xd9->special_price / 100, 2, ".", "");
                                     } else {
                                         $x3e = $xd9->special_price;
                                     }
                                 } else {
                                     $x3e = $xd9->getSpecial_price();
                                 }
                             }
                         } else {
                             if ($xd9->type_id == 'bundle') {
                                 if ($xd9->price_type) {
                                     $x3e = $x14c($xd9->price * $xd9->special_price / 100, 2, ".", "");
                                 } else {
                                     $x3e = $xd9->special_price;
                                 }
                             } else {
                                 $x3e = $xd9->getSpecial_price();
                             }
                         }
                         !isset($xd8['options'][1]) ? $x43 = false : ($x43 = $xd8['options'][1]);
                         if ($x3e > 0) {
                             if ($xd9->getTypeId() == "configurable") {
                                 if (isset($this->configurablePrices[$xd9->getId()][$product->getId()])) {
                                     $xf2 = 0;
                                     foreach ($this->configurablePrices[$xd9->getId()][$product->getId()] as $xf3) {
                                         if ($xf3["is_percent"]) {
                                             $xf2 += $xf3["pricing_value"] / 100 * $x3e;
                                         } else {
                                             $xf2 += $xf3["pricing_value"];
                                         }
                                     }
                                     $x3e += $xf2;
                                 }
                             }
                             $x4a = $this->x167($x3e, $x62, $xd9->getTaxClassId(), $x43);
                             !isset($xd8['options'][0]) ? $x3f = $x5c : ($x3f = $xd8['options'][0]);
                             $x4a = $this->x166($x4a, $x3f);
                             $x4a = $x14c($x4a, 2, '.', '');
                         } else {
                             $x4a = "";
                         }
                         break;
                     case '{price_rules}':
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x58 = $this->getStoreId();
                         $xf5 = Mage::getResourceModel('catalogrule/rule');
                         $xf6 = Mage::app()->getLocale()->storeTimeStamp($x58);
                         $xf7 = Mage::app()->getStore($x58);
                         $xf8 = $xf7->getWebsiteId();
                         $xf9 = Mage::getSingleton('customer/session')->getCustomerGroupId();
                         $xfa = $xf5->getRulePrice($xf6, $xf8, $xf9, $xd9->getId());
                         if ($xfa !== false) {
                             $xfb = sprintf('%.2f', round($xfa, 2));
                         } else {
                             $xfb = $xd9->getPrice();
                         }
                         if ($xd9->getSpecialFromDate() && !$xd9->getSpecialToDate()) {
                             if ($xd9->getSpecialFromDate() <= date("Y-m-d H:i:s")) {
                                 if ($xd9->type_id == "bundle") {
                                     if (($xd9->price_type || !$xd9->price_type && $xd9->special_price < $xd9->price) && $xd9->special_price > 0) {
                                         if ($xd9->price_type) {
                                             $x3e = $x14c($xd9->price * $xd9->special_price / 100, 2, ".", "");
                                         } else {
                                             $x3e = $xd9->special_price;
                                         }
                                     } else {
                                         $x3e = $xd9->price;
                                     }
                                 } else {
                                     $xd9->getSpecial_price() && $xd9->getSpecial_price() < $xd9->getPrice() ? $x3e = $xd9->getSpecialPrice() : ($x3e = $xfb);
                                 }
                             } else {
                                 if ($xd9->type_id == "bundle") {
                                     $x3e = $xd9->price;
                                 } else {
                                     $x3e = $xfb;
                                 }
                             }
                         } elseif ($xd9->getSpecialFromDate() && $xd9->getSpecialToDate()) {
                             if ($xd9->getSpecialFromDate() <= date("Y-m-d H:i:s") && date("Y-m-d H:i:s") < $xd9->getSpecialToDate()) {
                                 if ($xd9->type_id == "bundle") {
                                     if (($xd9->price_type || !$xd9->price_type && $xd9->special_price < $xd9->price) && $xd9->special_price > 0) {
                                         if ($xd9->price_type) {
                                             $x3e = $x14c($xd9->price * $xd9->special_price / 100, 2, ".", "");
                                         } else {
                                             $x3e = $xd9->special_price;
                                         }
                                     } else {
                                         $x3e = $xd9->price;
                                     }
                                 } else {
                                     $xd9->getSpecial_price() && $xd9->getSpecial_price() < $xd9->getPrice() ? $x3e = $xd9->getSpecialPrice() : ($x3e = $xfb);
                                 }
                             } else {
                                 if ($xd9->type_id == "bundle") {
                                     $x3e = $xd9->price;
                                 } else {
                                     $x3e = $xfb;
                                 }
                             }
                         } else {
                             if ($xd9->type_id == "bundle") {
                                 if (($xd9->price_type || !$xd9->price_type && $xd9->special_price < $xd9->price) && $xd9->special_price > 0) {
                                     if ($xd9->price_type) {
                                         $x3e = $x14c($xd9->price * $xd9->special_price / 100, 2, ".", "");
                                     } else {
                                         $x3e = $xd9->special_price;
                                     }
                                 } else {
                                     $x3e = $xd9->price;
                                 }
                             } else {
                                 $xd9->getSpecial_price() && $xd9->getSpecial_price() < $xd9->getPrice() ? $x3e = $xd9->getSpecialPrice() : ($x3e = $xfb);
                             }
                         }
                         if ($xfb !== FALSE) {
                             if ($xfb < $x3e) {
                                 $x4a = $xfb;
                             } else {
                                 $x4a = $x3e;
                             }
                         } else {
                             $x4a = $x3e;
                         }
                         if ($xd9->getTypeId() == "configurable") {
                             if (isset($this->configurablePrices[$xd9->getId()][$product->getId()])) {
                                 $xf2 = 0;
                                 foreach ($this->configurablePrices[$xd9->getId()][$product->getId()] as $xf3) {
                                     if ($xf3["is_percent"]) {
                                         $xf2 += $xf3["pricing_value"] / 100 * $x3e;
                                     } else {
                                         $xf2 += $xf3["pricing_value"];
                                     }
                                 }
                                 $x3e += $xf2;
                             }
                         }
                         !isset($xd8['options'][1]) ? $x43 = false : ($x43 = $xd8['options'][1]);
                         $x4a = $this->x167($x3e, $x62, $xd9->getTaxClassId(), $x43);
                         !isset($xd8["options"][0]) ? $x3f = $x5c : ($x3f = $xd8["options"][0]);
                         $x4a = $this->x166($x4a, $x3f);
                         $x4a = $x14c($x4a, 2, ".", "");
                         break;
                     case '{G:PRICE}':
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         if ($xd9->type_id == 'bundle') {
                             $x3e = $xd9->price;
                         } else {
                             $x3e = $xd9->getPrice();
                         }
                         if ($xd9->getTypeId() == "configurable") {
                             if (isset($this->configurablePrices[$xd9->getId()][$product->getId()])) {
                                 $xf2 = 0;
                                 foreach ($this->configurablePrices[$xd9->getId()][$product->getId()] as $xf3) {
                                     if ($xf3["is_percent"]) {
                                         $xf2 += $xf3["pricing_value"] / 100 * $x3e;
                                     } else {
                                         $xf2 += $xf3["pricing_value"];
                                     }
                                 }
                                 $x3e += $xf2;
                             }
                         }
                         !isset($xd8['options'][1]) ? $x43 = false : ($x43 = $xd8['options'][1]);
                         $x4a = $this->x167($x3e, $x62, $xd9->getTaxClassId(), $x43);
                         !isset($xd8['options'][0]) ? $x3f = $x5c : ($x3f = $xd8['options'][0]);
                         $x4a = $this->x166($x4a, $x3f);
                         $x4a = $x14c($x4a, 2, '.', '');
                         $x4a = "<g:price><![CDATA[" . $x4a . " " . $x3f . "]]></g:price>";
                         break;
                     case "{G:SALE_PRICE}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x58 = $this->getStoreId();
                         $xf5 = Mage::getResourceModel('catalogrule/rule');
                         $xf6 = Mage::app()->getLocale()->storeTimeStamp($x58);
                         $xf7 = Mage::app()->getStore($x58);
                         $xf8 = $xf7->getWebsiteId();
                         $xf9 = Mage::getSingleton('customer/session')->getCustomerGroupId();
                         $xfa = $xf5->getRulePrice($xf6, $xf8, $xf9, $xd9->getId());
                         if ($xfa !== false) {
                             $xfb = sprintf('%.2f', round($xfa, 2));
                         }
                         $xfc = Mage::getSingleton('core/date')->getGmtOffset("hours");
                         if ($xfc > 0) {
                             $xfd = "+";
                             $xfe = $x158(abs(floor($xfc)), 2, 0, STR_PAD_LEFT) . '' . $x158((abs($xfc) - floor(abs($xfc))) * 60, 2, 0, STR_PAD_LEFT);
                         } else {
                             $xfd = "-";
                             $xfe = $x158(abs(floor($xfc)), 2, 0, STR_PAD_LEFT) . '' . $x158((abs($xfc) - floor(abs($xfc))) * 60, 2, 0, STR_PAD_LEFT);
                         }
                         $xff = substr($x147(' ', 'T', $xd9->getSpecialFromDate()), 0, -3);
                         $x100 = substr($x147(' ', 'T', $xd9->getSpecialToDate()), 0, -3);
                         if ($xd9->type_id == 'bundle' && $xd9->special_price) {
                             if ($xd9->price_type) {
                                 $x3e = $x14c($xd9->price * $xd9->special_price / 100, 2, ".", "");
                             } else {
                                 $x3e = $xd9->special_price;
                             }
                         } else {
                             $x3e = $xd9->getSpecial_price();
                         }
                         !isset($xd8['options'][1]) ? $x43 = false : ($x43 = $xd8['options'][1]);
                         if ($xfb < $x3e && $xfa !== false) {
                             $x3e = $xfb;
                         }
                         if ($x3e > 0) {
                             if ($xd9->getTypeId() == "configurable") {
                                 if (isset($this->configurablePrices[$xd9->getId()][$product->getId()])) {
                                     $xf2 = 0;
                                     foreach ($this->configurablePrices[$xd9->getId()][$product->getId()] as $xf3) {
                                         if ($xf3["is_percent"]) {
                                             $xf2 += $xf3["pricing_value"] / 100 * $x3e;
                                         } else {
                                             $xf2 += $xf3["pricing_value"];
                                         }
                                     }
                                     $x3e += $xf2;
                                 }
                             }
                             $x3e = $this->x167($x3e, $x62, $xd9->getTaxClassId(), $x43);
                             !isset($xd8['options'][0]) ? $x3f = $x5c : ($x3f = $xd8['options'][0]);
                             $x3e = $this->x166($x3e, $x3f);
                             $x3e = $x14c($x3e, 2, '.', '');
                         }
                         if ($x3e > 0) {
                             $x4a = "<g:sale_price><![CDATA[" . $x3e . " " . $x3f . "]]></g:sale_price>\n";
                         }
                         if ($x3e > 0 && $x100) {
                             $x4a .= "<g:sale_price_effective_date><![CDATA[" . $xff . $xfd . $xfe . "/" . $x100 . $xfd . $xfe . "]]></g:sale_price_effective_date>\n";
                         }
                         break;
                     case "{image}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x101 = $xd9->getImage();
                         if (!isset($xd8['options'][0]) || $xd8['options'][0] == 0) {
                             if ($xd9->getImage() && $xd9->getImage() != 'no_selection') {
                                 $x102 = 'catalog/product/' . $xd9->getImage();
                                 $x4a = $x61 . $x147('//', '/', $x102);
                             } else {
                                 $x4a = $x61 . '/catalog/product/placeholder/' . $x5b;
                             }
                         } elseif (isset($xa1[$xd9->getId()]['src'][$xd8['options'][0] - 1]) && $xd8['options'][0] > 0) {
                             if ($xa1[$xd9->getId()]['src'][$xd8['options'][0] - 1] != $x101) {
                                 $x102 = 'catalog/product/' . $xa1[$xd9->getId()]['src'][$xd8['options'][0] - 1];
                                 $x4a = $x61 . $x147('//', '/', $x102);
                             }
                         }
                         break;
                     case "{G:IMAGE_LINK}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x101 = $xd9->getImage();
                         $x103 = array($xd9->getSmall_image(), $xd9->getThumbnail());
                         $x104 = '';
                         $xeb = 0;
                         if ($xd9->getImage() && $xd9->getImage() != 'no_selection') {
                             $x102 = 'catalog/product/' . $xd9->getImage();
                             $x4a = $x61 . $x147('//', '/', $x102);
                             $x104 .= "<g:image_link><![CDATA[" . $x4a . "]]></g:image_link>\n";
                             $xeb++;
                         }
                         $xe4 = 0;
                         while (isset($xa1[$xd9->getId()]['src'][$xe4]) && $xeb < 10) {
                             if ($xa1[$xd9->getId()]['src'][$xe4] != $x101) {
                                 if ($x156($xa1[$xd9->getId()]['src'][$xe4], $x103) || $xa1[$xd9->getId()]['disabled'][$xe4] != 1) {
                                     $x102 = 'catalog/product/' . $xa1[$xd9->getId()]['src'][$xe4];
                                     $x4a = $x61 . $x147('//', '/', $x102);
                                     $x104 .= "<g:additional_image_link><![CDATA[" . $x4a . "]]></g:additional_image_link>\n";
                                     $xeb++;
                                 }
                             }
                             $xe4++;
                         }
                         $x4a = $x104;
                         break;
                     case "{G:LINK}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         if ($xd9->getRequest_path()) {
                             if (Mage::getStoreConfig("simplegoogleshopping/system/urlrewrite") == 2) {
                                 $x105 = explode(",", $xd9->getRequest_path());
                                 usort($x105, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x161'));
                                 $x4a = $x60 . $x157($x105);
                             } elseif (Mage::getStoreConfig("simplegoogleshopping/system/urlrewrite") == 3) {
                                 $x105 = explode(",", $xd9->getRequest_path());
                                 usort($x105, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x161'));
                                 $x4a = $x60 . $x159($x105);
                             } else {
                                 $x4a = $x60 . $xd9->getRequest_path();
                             }
                         } else {
                             $x4a = $xd9->getProductUrl();
                         }
                         $x4a = "<link><![CDATA[" . $x4a . "]]></link>";
                         break;
                     case "{url}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         if ($xd9->getRequest_path()) {
                             if (Mage::getStoreConfig("simplegoogleshopping/system/urlrewrite") == 2) {
                                 $x105 = explode(",", $xd9->getRequest_path());
                                 usort($x105, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x161'));
                                 $x4a = $x60 . $x157($x105);
                             } elseif (Mage::getStoreConfig("simplegoogleshopping/system/urlrewrite") == 3) {
                                 $x105 = explode(",", $xd9->getRequest_path());
                                 usort($x105, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x161'));
                                 $x4a = $x60 . $x159($x105);
                             } else {
                                 $x4a = $x60 . $xd9->getRequest_path();
                             }
                         } else {
                             $x4a = $xd9->getProductUrl();
                         }
                         break;
                     case "{host}":
                         $x4a = $x60;
                         break;
                     case "{uri}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         if ($xd9->getRequest_path()) {
                             if (Mage::getStoreConfig("simplegoogleshopping/system/urlrewrite") == 2) {
                                 $x105 = explode(",", $xd9->getRequest_path());
                                 usort($x105, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x161'));
                                 $x4a = $x157($x105);
                             } elseif (Mage::getStoreConfig("simplegoogleshopping/system/urlrewrite") == 3) {
                                 $x105 = explode(",", $xd9->getRequest_path());
                                 usort($x105, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x161'));
                                 $x4a = $x159($x105);
                             } else {
                                 $x4a = $xd9->getRequest_path();
                             }
                         } else {
                             $x4a = $x147($x60, '', $xd9->getProductUrl());
                         }
                         break;
                     case '{G:AVAILABILITY}':
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         !isset($xd8['options'][0]) ? $x106 = 'in stock' : ($x106 = $xd8['options'][0]);
                         !isset($xd8['options'][1]) ? $x107 = "out of stock" : ($x107 = $xd8['options'][1]);
                         !isset($xd8['options'][2]) ? $x108 = "preorder" : ($x108 = $xd8['options'][2]);
                         if ($xd9->getManageStock() && !$xd9->getUseConfigManageStock() && !$x5d || $xd9->getUseConfigManageStock() && $x5d || $xd9->getManageStock() && !$xd9->getUseConfigManageStock()) {
                             if ($xd9->getIsInStock() > 0) {
                                 if ($product->type_id == "configurable") {
                                     $x109 = $xb0[$product->getId()];
                                 } else {
                                     $x109 = $xd9->getQty();
                                 }
                                 if ($x109 > 0) {
                                     $x4a = $x106;
                                 } else {
                                     if ($xd9->getBackorders() || $xd9->getUseConfigBackorders() && $x5e) {
                                         $x4a = $x108;
                                     } else {
                                         $x4a = $x107;
                                     }
                                 }
                             } else {
                                 $x4a = $x107;
                             }
                         } else {
                             $x4a = $x106;
                         }
                         $x4a = "<g:availability><![CDATA[" . $x4a . "]]></g:availability>";
                         break;
                     case '{is_in_stock}':
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         !isset($xd8['options'][0]) ? $x106 = 'in stock' : ($x106 = $xd8['options'][0]);
                         !isset($xd8['options'][1]) ? $x107 = "out of stock" : ($x107 = $xd8['options'][1]);
                         !isset($xd8['options'][2]) ? $x108 = "preorder" : ($x108 = $xd8['options'][2]);
                         if ($xd9->getManageStock() && !$xd9->getUseConfigManageStock() && !$x5d || $xd9->getUseConfigManageStock() && $x5d || $xd9->getManageStock() && !$xd9->getUseConfigManageStock()) {
                             if ($xd9->getIsInStock() > 0) {
                                 if ($product->type_id == "configurable") {
                                     $x109 = $xb0[$product->getId()];
                                 } else {
                                     $x109 = $xd9->getQty();
                                 }
                                 if ($x109 > 0) {
                                     $x4a = $x106;
                                 } else {
                                     if ($xd9->getBackorders() || $xd9->getUseConfigBackorders() && $x5e) {
                                         $x4a = $x108;
                                     } else {
                                         $x4a = $x107;
                                     }
                                 }
                             } else {
                                 $x4a = $x107;
                             }
                         } else {
                             $x4a = $x106;
                         }
                         break;
                     case '{stock_status}':
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $xd9->getIs_in_stock() > 0 ? $x4a = 'in stock' : ($x4a = 'out of stock');
                         break;
                     case '{qty}':
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         !isset($xd8['options'][0]) ? $x10a = 0 : ($x10a = $xd8['options'][0]);
                         if ($product->type_id == "configurable") {
                             $x4a = $xb0[$product->getId()];
                             $x4a = $x14c($x4a, $x10a, '.', '');
                         } else {
                             if ($xd8['reference'] == "configurable") {
                                 $x4a = $x14c($xb0[$xd9->getId()], $x10a, '.', '');
                             } else {
                                 $x4a = $x14c($xd9->getQty(), $x10a, '.', '');
                             }
                         }
                         break;
                     case "{categories_v1}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         !isset($xd8['options'][0]) || !$xd8['options'][0] || $xd8['options'][0] == 'INF' ? $x10b = INF : ($x10b = $xd8['options'][0]);
                         !isset($xd8['options'][1]) ? $x10c = 1 : ($x10c = $xd8['options'][1]);
                         !isset($xd8['options'][2]) || !$xd8['options'][2] || $xd8['options'][2] == 'INF' ? $x10d = INF : ($x10d = $xd8['options'][2]);
                         $x10e = 0;
                         $x4a = '';
                         $x10f = '';
                         foreach (explode(',', $xd9->getCategoriesIds()) as $x37 => $x7c) {
                             $x6a ? $x110 = $x156($x7b[$x7c]["path"], $x6c) : ($x110 = !$x156($x7b[$x7c]["path"], $x6c));
                             if (isset($x7b[$x7c]) && $x10e < $x10b && ($x110 || $x6c[0] == "*")) {
                                 $x111 = 0;
                                 $x112 = explode('/', $x7b[$x7c]["path"]);
                                 if ($x156($x63, $x112)) {
                                     $x113 = "";
                                     if ($x10e > 0) {
                                         $x10f = ",";
                                     }
                                     foreach ($x112 as $x114) {
                                         if (isset($x7b[$x114])) {
                                             if ($x7b[$x114]['level'] > $x10c && $x111 < $x10d) {
                                                 if ($x111 > 0) {
                                                     $x113 .= '>';
                                                 }
                                                 $x113 .= $x7b[$x114]['name'];
                                                 $x111++;
                                             }
                                         }
                                     }
                                     $x115 = "";
                                     if (!empty($x113)) {
                                         $x4a .= $x10f . $x113 . $x115;
                                         $x10e++;
                                     }
                                 }
                             }
                         }
                         break;
                     case "{categories}":
                         $x116 = null;
                         $x10b = INF;
                         $x10c = 1;
                         $x117 = INF;
                         $x118 = ', ';
                         $x119 = " > ";
                         if (count($xd8['options']) == 1) {
                             !isset($xd8['options'][0]) ? $x116 = "last" : ($x116 = $xd8['options'][0]);
                             $x10b = 1;
                         } elseif (count($xd8['options']) == 2) {
                             !isset($xd8['options'][0]) ? $x118 = ', ' : ($x118 = $xd8['options'][0]);
                             !isset($xd8['options'][1]) ? $x119 = " > " : ($x119 = $xd8['options'][1]);
                         } elseif (count($xd8['options']) > 2) {
                             !isset($xd8['options'][0]) || !$xd8['options'][0] || $xd8['options'][0] == 'INF' ? $x10b = INF : ($x10b = $xd8['options'][0]);
                             !isset($xd8['options'][1]) ? $x10c = 1 : ($x10c = $xd8['options'][1]);
                             !isset($xd8['options'][2]) || !$xd8['options'][2] || $xd8['options'][2] == 'INF' ? $x117 = INF : ($x117 = $xd8['options'][2]);
                             !isset($xd8['options'][3]) ? $x118 = ', ' : ($x118 = $xd8['options'][3]);
                             !isset($xd8['options'][4]) ? $x119 = " > " : ($x119 = $xd8['options'][4]);
                         }
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x102 = 0;
                         $x11a = array();
                         foreach (explode(',', $xd9->getCategoriesIds()) as $x37 => $x7c) {
                             $x6a ? $x110 = $x156(@$x7b[$x7c]["path"], $x6c) : ($x110 = !$x156(@$x7b[$x7c]["path"], $x6c));
                             if (isset($x7b[$x7c]) && ($x110 || $x6c[0] == "*")) {
                                 $x102++;
                                 $x11a[$x102] = array();
                                 $x112 = explode('/', $x7b[$x7c]["path"]);
                                 if ($x156($x63, $x112)) {
                                     foreach ($x112 as $x114) {
                                         if (isset($x7b[$x114]) && $x7b[$x114]['name'] != null) {
                                             $x11a[$x102][] = $x7b[$x114]['name'];
                                         }
                                     }
                                 }
                             }
                         }
                         $x11b = array();
                         usort($x11a, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x161Array'));
                         if ($x116 == "last") {
                             $x11a = $x15a($x11a);
                         }
                         $xd9->setCategoriesArray($x11a);
                         $x11c = 0;
                         foreach ($x11a as $x37 => $x111) {
                             if ($x11c < $x10b) {
                                 foreach ($x111 as $x11d => $x11e) {
                                     if ($x11d >= $x10c && $x11d <= $x117) {
                                         if (!isset($x11b[$x11c])) {
                                             $x11b[$x11c] = array();
                                         }
                                         $x11b[$x11c][] .= $x11e;
                                     }
                                 }
                                 if (count($x11b[$x11c])) {
                                     $x11c++;
                                 }
                             }
                         }
                         $x4a = null;
                         foreach ($x15b($x11b) as $x37 => $x11f) {
                             if ($x37 > 0) {
                                 $x4a .= $x118;
                             }
                             $x4a .= implode($x119, $x11f);
                         }
                         break;
                     case "{G:PRODUCT_TYPE_v1}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         !isset($xd8['options'][0]) || !$xd8['options'][0] || $xd8['options'][0] == 'INF' ? $x10b = INF : ($x10b = $xd8['options'][0]);
                         !isset($xd8['options'][1]) ? $x10c = 1 : ($x10c = $xd8['options'][1]);
                         !isset($xd8['options'][2]) || !$xd8['options'][2] || $xd8['options'][2] == 'INF' ? $x10d = INF : ($x10d = $xd8['options'][2]);
                         $x10e = 0;
                         $x4a = '';
                         foreach (explode(',', $xd9->getCategoriesIds()) as $x37 => $x7c) {
                             $x6a ? $x110 = $x156($x7b[$x7c]["path"], $x6c) : ($x110 = !$x156($x7b[$x7c]["path"], $x6c));
                             if (@$x7b[$x7c]["include_in_menu"] && isset($x7b[$x7c]) && $x10e < $x10b && ($x110 || $x6c[0] == "*")) {
                                 $x111 = 0;
                                 $x112 = explode('/', $x7b[$x7c]["path"]);
                                 if ($x156($x63, $x112)) {
                                     $x113 = '';
                                     $x10f = '<g:product_type><![CDATA[';
                                     foreach ($x112 as $x114) {
                                         if (isset($x7b[$x114])) {
                                             if ($x7b[$x114]['level'] > $x10c && $x111 < $x10d) {
                                                 if ($x111 > 0) {
                                                     $x113 .= ' > ';
                                                 }
                                                 $x113 .= $x7b[$x114]['name'];
                                                 $x111++;
                                             }
                                         }
                                     }
                                     $x115 = "]]></g:product_type>\n";
                                     if (!empty($x113)) {
                                         $x4a .= $x10f . $x113 . $x115;
                                         $x10e++;
                                     }
                                 }
                             }
                         }
                         break;
                     case "{G:PRODUCT_TYPE}":
                         $x118 = "]]></g:product_type>\n<g:product_type><![CDATA[";
                         $x119 = " > ";
                         !isset($xd8['options'][0]) || !$xd8['options'][0] || $xd8['options'][0] == 'INF' ? $x10b = INF : ($x10b = $xd8['options'][0]);
                         !isset($xd8['options'][1]) ? $x10c = 1 : ($x10c = $xd8['options'][1]);
                         !isset($xd8['options'][2]) || !$xd8['options'][2] || $xd8['options'][2] == 'INF' ? $x117 = INF : ($x117 = $xd8['options'][2]);
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x102 = 0;
                         $x11a = array();
                         foreach (explode(',', $xd9->getCategoriesIds()) as $x37 => $x7c) {
                             $x6a ? $x110 = $x156(@$x7b[$x7c]["path"], $x6c) : ($x110 = !$x156(@$x7b[$x7c]["path"], $x6c));
                             if (isset($x7b[$x7c]) && ($x110 || $x6c[0] == "*")) {
                                 $x102++;
                                 $x11a[$x102] = array();
                                 $x112 = explode('/', $x7b[$x7c]["path"]);
                                 if ($x156($x63, $x112)) {
                                     foreach ($x112 as $x114) {
                                         if (isset($x7b[$x114]) && $x7b[$x114]['name'] != null) {
                                             $x11a[$x102][] = $x7b[$x114]['name'];
                                         }
                                     }
                                 }
                             }
                         }
                         $x11b = array();
                         usort($x11a, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x161Array'));
                         foreach ($x11a as $x37 => $x111) {
                             if ($x37 < $x10b) {
                                 foreach ($x111 as $x11d => $x11e) {
                                     if ($x11d > $x10c && $x11d <= $x117) {
                                         if (!isset($x11b[$x37])) {
                                             $x11b[$x37] = array();
                                         }
                                         $x11b[$x37][] .= $x11e;
                                     }
                                 }
                             }
                         }
                         $x4a = null;
                         foreach ($x15b($x11b) as $x37 => $x11f) {
                             if ($x37 > 0) {
                                 $x4a .= $x118;
                             }
                             $x4a .= implode($x119, $x11f);
                         }
                         if ($x11b) {
                             $x4a = "<g:product_type><![CDATA[" . $x4a . "]]></g:product_type>\n";
                         }
                         break;
                     case "{G:GOOGLE_PRODUCT_CATEGORY}":
                         $x120 = array();
                         !isset($xd8['options'][0]) ? $x116 = "longest" : ($x116 = $xd8['options'][0]);
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         foreach (explode(',', $xd9->getCategoriesIds()) as $x37 => $x7c) {
                             if (isset($x7b[$x7c]["path"]) && isset($x6d[$x7b[$x7c]["path"]])) {
                                 $x120[] = $x6d[$x7b[$x7c]["path"]];
                             }
                         }
                         usort($x120, array('Wyomind_Simplegoogleshopping_Model_Simplegoogleshopping', 'x161'));
                         if ($x116 == "shortest") {
                             $x120 = $x15a($x120);
                         }
                         $x121 = $x159($x120);
                         if ($x121 != "") {
                             $x4a = "<g:google_product_category><![CDATA[" . $x121 . "]]></g:google_product_category>\n";
                         }
                         break;
                     case "{category_mapping}":
                         isset($xd8["options"][0]) ? $x122 = $xd8["options"][0] : ($x122 = 0);
                         $x4a = "";
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x123 = 0;
                         foreach (explode(',', $xd9->getCategoriesIds()) as $x37 => $x7c) {
                             if (isset($x6d[$x7b[$x7c]["path"]])) {
                                 if ($x123 == $x122) {
                                     $x4a .= $x6d[$x7b[$x7c]["path"]];
                                     break;
                                 }
                                 $x123++;
                             }
                         }
                         break;
                     case "{review_count}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x4a = "";
                         isset($xd8["options"][0]) && $xd8["options"][0] == "*" ? $x124 = 0 : ($x124 = $x58);
                         if (isset($x9b[$xd9->getId()][$x124]["count"])) {
                             $x125 = $x9b[$xd9->getId()][$x124]["count"];
                             if (isset($x125)) {
                                 $x4a .= $x125;
                             }
                         }
                         break;
                     case "{review_average}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x4a = "";
                         isset($xd8["options"][0]) && $xd8["options"][0] == "*" ? $x124 = 0 : ($x124 = $x58);
                         !isset($xd8["options"][1]) || !$xd8["options"][1] ? $x126 = 5 : ($x126 = $xd8["options"][1]);
                         if (isset($x9b[$xd9->getId()][$x124]["score"])) {
                             $x127 = $x14c($x9b[$xd9->getId()][$x124]["score"] * $x126 / 100, 2, ".", "");
                             if (isset($x127)) {
                                 $x4a .= $x127;
                             }
                         }
                         break;
                     case "{G:PRODUCT_REVIEW}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         isset($xd8["options"][0]) && $xd8["options"][0] == "*" ? $x124 = 0 : ($x124 = $x58);
                         !isset($xd8["options"][1]) || !$xd8["options"][1] ? $x126 = 5 : ($x126 = $xd8["options"][1]);
                         $x4a = "";
                         if (isset($x9b[$xd9->getId()][$x124]["count"])) {
                             $x125 = $x9b[$xd9->getId()][$x124]["count"];
                             $x127 = $x14c($x9b[$xd9->getId()][$x124]["score"] * $x126 / 100, 2, ".", "");
                         }
                         if (isset($x127) && $x127 > 0) {
                             $x4a .= "<g:product_review_average><![CDATA[" . $x127 . "]]></g:product_review_average>\n";
                         }
                         if (isset($x125) && $x125 > 0) {
                             $x4a .= "<g:product_review_count><![CDATA[" . $x125 . "]]></g:product_review_count>\n";
                         }
                         unset($x127);
                         unset($x125);
                         break;
                     case "{G:ITEM_GROUP_ID}":
                         if (isset($this->configurable[$product->getId()])) {
                             $xd9 = $this->checkReference('configurable', $product);
                             $x4a = "<g:item_group_id><![CDATA[" . $xd9->getSku() . "]]></g:item_group_id>";
                         }
                         break;
                     case "{SC:EAN}":
                         $x14d($xd8['options'][0]) && $xd8['options'][0] > 0 ? $x128 = $xd8['options'][0] : ($x128 = 0);
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x4a = explode(',', $xd9->getEan());
                         $x4a = "<g:ean><![CDATA[" . $x4a[$x128] . "]]></g:ean>";
                         break;
                     case "{SC:IMAGES}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x101 = $xd9->getSmall_image();
                         $x103 = array($xd9->getImage(), $xd9->getThumbnail());
                         $x104 = '';
                         $xeb = 0;
                         if ($xd9->getSmall_image() && $xd9->getSmall_image() != 'no_selection') {
                             $x102 = $xd9->getSmall_image();
                             $x4a = $x102;
                             $x104 .= "<g:image_link><![CDATA[" . $x4a . "]]></g:image_link>\n";
                             $xeb++;
                         }
                         $xe4 = 0;
                         while (isset($xa1[$xd9->getId()]['src'][$xe4]) && $xeb < 10) {
                             if ($xa1[$xd9->getId()]['src'][$xe4] != $x101) {
                                 if ($x156($xa1[$xd9->getId()]['src'][$xe4], $x103) || $xa1[$xd9->getId()]['disabled'][$xe4] != 1) {
                                     $x102 = $xa1[$xd9->getId()]['src'][$xe4];
                                     $x4a = $x102;
                                     $x104 .= "<g:additional_image_link><![CDATA[" . $x4a . "]]></g:additional_image_link>\n";
                                     $xeb++;
                                 }
                             }
                             $xe4++;
                         }
                         $x4a = $x104;
                         break;
                     case "{SC:DESCRIPTION}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         $x51 = $xd9->getDescription() . $xd9->getShortDescription();
                         $x129 = "|<iframe(.*)</iframe>|U";
                         $x14a($x129, $x51, $x12a);
                         if ($x12a) {
                             $x51 = $xd9->getAttributeText('manufacturer') . " " . $xd9->getName() . " - Part number: " . $xd9->getSku() . " - Category : {categories,[1],[1],[1]}";
                         } else {
                             if ($x156("strip_tags", $xd8['options'])) {
                                 $x51 = $x15c('!\\<br /\\>!isU', " ", $x51);
                                 $x51 = $x15c('!\\<br/\\>!isU', " ", $x51);
                                 $x51 = $x15c('!\\<br>!isU', " ", $x51);
                                 $x51 = $x15d($x51);
                             }
                             if ($x156("html_entity_decode", $xd8['options'])) {
                                 $x51 = $x15e($x51, ENT_QUOTES, 'UTF-8');
                             }
                             if ($x156("htmlentities", $xd8['options'])) {
                                 $x51 = htmlspecialchars($x51);
                             }
                             if (strlen($x51) > 900) {
                                 $x51 = substr($x51, 0, 900 - 3);
                                 $xdb = strrpos($x51, " ");
                                 $x51 = substr($x51, 0, $xdb) . '...';
                             }
                         }
                         if ($x51 == null) {
                             $x51 = $xd9->getAttributeText('manufacturer') . " " . $xd9->getName() . " - Part number: " . $xd9->getSku() . " - Category : {categories,[1],[1],[1]}";
                         }
                         $x51 = $x15c('/' . '[\\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', ' ', $x51);
                         $x51 = $x147('â„¢', '', $x51);
                         $x4a = "<description><![CDATA[" . $x51 . "]]></description>";
                         break;
                     case "{SC:URL}":
                         isset($xd8['options'][0]) ? $x12b = $xd8['options'][0] : ($x12b = "");
                         isset($xd8['options'][1]) ? $x12c = $xd8['options'][1] : ($x12c = "");
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         if ($xd9->getRequest_path()) {
                             $x4a = "<link><![CDATA[" . $x60 . $x12c . $xd9->getRequest_path() . $x12b . "]]></link>";
                         } else {
                             $x4a = "<link><![CDATA[" . $xd9->getProductUrl() . "]]></link>";
                         }
                         break;
                     case "{SC:CONDITION}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         stristr($xd9->getName(), "refurbished") ? $xc7 = 'refurbished' : ($xc7 = 'new');
                         $x4a = "<g:condition><![CDATA[" . $xc7 . "]]></g:condition>";
                         break;
                     case "{sc:condition}":
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         stristr($xd9->getName(), "refurbished") ? $xc7 = 'refurbished' : ($xc7 = 'new');
                         $x4a = $xc7;
                         break;
                     default:
                         $xd9 = $this->checkReference($xd8['reference'], $product);
                         if ($x156($xd8['name'], $x86)) {
                             if ($x156($x87[$xd8['name']], array('select', 'multiselect'))) {
                                 eval('$x12e =($xd9->' . $xd8['methodName'] . ");");
                                 $x12d = explode(',', $x12e);
                                 if (count($x12d) > 1) {
                                     $x4a = array();
                                     foreach ($x12d as $xcd) {
                                         if (isset($x8c[$xcd][$x58])) {
                                             $x4a[] = $x8c[$xcd][$x58];
                                         } else {
                                             if (isset($x8c[$xcd][0])) {
                                                 $x4a[] = $x8c[$xcd][0];
                                             }
                                         }
                                     }
                                 } else {
                                     if (isset($x8c[$x12d[0]][$x58])) {
                                         $x4a = $x8c[$x12d[0]][$x58];
                                     } else {
                                         if (isset($x8c[$x12d[0]][0])) {
                                             $x4a = $x8c[$x12d[0]][0];
                                         }
                                     }
                                 }
                             } else {
                                 eval('$x4a =($xd9->' . $xd8['methodName'] . ");");
                             }
                         }
                         if ($x156(@$x84[$xd8['name']], $x84)) {
                             $x4a = $x84[$xd8['name']];
                         }
                         $x4a = $x15c('/' . '[\\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', ' ', $x4a);
                         $x4a = $x147('â„¢', '', $x4a);
                         $x12f = 0;
                         if (count($xd8['options']) > 0) {
                             while (isset($xd8['options'][$x12f])) {
                                 switch ($xd8['options'][$x12f]) {
                                     case "substr":
                                         if (isset($xd8['options'][$x12f + 1]) && strlen($x4a) > $xd8['options'][$x12f + 1]) {
                                             $x4a = substr($x4a, 0, $xd8['options'][$x12f + 1] - 3);
                                             $xdb = strrpos($x4a, " ");
                                             $x4a = substr($x4a, 0, $xdb) . $xd8['options'][$x12f + 2];
                                         }
                                         $x12f++;
                                         $x12f++;
                                         break;
                                     case "htmlentities":
                                         $x4a = htmlspecialchars($x4a);
                                         break;
                                     case "strip_tags":
                                         $x130 = " ";
                                         $x4a = $x15c('!\\<br /\\>!isU', $x130, $x4a);
                                         $x4a = $x15c('!\\<br/\\>!isU', $x130, $x4a);
                                         $x4a = $x15c('!\\<br>!isU', $x130, $x4a);
                                         $x4a = $x15d($x4a);
                                         break;
                                     case "implode":
                                         $x4a = $x152($x4a) ? implode($xd8['options'][$x12f + 1], $x4a) : $x4a;
                                         $x12f++;
                                         break;
                                     case "float":
                                         $x4a = $x14c($x4a, $xd8['options'][$x12f + 1], '.', '');
                                         $x12f++;
                                         break;
                                     case "html_entity_decode":
                                         $x4a = $x15e($x4a, ENT_QUOTES, 'UTF-8');
                                         break;
                                     case "inline":
                                         $x4a = $x15c('/(\\r\\n|\\n|\\r|\\r\\n|\\t)/s', '', $x4a);
                                         break;
                                     case "strtolower":
                                         $x4a = $x15f($x4a, "UTF8");
                                         break;
                                     case "strtoupper":
                                         $x4a = $x160($x4a, "UTF8");
                                         break;
                                     case "cleaner":
                                         $x4a = $x15c('/' . '[\\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', ' ', $x4a);
                                         $x4a = $x147('â„¢', '', $x4a);
                                         break;
                                     default:
                                         if (stristr($xd8['options'][$x12f], "%s")) {
                                             $xec = $x147("%s", '$x4a', $xd8['options'][$x12f]);
                                             eval('$x4a=' . $xec . '; ');
                                         } else {
                                             eval('$x4a=' . $xd8['options'][$x12f] . '($x4a); ');
                                         }
                                         break;
                                 }
                                 $x12f++;
                             }
                         }
                         break;
                 }
                 $x4a = $x147(array("<", ">", '"', '\\'), array("__LOWERTHAN__", "__HIGHERTHAN__", "__QUOTES__", "__BACKSLASH__"), $x4a);
                 if ($x152($x4a)) {
                     $x4a = implode(",", $x4a);
                 }
                 if ($x4a != "") {
                     $x48 = $x147($xd8['fullpattern'], $x4a, $x48);
                 }
             }
             foreach ($x76 as $x131) {
                 $x48 = $x147($x131['fullpattern'], "", $x48);
             }
             $x48 = $this->x163($x48, $product);
             $x48 = $this->x169($x48);
             $x48 = $this->x168($x48);
             $x48 = $x147(array("__LOWERTHAN__", "__HIGHERTHAN__", "__QUOTES__", "__BACKSLASH__"), array("<", ">", '"', '\\'), $x48);
             if (!empty($x48)) {
                 $x73 .= "<item>";
                 $x73 .= "\n" . $x48 . "\n";
                 $x73 .= "</item>" . "\n";
                 $xc3++;
                 $this->_inc = $xd4;
                 $xd4++;
             }
             $x132 = array();
             try {
                 $xd9 = new SimpleXMLElement("<item>" . $x147(array("<g:", "</g:"), array("<g_", "</g_"), $x48) . "</item>");
             } catch (Exception $x133) {
                 $this->x16a($x4f, $x53, "FAILLED;0");
                 Mage::throwException($x133->getMessage() . " " . Mage::helper('simplegoogleshopping')->__("Please check the template syntax."));
             }
             $x134 = array();
             foreach ($requirements as $x135) {
                 if ($x152($x135['depends'])) {
                     $x136 = false;
                     foreach ($x135['depends'] as $x137 => $xc7) {
                         foreach ($xc7 as $x138 => $x4a) {
                             $x139 = $this->x16b($requirements, $x137);
                             switch ($x138) {
                                 case "eq":
                                     if ($xd9->{$x139}['tag'] == $x4a) {
                                         $x136 = true;
                                     } else {
                                         $x136 = false;
                                     }
                                     break;
                                 case "neq":
                                     if ($xd9->{$x139}['tag'] != $x4a) {
                                         $x136 = true;
                                     } else {
                                         $x136 = false;
                                     }
                                     break;
                                 case "like":
                                     if (stristr($xd9->{$x139}['tag'], $x4a)) {
                                         $x136 = true;
                                     } else {
                                         $x136 = false;
                                     }
                                     break;
                             }
                         }
                     }
                 } else {
                     $x136 = true;
                 }
                 if ($x136 == true && !$x156($x135['label'], $x134)) {
                     $x134[] = $x135['label'];
                     if ($x135['required'] && empty($xd9->{$x135}['tag'])) {
                         $this->x16c($x135['label'], 'required', $xd9->{"g_id"});
                     } elseif ($x135['recommended'] && empty($xd9->{$x135}['tag'])) {
                         $this->x16c($x135['label'], 'recommended', $xd9->{"g_id"}, null);
                     } elseif ((int) $x135['occurrence'] < count($xd9->{$x135}['tag'])) {
                         $this->x16c($x135['label'], 'toomany', $xd9->{"id"});
                     } else {
                         if (isset($x135['length']) && strlen($xd9->{$x135}['tag']) > $x135['length']) {
                             $this->x16c($x135['label'], 'toolong', $xd9->{"g_id"}, $x135['length']);
                         }
                         if (isset($x135['type']) && $x135['type'] == "RegExp" && !empty($xd9->{$x135}['tag']) && !$x14a("/^" . $x135['regexp'] . "\$/i", $xd9->{$x135}['tag'])) {
                             $this->x16c($x135['label'], 'invalid', $xd9->{"g_id"}, $x135['say']);
                         } elseif (isset($x135['type']) && ($x135['type'] == "GoogleProductCategory" || $x135['type'] == "Text")) {
                         } elseif (isset($x135['type']) && !empty($xd9->{$x135}['tag']) && $x135['type'] != "RegExp") {
                             switch ($x135['type']) {
                                 case "Boolean":
                                     $x13a = "/^true|false\$/i";
                                     break;
                                 case "Alphanumeric":
                                     $x13a = "/^[\\wc73\\-]+\$/";
                                     break;
                                     break;
                                 case "Url":
                                     $x13a = "/^http(s)?:\\/\\/.+\$/";
                                     break;
                                 case "Price":
                                     $x13a = '/^([0-9]+\\.[0-9]{2})\\s?[A-Z]{3}$/';
                                     break;
                             }
                             if (!$x14a($x13a, $xd9->{$x135}['tag'], $x13b)) {
                                 $this->x16c($x135['label'], 'invalid', $xd9->{"g_id"}, $x135['type']);
                             } elseif ($x135['type'] == "Price" && (double) $x13b[1] < 0.01) {
                                 $this->x16c($x135['label'], 'invalid', $xd9->{"g_id"}, $x135['type']);
                             }
                         }
                     }
                 }
             }
             if ($this->_display) {
                 $x74 .= $x73;
                 $x73 = '';
             } else {
                 if ($xc3 % Mage::getStoreConfig("simplegoogleshopping/system/buffer") == 0) {
                     $x3a->streamWrite($x73);
                     unset($x73);
                     $x73 = '';
                     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" . $xd4 . "/" . $this->_counter . " items added", null, $this->x165('.log'));
                     $x13c = time(true);
                     $x13d = (int) $x13c - (int) $xd5;
                     $this->_time += $x13d;
                     $this->x16a($x4f, $x53, "PROCESSING; {$xd4}; " . $this->_counter . ";" . $x13d);
                     $xd5 = time(true);
                 }
             }
             if ($this->_limit && $xd4 > $this->_limit) {
                 break 2;
             }
         }
     }
     $x73 .= '</channel>' . "\n";
     $x73 .= '</rss>';
     if (!$this->_display) {
         $x3a->streamWrite($x73);
         $this->x16a($x4f, $x53, "SUCCEED;ˆ0;ˆ0; 0");
     }
     Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " . ($xd4 - 1) . "/" . $this->_counter . " items added", null, $this->x165('.log'));
     unset($xab);
     $x74 .= $x73;
     if ($this->_display && !$this->_debug) {
         return $x74;
     } elseif ($this->_debug) {
         echo "<br><br>------------ XML OUTPUT ----------------<br>";
         $x51 = "<pre>" . htmlentities($x74) . "</pre>";
         return $x51;
     } else {
         $x3a->streamClose();
         $x3a->mv($this->x165(), $this->x165(false));
         $x3a->rm($this->x165());
         $this->setSimplegoogleshopping_time(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
         $this->_errorReport['stats'] = array($xd4 - 1, $this->_time);
         $this->setSimplegoogleshopping_report(serialize($this->_errorReport));
         $this->save();
         Mage::log("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Temp file closed and moved to " . $this->x165(false), null, $this->x165('.log'));
     }
     Mage::app()->setCurrentStore(0);
     return $this;
 }
示例#30
0
 public function generateFile()
 {
     $xb4 = "array_push";
     $xb5 = "count";
     $xb6 = "date";
     $xb7 = "eval";
     $xb8 = "explode";
     $xb9 = "header";
     $xba = "htmlspecialchars";
     $xbb = "html_entity_decode";
     $xbc = "htmlentities";
     $xbd = "in_array";
     $xbe = "implode";
     $xbf = "ini_get";
     $xc0 = "is_bool";
     $xc1 = "is_array";
     $xc2 = "is_null";
     $xc3 = "is_numeric";
     $xc4 = "mb_strtolower";
     $xc5 = "mb_strtoupper";
     $xc6 = "number_format";
     $xc7 = "preg_match";
     $xc8 = "preg_match_all";
     $xc9 = "preg_split";
     $xca = "preg_replace";
     $xcb = "print_r";
     $xcc = "round";
     $xcd = "rtrim";
     $xce = "set_time_limit";
     $xcf = "sprintf";
     $xd0 = "str_replace";
     $xd1 = "strlen";
     $xd2 = "stristr";
     $xd3 = "strip_tags";
     $xd4 = "substr";
     $xd5 = "strrpos";
     $xd6 = "trim";
     $xd7 = "ucwords";
     $xd8 = "utf8_decode";
     $this->_debug = isset($_GET['debug']) ? true : false;
     $this->_type = isset($_GET['type']) ? $_GET['type'] : "*";
     if ($this->_debug) {
         echo "----------------------------------------------<br>------------ DEBUG MODE ----------------<br>----------------------------------------------<br><br>";
         $xcb($x2e);
     }
     $x2f = $this->_indexPhp;
     $x30 = array("ac" => "activation_code", "ak" => "activation_key", "bu" => "base_url", "md" => "md5", "th" => "this", "dm" => "_demo", "ext" => "dfm", "ver" => "3.4.3");
     $x31 = $this->getStoreId();
     $x32 = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
     $x33 = Mage::getDesign()->getSkinUrl();
     $x34 = Mage::getStoreConfig("catalog/placeholder/image_placeholder", $x31);
     $x35 = Mage::getStoreConfig("currency/options/base", $x31);
     $x36 = Mage::app()->getStore($x31)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, false);
     $x37 = Mage::app()->getStore($x31)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA, false);
     $x38 = Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, $x31);
     $x39 = Mage::app()->getStore($x31)->getRootCategoryId();
     $x3a = 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"));
     $x3b = $this->getFeed_product();
     $x2a = $this->getFeed_header();
     $x3c = $this->getFeed_footer();
     $x3d = $this->getFeed_type();
     $x3e = $this->getFeed_include_header();
     $x26 = $this->getFeed_separator();
     $x27 = $this->getFeed_protector();
     $x3f = $this->getFeed_status();
     $x40 = $this->getFeed_enclose_data();
     $x41 = json_decode($this->getDatafeedmanagerCategories());
     $x42 = array();
     $x43 = array();
     if ($this->getGoogleshoppingCategories() != '*') {
         foreach ($x41 as $x44) {
             if ($x44->checked) {
                 $x42[] = $x44->line;
             }
         }
         foreach ($x41 as $x44) {
             if ($x44->mapping != "") {
                 $x43[$x44->line] = $x44->mapping;
             }
         }
     }
     if ($xb5($x42) < 1) {
         $x42[] = '*';
     }
     $x45 = $xb8(',', $this->getDatafeedmanagerTypeIds());
     $x46 = $xb8(',', $this->getDatafeedmanagerVisibility());
     $x47 = json_decode($this->getDatafeedmanagerAttributes());
     if ($x3a[$x30['ac']] != $x30["md"]($x30["md"]($x3a[$x30['ak']]) . $x30["md"]($x3a[$x30['bu']]) . $x30["md"]($x30["ext"]) . $x30["md"]($x30["ver"]))) {
         ${$x30}["ext"] = "valid";
         ${$x30}["th"]->{$x30}["dm"] = true;
     } else {
         ${$x30}["th"]->{$x30}["dm"] = false;
         ${$x30}["ext"] = "valid";
     }
     if (!$x3f && !$this->_display) {
         Mage::throwException(Mage::helper("datafeedmanager")->__("The data feed configuration must be enabled in order to generate a file."));
     }
     $x0b = new Varien_Io_File();
     $x0b->setAllowCreateFolders(true);
     if (!$this->_display) {
         $x0b->open(array('path' => $this->getPath()));
         if ($x0b->fileExists($this->getFilename()) && !$x0b->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()));
         }
         $x0b->streamOpen($this->getFilename());
     }
     if (!isset(${$x30}["ext"]) || ${$x30}["th"]->{$x30}["dm"]) {
         ${$x30}["th"]->{$x30}["dm"] = true;
         return ${$x30}["th"];
     }
     $x48 = '';
     $x49 = '';
     $xb9("Content-Type: text/html; charset=utf-8");
     $this->getEncodeType($x2a);
     $x2a = $this->execPhpScript($x2a, $x3d, null, true);
     if ($x3d == 1 || $x3d != 1 && !$this->_display) {
         $x18 = $this->encode($x2a);
     }
     if ($this->_display) {
         if ($x3d == 1) {
             $x49 = $this->xmlEncloseData($x2a, $x40) . "\n";
         } else {
             $x49 = "<table style='border:2px solid grey; font-family:arial; font-size:12px' cellspacing=0 cellpadding=0>";
             if ($x3e) {
                 $x49 .= $this->jsonToTable($x2a, true);
             }
         }
     } else {
         if ($x3d == 1) {
             $x0b->streamWrite($this->xmlEncloseData($x2a, $x40) . "\n");
         } else {
             if ($x3e) {
                 $x0b->streamWrite($this->jsonToStr($x2a, $x26, $x27) . "\n");
             }
         }
     }
     $x1a = '/{([a-zA-Z_0-9:]+)(\\sparent|\\sgrouped|\\sconfigurable|\\sbundle)?([^}]*)}/';
     $xc8($x1a, $x3b, $x1b);
     $x4a = array();
     $x4b = array();
     foreach ($x1b[1] as $x1c => $x4c) {
         $x4a[$x1c]['methodName'] = "get" . $xd0(' ', '', $xd7($xd6($x4c)) . '()');
         $x4a[$x1c]['pattern'] = "{" . $xd6($x4c) . "}";
         $x4a[$x1c]['fullpattern'] = $x1b[0][$x1c];
         $x4a[$x1c]['name'] = $xd6($x4c);
         $x4a[$x1c]['reference'] = $xd6($x1b[2][$x1c]);
         if (empty($x4a[$x1c]['reference'])) {
             $x4a[$x1c]['reference'] = 'self';
         }
         switch ($x4a[$x1c]['name']) {
             case 'G:IMAGE_LINK':
                 $xb4($x4b, 'image');
                 $xb4($x4b, 'small_image');
                 $xb4($x4b, 'thumbnail');
                 break;
             default:
                 $xb4($x4b, $x4a[$x1c]['name']);
         }
         $x4a[$x1c]["value"] = '$x2c->get' . $x4a[$x1c]['name'] . "()";
         $x4a[$x1c]["getText"] = 'getAttributeText(\'' . $xd6($x4c) . '\')';
         $x4d = '/\\[([^\\]]+)\\]/';
         $xc8($x4d, $x1b[3][$x1c], $x4e);
         $x4a[$x1c]["options"] = $x4e[1];
     }
     if ($this->_debug) {
         echo "<br><br>------------ ATTRIBUTES REQUIRED ----------------<br>";
         $xcb($x4a);
     }
     $x4f = Mage::getModel('catalog/category')->getCollection()->setStoreId($x31)->addAttributeToSelect('name')->addAttributeToSelect('is_active');
     $x2e = array();
     foreach ($x4f as $x50) {
         $x2e[$x50->getId()]['name'] = $x50->getName();
         $x2e[$x50->getId()]['path'] = $x50->getPath();
         $x2e[$x50->getId()]['level'] = $x50->getLevel();
     }
     if ($this->_debug) {
         echo "<br><br>------------ CATEGORIES ----------------<br>";
         $xcb($x2e);
     }
     $x51 = Mage::getSingleton('core/resource');
     $x52 = $x51->getConnection('core_read');
     $x53 = $x51->getTableName('eav_entity_type');
     $x54 = $x52->select()->from($x53)->where('entity_type_code=\'catalog_product\'');
     $x24 = $x52->fetchAll($x54);
     $x55 = $x24[0]['entity_type_id'];
     $x51 = Mage::getSingleton('core/resource');
     $x52 = $x51->getConnection('core_read');
     $x56 = $x51->getTableName('directory_currency_rate');
     $x54 = $x52->select()->from($x56)->where('currency_from=\'' . $x35 . '\'');
     $x10 = $x52->fetchAll($x54);
     $x57 = array();
     foreach ($x10 as $x0f) {
         $x57[$x0f['currency_to']] = $x0f['rate'];
     }
     $this->_currencies = $x57;
     if ($this->_debug) {
         echo "<br><br>------------ CURRENCIES ----------------<br>";
         $xcb($x57);
     }
     $x58 = Mage::getResourceModel('eav/entity_attribute_collection')->setEntityTypeFilter($x55)->addSetInfo()->getData();
     $x59 = array();
     $x5a = array();
     foreach ($x58 as $x1c => $x4c) {
         if ($xbd($x4c['attribute_code'], $x4b)) {
             $xb4($x59, $x4c['attribute_code']);
             $x5a[$x4c['attribute_code']] = $x4c['frontend_input'];
         }
     }
     if (!$xbd('special_price', $x59)) {
         $x59[] = 'special_price';
     }
     if (!$xbd('special_from_date', $x59)) {
         $x59[] = 'special_from_date';
     }
     if (!$xbd('special_to_date', $x59)) {
         $x59[] = 'special_to_date';
     }
     if (!$xbd('price_type', $x59)) {
         $x59[] = 'price_type';
     }
     if (!$xbd('price', $x59)) {
         $x59[] = 'price';
     }
     $x59[] = 'tax_class_id';
     foreach ($x47 as $x5b) {
         if (!$xbd($x5b->code, $x59) && $x5b->checked) {
             $x59[] = $x5b->code;
         }
     }
     if ($this->_debug) {
         echo "<br><br>------------ ATTRIBUTES ----------------<br>";
         $xcb($x59);
     }
     $x51 = Mage::getSingleton('core/resource');
     $x52 = $x51->getConnection('core_read');
     $x5c = $x51->getTableName('eav_attribute_option_value');
     $x54 = $x52->select();
     $x54->from($x5c);
     $x54->where("store_id=" . $x31 . ' OR  store_id=0');
     $x54->order(array('option_id', 'store_id'));
     $x5d = $x52->fetchAll($x54);
     foreach ($x5d as $x5e) {
         $x5f[$x5e['option_id']][$x5e['store_id']] = $x5e['value'];
     }
     if ($this->_debug) {
         echo "<br><br>------------ ATTRIBUTES LABEL ----------------<br>";
         $xcb($x5f);
     }
     $x60 = $x51->getTableName('tax_class');
     $x61 = $x51->getTableName('tax_calculation');
     $x62 = $x51->getTableName('tax_calculation_rate');
     $x63 = $x51->getTableName('directory_country_region');
     $x54 = $x52->select();
     $x54->from($x60)->order(array('class_id', 'tax_calculation_rate_id'));
     $x54->joinleft(array('tc' => $x61), 'tc.product_tax_class_id = ' . $x60 . '.class_id', 'tc.tax_calculation_rate_id');
     $x54->joinleft(array('tcr' => $x62), 'tcr.tax_calculation_rate_id = tc.tax_calculation_rate_id', array('tcr.rate', 'tax_country_id', 'tax_region_id'));
     $x54->joinleft(array('dcr' => $x63), 'dcr.region_id=tcr.tax_region_id', 'code');
     $x64 = $x52->fetchAll($x54);
     $x14 = array();
     $x65 = '';
     foreach ($x64 as $x66) {
         if ($x65 != $x66['class_id']) {
             $x67 = 0;
         } else {
             $x67++;
         }
         $x65 = $x66['class_id'];
         $x14[$x66['class_id']][$x67]['rate'] = $x66['rate'];
         $x14[$x66['class_id']][$x67]['code'] = $x66['code'];
         $x14[$x66['class_id']][$x67]['country'] = $x66['tax_country_id'];
     }
     $this->_rates = $x14;
     if ($this->_debug) {
         echo "<br><br>------------ TAX CLASS ----------------<br>";
         $xcb($x14);
     }
     $x68 = $x51->getTableName('review');
     $x69 = $x51->getTableName('review_store');
     $x6a = $x51->getTableName('rating_option_vote');
     $x6b = $x52->select()->distinct('review_id');
     $x6b->from(array("r" => $x68), array("COUNT(DISTINCT r.review_id) AS count", 'entity_pk_value'));
     $x6b->joinleft(array('rs' => $x69), 'rs.review_id=r.review_id', 'rs.store_id');
     $x6b->joinleft(array('rov' => $x6a), 'rov.review_id=r.review_id', 'AVG(rov.percent) AS score');
     $x6b->where("status_id=1 and entity_id=1");
     $x6b->group(array('r.entity_pk_value', 'rs.store_id'));
     $x6c = $x52->select();
     $x6c->from(array("r" => $x68), array("COUNT(DISTINCT r.review_id) AS count", 'entity_pk_value', "(SELECT 0) AS  store_id"));
     $x6c->joinleft(array('rs' => $x69), 'rs.review_id=r.review_id', array());
     $x6c->joinleft(array('rov' => $x6a), 'rov.review_id=r.review_id', 'AVG(rov.percent) AS score');
     $x6c->where("status_id=1 and entity_id=1");
     $x6c->group(array('r.entity_pk_value'));
     $x54 = $x52->select()->union(array($x6b, $x6c));
     $x54->order(array('entity_pk_value', 'store_id'));
     $x6d = $x52->fetchAll($x54);
     $x6e = array();
     foreach ($x6d as $x6f) {
         $x6e[$x6f['entity_pk_value']][$x6f['store_id']]['count'] = $x6f['count'];
         $x6e[$x6f['entity_pk_value']][$x6f['store_id']]['score'] = $x6f['score'];
     }
     $x51 = Mage::getSingleton('core/resource');
     $x52 = $x51->getConnection('core_read');
     $x70 = $x51->getTableName('catalog_product_entity_media_gallery');
     $x71 = $x51->getTableName('catalog_product_entity_media_gallery_value');
     $x54 = $x52->select();
     $x54->from($x70);
     $x54->joinleft(array('cpemgv' => $x71), 'cpemgv.value_id = ' . $x70 . '.value_id', array('cpemgv.position', 'cpemgv.disabled'));
     $x54->where("value<>TRIM('') AND (store_id=" . $x31 . ' OR  store_id=0)');
     $x54->order(array('position', 'value_id'));
     $x72 = $x52->fetchAll($x54);
     foreach ($x72 as $x73) {
         $x74[$x73['entity_id']]['src'][] = $x73['value'];
         $x74[$x73['entity_id']]['disabled'][] = $x73['disabled'];
     }
     if ($this->_debug) {
         echo "<br><br>------------ IMAGES ----------------<br>";
         $xcb($x74);
     }
     $x75 = $x51->getTableName("cataloginventory_stock_item");
     $x76 = $x51->getTableName("core_url_rewrite");
     $x56 = $x51->getTableName('catalog_category_product');
     $x77 = $x51->getTableName('catalog_category_product_index');
     $x78 = $x51->getTableName('catalog_product_index_price');
     $x79 = $x51->getTableName('catalog_product_super_link');
     $x7a = $x51->getTableName('catalog_product_link');
     $x7b = $x51->getTableName('catalog_product_bundle_selection');
     $x7c = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x31);
     $x7c->addAttributeToFilter('status', 1);
     $x7c->addAttributeToFilter('type_id', array("in" => "configurable"));
     $x7c->addAttributeToFilter('visibility', array("nin" => 1));
     $x7c->addAttributeToSelect($x59);
     $x7c->getSelect()->joinLeft($x79 . ' AS cpsl', 'cpsl.parent_id=e.entity_id ', array('child_ids' => 'GROUP_CONCAT( DISTINCT cpsl.product_id)'));
     $x7c->getSelect()->joinLeft($x75 . ' AS stock', 'stock.product_id=e.entity_id', array('qty' => 'qty', 'is_in_stock' => 'is_in_stock'));
     $x7c->getSelect()->joinLeft($x76 . ' AS url', 'url.product_id=e.entity_id AND url.category_id IS NULL AND is_system=1 AND options<> "RP" AND url.store_id=' . $x31, array('request_path' => 'request_path'));
     $x7c->getSelect()->joinLeft($x56 . ' AS categories', 'categories.product_id=e.entity_id');
     $x7c->getSelect()->joinLeft($x77 . ' AS categories_index', 'categories_index.category_id=categories.category_id AND  categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x31, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     $x7c->getSelect()->group(array('cpsl.parent_id'));
     $x7d = array();
     foreach ($x7c as $x7e) {
         foreach ($xb8(",", $x7e->getChildIds()) as $x7f) {
             $x7d[$x7f] = $x7e;
             $x80[$x7f]['categories_ids'] = $x7e->getCategories_ids();
             $x80[$x7f]['parent_id'] = $x7e->getId();
             $x80[$x7f]['parent_sku'] = $x7e->getSku();
             $x80[$x7f]['parent_request_path'] = $x7e->getRequestPath();
         }
     }
     $this->configurable = $x7d;
     if ($this->_debug) {
         echo "<br><br>------------ CONFIGURABLES ----------------<br>";
         echo $x7c->getSelect() . '<br><br>';
         $xcb($x80);
     }
     $x7c = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x31);
     $x7c->addAttributeToFilter('status', 1);
     $x7c->addAttributeToFilter('type_id', array("in" => "configurable"));
     $x7c->addAttributeToFilter('visibility', array("nin" => 1));
     $x7c->getSelect()->joinLeft($x79 . ' AS cpsl', 'cpsl.parent_id=e.entity_id ');
     $x7c->getSelect()->joinLeft($x75 . ' AS stock', 'stock.product_id=cpsl.product_id', array('qty' => 'SUM(qty)'));
     $x7c->getSelect()->group(array('cpsl.parent_id'));
     $x81 = array();
     foreach ($x7c as $x82) {
         $x81[$x82->getId()] = $x82->getQty();
     }
     $this->configurableQty = $x81;
     if ($this->_debug) {
         echo "<br><br>------------ CONFIGURABLES QTY ----------------<br>";
         echo $x7c->getSelect() . '<br><br>';
         $xcb($x81);
     }
     $x7c = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x31);
     $x7c->addAttributeToFilter('status', 1);
     $x7c->addAttributeToFilter('type_id', array("in" => "grouped"));
     $x7c->addAttributeToFilter('visibility', array("nin" => 1));
     $x7c->addAttributeToSelect($x59);
     $x7c->getSelect()->joinLeft($x7a . ' AS cpl', 'cpl.product_id=e.entity_id AND cpl.link_type_id=3', array('child_ids' => 'GROUP_CONCAT( DISTINCT cpl.linked_product_id)'));
     $x7c->getSelect()->joinLeft($x75 . ' AS stock', 'stock.product_id=e.entity_id', array('qty' => 'qty', 'is_in_stock' => 'is_in_stock'));
     $x7c->getSelect()->joinLeft($x76 . ' AS url', 'url.product_id=e.entity_id AND url.category_id IS NULL AND is_system=1 AND options<> "RP" AND url.store_id=' . $x31, array('request_path' => 'request_path'));
     $x7c->getSelect()->joinLeft($x56 . ' AS categories', 'categories.product_id=e.entity_id');
     $x7c->getSelect()->joinLeft($x77 . ' AS categories_index', 'categories_index.category_id=categories.category_id AND  categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x31, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     $x7c->getSelect()->group(array('cpl.product_id'));
     $x83 = array();
     foreach ($x7c as $x7e) {
         foreach ($xb8(",", $x7e->getChildIds()) as $x7f) {
             $x83[$x7f] = $x7e;
             $x84[$x7f]['categories_ids'] = $x7e->getCategories_ids();
             $x84[$x7f]['parent_id'] = $x7e->getId();
             $x84[$x7f]['parent_sku'] = $x7e->getSku();
             $x84[$x7f]['parent_request_path'] = $x7e->getRequestPath();
         }
     }
     $this->grouped = $x83;
     if ($this->_debug) {
         echo "<br><br>------------ GROUPED ----------------<br>";
         echo $x7c->getSelect() . '<br><br>';
         $xcb($x84);
     }
     $x7c = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x31);
     $x7c->addAttributeToFilter('status', 1);
     $x7c->addAttributeToFilter('type_id', array("in" => "bundle"));
     $x7c->addAttributeToFilter('visibility', array("nin" => 1));
     $x7c->addAttributeToSelect($x59);
     $x7c->getSelect()->joinLeft($x7b . ' AS cpbs', 'cpbs.parent_product_id=e.entity_id', array('child_ids' => 'GROUP_CONCAT( DISTINCT cpbs.product_id)'));
     $x7c->getSelect()->joinLeft($x75 . ' AS stock', 'stock.product_id=e.entity_id', array('qty' => 'qty', 'is_in_stock' => 'is_in_stock'));
     $x7c->getSelect()->joinLeft($x76 . ' AS url', 'url.product_id=e.entity_id AND url.category_id IS NULL AND is_system=1 AND options<> "RP" AND url.store_id=' . $x31, array('request_path' => 'request_path'));
     $x7c->getSelect()->joinLeft($x56 . ' AS categories', 'categories.product_id=e.entity_id');
     $x7c->getSelect()->joinLeft($x77 . ' AS categories_index', 'categories_index.category_id=categories.category_id AND  categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x31, array('categories_ids' => 'GROUP_CONCAT( DISTINCT categories_index.category_id)'));
     $x7c->getSelect()->group(array('e.entity_id'));
     $x85 = array();
     foreach ($x7c as $x7e) {
         foreach ($xb8(",", $x7e->getChildIds()) as $x7f) {
             $x85[$x7f] = $x7e;
             $x86[$x7f]['parent_id'] = $x7e->getId();
             $x86[$x7f]['parent_sku'] = $x7e->getSku();
             $x86[$x7f]['parent_request_path'] = $x7e->getRequestPath();
             $x86[$x7f]['categories_ids'] = $x7e->getCategories_ids();
         }
     }
     $this->bundle = $x85;
     if ($this->_debug) {
         echo "<br><br>------------ BUNDLE ----------------<br>";
         echo $x7c->getSelect() . '<br><br>';
         $xcb($x86);
     }
     $x87 = 0;
     $x7c = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x31);
     $x7c->addAttributeToFilter('status', 1);
     $x7c->addAttributeToFilter('type_id', array("in" => $x45));
     $x7c->addAttributeToFilter('visibility', array("in" => $x46));
     $x88 = $x7c->{$xb5}();
     $x89 = $xcc($x88 / $this->_sqlSize) + 1;
     $x48 = '';
     while ($x87 < $x89) {
         $x7c = Mage::getModel('catalog/product')->getCollection()->addStoreFilter($x31);
         $x7c->addFieldToFilter("status", 1);
         $x7c->addAttributeToFilter("type_id", array("in" => $x45));
         $x7c->addAttributeToFilter("visibility", array("in" => $x46));
         $x7c->addAttributeToSelect($x59);
         $x8a = 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)");
         $x8b = '';
         $x1f = 0;
         foreach ($x47 as $x5b) {
             if ($x5b->checked) {
                 if ($x5b->condition == 'in' || $x5b->condition == 'nin') {
                     if ($x5b->code == 'qty' || $x5b->code == 'is_in_stock') {
                         $x8c = $xb8(',', $x5b->value);
                         $x5b->value = "'" . $xbe($x8c, "','") . "'";
                     } else {
                         $x5b->value = $xb8(',', $x5b->value);
                     }
                 }
                 switch ($x5b->code) {
                     case 'qty':
                         if ($x1f > 0) {
                             $x8b .= ' AND ';
                         }
                         $x8b .= " qty " . $xcf($x8a[$x5b->condition], $x5b->value);
                         $x1f++;
                         break;
                     case 'is_in_stock':
                         if ($x1f > 0) {
                             $x8b .= ' AND ';
                         }
                         $x8b .= " is_in_stock " . $xcf($x8a[$x5b->condition], $x5b->value);
                         $x1f++;
                         break;
                     default:
                         $x7c->addFieldToFilter($x5b->code, array($x5b->condition => $x5b->value));
                         break;
                 }
             }
         }
         $x7c->getSelect()->joinLeft($x75 . ' AS stock', 'stock.product_id=e.entity_id', array('qty' => 'qty', 'is_in_stock' => 'is_in_stock'));
         $x7c->getSelect()->joinLeft($x76 . ' AS url', 'url.product_id=e.entity_id AND url.category_id IS NULL AND is_system=1 AND options<> "RP" AND url.store_id=' . $x31, array('request_path' => 'request_path'));
         $x7c->getSelect()->joinLeft($x56 . ' AS categories', 'categories.product_id=e.entity_id');
         $x7c->getSelect()->joinLeft($x77 . ' AS categories_index', 'categories_index.category_id=categories.category_id AND  categories_index.product_id=categories.product_id AND categories_index.store_id=' . $x31, array('categories_ids' => 'GROUP_CONCAT(categories_index.category_id)'));
         $x7c->getSelect()->joinLeft($x78 . ' 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($x31)->getWebsiteId(), array('min_price' => 'min_price', 'max_price' => 'max_price', 'tier_price' => 'tier_price', 'final_price' => 'final_price'));
         if (!empty($x8b)) {
             $x7c->getSelect()->where($x8b);
         }
         $x7c->getSelect()->group(array('e.entity_id'));
         if ($this->_debug && ($this->_type == '*' || $this->_type == "sql")) {
             echo "<br><br>------------ SQL ----------------<br>";
             print $x7c->getSelect();
         }
         $x7c->getSelect()->limit($this->_sqlSize, $this->_sqlSize * $x87);
         $x87++;
         $x8d = 1;
         $x8e = new MyCustomOptions();
         $x8f = new MyCustomAttributes();
         foreach ($x7c as $x2c) {
             if ($this->_debug) {
                 echo "<br><br>------------ PRODUCT [ SKU -> " . $x2c->getSku() . " | ID -> " . $x2c->getId() . "]---------------<br>";
                 echo "categories : " . $x2c->getCategoriesIds() . ", Root id: " . $x39 . "<br>";
                 foreach ($xb8(',', $x2c->getCategoriesIds()) as $x1c => $x50) {
                     echo $x50 . "=>" . $x2e[$x50]["path"] . "<br>";
                 }
             }
             if (!$xbf('safe_mode')) {
                 $xce(60);
             }
             $x18 = $x3b;
             foreach ($x4a as $x1c => $x90) {
                 $x1d = "";
                 $this->option = 0;
                 switch ($x90['pattern']) {
                     case '{id}':
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         $x1d = $x91->getId();
                         break;
                     case '{inc}':
                         $x1d = $x8d;
                         break;
                     case '{final_price}':
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         $x0e = $x91->getFinalePrice();
                         !isset($x90['options'][1]) ? $x13 = false : ($x13 = $x90['options'][1]);
                         $x1d = $this->applyTax($x0e, $x38, $x91->getTaxClassId(), $x13);
                         !isset($x90['options'][0]) ? $x0f = $x35 : ($x0f = $x90['options'][0]);
                         $x1d = $this->applyCurrencyRate($x1d, $x0f);
                         $x1d = $xc6($x1d, 2, '.', '');
                         break;
                     case '{tier_price}':
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         $x0e = $x91->getTierPrice();
                         !isset($x90['options'][1]) ? $x13 = false : ($x13 = $x90['options'][1]);
                         $x1d = $this->applyTax($x0e, $x38, $x91->getTaxClassId(), $x13);
                         !isset($x90['options'][0]) ? $x0f = $x35 : ($x0f = $x90['options'][0]);
                         $x1d = $this->applyCurrencyRate($x1d, $x0f);
                         $x1d = $xc6($x1d, 2, '.', '');
                         break;
                     case '{min_price}':
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         $x0e = $x91->getMinPrice();
                         !isset($x90['options'][1]) ? $x13 = false : ($x13 = $x90['options'][1]);
                         $x1d = $this->applyTax($x0e, $x38, $x91->getTaxClassId(), $x13);
                         !isset($x90['options'][0]) ? $x0f = $x35 : ($x0f = $x90['options'][0]);
                         $x1d = $this->applyCurrencyRate($x1d, $x0f);
                         $x1d = $xc6($x1d, 2, '.', '');
                         break;
                     case '{max_price}':
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         $x0e = $x91->getMaxPrice();
                         !isset($x90['options'][1]) ? $x13 = false : ($x13 = $x90['options'][1]);
                         $x1d = $this->applyTax($x0e, $x38, $x91->getTaxClassId(), $x13);
                         !isset($x90['options'][0]) ? $x0f = $x35 : ($x0f = $x90['options'][0]);
                         $x1d = $this->applyCurrencyRate($x1d, $x0f);
                         $x1d = $xc6($x1d, 2, '.', '');
                         break;
                     case '{normal_price}':
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         if ($x91->type_id == 'bundle') {
                             $x0e = $x91->price;
                         } else {
                             $x0e = $x91->getPrice();
                         }
                         !isset($x90['options'][1]) ? $x13 = false : ($x13 = $x90['options'][1]);
                         $x1d = $this->applyTax($x0e, $x38, $x91->getTaxClassId(), $x13);
                         !isset($x90['options'][0]) ? $x0f = $x35 : ($x0f = $x90['options'][0]);
                         $x1d = $this->applyCurrencyRate($x1d, $x0f);
                         $x1d = $xc6($x1d, 2, '.', '');
                         $this->skipOptions(2);
                         break;
                     case '{price}':
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         if ($x91->getSpecialFromDate() && !$x91->getSpecialToDate()) {
                             if ($x91->getSpecialFromDate() <= $xb6("Y-m-d H:i:s")) {
                                 if ($x91->type_id == "bundle") {
                                     if (($x91->price_type || !$x91->price_type && $x91->special_price < $x91->price) && $x91->special_price > 0) {
                                         if ($x91->price_type) {
                                             $x0e = $xc6($x91->price * $x91->special_price / 100, 2, ".", "");
                                         } else {
                                             $x0e = $x91->special_price;
                                         }
                                     } else {
                                         $x0e = $x91->price;
                                     }
                                 } else {
                                     $x91->getSpecial_price() && $x91->getSpecial_price() < $x91->getPrice() ? $x0e = $x91->getSpecialPrice() : ($x0e = $x91->getPrice());
                                 }
                             } else {
                                 if ($x91->type_id == "bundle") {
                                     $x0e = $x91->price;
                                 } else {
                                     $x0e = $x91->getPrice();
                                 }
                             }
                         } elseif ($x91->getSpecialFromDate() && $x91->getSpecialToDate()) {
                             if ($x91->getSpecialFromDate() <= $xb6("Y-m-d H:i:s") && $xb6("Y-m-d H:i:s") < $x91->getSpecialToDate()) {
                                 if ($x91->type_id == "bundle") {
                                     if (($x91->price_type || !$x91->price_type && $x91->special_price < $x91->price) && $x91->special_price > 0) {
                                         if ($x91->price_type) {
                                             $x0e = $xc6($x91->price * $x91->special_price / 100, 2, ".", "");
                                         } else {
                                             $x0e = $x91->special_price;
                                         }
                                     } else {
                                         $x0e = $x91->price;
                                     }
                                 } else {
                                     $x91->getSpecial_price() && $x91->getSpecial_price() < $x91->getPrice() ? $x0e = $x91->getSpecialPrice() : ($x0e = $x91->getPrice());
                                 }
                             } else {
                                 if ($x91->type_id == "bundle") {
                                     $x0e = $x91->price;
                                 } else {
                                     $x0e = $x91->getPrice();
                                 }
                             }
                         } else {
                             if ($x91->type_id == "bundle") {
                                 if (($x91->price_type || !$x91->price_type && $x91->special_price < $x91->price) && $x91->special_price > 0) {
                                     if ($x91->price_type) {
                                         $x0e = $xc6($x91->price * $x91->special_price / 100, 2, ".", "");
                                     } else {
                                         $x0e = $x91->special_price;
                                     }
                                 } else {
                                     $x0e = $x91->price;
                                 }
                             } else {
                                 $x91->getSpecial_price() && $x91->getSpecial_price() < $x91->getPrice() ? $x0e = $x91->getSpecialPrice() : ($x0e = $x91->getPrice());
                             }
                         }
                         !isset($x90['options'][1]) ? $x13 = false : ($x13 = $x90['options'][1]);
                         $x1d = $this->applyTax($x0e, $x38, $x91->getTaxClassId(), $x13);
                         !isset($x90["options"][0]) ? $x0f = $x35 : ($x0f = $x90["options"][0]);
                         $x1d = $this->applyCurrencyRate($x1d, $x0f);
                         $x1d = $xc6($x1d, 2, ".", "");
                         $this->skipOptions(2);
                         break;
                     case "{is_special_price}":
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         !isset($x90["options"][0]) ? $x92 = 1 : ($x92 = $x90["options"][0]);
                         !isset($x90["options"][1]) ? $x93 = 0 : ($x93 = $x90["options"][1]);
                         if ($x91->getSpecialFromDate() && !$x91->getSpecialToDate()) {
                             if ($x91->getSpecialFromDate() <= $xb6("Y-m-d H:i:s")) {
                                 if ($x91->type_id == "bundle") {
                                     ($x91->price_type || !$x91->price_type && $x91->special_price < $x91->price) && $x91->special_price > 0 ? $x1d = $x92 : ($x1d = $x93);
                                 } else {
                                     $x91->getSpecial_price() && $x91->getSpecial_price() < $x91->getPrice() ? $x1d = $x92 : ($x1d = $x93);
                                 }
                             } else {
                                 if ($x91->type_id == "bundle") {
                                     $x1d = $x93;
                                 } else {
                                     $x1d = $x93;
                                 }
                             }
                         } elseif ($x91->getSpecialFromDate() && $x91->getSpecialToDate()) {
                             if ($x91->getSpecialFromDate() <= $xb6("Y-m-d H:i:s") && $xb6("Y-m-d H:i:s") < $x91->getSpecialToDate()) {
                                 if ($x91->type_id == "bundle") {
                                     ($x91->price_type || !$x91->price_type && $x91->special_price < $x91->price) && $x91->special_price > 0 ? $x1d = $x92 : ($x1d = $x93);
                                 } else {
                                     $x91->getSpecial_price() && $x91->getSpecial_price() < $x91->getPrice() ? $x1d = $x92 : ($x1d = $x93);
                                 }
                             } else {
                                 if ($x91->type_id == "bundle") {
                                     $x1d = $x93;
                                 } else {
                                     $x1d = $x93;
                                 }
                             }
                         } else {
                             if ($x91->type_id == "bundle") {
                                 ($x91->price_type || !$x91->price_type && $x91->special_price < $x91->price) && $x91->special_price > 0 ? $x1d = $x92 : ($x1d = $x93);
                             } else {
                                 $x91->getSpecial_price() && $x91->getSpecial_price() < $x91->getPrice() ? $x1d = $x92 : ($x1d = $x93);
                             }
                         }
                         $this->skipOptions(2);
                         break;
                     case "{special_price}":
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         $x0e = null;
                         if ($x91->getSpecialFromDate() && !$x91->getSpecialToDate()) {
                             if ($x91->getSpecialFromDate() <= $xb6("Y-m-d H:i:s")) {
                                 if ($x91->type_id == 'bundle') {
                                     if ($x91->price_type) {
                                         $x0e = $xc6($x91->price * $x91->special_price / 100, 2, ".", "");
                                     } else {
                                         $x0e = $x91->special_price;
                                     }
                                 } else {
                                     $x0e = $x91->getSpecial_price();
                                 }
                             }
                         } elseif ($x91->getSpecialFromDate() && $x91->getSpecialToDate()) {
                             if ($x91->getSpecialFromDate() <= $xb6("Y-m-d H:i:s") && $xb6("Y-m-d H:i:s") < $x91->getSpecialToDate()) {
                                 if ($x91->type_id == 'bundle') {
                                     if ($x91->price_type) {
                                         $x0e = $xc6($x91->price * $x91->special_price / 100, 2, ".", "");
                                     } else {
                                         $x0e = $x91->special_price;
                                     }
                                 } else {
                                     $x0e = $x91->getSpecial_price();
                                 }
                             }
                         } else {
                             if ($x91->type_id == 'bundle') {
                                 if ($x91->price_type) {
                                     $x0e = $xc6($x91->price * $x91->special_price / 100, 2, ".", "");
                                 } else {
                                     $x0e = $x91->special_price;
                                 }
                             } else {
                                 $x0e = $x91->getSpecial_price();
                             }
                         }
                         !isset($x90['options'][1]) ? $x13 = false : ($x13 = $x90['options'][1]);
                         if ($x0e > 0) {
                             $x1d = $this->applyTax($x0e, $x38, $x91->getTaxClassId(), $x13);
                             !isset($x90['options'][0]) ? $x0f = $x35 : ($x0f = $x90['options'][0]);
                             $x1d = $this->applyCurrencyRate($x1d, $x0f);
                             $x1d = $xc6($x1d, 2, '.', '');
                         } else {
                             $x1d = "";
                         }
                         $this->skipOptions(2);
                         break;
                     case "{G:SALE_PRICE}":
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         $x94 = $xd0(' ', 'T', $x91->getSpecialFromDate());
                         $x95 = $xd0(' ', 'T', $x91->getSpecialToDate());
                         if ($x91->type_id == 'bundle' && $x91->special_price) {
                             if ($x91->price_type) {
                                 $x0e = $xc6($x91->price * $x91->special_price / 100, 2, ".", "");
                             } else {
                                 $x0e = $x91->special_price;
                             }
                         } else {
                             $x0e = $x91->getSpecial_price();
                         }
                         !isset($x90['options'][1]) ? $x13 = false : ($x13 = $x90['options'][1]);
                         if ($x0e > 0) {
                             $x0e = $this->applyTax($x0e, $x38, $x91->getTaxClassId(), $x13);
                             !isset($x90['options'][0]) ? $x0f = $x35 : ($x0f = $x90['options'][0]);
                             $x0e = $this->applyCurrencyRate($x0e, $x0f);
                             $x0e = $xc6($x0e, 2, '.', '');
                         }
                         if ($x0e > 0) {
                             $x1d = "<g:sale_price><![CDATA[" . $x0e . "]]></g:sale_price>\n";
                         }
                         if ($x0e > 0 && $x95) {
                             $x1d .= "<g:sale_price_effective_date><![CDATA[" . $x94 . "Z/" . $x95 . "Z]]></g:sale_price_effective_date>";
                         }
                         $this->skipOptions(2);
                         break;
                     case "{image}":
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         $x96 = $x91->getImage();
                         if (!isset($x90['options'][0]) || $x90['options'][0] == 0) {
                             if ($x91->getImage() && $x91->getImage() != 'no_selection') {
                                 $x97 = 'catalog/product/' . $x91->getImage();
                                 $x1d = $x37 . $xd0('//', '/', $x97);
                             } else {
                                 $x1d = $x37 . '/catalog/product/placeholder/' . $x34;
                             }
                         } elseif (isset($x74[$x91->getId()]['src'][$x90['options'][0] - 1]) && $x90['options'][0] > 0) {
                             if ($x74[$x91->getId()]['src'][$x90['options'][0] - 1] != $x96) {
                                 $x97 = 'catalog/product/' . $x74[$x91->getId()]['src'][$x90['options'][0] - 1];
                                 $x1d = $x37 . $xd0('//', '/', $x97);
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{G:IMAGE_LINK}":
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         $x96 = $x91->getImage();
                         $x98 = array($x91->getSmall_image(), $x91->getThumbnail());
                         $x99 = '';
                         $x9a = 0;
                         if ($x91->getImage() && $x91->getImage() != 'no_selection') {
                             $x97 = 'catalog/product/' . $x91->getImage();
                             $x1d = $x37 . $xd0('//', '/', $x97);
                             $x99 .= "<g:image_link><![CDATA[" . $x1d . "]]></g:image_link>\n";
                             $x9a++;
                         }
                         $x9b = 0;
                         while (isset($x74[$x91->getId()]['src'][$x9b]) && $x9a < 10) {
                             if ($x74[$x91->getId()]['src'][$x9b] != $x96) {
                                 if ($xbd($x74[$x91->getId()]['src'][$x9b], $x98) || $x74[$x91->getId()]['disabled'][$x9b] != 1) {
                                     $x97 = 'catalog/product/' . $x74[$x91->getId()]['src'][$x9b];
                                     $x1d = $x37 . $xd0('//', '/', $x97);
                                     $x99 .= "<g:additional_image_link><![CDATA[" . $x1d . "]]></g:additional_image_link>\n";
                                     $x9a++;
                                 }
                             }
                             $x9b++;
                         }
                         $x1d = $x99;
                         break;
                     case "{url}":
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         if ($x91->getRequest_path()) {
                             $x1d = $x36 . $x2f . $x91->getRequest_path();
                         } else {
                             $x1d = $x91->getProductUrl();
                         }
                         break;
                     case "{uri}":
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         if ($x91->getRequest_path()) {
                             $x1d = $x91->getRequest_path();
                         } else {
                             $x1d = $xd0($x36, '', $x91->getProductUrl());
                         }
                         break;
                     case '{is_in_stock}':
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         !isset($x90['options'][0]) ? $x92 = 1 : ($x92 = $x90['options'][0]);
                         !isset($x90['options'][1]) ? $x93 = 0 : ($x93 = $x90['options'][1]);
                         $x91->getIs_in_stock() > 0 ? $x1d = $x92 : ($x1d = $x93);
                         $this->skipOptions(2);
                         break;
                     case '{stock_status}':
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         $x91->getIs_in_stock() > 0 ? $x1d = Mage::helper('datafeedmanager')->__('in stock') : ($x1d = Mage::helper('datafeedmanager')->__('out of stock'));
                         break;
                     case '{qty}':
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         !isset($x90['options'][0]) ? $x9c = 0 : ($x9c = $x90['options'][0]);
                         if ($x2c->type_id == "configurable") {
                             $x1d = $x81[$x2c->getId()];
                             $x1d = $xc6($x1d, $x9c, '.', '');
                         } else {
                             if ($x90['reference'] == "configurable") {
                                 $x1d = $xc6($x81[$x91->getId()], $x9c, '.', '');
                             } else {
                                 $x1d = $xc6($x91->getQty(), $x9c, '.', '');
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{categories}":
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         !isset($x90['options'][0]) || !$x90['options'][0] || $x90['options'][0] == 'INF' ? $x9d = INF : ($x9d = $x90['options'][0]);
                         !isset($x90['options'][1]) ? $x9e = 1 : ($x9e = $x90['options'][1]);
                         !isset($x90['options'][2]) || !$x90['options'][2] || $x90['options'][2] == 'INF' ? $x9f = INF : ($x9f = $x90['options'][2]);
                         $xa0 = 0;
                         $x1d = '';
                         $xa1 = '';
                         foreach ($xb8(',', $x91->getCategoriesIds()) as $x1c => $x50) {
                             if (isset($x2e[$x50]) && $xa0 < $x9d && ($xbd($x2e[$x50]["path"], $x42) || $x42[0] == "*")) {
                                 $xa2 = 0;
                                 $xa3 = $xb8('/', $x2e[$x50]["path"]);
                                 if ($xbd($x39, $xa3)) {
                                     $xa4 = "";
                                     if ($xa0 > 0) {
                                         $xa1 = ",";
                                     }
                                     foreach ($xa3 as $xa5) {
                                         if (isset($x2e[$xa5])) {
                                             if ($x2e[$xa5]['level'] > $x9e && $xa2 < $x9f) {
                                                 if ($xa2 > 0) {
                                                     $xa4 .= ' > ';
                                                 }
                                                 $xa4 .= $x2e[$xa5]['name'];
                                                 $xa2++;
                                             }
                                         }
                                     }
                                     $xa6 = "";
                                     if (!empty($xa4)) {
                                         $x1d .= $xa1 . $xa4 . $xa6;
                                         $xa0++;
                                     }
                                 }
                             }
                         }
                         $this->skipOptions(3);
                         break;
                     case "{G:PRODUCT_TYPE}":
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         !isset($x90['options'][0]) || !$x90['options'][0] || $x90['options'][0] == 'INF' ? $x9d = INF : ($x9d = $x90['options'][0]);
                         !isset($x90['options'][1]) ? $x9e = 1 : ($x9e = $x90['options'][1]);
                         !isset($x90['options'][2]) || !$x90['options'][2] || $x90['options'][2] == 'INF' ? $x9f = INF : ($x9f = $x90['options'][2]);
                         $xa0 = 0;
                         $x1d = '';
                         foreach ($xb8(',', $x91->getCategoriesIds()) as $x1c => $x50) {
                             if (isset($x2e[$x50]) && $xa0 < $x9d && ($xbd($x2e[$x50]["path"], $x42) || $x42[0] == "*")) {
                                 $xa2 = 0;
                                 $xa3 = $xb8('/', $x2e[$x50]["path"]);
                                 if ($xbd($x39, $xa3)) {
                                     $xa4 = '';
                                     $xa1 = '<g:product_type><![CDATA[';
                                     foreach ($xa3 as $xa5) {
                                         if (isset($x2e[$xa5])) {
                                             if ($x2e[$xa5]['level'] > $x9e && $xa2 < $x9f) {
                                                 if ($xa2 > 0) {
                                                     $xa4 .= ' > ';
                                                 }
                                                 $xa4 .= $x2e[$xa5]['name'];
                                                 $xa2++;
                                             }
                                         }
                                     }
                                     $xa6 = "]]></g:product_type>\n";
                                     if (!empty($xa4)) {
                                         $x1d .= $xa1 . $xa4 . $xa6;
                                         $xa0++;
                                     }
                                 }
                             }
                         }
                         $this->skipOptions(3);
                         break;
                     case "{G:GOOGLE_PRODUCT_CATEGORY}":
                         isset($x90["options"][0]) ? $xa7 = $x90["options"][0] : ($xa7 = 0);
                         $x1d = "";
                         $xa8 = 0;
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         foreach ($xb8(',', $x91->getCategoriesIds()) as $x1c => $x50) {
                             if (isset($x2e[$x50]["path"]) && isset($x43[$x2e[$x50]["path"]])) {
                                 if ($xa8 == $xa7) {
                                     $x1d .= "<g:google_product_category><![CDATA[" . $x43[$x2e[$x50]["path"]] . "]]></g:google_product_category>\n";
                                     break;
                                 }
                                 $xa8++;
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{category_mapping}":
                         isset($x90["options"][0]) ? $xa7 = $x90["options"][0] : ($xa7 = 0);
                         $x1d = "";
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         $xa8 = 0;
                         foreach ($xb8(',', $x91->getCategoriesIds()) as $x1c => $x50) {
                             if (isset($x43[$x2e[$x50]["path"]])) {
                                 if ($xa8 == $xa7) {
                                     $x1d .= $x43[$x2e[$x50]["path"]];
                                     break;
                                 }
                                 $xa8++;
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{review_count}":
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         $x1d = "";
                         isset($x90["options"][0]) && $x90["options"][0] == "*" ? $xa9 = 0 : ($xa9 = $x31);
                         if (isset($x6e[$x91->getId()][$xa9]["count"])) {
                             $xaa = $x6e[$x91->getId()][$xa9]["count"];
                             if (isset($xaa)) {
                                 $x1d .= $xaa;
                             }
                         }
                         $this->skipOptions(1);
                         break;
                     case "{review_average}":
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         $x1d = "";
                         isset($x90["options"][0]) && $x90["options"][0] == "*" ? $xa9 = 0 : ($xa9 = $x31);
                         !isset($x90["options"][1]) || !$x90["options"][1] ? $xab = 5 : ($xab = $x90["options"][1]);
                         if (isset($x6e[$x91->getId()][$xa9]["score"])) {
                             $xac = $xc6($x6e[$x91->getId()][$xa9]["score"] * $xab / 100, 2, ".", "");
                             if (isset($xac)) {
                                 $x1d .= $xac;
                             }
                         }
                         $this->skipOptions(2);
                         break;
                     case "{G:PRODUCT_REVIEW}":
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         isset($x90["options"][0]) && $x90["options"][0] == "*" ? $xa9 = 0 : ($xa9 = $x31);
                         !isset($x90["options"][1]) || !$x90["options"][1] ? $xab = 5 : ($xab = $x90["options"][1]);
                         $x1d = "";
                         if (isset($x6e[$x91->getId()][$xa9]["count"])) {
                             $xaa = $x6e[$x91->getId()][$xa9]["count"];
                             $xac = $xc6($x6e[$x91->getId()][$xa9]["score"] * $xab / 100, 2, ".", "");
                         }
                         if (isset($xac) && $xac > 0) {
                             $x1d .= "<g:product_review_average><![CDATA[" . $xac . "]]></g:product_review_average>\n";
                         }
                         if (isset($xaa) && $xaa > 0) {
                             $x1d .= "<g:product_review_count><![CDATA[" . $xaa . "]]></g:product_review_count>\n";
                         }
                         unset($xac);
                         unset($xaa);
                         break;
                     case "{G:ITEM_GROUP_ID}":
                         if (isset($this->configurable[$x2c->getId()])) {
                             $x91 = $this->checkReference('configurable', $x2c);
                             $x1d = "<g:item_group_id><![CDATA[" . $x91->getSku() . "]]></g:item_group_id>";
                         }
                         break;
                     default:
                         $x91 = $this->checkReference($x90['reference'], $x2c);
                         if ($xbd($x90['name'], $x59)) {
                             if ($xbd($x5a[$x90['name']], array('select', 'multiselect'))) {
                                 eval('$xad =($x91->' . $x90['methodName'] . ");");
                                 $xae = $xb8(',', $xad);
                                 if ($xb5($xae) > 1) {
                                     $x1d = array();
                                     foreach ($xae as $xaf) {
                                         if (isset($x5f[$xaf][$x31])) {
                                             $x1d[] = $x5f[$xaf][$x31];
                                         } else {
                                             if (isset($x5f[$xaf][0])) {
                                                 $x1d[] = $x5f[$xaf][0];
                                             }
                                         }
                                     }
                                 } else {
                                     if (isset($x5f[$xae[0]][$x31])) {
                                         $x1d = $x5f[$xae[0]][$x31];
                                     } else {
                                         if (isset($x5f[$xae[0]][0])) {
                                             $x1d = $x5f[$xae[0]][0];
                                         }
                                     }
                                 }
                             } else {
                                 eval('$x1d =($x91->' . $x90['methodName'] . ");");
                             }
                         }
                         if ($xbd(@$x57[$x90['name']], $x57)) {
                             $x1d = $x57[$x90['name']];
                         }
                         $x1d = $x8f->_eval($x2c, $x90, $x1d);
                         if ($xc0($x1d) && !$x1d) {
                             continue 3;
                         }
                         break;
                 }
                 if ($xb5($x90['options']) > 0) {
                     foreach ($x90['options'] as $x1c => $xb0) {
                         if ($x1c >= $this->option) {
                             switch ($x90['options'][$this->option]) {
                                 case "substr":
                                     if (isset($x90['options'][$this->option + 1]) && $xd1($x1d) > $x90['options'][$this->option + 1]) {
                                         $x1d = $xd4($x1d, 0, $x90['options'][$this->option + 1] - 3);
                                         $xb1 = $xd5($x1d, " ");
                                         $x1d = $xd4($x1d, 0, $xb1) . $x90['options'][$this->option + 2];
                                     }
                                     $this->skipOptions(3);
                                     break;
                                 case "strip_tags":
                                     $xb2 = " ";
                                     $x1d = $xca('!\\<br /\\>!isU', $xb2, $x1d);
                                     $x1d = $xca('!\\<br/\\>!isU', $xb2, $x1d);
                                     $x1d = $xca('!\\<br>!isU', $xb2, $x1d);
                                     $x1d = $xd3($x1d);
                                     $this->skipOptions(1);
                                     break;
                                 case "htmlentities":
                                     $x1d = $xba($x1d);
                                     $this->skipOptions(1);
                                     break;
                                 case "implode":
                                     $x1d = $xc1($x1d) ? $xbe($x90['options'][$this->option + 1], $x1d) : $x1d;
                                     $this->skipOptions(2);
                                     break;
                                 case "float":
                                     $x1d = $xc6($x1d, $x90['options'][$this->option + 1], '.', '');
                                     $this->skipOptions(2);
                                     break;
                                 case "html_entity_decode":
                                     $x1d = $xbb($x1d, ENT_QUOTES, 'UTF-8');
                                     $this->skipOptions(1);
                                     break;
                                 case "inline":
                                     $x1d = $xca('/(\\r\\n|\\n|\\r|\\r\\n)/s', '', $x1d);
                                     $this->skipOptions(1);
                                     break;
                                 case "strtolower":
                                     $x1d = $xc4($x1d, "UTF8");
                                     $this->skipOptions(1);
                                     break;
                                 case "strtoupper":
                                     $x1d = $xc5($x1d, "UTF8");
                                     $this->skipOptions(1);
                                     break;
                                 default:
                                     $x8e->option = $this->option;
                                     $x1d = $x8e->_eval($x2c, $x90, $x1d);
                                     $this->option = $x8e->option;
                                     if ($xc0($x1d) && !$x1d) {
                                         continue 3;
                                     }
                                     break;
                             }
                         }
                     }
                 }
                 if ($x3d > 1) {
                     $x1d = $this->escapeStr($x1d);
                 }
                 $x1d = $xd0(array("<", ">"), array("{([", "])}"), $x1d);
                 $x18 = $xd0($x90['fullpattern'], $x1d, $x18);
             }
             $x18 = $this->execPhpScript($x18, $x2c, $x3d);
             if ($x3d == 1 || $x3d != 1 && !$this->_display) {
                 $x18 = $this->encode($x18);
             }
             if ($x3d == 1) {
                 $x18 = $this->xmlEncloseData($x18, $x40);
             } else {
                 if (!$this->_display) {
                     $x18 = $this->jsonToStr($x18, $x26, $x27);
                 } else {
                     $x18 = $this->jsonToTable($x18, false);
                 }
             }
             $x18 = $xd0(array("{([", "])}"), array("<", ">"), $x18);
             if ($x42[0] != '*') {
                 $xa2 = 0;
                 foreach ($xb8(",", $x2c->getCategoriesIds()) as $x1c => $x50) {
                     if (isset($x2e[$x50])) {
                         if ($xbd($x2e[$x50]['path'], $x42)) {
                             $xa2++;
                         }
                     }
                 }
                 if ($xa2 < 1) {
                     $x18 = '';
                 }
             }
             if (!empty($x18)) {
                 $x48 .= $x18 . "\r\n";
                 if ($this->_display) {
                     $x49 .= $x48;
                     $x48 = '';
                 } else {
                     if ($x8d % 10 == 0) {
                         $x0b->streamWrite($x48);
                         unset($x48);
                         $x48 = '';
                     }
                 }
                 if ($this->_limit && $x8d > $this->_limit) {
                     break 2;
                 }
                 $x8d++;
             }
         }
     }
     if (!$this->_display) {
         $x0b->streamWrite($x48);
         if ($xd1($xd6($x3c)) > 1) {
             $x0b->streamWrite($x3c . "\n");
         }
     } else {
         $x49 .= $x48;
         $x49 .= $x3c . "\n";
         if ($x3d > 1) {
             $x49 .= "</table>";
         }
     }
     unset($x7c);
     if ($this->_display && !$this->_debug) {
         $x3d == 1 ? $xb3 = "<pre name='code' class='xml'>" . $xba($x49) . "</pre>" : ($xb3 = $x49);
         return "\r\r    \t\t<html>\r\n    \t\t<head>\r\n    \t\t<title>" . $this->getFeedName() . "</title>\r    \t\t<link type='text/css' rel='stylesheet' href='" . $x36 . "skin/adminhtml/default/default/datafeedmanager/SyntaxHighlighter/css/SyntaxHighlighter.css'></link>\r\t\t\t<script language='javascript' src='" . $x36 . "skin/adminhtml/default/default/datafeedmanager/SyntaxHighlighter/js/shCore.js'></script>\r\n\t\t\t<script language='javascript' src='" . $x36 . "skin/adminhtml/default/default/datafeedmanager/SyntaxHighlighter/js/shBrushXml.js'></script>\r\n    \t\t\r\n\t\t\t</head>\r\n\t\t\t<body>\r\n\t\t\t" . $xb3 . "\r\n\t\t\t<script language='javascript'>\r\n\t\t\t\r\n\t\t\tdp.SyntaxHighlighter.HighlightAll('code',false,false,false,false);\r\n\t\t\t</script>\r\r\t\t\t</body>\r\n\t\t\t</html>";
     } elseif ($this->_debug) {
         echo "<br><br>------------ XML OUTPUT ----------------<br>";
         $xb3 = "<pre>" . $xbc($x49) . "</pre>";
         return $xb3;
     } else {
         $x0b->streamClose();
         $this->setFeedUpdatedAt(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
         $this->save();
     }
     return $this;
 }