This entry is purely about tricks of the trade involving Opencart. There are thousands of little tricks that you should know to make your life easier. The forums are crawling with folks that need quick fixes to easy issues which brings an even bigger need for a much larger resource of small fixes. Here is a list of just a few:
TRICK: Set grid as default view
HOW TO:
Open category.tpl
Find:
$.cookie('display', 'grid');
Change to:
$.cookie('display', 'grid', { path: '/' });
Find:
$.cookie('display', 'list');
Change to:
$.cookie('display', 'list', { path: '/' });
Find:
display('list');
Change to:
display('grid');
TRICK: Changing Default Sort by and Display in product categories
How To:
1. Open file category.php in catalog/controller/product/category.php
2. Find (~ line 15):
$sort = 'p.sort_order';
Replace With:
$sort = 'pd.name';
To display 100 item as default
1. Open file category.php in catalog/controller/product/category.php
2. Find (~ line 33):
$limit = $this->config->get('config_catalog_limit');
Replace with:
$limit = 100;
TRICK: Add to cart Login pop up
How to:
For each of the following lines:
Find:
<a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><span><?php echo $button_cart; ?></span></a>
Change To:
<?php if($this->customer->isLogged()){ ?><a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><span><?php echo $button_cart; ?></span></a><?php }else{ ?><a onclick="alert('Please Login to View Prices and Add to Cart!');" class="button"><span><?php echo $button_cart; ?></span></a><?php } ?>
Looking for quality OpenCart Hosting? Look no further than Arvixe Web Hosting!