/** * Rotate all files in var/log which ends with .log */ public function rotateLogs() { $var = Mage::getBaseDir('log'); $logDir = new Varien_Io_File(); $logDir->cd($var); $logFiles = $logDir->ls(Varien_Io_File::GREP_FILES); foreach ($logFiles as $logFile) { if ($logFile['filetype'] == 'log') { $filename = $logFile['text']; if (extension_loaded('zlib')) { $zipname = $var . DS . $this->getArchiveName($filename); $zip = gzopen($zipname, 'wb9'); gzwrite($zip, $logDir->read($filename)); gzclose($zip); } else { $logDir->cp($filename, $this->getArchiveName($filename)); } foreach ($this->getFilesOlderThan(self::MAX_FILE_DAYS, $var, $filename) as $oldFile) { $logDir->rm($oldFile['text']); } $logDir->rm($filename); } } $logDir->close(); }
/** * Export function: * - Returns false, if an error occured or if there are no orders to export * - Returns array, containing the filename and the file contents * * @return bool|array */ public function export() { $collection = $this->_hasOrdersToExport(); if (!$collection) { return false; } $fileName = $this->getFileName(); // Open file $file = new Varien_Io_File(); $file->open(array('path' => Mage::getBaseDir('var'))); $file->streamOpen($fileName); // Add headline $row = array('Kundenname', 'BLZ', 'Kontonummer', 'BIC/Swift-Code', 'IBAN', 'Betrag', 'Verwendungszweck'); $file->streamWriteCsv($row); // Add rows foreach ($collection as $order) { /* @var $orderModel Mage_Sales_Model_Order */ $orderModel = Mage::getModel('sales/order')->load($order->getData('entity_id')); /* @var $paymentMethod Itabs_Debit_Model_Debit */ $paymentMethod = $orderModel->getPayment()->getMethodInstance(); // Format order amount $amount = number_format($order->getData('grand_total'), 2, ',', '.'); $row = array('name' => $paymentMethod->getAccountName(), 'bank_code' => $paymentMethod->getAccountBLZ(), 'account_number' => $paymentMethod->getAccountNumber(), 'account_swift' => $paymentMethod->getAccountSwift(), 'account_iban' => $paymentMethod->getAccountIban(), 'amount' => $amount . ' ' . $order->getData('order_currency_code'), 'purpose' => 'Bestellung Nr. ' . $order->getData('increment_id')); $file->streamWriteCsv($row); $this->_getDebitHelper()->setStatusAsExported($order->getId()); } // Close file, get file contents and delete temporary file $file->close(); $filePath = Mage::getBaseDir('var') . DS . $fileName; $fileContents = file_get_contents($filePath); $file->rm($fileName); $response = array('file_name' => $fileName, 'file_content' => $fileContents); return $response; }
/** * Upload file to CDN async */ public function uploadFile() { $adapter = Mage::getModel('mycdn/adapter'); if (!$adapter) { return; } $ioObject = new Varien_Io_File(); $ioObject->setAllowCreateFolders(true); $ioObject->open(array('path' => $ioObject->dirname($this->getData('filename')))); if (!$ioObject->fileExists($this->getData('filename'), true)) { Mage::helper('mycdn')->addLog('[CRON] No file ' . $this->getData('filename')); $this->delete(); return; } //Mage::helper('mycdn')->addLog('[CRON] processing id = ' . $this->getId()); //Mage::helper('mycdn')->addLog($this->getData()); $result = $adapter->uploadFile($this->getData('filename'), $this->getData('uploadname'), $this->getData('content_type')); if ($result && $this->getData('delete')) { $ioObject->rm($this->getData('filename')); Mage::helper('mycdn')->addLog('[DELETE] CRON delete for ' . $this->getData('filename')); } if ($result) { Mage::helper('mycdn')->addLog('[JOB] CRON delete job for ' . $this->getData('filename') . "\n"); $this->delete(); } }
final function uninstall(Varien_Event_Observer $observer) { $module = $observer->getEvent()->getModule(); if (0 !== strpos(get_class($this), $module)) { return false; } $this->run(); $manifestPath = str_replace('_', '/', $module) . '/etc/manifest.xml'; foreach (explode(PS, get_include_path()) as $includePath) { if (file_exists($includePath . DS . $manifestPath)) { $manifestPath = $includePath . DS . $manifestPath; break; } } if (!file_exists($manifestPath)) { throw new Exception('Manifest path "' . $manifestPath . '" does not exist'); } $manifestXml = new SimpleXMLElement($manifestPath, null, true); $paths = $manifestXml->xpath('/manifest/' . $module . '/paths/path'); $file = new Varien_Io_File(); foreach ($paths as $path) { $path = BP . DS . $path; if (file_exists($path)) { if (is_dir($path)) { $file->rmdir($path, true); } else { $file->rm($path); } } } $this->_removeResources($module); }
/** * Remove item image by image filename * * @param string $imageFile * @return bool */ public function removeImage($imageFile) { $io = new Varien_Io_File(); $io->open(array('path' => $this->getBaseDir())); if ($io->fileExists($imageFile)) { return $io->rm($imageFile); } return false; }
public function saveAction() { $post_data = $this->getRequest()->getPost(); if ($post_data) { try { $post_data['category'] = implode(',', $post_data['category']); //save image try { if ((bool) $post_data['image']['delete'] == 1) { $post_data['image'] = ''; } else { unset($post_data['image']); if (isset($_FILES)) { if ($_FILES['image']['name']) { if ($this->getRequest()->getParam("id")) { $model = Mage::getModel("gallery/image")->load($this->getRequest()->getParam("id")); if ($model->getData('image')) { $io = new Varien_Io_File(); $io->rm(Mage::getBaseDir('media') . DS . implode(DS, explode('/', $model->getData('image')))); } } $path = Mage::getBaseDir('media') . DS . 'gallery' . DS . 'image' . DS; $uploader = new Varien_File_Uploader('image'); $uploader->setAllowedExtensions(array('jpg', 'png', 'gif')); $uploader->setAllowRenameFiles(false); $uploader->setFilesDispersion(false); $destFile = $path . $_FILES['image']['name']; $filename = $uploader->getNewFileName($destFile); $uploader->save($path, $filename); $post_data['image'] = 'gallery/image/' . $filename; } } } } catch (Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id'))); return; } //save image $model = Mage::getModel("gallery/image")->addData($post_data)->setId($this->getRequest()->getParam("id"))->save(); Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Image was successfully saved")); Mage::getSingleton("adminhtml/session")->setImageData(false); if ($this->getRequest()->getParam("back")) { $this->_redirect("*/*/edit", array("id" => $model->getId())); return; } $this->_redirect("*/*/"); return; } catch (Exception $e) { Mage::getSingleton("adminhtml/session")->addError($e->getMessage()); Mage::getSingleton("adminhtml/session")->setImageData($this->getRequest()->getPost()); $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id"))); return; } } $this->_redirect("*/*/"); }
/** * Save uploaded file before saving config value * * Save changes and delete file if "delete" option passed * * @return Codewix_Logo_Model_System_Config_Backend_Logo */ protected function _beforeSave() { $value = $this->getValue(); $deleteFlag = is_array($value) && !empty($value['delete']); $fileTmpName = $_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value']; if ($this->getOldValue() && ($fileTmpName || $deleteFlag)) { $io = new Varien_Io_File(); $io->rm($this->_getUploadRoot(self::UPLOAD_ROOT_TOKEN) . DS . self::UPLOAD_DIR . DS . $this->getOldValue()); } return parent::_beforeSave(); }
public function refreshStatus($observer) { ob_start(); $product = split("_", $observer['event']['name']); $product = $product[count($product) - 1]; // remove old local key $dir = Mage::getBaseDir("var") . DS . "smartosc" . DS . strtolower(substr('X-MultiVendor Basic', 0, 5)) . DS; $filepath = $dir . "license.dat"; $file = new Varien_Io_File(); $file->rm($filepath); if (Mage::helper('smcore')->checkLicense('X-MultiVendor Basic', Mage::getStoreConfig($product . '/general/key'), true)) { Mage::getModel('core/config')->saveConfig($product . '/general/enable', "1"); } else { Mage::getModel('core/config')->saveConfig($product . '/general/enable', "0"); } Mage::getConfig()->cleanCache(); }
public function refreshStatus($observer) { ob_start(); $product = split("_", $observer['event']['name']); $product = $product[count($product) - 1]; if ($product == "barcode") { $product2 = SM_Barcode_Helper_Abstract::PRODUCT; } else { $product2 = $product; } // remove old local key $dir = Mage::getBaseDir("var") . DS . "smartosc" . DS . strtolower(substr($product2, 0, 5)) . DS; $filepath = $dir . "license.dat"; $file = new Varien_Io_File(); $file->rm($filepath); Mage::helper('smcore')->checkLicense($product2, Mage::getStoreConfig($product . '/general/key'), true); Mage::getConfig()->cleanCache(); }
/** * Deletes all extension folders and the app/etc/modules config file. */ public function deleteExtensionFolderFiles() { $namespacePath = $this->_getNamespacePath(); $extensionPath = $this->_getExtensionPath(); try { $this->_filesystem->rmdir($extensionPath, true); if (is_dir($namespacePath)) { $this->_filesystem->cd($namespacePath); if (count($this->_filesystem->ls()) == 0) { $this->_filesystem->rmdir($namespacePath, true); } } $modulesConfigFile = $this->_namespace . '_' . $this->_extensionName . '.xml'; $modulesConfigFilePath = $this->_helper->getModulesConfigDir() . DS . $modulesConfigFile; if (file_exists($modulesConfigFilePath)) { $this->_filesystem->rm($modulesConfigFilePath); } } catch (Exception $e) { Mage::log($e->getMessage(), null, $this->_helper->getLogFilename()); Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); } }
protected function _copyImage($file) { try { $ioObject = new Varien_Io_File(); $destDirectory = dirname($this->_getConfig()->getMediaPath($file)); $ioObject->open(array('path' => $destDirectory)); $destFile = $this->_getUniqueFileName($file, $ioObject->dirsep()); if (!$ioObject->fileExists($this->_getConfig()->getMediaPath($file), true)) { throw new Exception('File not exists'); } if ($this->_checkDb()) { Mage::helper('core/file_storage_database')->copyFile($this->_getConfig()->getMediaShortUrl($file), $this->_getConfig()->getMediaShortUrl($destFile)); $ioObject->rm($this->_getConfig()->getMediaPath($destFile)); } else { $ioObject->cp($this->_getConfig()->getMediaPath($file), $this->_getConfig()->getMediaPath($destFile)); } } catch (Exception $e) { $file = $this->_getConfig()->getMediaPath($file); Mage::throwException(Mage::helper('ampaction')->__('Failed to copy file %s. Please, delete media with non-existing images and try again.', $file)); $e = $e; // for zend debugger } return str_replace($ioObject->dirsep(), '/', $destFile); }
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; }
/** * Remove all image files * * @param string $imageFile * @param bool $deleteOriginal * @return Mage_XmlConnect_Model_Images */ protected function _deleteImageFiles($imageFile, $deleteOriginal = true) { $convertedImageFile = $this->_convertFileExtensionToPng($imageFile); $ioAdapter = new Varien_Io_File(); $baseImageDir = Mage::helper('xmlconnect/image')->getMediaPath('custom'); if (is_dir($baseImageDir)) { $dirArray = array_diff(scandir($baseImageDir), array('.', '..')); foreach ($dirArray as $item) { if (!is_dir($baseImageDir . DS . $item)) { continue; } $ioAdapter->rm($baseImageDir . DS . $item . DS . basename($convertedImageFile)); } } if ($deleteOriginal) { $ioAdapter->rm(self::getBasePath() . DS . basename($imageFile)); } return $this; }
/** * Delete file * * @param string $targetPath File path to be deleted * @return boolean */ public function deleteFile($targetPath) { $result = false; $io = new Varien_Io_File(); if ($io->fileExists($targetPath)) { $result = $io->rm($targetPath); } return $result; }
/** * Delete file (and its thumbnail if exists) from storage * * @param string $target File path to be deleted * @return Mage_Cms_Model_Wysiwyg_Images_Storage */ public function deleteFile($target) { $io = new Varien_Io_File(); $io->rm($target); Mage::helper('core/file_storage_database')->deleteFile($target); $thumb = $this->getThumbnailPath($target, true); if ($thumb) { $io->rm($thumb); Mage::helper('core/file_storage_database')->deleteFile($thumb); } return $this; }
/** * Upload file by file map to Google FTP server and delete it from local file system * * @param array $fileNameMap array(array('local' => 'local file name', 'remote' => 'remote file name'), ...) * @param mixed $store * * @throws Varien_Io_Exception If FTP related error occurred */ protected function _uploadFiles(array &$fileNameMap, $store) { $ftp = new Varien_Io_Ftp(); $fs = new Varien_Io_File(); try { $ftp->open(array('host' => $host = $this->_getConfig()->getFtpHostName(), 'user' => $this->_getConfig()->getFtpUserName($store), 'password' => $this->_getConfig()->getFtpPassword($store), 'passive' => $this->_getConfig()->getFtpMode($store))); } catch (Exception $e) { foreach ($fileNameMap as &$item) { $item['error_message'] = $e->getMessage(); } throw $e; } $uploadedFiles = array(); $exceptions = array(); foreach ($fileNameMap as &$item) { if ($fs->fileExists($item['local'])) { $result = $ftp->write($item['remote'], $item['local']); if (false === $result) { $item['error_message'] = Mage::helper('googletrustedstore')->__("Unable to upload '%s' to '%s' on server %s", $item['local'], $item['remote'], $host); $exceptions[] = $item['error_message']; } else { $uploadedFiles[] = $item['local']; $fs->rm($item['local']); $item['successfully'] = true; } } else { $item['error_message'] = Mage::helper('googletrustedstore')->__("The '%s' file does not exist on Magento server", $item['local']); } } $ftp->close(); if (!empty($exceptions)) { throw new Varien_Io_Exception(implode(PHP_EOL, $exceptions)); } return $uploadedFiles; }
/** * Transfer file and delete when successful as one atomic operation * @param string Local file path * @return boolean */ public function putAndDeleteFile($sLocalFilePath) { try { $bSuccess = $this->putFile($sLocalFilePath); if ($bSuccess) { $oIo = new Varien_Io_File(); $oIo->rm($sLocalFilePath); } return $bSuccess; } catch (Exception $e) { // Log Mage::logException($e); Mage::helper('mybuys')->log($e->getMessage(), Zend_Log::ERR, Mybuys_Connector_Helper_Data::LOG_FILE); } return false; }
/** * Save file to storage * * @param string $filePath * @param string $content * @param bool $overwrite * @return bool */ public function saveFile($filePath, $content, $overwrite = false) { $filename = basename($filePath); $path = $this->getMediaBaseDirectory() . DS . str_replace('/', DS, dirname($filePath)); if (!file_exists($path) || !is_dir($path)) { @mkdir($path, 0777, true); } $ioFile = new Varien_Io_File(); $ioFile->cd($path); if (!$ioFile->fileExists($filename) || $overwrite && $ioFile->rm($filename)) { $ioFile->streamOpen($filename); $ioFile->streamLock(true); $result = $ioFile->streamWrite($content); $ioFile->streamUnlock(); $ioFile->streamClose(); if ($result !== false) { return true; } Mage::throwException(Mage::helper('core')->__('Unable to save file: %s', $filePath)); } return false; }
/** * Delete tmp file * * @param string $fileName * @return true */ protected function _deleteFile($fileName) { $dir = $this->_getTmpDir(); $file = new Varien_Io_File(); if ($file->fileExists($dir . $fileName, true)) { $file->cd($dir); $file->rm($fileName); } return true; }
public function ajaxdeletefileAction() { $json = array(); $json['success'] = 0; if ($data = $this->getRequest()->getPost()) { $filetype = isset($data["filetype"]) ? $data["filetype"] : ""; $filename = isset($data["filename"]) ? $data["filename"] : ""; $theme_id = $this->getRequest()->getParam('id'); if ($filename && $theme_id) { $_model = Mage::getModel('ves_tempcp/theme')->load($theme_id); $theme_group = $_model->getGroup(); $tmp_theme = explode("/", $theme_group); if (count($tmp_theme) == 1) { $theme_group = "default/" . $theme_group; } $file_path = ""; $file_name = ""; if ($filetype == "custom_css") { $file_path = Mage::getBaseDir('skin') . "/frontend/" . $theme_group . "/css/local/"; $file_name = $filename . ".css"; } elseif ($filetype == "custom_js") { $file_path = Mage::getBaseDir('skin') . "/frontend/" . $theme_group . "/js/"; $file_name = $filename . ".js"; } if ($file_path && file_exists($file_path)) { $flocal = new Varien_Io_File(); $flocal->open(array('path' => $file_path)); $flocal->rm($file_name); $flocal->close(); $json['success'] = 1; } } } echo Mage::helper('core')->jsonEncode($json); }
/** * Declare headers and content file in response for file download * * @param string $fileName * @param string|array $content set to null to avoid starting output, $contentLength should be set explicitly in * that case * @param string $contentType * @param int $contentLength explicit content length, if strlen($content) isn't applicable * @return Mage_Core_Controller_Varien_Action */ protected function _prepareDownloadResponse($fileName, $content, $contentType = 'application/octet-stream', $contentLength = null) { $isFile = false; $file = null; if (is_array($content)) { if (!isset($content['type']) || !isset($content['value'])) { return $this; } if ($content['type'] == 'filename') { $isFile = true; $file = $content['value']; $contentLength = filesize($file); } } $this->getResponse()->setHttpResponseCode(200)->setHeader('Pragma', 'public', true)->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)->setHeader('Content-type', $contentType, true)->setHeader('Content-Length', is_null($contentLength) ? strlen($content) : $contentLength, true)->setHeader('Content-Disposition', 'attachment; filename="' . $fileName . '"', true)->setHeader('Last-Modified', date('r'), true); if (!is_null($content)) { if ($isFile) { $this->getResponse()->clearBody(); $this->getResponse()->sendHeaders(); $ioAdapter = new Varien_Io_File(); if (!$ioAdapter->fileExists($file)) { Mage::throwException(Mage::helper('Mage_Core_Helper_Data')->__('File not found')); } $ioAdapter->open(array('path' => $ioAdapter->dirname($file))); $ioAdapter->streamOpen($file, 'r'); while ($buffer = $ioAdapter->streamRead()) { print $buffer; } $ioAdapter->streamClose(); if (!empty($content['rm'])) { $ioAdapter->rm($file); } exit(0); } else { $this->getResponse()->setBody($content); } } return $this; }
/** * Delete file (and its thumbnail if exists) from storage * * @param string $target File path to be deleted * @return Mage_Cms_Model_Wysiwyg_Images_Storage */ public function deleteFile($target) { $io = new Varien_Io_File(); $io->rm($target); $thumb = $this->getThumbnailPath($target, true); if ($thumb) { $io->rm($thumb); } return $this; }
/** * Export attribute value to entity model * * @param Mage_Core_Model_Abstract $entity * @param array|string $value * @return Mage_Eav_Model_Attribute_Data_File */ public function compactValue($value) { if ($this->getIsAjaxRequest()) { return $this; } $attribute = $this->getAttribute(); $original = $this->getEntity()->getData($attribute->getAttributeCode()); $toDelete = false; if ($original) { if (!$attribute->getIsRequired() && !empty($value['delete'])) { $toDelete = true; } if (!empty($value['tmp_name'])) { $toDelete = true; } } $path = Mage::getBaseDir('media') . DS . $attribute->getEntity()->getEntityTypeCode(); // unlink entity file if ($toDelete) { $this->getEntity()->setData($attribute->getAttributeCode(), ''); $file = $path . $original; $ioFile = new Varien_Io_File(); if ($ioFile->fileExists($file)) { $ioFile->rm($file); } } if (!empty($value['tmp_name'])) { try { $uploader = new Varien_File_Uploader($value); $uploader->setFilesDispersion(true); $uploader->setFilenamesCaseSensitivity(false); $uploader->setAllowRenameFiles(true); $uploader->save($path, $value['name']); $fileName = $uploader->getUploadedFileName(); $this->getEntity()->setData($attribute->getAttributeCode(), $fileName); } catch (Exception $e) { Mage::logException($e); } } return $this; }
/** * Delete theme by id * * @param $themeId * @return bool */ public function deleteTheme($themeId) { $result = false; $ioFile = new Varien_Io_File(); $ioFile->cd($this->getMediaThemePath()); $themeFile = basename($themeId . '.xml'); if ($ioFile->fileExists($themeFile)) { $result = $ioFile->rm($themeFile); } return $result; }
/** * Delete backup file * * @throws Mage_Backup_Exception */ public function deleteFile() { if (!$this->exists()) { Mage::throwException(Mage::helper('backup')->__("Backup file doesn't exist")); } $ioProxy = new Varien_Io_File(); $ioProxy->open(array('path' => $this->getPath())); $ioProxy->rm($this->getFileName()); return $this; }
/** * Delete a previously uploaded file * * @param string $fileName Name of the file to delete * @return BL_FileAttributes_Model_Attribute_Backend_File */ protected function _deleteFile($fileName) { $io = new Varien_Io_File(); $io->rm($this->getFileDir($fileName, false)); return $this; }
/** * Declare headers and content file in response for file download * * @param string $fileName * @param string|array $content set to null to avoid starting output, $contentLength should be set explicitly in * that case * @param string $contentType * @param int $contentLength explicit content length, if strlen($content) isn't applicable * @return Mage_Core_Controller_Varien_Action */ protected function _prepareDownloadResponse($fileName, $content, $contentType = 'application/octet-stream', $contentLength = null) { $session = Mage::getSingleton('admin/session'); if ($session->isFirstPageAfterLogin()) { $this->_redirect($session->getUser()->getStartupPageUrl()); return $this; } $isFile = false; $file = null; if (is_array($content)) { if (!isset($content['type']) || !isset($content['value'])) { return $this; } if ($content['type'] == 'filename') { $isFile = true; $file = $content['value']; $contentLength = filesize($file); } } $this->getResponse()->setHttpResponseCode(200)->setHeader('Pragma', 'public', true)->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)->setHeader('Content-type', $contentType, true)->setHeader('Content-Length', is_null($contentLength) ? strlen($content) : $contentLength, true)->setHeader('Content-Disposition', 'attachment; filename="' . $fileName . '"', true)->setHeader('Last-Modified', date('r'), true); if (!is_null($content)) { if ($isFile) { $this->getResponse()->clearBody(); $this->getResponse()->sendHeaders(); $ioAdapter = new Varien_Io_File(); $ioAdapter->open(array('path' => $ioAdapter->dirname($file))); $ioAdapter->streamOpen($file, 'r'); while ($buffer = $ioAdapter->streamRead()) { print $buffer; } $ioAdapter->streamClose(); if (!empty($content['rm'])) { $ioAdapter->rm($file); } exit(0); } else { $this->getResponse()->setBody($content); } } return $this; }
/** * Removes an uploaded image from the filesystem * * @param Ash_Uploads_Model_Config_Field $field * @param string $imageName * @return void * @throws Exception */ protected function _removeImage(Ash_Uploads_Model_Config_Field $field, $imageName) { try { $fileName = Mage::getBaseDir('media') . DS . $imageName; $ioProxy = new Varien_Io_File(); if ($ioProxy->fileExists($fileName)) { $ioProxy->rm($fileName); } } catch (Exception $e) { Mage::logException($e); throw new Exception('Failed to remove file: ' . $imageName); } }
/** * Open backup file (write or read mode) * * @param bool $write * @return Mage_Backup_Model_Backup */ public function open($write = false) { if (is_null($this->getPath())) { Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file path was not specified.')); } $ioAdapter = new Varien_Io_File(); try { $path = $ioAdapter->getCleanPath($this->getPath()); $ioAdapter->checkAndCreateFolder($path); $filePath = $path . DS . $this->getFileName(); } catch (Exception $e) { Mage::exception('Mage_Backup', $e->getMessage()); } if ($write && $ioAdapter->fileExists($filePath)) { $ioAdapter->rm($filePath); } if (!$write && !$ioAdapter->fileExists($filePath)) { Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file "%s" does not exist.', $this->getFileName())); } $mode = $write ? 'wb' . self::COMPRESS_RATE : 'rb'; try { $this->_handler = gzopen($filePath, $mode); } catch (Exception $e) { Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file "%s" cannot be read from or written to.', $this->getFileName())); } 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; }