public function viewfileAction() { $file = null; $plain = false; if ($this->getRequest()->getParam('file')) { // download file $file = Mage::helper('core')->urlDecode($this->getRequest()->getParam('file')); } else { if ($this->getRequest()->getParam('image')) { // show plain image $file = Mage::helper('core')->urlDecode($this->getRequest()->getParam('image')); $plain = true; } else { return $this->norouteAction(); } } if (strpos($file, 'medma_avatar') !== false) { $path = Mage::getBaseDir('media') . DS . 'medma_avatar' . DS; } else { $path = Mage::getBaseDir('media') . DS . 'customer'; } $ioFile = new Varien_Io_File(); $ioFile->open(array('path' => $path)); $fileName = $ioFile->getCleanPath($path . $file); $path = $ioFile->getCleanPath($path); if ((!$ioFile->fileExists($fileName) || strpos($fileName, $path) !== 0) && !Mage::helper('core/file_storage')->processStorageFile(str_replace('/', DS, $fileName))) { return $this->norouteAction(); } if ($plain) { $extension = pathinfo($fileName, PATHINFO_EXTENSION); switch (strtolower($extension)) { case 'gif': $contentType = 'image/gif'; break; case 'jpg': $contentType = 'image/jpeg'; break; case 'png': $contentType = 'image/png'; break; default: $contentType = 'application/octet-stream'; break; } $ioFile->streamOpen($fileName, 'r'); $contentLength = $ioFile->streamStat('size'); $contentModify = $ioFile->streamStat('mtime'); $this->getResponse()->setHttpResponseCode(200)->setHeader('Pragma', 'public', true)->setHeader('Content-type', $contentType, true)->setHeader('Content-Length', $contentLength)->setHeader('Last-Modified', date('r', $contentModify))->clearBody(); $this->getResponse()->sendHeaders(); while (false !== ($buffer = $ioFile->streamRead())) { echo $buffer; } } else { $name = pathinfo($fileName, PATHINFO_BASENAME); $this->_prepareDownloadResponse($name, array('type' => 'filename', 'value' => $fileName)); } exit; }
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; }
public function render(Varien_Object $row) { $dir = Mage::getBaseDir() . DS . 'var' . DS . 'tmp' . DS; $file = $dir . "sgs_" . $row->getId() . ".flag"; $flag = new Varien_Io_File(); $flag->open(array('path' => $dir)); if ($flag->fileExists($file, false)) { $flag->streamOpen($file, 'r'); $line = $flag->streamReadCsv(";"); $stats = $flag->streamStat(); if ($line[0] == $this::_PROCESSING) { $updated_at = $stats["mtime"]; $task_time = $line[3]; if (Mage::getSingleton('core/date')->gmtTimestamp() > $updated_at + $task_time * 10) { $line[0] = 'FAILED'; } elseif (Mage::getSingleton('core/date')->gmtTimestamp() > $updated_at + $task_time * 2) { $line[0] = 'HOLD'; } } elseif ($line[0] == $this::_SUCCEED) { $cron = array(); $cron['curent']['localTime'] = Mage::getSingleton('core/date')->timestamp(); $cron['file']['localTime'] = Mage::getSingleton('core/date')->timestamp($stats["mtime"]); $cronExpr = json_decode($row->getCronExpr()); $i = 0; foreach ($cronExpr->days as $d) { foreach ($cronExpr->hours as $h) { $time = explode(':', $h); if (date('l', $cron['curent']['localTime']) == $d) { $cron['tasks'][$i]['localTime'] = strtotime(Mage::getSingleton('core/date')->date('Y-m-d')) + $time[0] * 60 * 60 + $time[1] * 60; } else { $cron['tasks'][$i]['localTime'] = strtotime("last " . $d, $cron['curent']['localTime']) + $time[0] * 60 * 60 + $time[1] * 60; } if ($cron['tasks'][$i]['localTime'] >= $cron['file']['localTime'] && $cron['tasks'][$i]['localTime'] <= $cron['curent']['localTime']) { $line[0] = $this::_PENDING; continue 2; } $i++; } } } switch ($line[0]) { case $this::_SUCCEED: $severity = 'notice'; $status = Mage::helper("simplegoogleshopping")->__($line[0]); break; case $this::_PENDING: $severity = 'minor'; $status = Mage::helper("simplegoogleshopping")->__($line[0]); break; case $this::_PROCESSING: $percent = round($line[1] * 100 / $line[2]); $severity = 'minor'; $status = Mage::helper("simplegoogleshopping")->__($line[0]) . " [" . $percent . "%]"; break; case $this::_HOLD: $severity = 'major'; $status = Mage::helper("simplegoogleshopping")->__($line[0]); break; case $this::_FAILED: $severity = 'critical'; $status = Mage::helper("simplegoogleshopping")->__($line[0]); break; default: $severity = 'critical'; $status = Mage::helper("simplegoogleshopping")->__("ERROR"); break; } } else { $severity = 'minor'; $status = Mage::helper("simplegoogleshopping")->__($this::_PENDING); } $script = "<script language='javascript' type='text/javascript'>var updater_url='" . $this->getUrl('/simplegoogleshopping/updater') . "'</script>"; return $script . "<span class='grid-severity-{$severity} updater' cron='" . $row->getCronExpr() . "' id='feed_" . $row->getId() . "'><span>" . $status . "</span></span>"; }