How to make cache for Journal Product QuickView popup? (SOLVED)

AndreyPopov

Well-Known Member
#1
Journal Theme for Opencart provide Product QuickView PopUp
but after full site recache all work fast except ...... QuickView PopUp

how to make lscache for all Product QuickViews?
 
Last edited:

AndreyPopov

Well-Known Member
#2
Journal3 Developer provide url link for quickvew:

/index.php?route=journal3/product&product_id=XXXX&popup=quickview

now try and add to crawler recache algorithm.
 
Last edited:

AndreyPopov

Well-Known Member
#3
some modifications for functions from this thread

PHP:
    protected function BuildListOfProductUrls($categoryPath1) {
        
        $UrlsCount1 = 0;
        $this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "lscache_product_urls_list` ( `url_list_id` int(11) NOT NULL AUTO_INCREMENT, `lscache_product_url` varchar(255) NOT NULL, `recache_status` tinyint(1) NOT NULL, PRIMARY KEY (`url_list_id`)) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;");
        foreach ($this->model_catalog_product->getProducts() as $result) {
            foreach ($this->model_catalog_product->getCategories($result['product_id']) as $category) {
                if(isset( $categoryPath1[$category['category_id']] )){
                    $this->db->query("INSERT INTO " . DB_PREFIX . "lscache_product_urls_list SET lscache_product_url = '" . 'path=' . $categoryPath1[$category['category_id']] . '&product_id=' . $result['product_id'] . "' ");
                    $UrlsCount1++;
                }
            }

            $this->db->query("INSERT INTO " . DB_PREFIX . "lscache_product_urls_list SET lscache_product_url = '" . 'manufacturer_id=' . $result['manufacturer_id'] . '&product_id=' . $result['product_id'] . "' ");
            $UrlsCount1++;

            $this->db->query("INSERT INTO " . DB_PREFIX . "lscache_product_urls_list SET lscache_product_url = '" . 'product_id=' . $result['product_id'] . "' ");
            $UrlsCount1++;
            
            //Journal3 QuickView url begin
            if (defined('JOURNAL3_ACTIVE')) {
                $this->db->query("INSERT INTO " . DB_PREFIX . "lscache_product_urls_list SET lscache_product_url = '" . 'product_id=' . $result['product_id'] . '&popup=quickview' . "' ");
                $UrlsCount1++;
            }
            //Journal3 QuickView url end
            
        }
        
        $this->db->query("DELETE FROM " . DB_PREFIX . "setting WHERE store_id = '0' AND `code` = 'module_lscache' AND `key` = 'module_lscache_product_list_recache_status' ");
        $this->db->query("INSERT INTO " . DB_PREFIX . "setting SET store_id = '0', `code` = 'module_lscache', `key` = 'module_lscache_product_list_recache_status', `value` = 'full'");
        
        $this->db->query("DELETE FROM " . DB_PREFIX . "setting WHERE store_id = '0' AND `code` = 'module_lscache' AND `key` = 'module_lscache_product_list_recache_total' ");
        $this->db->query("INSERT INTO " . DB_PREFIX . "setting SET store_id = '0', `code` = 'module_lscache', `key` = 'module_lscache_product_list_recache_total', `value` = '" . $UrlsCount1 . "' ");

        return $UrlsCount1;

    }
    
    
    protected function BuildUrlsListForRecache($FirstItem,$LastItem) {
        
        $UrlsList = array();
        for ($num_item = $FirstItem ; $num_item <= $LastItem ;  $num_item++ ) {
            $PathToRecache = (array)$this->db->query("SELECT `lscache_product_url` FROM `" . DB_PREFIX . "lscache_product_urls_list` WHERE url_list_id = '" . $num_item ."' " );
            //Journal3 QuickView url
            if (strpos($PathToRecache['row']['lscache_product_url'], 'quickview') !== FALSE) {
                $UrlsList[] = $this->url->link('journal3/product', $PathToRecache['row']['lscache_product_url'] );
            } else {
            $UrlsList[] = $this->url->link('product/product', $PathToRecache['row']['lscache_product_url'] );
            }
        }

        return $UrlsList;
    }
 

AndreyPopov

Well-Known Member
#4
for standard algorithm to cache Journal3 Product QuickView popoup add:


Code:
if (defined('JOURNAL3_ACTIVE')) {
$urls[] = $this->url->link('journal3/product', 'product_id=' . $result['product_id'] . '&popup=quickview');
}
 
Top