In this tutorial, we will show you how to redirect “Add to cart” button in Opencart version 1.4+, version 1.5+, version 2.0+ and version 3.0+ and take you directly to the shopping cart page.
For Opencart 1.4+ versions
For Opencart 1.4 versions it’s easy we can do it through the admin section In Extensions->Modules under “Cart” you can disable ajax
For Opencart 1.5+ versions
But in Opencart 1.5+ there are no options to do those things so we have to edit in the codes.
Open the javascript file at catalog/view/javascript/common.js
We are showing how to do automated testing of opencart functionalities and keep on monitoring your sites and also freely available. Uptimerobot.com and ghostinspector.com are two websites that I am using right now which are great and free
Hi,
Thanks for registering Uptime Robot, the free website monitoring service.
In order to start monitoring your websites, please activate your account by clicking here.
Cheers From Uptime Robot,
Clicking the activation link, you will be taken to the Dashboard after login.
Click Add New Monitor button
Choose Monitor Type as HTTPs, then enter your URL then click monitor by checking the alert contact.
With this setup, you will get automated End-to-end Testing, UI testing, Browser testing, Visual testing easily. So you can catch website bugs and regressions before they cost you.
Add Ghost Inspector Extension: Simply install the extension in your Chrome or Firefox web browser. Click the toolbar icon on your website to start recording a test scenario.
Record in your Browser: The extension records all your interactions. You can then set assertions that will be checked to determine if the test has passed
Run Tests Continuously: Once saved, your browser tests can be run continuously on a schedule or triggered via their API. They track results and even compare screenshots.
Set Custom Notifications: Get notified when tests fail via email or 3rd party integrations.
It checks UI like below:
The only limit is 100 tests for a month for free users, for my site it is ok as I just test 3 times a day so it reaches around 100 in a month.
Some pros and cons to consider are the following as I found online:
Pros
Low-Cost Tool
Browser Compatibility Testing
Choice of Language
Multiple Testing Frameworks
Easy to Integrate With Testing Ecosystem
Open for Enhancement
Test-Driven Development
Useful for Comprehensive Testing
Cons
Problems While Testing
Issues with finding Locators
Limitation in Browser Support
Manual Scripts Not Allowed
Slow Performance
Don’t try to automate everything in the OpenCart site but it is good to have some. Always be clear with your strategy what you are automating the test and it does not take too much time as we think but it will be beneficial in the long run as none like the down site and especially eCommerce sites where every second is money.
Similarly, another testing, has lots of features of automation testing, automated testing tools, automated web UI testing, automated browser testing so use it and you know issues before customers report it.
Enjoy your automated testing and monitoring of the Opencart website, let us know how you are monitoring your eCommerce website.
This Opencart tutorial shows how to change and customize emails send out to the store administrator when they get the new order in the OpenCart store. Normally Opencart just sends an email with fewer details like below:
You have received an order.
Order ID: 1088 Date Added: 11/02/2019 Order Status: Complete
Products 1x .... $0.00
Order Totals Sub-Total: $0.00 Total: $0.00
Let’s change that email to send full details like the one that customers get.
Open catalog/controller/mail/order.php and remove the alert method and replace it with the below alert method.
With these changes, you can get the customized full detail email for Admin as well.
If you want to change the email design for the affiliate alert, affiliate welcome email, forgotten password email, order notification to the customer, order alert to store administrator, edit order alert, register alert, register notification to the customer, transaction alert, voucher alert, you can change them at catalog/view/theme/YOUR_TEME/template/mail where you can change your design as per your need.
Let us know if you find any difficulties or need any help from us. Likewise, you can see other Opencart tips and tricks.
This simple Opencart OCMod file will remove the index.php?route= in Opencart and shorten the URL of OpenCart for contact us page, common home, checkout, cart, voucher, account, log in, manufacturer, affiliate login, password forget URL, and others.
Once you download the above, you will get seo-url.ocmod_.zip extract it and rename it to seo-url.ocmod.zip, then go to admin >> Extensions >> Installer then upload the seo-url.ocmod.zip. Then download the following SEO-URL.sql
Once you download the above you will get seo-url-add.sql_.zip, extract it, you will get seo-url-add.sql. Then go to admin >> System >> Maintenance >> Backup & Restore, and click the Restore tab and click Import, and select seo-url-add.sql.
Once this is successful then go to admin >> Extensions >> Modifications >> then click refresh buttone
Then you are all set.
If you are still seeing issues then check if you complete all of the below:
The developer can do the following to make more changes as needed. Open catalog/controller/startup/seo_url.php and in the public function rewrite($link) method add below code after parse_str($url_info[‘query’], $data);
if ($data['route'] == 'common/home'){
$url .= '/';
}
if ($data['route'] == 'information/contact'){
$url .= '/contact';
}
if ($data['route'] == 'account/return/add'){
$url .= '/returnadd';
}
if ($data['route'] == 'information/sitemap'){
$url .= '/sitemap';
}
if ($data['route'] == 'product/manufacturer'){
$url .= '/manufacturer';
}
if ($data['route'] == 'account/voucher'){
$url .= '/voucher';
}
if ($data['route'] == 'affiliate/login'){
$url .= '/affiliatelogin';
}
if ($data['route'] == 'product/special'){
$url .= '/special';
}
if ($data['route'] == 'account/login'){
$url .= '/login';
}
if ($data['route'] == 'checkout/cart'){
$url .= '/cart';
}
Add as many URLs as you want in here and it’s rewrite URL. Then go to admin >> Design >> SEO URL and add them each except for the home page. Like for contact us page
So you need to insert for all, then you will see the changes or you can directly import the following seo-url.sql file at admin >> System >> Maintenance >> Backup/Restore. Download it. Check the database table prefix if it is different than oc_ if yes then need to change in the SQL file.
We make another free module today “Show only subcategories on category page OpenCart 2.0 free module” when enabled to category page then you will be able to see sub-categories of the active Category as a heading.
This is an extension for opencart 2.0 and 2.2 that I modify the Category module so it only displays the current top-level category page’s sub-categories. For example, if I am on the “Laptops & Desktops” category page, the sidebar module would only list the sub-categories associated with “Laptops & Desktops” category, such as “Macs” and “PCs” with the main heading “Laptops & Desktops” (And not list or show any of the other top-level categories).
Installation:
Unzip the downloaded folder.
Upload the files in the root folder to your server, no file is overwritten.
Then activate the Only Sub-Categories module.
Activating the Only Sub-Categories module:
After uploading files to servers, it’s time to install Only Sub-Categories module
We are showing the Only Sub-Categories module at the right or left column of the Category page (Category Layout).
Go to Admin section
Then click on Extensions on the left menu
After that Click Modules and go to Only Sub-Categories in the modules list
Then click the Green button for the Only Sub-Categories to install the module (see the image below)
Then click blue edit button
After that, you will see the form which has the status field, select Enabled and then click the Save button.
Your module is active and is ready to use in the layout.
Setup layout for the sidebar Only Sub-Categories module at the left column of category page:
From the admin section go to System >> Design >> Layouts.
You will see a list of layouts, from which edit the Category layout.
Then click Blue add the button to add rows at the module section which is shown in the image below:
Second, you choose the Only Sub-Categories in module column and Column left in the Position column and insert the sort order as required.
Then click save button
Your custom category page is ready with the Only Sub-Categories module in the left column.
Need to check if a string contains four sequential characters or consecutive characters/strings or identical letters/numbers/string/characters in PHP then following regex and code can be useful for you. I tested it with following code and regex is generated from
Please bear with that CSS and hope you will make changes to that CSS as per your theme. Similarly, we would have provided OCMOD, but because of laziness, we always go through logics :).
Enjoy it, hope we will soon launch OCMOD for all of you.
Today something went wrong with encoding in opencart – we cannot save the city with special language characters, like raga, but found out that it is a database field error.
When we try to insert raga, it is inserted as R?ga. ? marks in place of special characters
So we have to find out why this is happening, we check the code all working fine and at last, saw the database table field have a collation of latin1_bin so we change it to utf8_bin and the special character is saved on the database and the same are shown correctly.
So while making the database table keep these things into mind, if you have to save multi-language then utf8_bin is to be set on the collation
special character in opencart
Let us know if you have questions or concerns so that we can help you out, similarly, let us know if there are another best solutions. Till then please subscribe to our YouTube Channel for Opencart video tutorials. You can also find us on Twitter and Facebook.
When you are installing the extension, you go to admin >> extensions >> installer and click the upload button and select the extension ocmod.zip file but you got the following error like “The directory catalog/controller/product is not allowed to be written to – Opencart error”. The way to solve it is to add the path at admin\controller\marketplace\install.php
Here in the example, the path is catalog/controller/product/ so we needed to add at
// A list of allowed directories to be written to
$allowed = array(
'admin/controller/extension/',
'admin/language/',
'admin/model/extension/',
'admin/view/image/',
'admin/view/javascript/',
'admin/view/stylesheet/',
'admin/view/template/extension/',
'catalog/controller/extension/',
'catalog/language/',
'catalog/model/extension/',
'catalog/view/javascript/',
'catalog/view/theme/',
'system/config/',
'system/library/',
'image/catalog/',
'catalog/controller/product/'
);
Whatever error path you get, you need to add here to install successfully. But the best practice is to stick to the provided folders only if you need to manage multiple folders than manage subfolders within them.