params= new JRegistry(); $this->params->loadString($plugin->params, 'JSON'); $this->_cacheEnabled = $this->params->get('cache_enabled'); if ($this->_cacheEnabled === null) $this->_cacheEnabled == 1; $this->_autoflush = $this->params->get('autoFlush'); if ($this->_autoflush === null) $this->_autoflush = 1; $this->_autoflush3rdParty = $this->params->get('autoFlush-ThirdParty'); if ($this->_autoflush3rdParty === null) $this->_autoflush3rdParty = 1; $this->_autoflushClientSide = $this->params->get('autoFlush-ClientSide'); if ($this->_autoflushClientSide === null) $this->_autoflushClientSide = 0; } /** * Heartbeat cache checking function. Will also monitor $_GET for the jSGCache parameter * (pressing the purge cache button in admin) * * * @access public * @return null */ public function onAfterInitialise() { if (!$this->_cacheEnabled || $this->_isBlacklisted($this->_applicationPath)) { JResponse::setHeader('X-Cache-Enabled','False',true); return; } if ($this->_cacheEnabled) { JResponse::allowCache(true); JResponse::setHeader('X-Cache-Enabled','True',true); } //Init the application url $this->_applicationPath = str_replace(array('administrator/index.php','index.php'),'',str_replace($_SERVER['DOCUMENT_ROOT'],'',$_SERVER['SCRIPT_FILENAME'])); //Check for any admin action and proceed to flushMonitor and 3rd party plugins if ( isset($_POST['task']) || isset($_GET['task']) || isset($_GET['cart_virtuemart_product_id'])) { $this->_flushMonitor(); if ($this->_autoflush3rdParty) $this->_monitorThirdPartyPlugins(); } //Check if we have a logged in user and enable cache bypass cookie 'task' => string 'user.login' $user = JFactory::getUser(); if (!$user->guest || (isset($_POST['task']) && preg_match('/login/i', $_POST['task']))) { $_POST[JSession::getFormToken()] = 1; //Force the correct token, since the login box on the page is cached with the 1st visitors' token //Enable the cache bypass for logged users by setting a cache bypass cookie setcookie('jSGCacheBypass',1,time() + 6000,'/'); } if ($user->guest || (isset($_POST['task']) && $_POST['task'] == 'user.logout')) { //Remove the bypass cookie if not a logged user if (isset($_COOKIE['jSGCacheBypass'])) setcookie('jSGCacheBypass',0, time() - 3600,'/'); } // Handle purge button press when get has jSGCache=purge, but only in admin with a logged user if(isset($_GET['jSGCache']) && $_GET['jSGCache'] == 'purge' && JFactory::getApplication()->isAdmin() && !$user->guest ) $this->_purgeCache(true); } /** * Admin panel icon display * * @access public * @param string $context * @return array */ public function onGetIcons( $context ) { return array(array( 'link'=>'?jSGCache=purge', 'image'=>'refresh', 'text'=>JText::_('Purge jSGCache'), 'id'=>'jSGCache' )); } /** * Calls the cache server to purge the cache * * @access public * @param string|bool $message Message to be displayed if purge is successful. If this param is false no output would be done * @return null */ private function _purgeCache( $message = true ) { $purgeRequest = $this->_applicationPath . '(.*)'; // Construct the PURGE request $hostname = str_replace( 'www.', '', $_SERVER['HTTP_HOST'] ); $purge_method = "PURGE"; $cacheServerSocket = fsockopen($hostname, 80, $errno, $errstr, 2); if(!$cacheServerSocket) { JError::raise(E_ERROR,500,JText::_('Connection to cache server failed!')); JError::raise(E_ERROR,500,JText::_($errstr ($errno))); return; } $request = "$purge_method {$purgeRequest} HTTP/1.0\r\nHost: {$_SERVER['SERVER_NAME']}\r\nConnection: Close\r\n\r\n"; if (preg_match('/^www\./',$_SERVER['SERVER_NAME'])) { $domain_no_www = preg_replace('/^www\./', '', $_SERVER['SERVER_NAME']); $request2 = "$purge_method {$purgeRequest} HTTP/1.0\r\nHost: {$domain_no_www}\r\nConnection: Close\r\n\r\n"; } else $request2 = "$purge_method {$purgeRequest} HTTP/1.0\r\nHost: www.{$_SERVER['SERVER_NAME']}\r\nConnection: Close\r\n\r\n"; fwrite($cacheServerSocket, $request); $response = fgets($cacheServerSocket); fclose($cacheServerSocket); $cacheServerSocket = fsockopen($hostname, 80, $errno, $errstr, 2); fwrite($cacheServerSocket, $request2); fclose($cacheServerSocket); if($message !== false) { if(preg_match('/200/',$response)) { if ($message === true) JFactory::getApplication()->enqueueMessage(JText::_('SG Cache Successfully Purged!')); else JFactory::getApplication()->enqueueMessage(JText::_( $message )); } else { JError::raise(E_NOTICE,501, JText::_('SG Cache: Purge was not successful!')); JError::raise(E_NOTICE,501, jText::_('Error: ' . $response)); } } } /** * Check if url is in caching blacklist * * @param string $applicationPath * * @return bool */ private function _isBlacklisted($applicationPath) { $blacklistArray = explode("\n",$this->params->get('blacklist')); $blacklistRegexArray = array(); $indexIsBlacklisted = false; foreach($blacklistArray as $key=>$row) { $row = trim($row); if ($row != '/' && $quoted = preg_quote($row,'/')) $blacklistRegexArray[$key] = $quoted; if ($row == '/') $indexIsBlacklisted = true; } if ($indexIsBlacklisted && $_SERVER['REQUEST_URI'] == $applicationPath) return true; if (empty($blacklistRegexArray)) return false; $blacklistRegex = '/('.implode('|',$blacklistRegexArray) . ')/i'; return preg_match($blacklistRegex, $_SERVER['REQUEST_URI']); } /** * 3rd party plugin monitor * * @access private * @return null */ private function _monitorThirdPartyPlugins() { // Kunena & K2 if ($this->params->get('autoFlush-ThirdParty') == 1 && isset($_POST['option']) && ($_POST['option']=='com_k2' || $_POST['option' ]== 'com_kunena')) { $this->_purgeCache(false); } // VirtueMart if ( (isset($_POST['option']) && $_POST['option'] == 'com_virtuemart') || ( isset($_GET['option']) && $_GET['option'] == 'com_virtuemart' ) || isset($_GET['cart_virtuemart_product_id']) ) { if($this->params->get('autoFlush-ThirdParty') == 1) $this->_purgeCache(false); } } /** * Action monitor * * @access private * @return null */ private function _flushMonitor() { $user = JFactory::getUser(); if ((!JFactory::getApplication()->isAdmin() && !$this->_autoflushClientSide) || $user->guest) return; $autoflush = $this->params->get('autoFlush'); if ($autoflush === null) $autoflush = 1; if (isset($_POST['task']) && $_POST['task'] && !in_array($_POST['task'],self::$_ignoreTasks) && $autoflush == 1) $this->_purgeCache(false); } } Community Support Forums - Sellacious
  Friday, 25 January 2019
  3 Replies
  3.6K Visits
  Subscribe
Hi,

How many categories are supported?

Because all sounds good with a number of categories like in your demo but if you have 5820 categories like me; all sellacious backend slow down and doesn't work as expected.

Your product looks great but performance = 0. This is a nightmare...
Hello Tony,

Thanks for putting your concern here. I understand that you are finding trouble with sellacious backend/frontend slowness as you have nearly Six thousand product categories.

I would like to convey here, that sellacious backend UI has nothing to do with how many categories or products you have in your Database as sellacious backend UI only show limited amount of categories or products in the backend UI so even if you have 10k categories sellacious backend UI won't be slow as it will anyway show 100-200 categories in list. However, if you are forcefully trying to list all Categories or all products in one list then the UI will definitely be slow and your browser may crash.

Also, the calculation of categories/products when done by sellacious is based on what filter or sorting options you have selected. This needs ample server resources, as more the data more CPU, ram, disk read-write speed will be required thus we always suggest using a good fast server with proper resources to tackle the slowness issue on a higher amount of data. If you are trying to run sellacious or any other software with lots of data on a shared server then also you might experience very slow and crashing website.

We also suggest creating fewer categories as it is anyway not good for the end user to explore throw that many product categories, you can rather use product filterable attribute. Taking the example of Biggest Marketplaces like Amazon they also do not have 5-6000 categories there could be a very good reason why they do not have them.

Rest assured that if all above guidelines are taken care of it will work very smoothly. Many enterprise clients are using sellacious with as many as 12k product categories, However, it's again not recommended due to bad UX of frontend and won't work well until and unless you have very customized frontend.


-Abhishek
Team sellacious
5 years ago
·
#2925
Hi Abhishek,

Thank you for your answer.

Indeed, I am able to decrease the number of category.


For example:

Agriculture --> (no product here, it's only a family category filter)
Agriculture/Agricultural Greenhouses --> (product here)
Agriculture/Animal Husbandry --> (no product here, it's only a family sub category filter )
Agriculture/Animal Husbandry/Dairy Products --> (no product here, it's only a sub sub category filter)
Agriculture/Animal Husbandry/Dairy Products/Butter --> (product here)

In my example, I have got 2 real product categories where sellers will be able to post their own products.

To reduce categories, I could only create 2 product categories instead of 5. Do you recommand to create a joomla menu about non-product category (in my example: "Agriculture", Animal Husbandry", and "Dairy Products"Emoticon Wink?

Do you think I could reduce also categories with custom fields?

For example if I post a product Inside "Dairy Products" category (product category in this example), I can use a custom field as a product category and choose between:

-Butter
-Canned Dairy Products
-Casein
-Cheese
-Condensed Milk
-Cream
-Ice Cream
-Lactose
-Milk
-Milk Powder
-Whey Powder
-Yogurt
-Other Dairy Products

and if I select "Butter" in my example, some other custom fields, corresponding to butter, appear to complete the description to my product.

Do you recommand this method?

Thank you for your answer.

Tony
Dear Tony,

Essentially if you want /butter in URL or breadcrumbs

OR

if you have other additional attributes based on a selection that should be created as a category.

Thus, in this case, it looks like using categories will be better, as you need attributes and url both.

-Abhishek
Team sellacious
  • Page :
  • 1
There are no replies made for this post yet.
Be one of the first to reply to this post!
  • +1 (408) 821-8283
  • Email hello@sellacious.com