[Bootstrap]Featured or Saled Banner Weren’t Shown in the New Products Module

In bootstrap template, the products will be displayed in the new products module as follow:

products_banner

Figure 1. New products module in the store front

As you can see, there is the featured or sale banner on the product. If you set the ‘Date Available‘ field for the product under admin panel > start menu > catalog > products, the featured banner will be displayed.

new_products

Figure 2. Set the Data available for the product

If you set the special price for the product under admin panel > start menu > catalog > specials, the sale banner will be displayed.

specials

Figure 3. Set the special price for the product

But, some community users said that even if they set the date available and special price for the products, the banners were still not shown on the product.

banner_issue

Figure 4. The featured banner wasn’t shown

In fact, this issue is caused by the cache for the new products module. After setting the date available and special price for the product, the cache for the new products module wasn’t updated automatically. So, you could clear the cache manually under admin panel > tools > cache control module or apply the following code updates for your store.

Step 1. Go to admin/includes/classes/products.php and find the following code:

if(!$osC_Database->isError()) {
        osC_Cache::clear('feature-products');

        return true;
}

Replace above code with the following code:

if(!$osC_Database->isError()) {
      	osC_Cache::clear('new_products');
        osC_Cache::clear('feature-products');

        return true;
}

Step2. Go to admin/includes/classes/specials.php and find the following code:

if ($data['variants'] == 'on') {
  osC_Cache::clear('product-' . $Qproduct->valueInt('products_id'));
  osC_Cache::clear('product-variants-specials-' . $data['products_id']);
}else {
  osC_Cache::clear('product-' . $data['products_id']);
  osC_Cache::clear('product-specials-' . $data['products_id']);
}

Add the following code after above code:

osC_Cache::clear('new_products');

Step 3. Go to templates/bootstrap/models/products and find the following code:

$Qfeatureproducts->bindInt(':max_display_new_products', MODULE_CONTENT_NEW_PRODUCTS_MAX_DISPLAY);

Add the following code after above code:

//set the cache key for new products module in bootstrap
	if (MODULE_CONTENT_NEW_PRODUCTS_CACHE > 0) {
        $Qfeatureproducts->setCache('new_products-bootstrap-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode() . '-' . $current_category_id, MODULE_CONTENT_NEW_PRODUCTS_CACHE);
    }

Find the following code in it:

 $Qfeatureproducts->bindInt(':max_display_feature_products', MODULE_CONTENT_FEATURE_PRODUCTS_MAX_DISPLAY);

Add the following code after above code:

//set the cache key for feature products module in bootstrap
    if (MODULE_CONTENT_NEW_PRODUCTS_CACHE > 0) {
		$Qfeatureproducts->setCache('feature-products-bootstrap-' . $osC_Language->getCode() . '-' . $osC_Currencies->getCode() . '-' . $current_category_id, MODULE_CONTENT_NEW_PRODUCTS_CACHE);
    }

Now, the cache will be cleared and updated automatically. The products in the module will always be latest.

Looking for quality TomatoCart Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , | Posted under TomatoCart | RSS 2.0

Author Spotlight

Jack Yin

Jack Yin

TomatoCart Developer & Co Founder - Arvixe Web Hosting / TomatoCart Community Liaison

Leave a Reply

Your email address will not be published. Required fields are marked *


4 + = 6

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>