private function getMagentoCategegories() { // init $this->set('success', false); $this->set('errormessage', 'No results found.'); $_cached = false; $_output = false; $_languageCode = $this->get('languagecode'); if ($this->__config->get('useMemcache')) { $_key = $this->__config->get('cacheKey') . '-CATEGORIES-' . $_languageCode; $_output = \PAJ\Library\Cache\Helper::getCachedString($_key, true); } if (!$_output) { $this->loadMagento($_languageCode); $_storeID = $this->get('storeid'); $this->getCategoryCollection($_storeID); $_categories = $this->get('categories'); if ($_categories) { // render html $_html = HTML::Categories($_categories, $this->get('categoriesproductcount')); $this->set('success', true); $_output = array('getMagentoCategories' => array('html' => $this->minify($_html, false, true))); $this->set('output', $_output + array('cached' => $_cached)); if ($this->__config->get('useMemcache')) { \PAJ\Library\Cache\Helper::setCachedString($_output, $_key, 3600); } } else { $this->set('errormessage', 'No results found.'); } } else { $_cached = true; $this->set('success', true); $this->set('output', $_output + array('cached' => $_cached)); } }
private function getMagentoProducts() { // init $this->set('success', false); $this->set('errormessage', 'No results found.'); $_cached = false; $_output = false; $_languageCode = $this->get('languagecode'); $_page = $this->get('collectionpage'); $_count = $this->get('collectioncount'); $_type = $this->get('collectiontype'); if ($this->__config->get('useMemcache')) { $_key = $this->__config->get('cacheKey') . '-PRODUCTS-' . md5($_languageCode . $_page . $_count . $_type); $_output = \PAJ\Library\Cache\Helper::getCachedString($_key, true); } if (!$_output) { $this->loadMagento($_languageCode); $_storeID = $this->get('storeid'); $this->getProductCollection($_storeID, $_page, $_count, $_type); $_products = $this->get('collection'); if ($_products) { // render html $_html = HTML::Products($_products, $this->get('baseurlmedia')); $this->set('success', true); $_output = array('getMagentoProducts' => array('html' => $this->minify($_html, false, true), 'collectionappend' => $this->get('collectionappend'), 'collectionpage' => $_page, 'productcount' => count($_products), 'collectionlastitemid' => $this->get('collectionlastitemid'), 'collectionlastpagenumber' => $this->get('collectionlastpagenumber'), 'collectionsize' => $this->get('collectionsize'))); $this->set('output', $_output + array('cached' => $_cached)); if ($this->__config->get('useMemcache')) { \PAJ\Library\Cache\Helper::setCachedString($_output, $_key, 3600); } } else { $this->set('errormessage', 'No results found.'); } } else { $_cached = true; $this->set('success', true); $this->set('output', $_output + array('cached' => $_cached)); } }