In bootstrap template, the products will be displayed in the new products module as follow:
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.
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.
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.
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!