Extensions
Clear Thinking Extension Download Information
-
Thanks for your purchase! Clear Thinking has moved to a new licensing and download system, so please read the following information carefully in order to access your downloads.
-
You should automatically receive an e-mail from Clear Thinking once your order is marked as "Complete". That e-mail will include your license key and a direct link to the downloads for your extension. If you need to manually access your downloads again in the future, you can bookmark the link sent to you, or visit this page:
https://www.getclearthinking.com/downloads
-
If you visit that downloads URL manually, you'll need to enter the following information in order to access your downloads:
(1) Your order number
(2) Your installation domain
(3) Your license key
Your order number is a 4-digit or 5-digit number if you purchased on OpenCartX.com, or a 6-digit or 7-digit number if you purchased on opencart.com (often preceded by INV).
For the installation domain, if you purchased on OpenCartX.com it is the same one you entered during checkout. If you purchased on opencart.com, you'll need to fill an installation domain on the downloads page. This is the final live domain where you plan on installing the extension. Don't enter "localhost" or any test server domains, only enter the final live domain. (You're fine to use the extension on any test servers you have.) If you have a multi-store installation, only enter the main store domain. If you do not know your installation domain yet, enter the domain you plan on using, then e-mail Clear Thinking once you know the final live domain.
-
If you have lost your license key, you can get it resent to you by visiting the following page, and entering (1) your order number and (2) the e-mail address under which you purchased the extension:
https://www.getclearthinking.com/downloads/license
-
If you have any trouble accessing your downloads or retrieving your license key, please send your order information to Clear Thinking for assistance:
https://www.getclearthinking.com/contact
Editing Backup Files for Extension Settings
Please note: this only applies to Clear Thinking extensions that support the "Backup Settings" feature.
To manually edit settings, you should first change and edit some settings directly through the admin panel, then download the backup file to view how the settings are stored in the database. The data is in the following format:
Column 1: SETTING = the setting key
Column 2: NUMBER = the setting number (if applicable)
Column 3: SUB-SETTING = the sub-setting key (if applicable)
Column 4: SUB-NUMBER = the sub-setting number (if applicable)
Column 5: SUB-SUB-SETTING = the sub-sub-setting key (if applicable)
Column 6: VALUE = the value for the setting
Settings that are contained within tables (such as Charges, Rules, or Modules) use the NUMBER column to store data associated with the same setting, and use SUB-SETTINGs and SUB-SUB-SETTINGs to set further individual settings. For example, a charge setting might use this data:
SETTING |
NUMBER |
SUB-SETTING |
SUB-NUMBER |
SUB-SUB-SETTING |
VALUE |
charge |
2 |
charges |
|
|
5.00 |
charge |
2 |
group |
|
|
A |
charge |
2 |
rule |
1 |
comparison |
any |
charge |
2 |
rule |
1 |
type |
product_group |
charge |
2 |
rule |
1 |
value |
2 |
charge |
2 |
title_admin |
|
|
regular charge |
charge |
2 |
title_en |
|
|
Flat Rate Charge |
charge |
2 |
type |
|
|
flat |
Since the SETTING for each row is "charge" and the NUMBER for each row is "2",
that means that all these settings apply to charge #2. The SUB-SETTING values
show the various settings associated with charge #2. For example, the "group"
for charge #2 is "A", and the "type" of the charge is "flat".
One of these is a "rule" setting, which has its own sub-settings (comparison,
type, and value) associated with it. Rules always have these three
sub-settings, so when creating your own, you'll want to add three new rows.
For example, to add a Customer Group rule, you'd add rows like this:
SETTING |
NUMBER |
SUB-SETTING |
SUB-NUMBER |
SUB-SUB-SETTING |
VALUE |
charge |
2 |
rule |
2 |
type |
customer_group |
charge |
2 |
rule |
2 |
comparison |
is |
charge |
2 |
rule |
2 |
value |
1 |
That rule would mean the charge is enabled when the customer is part of the
group with the customer_group_id of 1. To view all the valid setting values
for a particular rule type, first add rules in the admin panel using each
comparison value, then download the backup file of the settings to view the
various options.
Shipping / Taxes
How To Show Only Free Shipping When Active
Want to hide all other shipping methods when Free Shipping is active? To do so, perform the following core file modifications.
Note: the files needing to be edited will depend on your OpenCart version.
IN ANY OF THESE FILES:
/catalog/controller/checkout/cart.php
/catalog/controller/checkout/guest_step_2.php
/catalog/controller/checkout/shipping.php
/catalog/controller/checkout/shipping_method.php
/catalog/controller/total/shipping.php
/catalog/controller/extension/total/shipping.php
BEFORE:
$this->session->data['shipping_methods'] =
ADD:
if (isset($quote_data['free'])) {
$free_only['free'] = $quote_data['free'];
$quote_data = $free_only;
}
if (isset($method_data['free'])) {
$free_only['free'] = $method_data['free'];
$method_data = $free_only;
}
How To Use Postcode-Based Fee/Discount to Charge Local Taxes
Do you need to charge local city or county taxes, but don't want to rework the geo zone and tax system to get it working? If your local taxes can be based on postcode, here's an example of how to use
Postcode-Based Fee/Discount to quickly set up postcode-based taxes on both products and shipping:
RATE #1
Title: Tax
Value for Total: Total
Geo Zones: (eligible geo zones)
Cost Brackets:
- From: 90000, To: 91999, Charge: 9.5%
- From: 92000, To: 92000, Charge: 7.0%
- From: 92001, To: 92499, Charge: 9.0%
- From: 92500, To: 98999, Charge: 8.0%
- etc.
EXAMPLE
For a zip code of 92100, it would charge 9% on both total at the position of the extension,
so the list of Order Total line items would look like this:
Sub-Total: $30.00
Shipping: $10.00
Tax: $3.60
Total: $43.60
Also, some important notes to remember:
- Make sure you position this extension after both Sub-Total and Shipping, so it will charge based on
both those values.
- If you need a general state or national tax, you can either create one using just geo zone limitation
and blank cost bracktets, or else apply regular tax classes to the products and shipping cost.
- Note that if you're not using the regular tax system, you probably want to disable the "Taxes" Order
Total in Extensions > Order Totals.
- If you need different tax amounts on products and shipping, you can use Shipping-Based Fee/Discount in the same way.
How To Use Weight & Volume-Based Shipping for USPS Flat Rate Boxes
Wondering how to set up Weight & Volume-Based Shipping to use for USPS flat rate boxes? You can view an example of that setup here:
Example: USPS Flat Rate Boxes
How To Use Weight-Based Shipping for Multiple Flat Rates
Want a second (or third, or fourth) flat rate for your site? Here's how to do it using the built-in Weight Based Shipping extension.
1. In
System > Localisation > Geo Zones, set up a duplicate geo zone for each flat rate that you want. For example, if you wanted these three shipping options available to the U.S.:
- Standard: $5.00
- Express: $12.00
- Next-Day: $18.00
then you would create three geo zones with the United States selected as the country, named "Standard", "Express", and "Next-Day".
2. In
Extensions > Shipping > Weight Based Shipping, create the following rates:
- RATE #1
Geo Zone: Standard
Rates: 999999:5.00
- RATE #2
Geo Zone: Express
Rates: 999999:12.00
- RATE #3
Geo Zone: Next-Day
Rates: 999999:18.00
Website
-----------------------------------------------------------------------------
How To Make "Discount" Prices Override "Special" Prices
In a default OpenCart installation, a product's "Special" price is calculated after the product's "Discount" price. This means if you have a product that is on special for $90.00, which has a discount of $80.00 when purchasing 5 or more, then a customer purchasing 5 items will be charged $90.00 x 5 = $450.00, instead of $80.00 x 5 = $400.00.
Some stores may want this behavior; however, if you'd rather have the "Discount" price be calculated
after the "Special" price, you just need to switch the order in which the cart library calculates the specials and discounts. To do so, make the following change to your installation:
IN:
/system/library/cart.php
or
/system/library/cart/cart.php
MOVE:
// Product Specials
$product_special_query = $this->db->query("SELECT price FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$cart['product_id'] . "' AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) ORDER BY priority ASC, price ASC LIMIT 1");
if ($product_special_query->num_rows) {
$price = $product_special_query->row['price'];
}
BEFORE:
// Product Discounts
$discount_quantity = 0;
$cart_2_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "cart WHERE customer_id = '" . (int)$this->customer->getId() . "' AND session_id = '" . $this->db->escape($this->session->getId()) . "'");
foreach ($cart_2_query->rows as $cart_2) {
if ($cart_2['product_id'] == $cart['product_id']) {
$discount_quantity += $cart_2['quantity'];
}
}
$product_discount_query = $this->db->query("SELECT price FROM " . DB_PREFIX . "product_discount WHERE product_id = '" . (int)$cart['product_id'] . "' AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND quantity <= '" . (int)$discount_quantity . "' AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) ORDER BY quantity DESC, priority ASC, price ASC LIMIT 1");
if ($product_discount_query->num_rows) {
$price = $product_discount_query->row['price'];
}
-----------------------------------------------------------------------------
How To Redirect "index.php?route=common/home" to Your Main Page
To redirect the home URL (http://www.yoursite.com/index.php?route=common/home) to your store's main page (http://www.yoursite.com), add the following code to your .htaccess file below the RewriteBase line:
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteCond %{REQUEST_METHOD} !^POST$
RewriteRule ^index\.php$ http://%{HTTP_HOST}? [R=301,L]
Note that this won't change the actual links in your store, but once clicked on, they'll redirect to the main page without the "index.php?route=common/home" portion. If you want to try changing all those links at once using javascript, you can make this edit:
IN:
/catalog/view/theme/YOURTHEME/template/common/footer.tpl
BEFORE:
</body>
ADD:
<script type="text/javascript"><!--
$(document).ready(function(){
$('a[href=http://www.yourdomain.com/index.php?route=common/home]').attr('href', '/');
});
//--></script>
If your store is installed in a sub-directory, you would change the "/" to your sub-directory path, like "/subdirectory/".
-----------------------------------------------------------------------------
How To Remove Category Names from Product URLs
Make this edit to only show a single category or product SEO keyword in the URL:
IN:
1.4.x: /catalog/model/tool/seo_url.php
1.5.x: /catalog/controller/common/seo_url.php
REPLACE THE FIRST INSTANCE OF:
$url .= '/' . $query->row['keyword'];
WITH:
$url = '/' . $query->row['keyword'];
If you want sub-categories to not show their parent categories in the URL, then replace both instances of that line with the replacement code. Note that this will affect breadcrumbs, since they are based on the URL.
-----------------------------------------------------------------------------
How To Redirect Category URLs to Information/Manufacturer/Product Pages (Without Modifying Core Files)
There's an easy way to add information pages to the menu bar in OpenCart, without modifying any core files. Just follow these steps to redirect a category to an information page:
- Create the information page to which you want to redirect.
- Enter an SEO keyword for that information page.
- Create the category that will redirect to the information page.
- Enter the same SEO keyword for that category.
That's it! This works because OpenCart only allows a single page to have an SEO keyword, and because the first entry in the "url_alias" table is picked when querying the SEO keywords. Thus, if you enter "info-link" for the information and category SEO keyword, then the URL http://www.mydomain.com/info-link will pull up the information page, because it exists first in the "url_alias" table.
Note that this also works for products or other areas with SEO keywords, you just need to make sure to save their SEO keyword before saving the category SEO keyword.