Code

Single Product Redirect Module for OpenCart

Single Product Redirect Module for OpenCart

Automatically Redirects to the Single Product in a Category or Search Result!

The Single Product Redirect Module for OpenCart is designed to create a more natural flow throughout an OpenCart storefront by eliminating the extra step commonly found when a category only contains a single product, and there are no further subcategories for the user to explore. This module also makes it possible to use Categories that would be displayed in the menu or navigation bar to link directly to a product, assuming however that there are no subcategories attached to that category.

Essentially, any time a request is made for a category level element, this module looks to see first if there are any subcategories. This is important because if there are more categories under the currently viewed category, we do not want to redirect the user away from being able to select the other subcategories. Once the user is in a last-level category (i.e. no more subcategories underneath it) the module then looks to see how many products are to be displayed. If there is only one product found, it automatically redirects the user seamlessly to the product page without first stopping on the category page.

As an example, if a storefront is selling computer repair services, they could create “Services” as a top level category. Then underneath “Services” they could create “Screen Replacement”, “Battery Replacement”, “Hard Drive Recovery”, or any other number of categories. Then they could create a single product in each of those subcategories so users can add the service to their cart and such. The front-end would then have the “Services” menu displayed with the subcategories that drop down from the menu. Clicking on any of the services would take the user directly to the service page to select options and add to cart, skipping to need to go to the “Screen Replacement” category page just to click on the “Screen Replacement” service item.

Additionally, any search results that result in only a single product to be displayed will now redirect the user directly to the product page of the single product that would have been displayed for the search query. Again, this eliminates the needless intermediary category page which would normally be displayed to show the single product.

Compatible from OpenCart 1.5+ up to OpenCart 2.0+

For users who are still on OpenCart 1.5 through early versions of OpenCart 2.0, you can use vQmod to install this module. Doing so allows for installation by a single file, and no modifications are made to the OpenCart installation so that there is never any changes made to core files.

For users who are on newer versions of OpenCart 2.0 and up, you can use OCMOD via the built-in “Modifications” section of the OpenCart administration. This module is installed by a single file and can be uploaded directly from the OpenCart admin without having to manually copy any files to the server. Again, there are no modifications made to the core OpenCart files using the OCMOD system.

This module includes three versions! The first provides support for all sites running OpenCart 1.5+ with vQmod. The second version provides support for all sites running OpenCart 2.0+ with vQmod. The third version provides support for all sites running OpenCart 2.0+ with OCMOD. Simply install the version specific to your current version of OpenCart and within minutes the module is up and running.

· Fully tested and functional with OpenCart 1.5.6 and vQmod 2.4.1

· Fully tested and functional with OpenCart 2.0.3.1 and vQmod 2.5.1

· Fully tested and functional with OpenCart 2.3.0.2 and OCMOD

Requirements

For older versions of OpenCart 1.5+ and early versions of OpenCart 2.0, please make sure you have vQmod installed on your installation of OpenCart prior to attempting to use this module. vQmod is a free download.

If you are running newer versions of OpenCart with the “Modifications” feature under “Extensions”, then you are able to utilize the OCMOD version of this plugin, and nothing additional is required.

What’s Included

Included with this module are two vQmod XML Module files which are to be uploaded to the XML folder of the vQmod installation. One file is used for any storefronts running OpenCart 1.5+ versions, while the other file is used for storefronts running OpenCart 2.0+ versions. Only one file needs to be installed for the version of OpenCart that is being used.

A third file is included and suffixed with ”.ocmod.xml”. This file is for newer installations of OpenCart 2.0+ for use within the OCMOD “Modifications” feature of the “Extensions” menu in the OpenCart administration. If you are running a newer version with the OCMOD feature, then this is the only file you need to select for upload within the “Modifications” section of your administration panel.

Change History

Version 2.0.0 (pending)
  • Added Support for OpenCart Modifications (OCMOD)
  • Tested & Functional with OpenCart 2.3.0.2 and OCMOD
Version 1.2.0
  • Tested & Functional with OpenCart 2.0.3.1 and vQmod 2.5.1
Version 1.1.0
  • Added Support for Search Result Page Redirection
  • Tested & Functional with OpenCart 1.5.6 and vQmod 2.4.1
Version 1.0.0
  • Initial software release
by
by
by
by
by
by