Display all products opencart module for free version 2.3, 2.2, 2.1, 2.0

Another free Opencart module to display all products on a custom page, we show you how to install steps and have provided all code definitions.

Steps to install “All Products Show in One Page” opencart 2.3 module free:
For OpenCart Version 3.0.*.* visit here

  • Download the module
    Download Show all product module in one page opencart versions 2.3
  • Extract the zip file.
  • Upload the catalog folder which is inside “List out all products OpenCart 2.2” to your server “catalog” folder
  • Now login to the admin section then go to Extensions >> Extension Installer >> where you upload the all.install.ocmod.xml if you see any error then see how to solve the Ocmod installation error.
  • After successful installation, go to Extensions>> Modification and click the log tab and see if some errors are showing, if the error shows then you have to solve it first.
  • If no error click the refresh button
  • You are all set.
  • If you have multiple languages then you have to translate the catalog/language/en-gb/product/allproduct.php and place into catalog/language/YOURLANGUAGEFOLDER/product
  • Enjoy the free module.

How to add modules on this page?

  • Go to Admin >> Design >> Layout >> Click the add button
  • Then fill out as follows:
  • The output will be as below:

How to stop showing all products link?

If you do not need this then you can disable and delete the “List Out All Products OpenCart 2.3 OCmod”.

Go to Admin >> Extensions >> Modifications >> Disable “List Out All Products OpenCart 2.3 OCmod” or you can delete it as well and you will not see the All products links in the menu.

You can follow at my twitter account @rupaknpl and subscribe to YouTube user Opencart Tutorials.

For questions, errors, suggestions at this email webocreation.com@gmail.com.

Below are steps for the OpenCart module 2.2 and below

Installation:

  1. Unzip “Show+All+Products+Module.zip” in the folder of your choice.
  2. Upload all the files to the root folder to your server, no files are overwritten.
  3. Be sure you have VqMod installed.

You can easily download here and enjoy the module. If you got any error or problems then let me know so that I can see how to improve it and make it more friendly.

DOWNLOAD SHOW ALL PRODUCT MODULE for 2.0.1.1

DOWNLOAD SHOW ALL PRODUCT MODULE for 2.2.0.0

eCommerce Solution: I have created the Show all products extension on OpenCart which I am sharing with you all for free

DEMO

It lists out all the products with the pagination feature available. Most of my clients asked for this extension so I think this will be helpful for you all so I post it here.

 Display All Products OpenCart Module

Codes are written are on the following files

Ocmod file named all.install.ocmod.xml for opencart version 2.3

<?xml version="1.0" encoding="utf-8"?>
<modification>
    <name>List Out All Products OpenCart 2.3 OCmod</name>
    <version>1.0</version>
    <author>Rupak Nepali, Webocreation.com</author>
    <code>List_all_Products</code>
    <link>https://webocreation.com</link>
    <file path="catalog/controller/common/header.php">
        <operation>
            <search><![CDATA[
            $data['categories'] = array();
            ]]></search>
            <add position="After"><![CDATA[
                $this->load->language('product/allproduct');
                $data['categories'][] = array(
                    'name'     => $this->language->get('all_product'),
                    'children' => "",
                    'column'   => 1,
                    'href'     => $this->url->link('product/allproduct')
                );
            ]]></add>
        </operation>
    </file>
</modification>

Vqmod vqmod\xml\all.install.ocmod.xml to show “All Products” link in the top menu.

<modification>	
	<version>OpenCart Version 2.2</version>
	<vqmver>2.0.0</vqmver>
	<author>Rupak Nepali</author>
	    <code>List_all_Products</code>
	<file name="catalog/view/theme/*/template/common/header.tpl" error="skip">
		<operation>
			<search position="after"><![CDATA[
				<ul class="nav navbar-nav">
			]]></search>
			<add><![CDATA[
				<li><a href="index.php?route=product/allproduct">All Products</a></li>
			]]></add>
		</operation>
	</file>
</modification>

Language file catalog\language\en-gb\product\allproduct.php

<?php

$_['page_title']        = 'All Products List';
$_['meta_description']  = 'All Products List';
$_['meta_keyword']      = 'All Products List';
$_['heading_title']     = 'All Products List';

// Text

$_['text_refine']       = 'Refine Search';
$_['text_product']      = 'Products';
$_['text_error']        = 'all products not found!';
$_['text_empty']        = 'There are no products to list in this all products.';
$_['text_quantity']     = 'Qty:';
$_['text_manufacturer'] = 'Brand:';
$_['text_model']        = 'Product Code:';
$_['text_points']       = 'Reward Points:';
$_['text_price']        = 'Price:';
$_['text_tax']          = 'Ex Tax:';
$_['text_compare']      = 'Product Compare (%s)';
$_['text_sort']         = 'Sort By:';
$_['text_default']      = 'Default';
$_['text_name_asc']     = 'Name (A - Z)';
$_['text_name_desc']    = 'Name (Z - A)';
$_['text_price_asc']    = 'Price (Low &gt; High)';
$_['text_price_desc']   = 'Price (High &gt; Low)';
$_['text_rating_asc']   = 'Rating (Lowest)';
$_['text_rating_desc']  = 'Rating (Highest)';
$_['text_model_asc']    = 'Model (A - Z)';
$_['text_model_desc']   = 'Model (Z - A)';
$_['text_limit']        = 'Show:';

Controller file catalog\controller\product\allproduct.php

<?php
class ControllerProductAllproduct extends Controller {
 public function index() {
 $this->load->language('product/allproduct');

 $this->load->model('catalog/allproduct');

 $this->load->model('catalog/product');

 $this->load->model('tool/image');
 $this->document->setTitle($this->language->get('page_title'));
 $this->document->setDescription($this->language->get('meta_description'));
 $this->document->setKeywords($this->language->get('meta_keyword'));

 $data['heading_title'] = $this->language->get('heading_title');
 if (isset($this->request->get['filter'])) {
 $filter = $this->request->get['filter'];
 } else {
 $filter = '';
 }

 if (isset($this->request->get['sort'])) {
 $sort = $this->request->get['sort'];
 } else {
 $sort = 'p.sort_order';
 }

 if (isset($this->request->get['order'])) {
 $order = $this->request->get['order'];
 } else {
 $order = 'ASC';
 }

 if (isset($this->request->get['page'])) {
 $page = $this->request->get['page'];
 } else {
 $page = 1;
 }

 if (isset($this->request->get['limit'])) {
 $limit = (int)$this->request->get['limit'];
 } else {
 $limit = $this->config->get($this->config->get('config_theme') . '_product_limit');
 }

 $data['breadcrumbs'] = array();

 $data['breadcrumbs'][] = array(
 'text' => $this->language->get('text_home'),
 'href' => $this->url->link('common/home')
 );

 $allproduct_info = $this->model_catalog_allproduct->getAllProduct();

 if ($allproduct_info) {


 $data['text_refine'] = $this->language->get('text_refine');
 $data['text_empty'] = $this->language->get('text_empty');
 $data['text_quantity'] = $this->language->get('text_quantity');
 $data['text_manufacturer'] = $this->language->get('text_manufacturer');
 $data['text_model'] = $this->language->get('text_model');
 $data['text_price'] = $this->language->get('text_price');
 $data['text_tax'] = $this->language->get('text_tax');
 $data['text_points'] = $this->language->get('text_points');
 $data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0));
 $data['text_sort'] = $this->language->get('text_sort');
 $data['text_limit'] = $this->language->get('text_limit');

 $data['button_cart'] = $this->language->get('button_cart');
 $data['button_wishlist'] = $this->language->get('button_wishlist');
 $data['button_compare'] = $this->language->get('button_compare');
 $data['button_continue'] = $this->language->get('button_continue');
 $data['button_list'] = $this->language->get('button_list');
 $data['button_grid'] = $this->language->get('button_grid');

$data['compare'] = $this->url->link('product/compare');


 // Set the last AllProduct breadcrumb
 $data['breadcrumbs'][] = array(
 'text' => $this->language->get('heading_title'),
 'href' => $this->url->link('product/allproduct')
 );
 $url = '';
 $data['products'] = array();
 $filter_data = array(
 'filter_filter'      => $filter,
 'sort'               => $sort,
 'order'              => $order,
 'start'              => ($page - 1) * $limit,
 'limit'              => $limit
 );

 $product_total = $this->model_catalog_product->getTotalProducts($filter_data);
 $results = $this->model_catalog_product->getProducts($filter_data);
 foreach ($results as $result) {
 if ($result['image']) {
 $image = $this->model_tool_image->resize($result['image'], $this->config->get($this->config->get('config_theme') . '_image_product_width'), $this->config->get($this->config->get('config_theme') . '_image_product_height'));
 } else {
 $image = $this->model_tool_image->resize('placeholder.png', $this->config->get($this->config->get('config_theme') . '_image_product_width'), $this->config->get($this->config->get('config_theme') . '_image_product_height'));
 }

 if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
 $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
 } else {
 $price = false;
 }

 if ((float)$result['special']) {
 $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
 } else {
 $special = false;
 }

 if ($this->config->get('config_tax')) {
 $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']);
 } else {
 $tax = false;
 }

 if ($this->config->get('config_review_status')) {
 $rating = (int)$result['rating'];
 } else {
 $rating = false;
 }

 $data['products'][] = array(
 'product_id'  => $result['product_id'],
 'thumb'       => $image,
 'name'        => $result['name'],
 'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get($this->config->get('config_theme') . '_product_description_length')) . '..',
 'price'       => $price,
 'special'     => $special,
 'tax'         => $tax,
 'minimum'     => $result['minimum'] > 0 ? $result['minimum'] : 1,
 'rating'      => $result['rating'],
 'href'        => $this->url->link('product/product', '&product_id=' . $result['product_id'] .$url)
 );
 }

 $url = '';

 if (isset($this->request->get['filter'])) {
 $url .= '&filter=' . $this->request->get['filter'];
 }

 if (isset($this->request->get['limit'])) {
 $url .= '&limit=' . $this->request->get['limit'];
 }

 $data['sorts'] = array();

 $data['sorts'][] = array(
 'text'  => $this->language->get('text_default'),
 'value' => 'p.sort_order-ASC',
 'href'  => $this->url->link('product/allproduct', $url)
 );

 $data['sorts'][] = array(
 'text'  => $this->language->get('text_name_asc'),
 'value' => 'pd.name-ASC',
 'href'  => $this->url->link('product/allproduct', $url)
 );

 $data['sorts'][] = array(
 'text'  => $this->language->get('text_name_desc'),
 'value' => 'pd.name-DESC',
 'href'  => $this->url->link('product/allproduct', $url)
 );

 $data['sorts'][] = array(
 'text'  => $this->language->get('text_price_asc'),
 'value' => 'p.price-ASC',
 'href'  => $this->url->link('product/allproduct', $url)
 );

 $data['sorts'][] = array(
 'text'  => $this->language->get('text_price_desc'),
 'value' => 'p.price-DESC',
 'href'  => $this->url->link('product/allproduct', $url)
 );

 if ($this->config->get('config_review_status')) {
 $data['sorts'][] = array(
 'text'  => $this->language->get('text_rating_desc'),
 'value' => 'rating-DESC',
 'href'  => $this->url->link('product/allproduct', $url)
 );

 $data['sorts'][] = array(
 'text'  => $this->language->get('text_rating_asc'),
 'value' => 'rating-ASC',
 'href'  => $this->url->link('product/allproduct', $url)
 );
 }

 $data['sorts'][] = array(
 'text'  => $this->language->get('text_model_asc'),
 'value' => 'p.model-ASC',
 'href'  => $this->url->link('product/allproduct', $url)
 );

 $data['sorts'][] = array(
 'text'  => $this->language->get('text_model_desc'),
 'value' => 'p.model-DESC',
 'href'  => $this->url->link('product/allproduct', $url)
 );

 $url = '';

 if (isset($this->request->get['filter'])) {
 $url .= '&filter=' . $this->request->get['filter'];
 }

 if (isset($this->request->get['sort'])) {
 $url .= '&sort=' . $this->request->get['sort'];
 }

 if (isset($this->request->get['order'])) {
 $url .= '&order=' . $this->request->get['order'];
 }

 $data['limits'] = array();

 $limits = array_unique(array($this->config->get($this->config->get('config_theme') . '_product_limit'), 25, 50, 75, 100));

 sort($limits);

 foreach($limits as $value) {
 $data['limits'][] = array(
 'text'  => $value,
 'value' => $value,
 'href'  => $this->url->link('product/allproduct', $url . '&limit=' . $value)
 );
 }

 $url = '';

 if (isset($this->request->get['filter'])) {
 $url .= '&filter=' . $this->request->get['filter'];
 }

 if (isset($this->request->get['sort'])) {
 $url .= '&sort=' . $this->request->get['sort'];
 }

 if (isset($this->request->get['order'])) {
 $url .= '&order=' . $this->request->get['order'];
 }

 if (isset($this->request->get['limit'])) {
 $url .= '&limit=' . $this->request->get['limit'];
 }

 $pagination = new Pagination();
 $pagination->total = $product_total;
 $pagination->page = $page;
 $pagination->limit = $limit;
 $pagination->url = $this->url->link('product/allproduct', $url . '&page={page}');

 $data['pagination'] = $pagination->render();

 $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit));

 if ($page == 1) {
     $this->document->addLink($this->url->link('product/allproduct', '', true), 'canonical');
 } elseif ($page == 2) {
     $this->document->addLink($this->url->link('product/allproduct', '', true), 'prev');
 } else {
     $this->document->addLink($this->url->link('product/allproduct', '&page='. ($page - 1), true), 'prev');
 }

 if ($limit && ceil($product_total / $limit) > $page) {
     $this->document->addLink($this->url->link('product/allproduct', '&page='. ($page + 1), true), 'next');
 }

 $data['sort'] = $sort;
 $data['order'] = $order;
 $data['limit'] = $limit;

 $data['continue'] = $this->url->link('common/home');

 $data['column_left'] = $this->load->controller('common/column_left');
 $data['column_right'] = $this->load->controller('common/column_right');
 $data['content_top'] = $this->load->controller('common/content_top');
 $data['content_bottom'] = $this->load->controller('common/content_bottom');
 $data['footer'] = $this->load->controller('common/footer');
 $data['header'] = $this->load->controller('common/header');

 $this->response->setOutput($this->load->view('product/allproduct', $data));
 } else {
 $url = '';

 if (isset($this->request->get['filter'])) {
 $url .= '&filter=' . $this->request->get['filter'];
 }

 if (isset($this->request->get['sort'])) {
 $url .= '&sort=' . $this->request->get['sort'];
 }

 if (isset($this->request->get['order'])) {
 $url .= '&order=' . $this->request->get['order'];
 }

 if (isset($this->request->get['page'])) {
 $url .= '&page=' . $this->request->get['page'];
 }

 if (isset($this->request->get['limit'])) {
 $url .= '&limit=' . $this->request->get['limit'];
 }

 $data['breadcrumbs'][] = array(
 'text' => $this->language->get('text_error'),
 'href' => $this->url->link('product/allproduct', $url)
 );

 $this->document->setTitle($this->language->get('text_error'));

 $data['heading_title'] = $this->language->get('text_error');

 $data['text_error'] = $this->language->get('text_error');

 $data['button_continue'] = $this->language->get('button_continue');

 $data['continue'] = $this->url->link('common/home');

 $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found');

 $data['column_left'] = $this->load->controller('common/column_left');
 $data['column_right'] = $this->load->controller('common/column_right');
 $data['content_top'] = $this->load->controller('common/content_top');
 $data['content_bottom'] = $this->load->controller('common/content_bottom');
 $data['footer'] = $this->load->controller('common/footer');
 $data['header'] = $this->load->controller('common/header');

 $this->response->setOutput($this->load->view('error/not_found', $data));
 }
 }
}

Model file at catalog\model\catalog\allproduct.php

<?php
class ModelCatalogAllProduct extends Model {
	public function getAllProduct($data = array()) {
		$sql = "SELECT p.product_id, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special";

		if (!empty($data['filter_category_id'])) {
			if (!empty($data['filter_sub_category'])) {
				$sql .= " FROM " . DB_PREFIX . "category_path cp LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (cp.category_id = p2c.category_id)";
			} else {
				$sql .= " FROM " . DB_PREFIX . "product_to_category p2c";
			}

			if (!empty($data['filter_filter'])) {
				$sql .= " LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) LEFT JOIN " . DB_PREFIX . "product p ON (pf.product_id = p.product_id)";
			} else {
				$sql .= " LEFT JOIN " . DB_PREFIX . "product p ON (p2c.product_id = p.product_id)";
			}
		} else {
			$sql .= " FROM " . DB_PREFIX . "product p";
		}

		$sql .= " LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'";

		if (!empty($data['filter_category_id'])) {
			if (!empty($data['filter_sub_category'])) {
				$sql .= " AND cp.path_id = '" . (int)$data['filter_category_id'] . "'";
			} else {
				$sql .= " AND p2c.category_id = '" . (int)$data['filter_category_id'] . "'";
			}

			if (!empty($data['filter_filter'])) {
				$implode = array();

				$filters = explode(',', $data['filter_filter']);

				foreach ($filters as $filter_id) {
					$implode[] = (int)$filter_id;
				}

				$sql .= " AND pf.filter_id IN (" . implode(',', $implode) . ")";
			}
		}

		if (!empty($data['filter_name']) || !empty($data['filter_tag'])) {
			$sql .= " AND (";

			if (!empty($data['filter_name'])) {
				$implode = array();

				$words = explode(' ', trim(preg_replace('/\s+/', ' ', $data['filter_name'])));

				foreach ($words as $word) {
					$implode[] = "pd.name LIKE '%" . $this->db->escape($word) . "%'";
				}

				if ($implode) {
					$sql .= " " . implode(" AND ", $implode) . "";
				}

				if (!empty($data['filter_description'])) {
					$sql .= " OR pd.description LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
				}
			}

			if (!empty($data['filter_name']) && !empty($data['filter_tag'])) {
				$sql .= " OR ";
			}

			if (!empty($data['filter_tag'])) {
				$sql .= "pd.tag LIKE '%" . $this->db->escape($data['filter_tag']) . "%'";
			}

			if (!empty($data['filter_name'])) {
				$sql .= " OR LCASE(p.model) = '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "'";
				$sql .= " OR LCASE(p.sku) = '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "'";
				$sql .= " OR LCASE(p.upc) = '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "'";
				$sql .= " OR LCASE(p.ean) = '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "'";
				$sql .= " OR LCASE(p.jan) = '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "'";
				$sql .= " OR LCASE(p.isbn) = '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "'";
				$sql .= " OR LCASE(p.mpn) = '" . $this->db->escape(utf8_strtolower($data['filter_name'])) . "'";
			}

			$sql .= ")";
		}

		if (!empty($data['filter_manufacturer_id'])) {
			$sql .= " AND p.manufacturer_id = '" . (int)$data['filter_manufacturer_id'] . "'";
		}

		$sql .= " GROUP BY p.product_id";

		$sort_data = array(
			'pd.name',
			'p.model',
			'p.quantity',
			'p.price',
			'rating',
			'p.sort_order',
			'p.date_added'
		);

		if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
			if ($data['sort'] == 'pd.name' || $data['sort'] == 'p.model') {
				$sql .= " ORDER BY LCASE(" . $data['sort'] . ")";
			} elseif ($data['sort'] == 'p.price') {
				$sql .= " ORDER BY (CASE WHEN special IS NOT NULL THEN special WHEN discount IS NOT NULL THEN discount ELSE p.price END)";
			} else {
				$sql .= " ORDER BY " . $data['sort'];
			}
		} else {
			$sql .= " ORDER BY p.sort_order";
		}

		if (isset($data['order']) && ($data['order'] == 'DESC')) {
			$sql .= " DESC, LCASE(pd.name) DESC";
		} else {
			$sql .= " ASC, LCASE(pd.name) ASC";
		}

		if (isset($data['start']) || isset($data['limit'])) {
			if ($data['start'] < 0) {
				$data['start'] = 0;
			}

			if ($data['limit'] < 1) {
				$data['limit'] = 20;
			}

			$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
		}

		$product_data = array();

		$query = $this->db->query($sql);

		foreach ($query->rows as $result) {
			$product_data[$result['product_id']] = $this->getProduct($result['product_id']);
		}

		return $product_data;
	}

	public function getProduct($product_id) {
		$query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, m.name AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");

		if ($query->num_rows) {
			return array(
				'product_id'       => $query->row['product_id'],
				'name'             => $query->row['name'],
				'description'      => $query->row['description'],
				'meta_title'       => $query->row['meta_title'],
				'meta_description' => $query->row['meta_description'],
				'meta_keyword'     => $query->row['meta_keyword'],
				'tag'              => $query->row['tag'],
				'model'            => $query->row['model'],
				'sku'              => $query->row['sku'],
				'upc'              => $query->row['upc'],
				'ean'              => $query->row['ean'],
				'jan'              => $query->row['jan'],
				'isbn'             => $query->row['isbn'],
				'mpn'              => $query->row['mpn'],
				'location'         => $query->row['location'],
				'quantity'         => $query->row['quantity'],
				'stock_status'     => $query->row['stock_status'],
				'image'            => $query->row['image'],
				'manufacturer_id'  => $query->row['manufacturer_id'],
				'manufacturer'     => $query->row['manufacturer'],
				'price'            => ($query->row['discount'] ? $query->row['discount'] : $query->row['price']),
				'special'          => $query->row['special'],
				'reward'           => $query->row['reward'],
				'points'           => $query->row['points'],
				'tax_class_id'     => $query->row['tax_class_id'],
				'date_available'   => $query->row['date_available'],
				'weight'           => $query->row['weight'],
				'weight_class_id'  => $query->row['weight_class_id'],
				'length'           => $query->row['length'],
				'width'            => $query->row['width'],
				'height'           => $query->row['height'],
				'length_class_id'  => $query->row['length_class_id'],
				'subtract'         => $query->row['subtract'],
				'rating'           => round($query->row['rating']),
				'reviews'          => $query->row['reviews'] ? $query->row['reviews'] : 0,
				'minimum'          => $query->row['minimum'],
				'sort_order'       => $query->row['sort_order'],
				'status'           => $query->row['status'],
				'date_added'       => $query->row['date_added'],
				'date_modified'    => $query->row['date_modified'],
				'viewed'           => $query->row['viewed']
			);
		} else {
			return false;
		}
	}
}

Template file catalog\view\theme\default\template\product\allproduct.tpl

<?php echo $header; ?> <div class="container">
    <ul class="breadcrumb"> <?php foreach ($breadcrumbs as $breadcrumb) { ?> <li><a
                href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li> <?php } ?> </ul>
    <div class="row"><?php echo $column_left; ?> <?php if ($column_left && $column_right) { ?>
        <?php $class = 'col-sm-6'; ?> <?php } elseif ($column_left || $column_right) { ?> <?php $class = 'col-sm-9'; ?>
        <?php } else { ?> <?php $class = 'col-sm-12'; ?> <?php } ?> <div id="content" class="<?php echo $class; ?>">
            <?php echo $content_top; ?> <h2><?php echo $heading_title; ?></h2> <?php if ($products) { ?> <p><a
                    href="<?php echo $compare; ?>" id="compare-total"><?php echo $text_compare; ?></a></p>
            <div class="row">
                <div class="col-md-4">
                    <div class="btn-group hidden-xs"> <button type="button" id="list-view" class="btn btn-default"
                            data-toggle="tooltip" title="<?php echo $button_list; ?>"><i
                                class="fa fa-th-list"></i></button> <button type="button" id="grid-view"
                            class="btn btn-default" data-toggle="tooltip" title="<?php echo $button_grid; ?>"><i
                                class="fa fa-th"></i></button> </div>
                </div>
                <div class="col-md-2 text-right"> <label class="control-label"
                        for="input-sort"><?php echo $text_sort; ?></label> </div>
                <div class="col-md-3 text-right"> <select id="input-sort" class="form-control"
                        onchange="location = this.value;"> <?php foreach ($sorts as $sorts) { ?>
                        <?php if ($sorts['value'] == $sort . '-' . $order) { ?> <option
                            value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?>
                        </option> <?php } else { ?> <option value="<?php echo $sorts['href']; ?>">
                            <?php echo $sorts['text']; ?></option> <?php } ?> <?php } ?> </select> </div>
                <div class="col-md-1 text-right"> <label class="control-label"
                        for="input-limit"><?php echo $text_limit; ?></label> </div>
                <div class="col-md-2 text-right"> <select id="input-limit" class="form-control"
                        onchange="location = this.value;"> <?php foreach ($limits as $limits) { ?>
                        <?php if ($limits['value'] == $limit) { ?> <option value="<?php echo $limits['href']; ?>"
                            selected="selected"><?php echo $limits['text']; ?></option> <?php } else { ?> <option
                            value="<?php echo $limits['href']; ?>"><?php echo $limits['text']; ?></option> <?php } ?>
                        <?php } ?> </select> </div>
            </div> <br />
            <div class="row"> <?php foreach ($products as $product) { ?> <div
                    class="product-layout product-list col-xs-12">
                    <div class="product-thumb">
                        <div class="image"><a href="<?php echo $product['href']; ?>"><img
                                    src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>"
                                    title="<?php echo $product['name']; ?>" class="img-responsive" /></a></div>
                        <div>
                            <div class="caption">
                                <h4><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></h4>
                                <p><?php echo $product['description']; ?></p> <?php if ($product['rating']) { ?> <div
                                    class="rating"> <?php for ($i = 1; $i <= 5; $i++) { ?>
                                    <?php if ($product['rating'] < $i) { ?> <span class="fa fa-stack"><i
                                            class="fa fa-star-o fa-stack-2x"></i></span> <?php } else { ?> <span
                                        class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i
                                            class="fa fa-star-o fa-stack-2x"></i></span> <?php } ?> <?php } ?> </div>
                                <?php } ?> <?php if ($product['price']) { ?> <p class="price">
                                    <?php if (!$product['special']) { ?> <?php echo $product['price']; ?>
                                    <?php } else { ?> <span class="price-new"><?php echo $product['special']; ?></span>
                                    <span class="price-old"><?php echo $product['price']; ?></span> <?php } ?>
                                    <?php if ($product['tax']) { ?> <span class="price-tax"><?php echo $text_tax; ?>
                                        <?php echo $product['tax']; ?></span> <?php } ?> </p> <?php } ?>
                            </div>
                            <div class="button-group"> <button type="button"
                                    onclick="cart.add('<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');"><i
                                        class="fa fa-shopping-cart"></i> <span
                                        class="hidden-xs hidden-sm hidden-md"><?php echo $button_cart; ?></span></button>
                                <button type="button" data-toggle="tooltip" title="<?php echo $button_wishlist; ?>"
                                    onclick="wishlist.add('<?php echo $product['product_id']; ?>');"><i
                                        class="fa fa-heart"></i></button> <button type="button" data-toggle="tooltip"
                                    title="<?php echo $button_compare; ?>"
                                    onclick="compare.add('<?php echo $product['product_id']; ?>');"><i
                                        class="fa fa-exchange"></i></button> </div>
                        </div>
                    </div>
                </div> <?php } ?> </div>
            <div class="row">
                <div class="col-sm-6 text-left"><?php echo $pagination; ?></div>
                <div class="col-sm-6 text-right"><?php echo $results; ?></div>
            </div> <?php } ?> <?php echo $content_bottom; ?>
        </div> <?php echo $column_right; ?></div>
</div> <?php echo $footer; ?>

Previous articlewhat is the best salesforce tool to prevent overbooking?
Next articleMarketo API – export all Forms and their Fields from our Marketo database

59 COMMENTS

  1. i would like a module that displays products according to their categories in rows on the homepage of my website.

  2. HI,

    I have vqmod installed and uploaded all the module files to the root folder, but i can’t see the module name from backend. how do i install it? what am i doing wrong?

    opencart Version 2.0.3.1

  3. Thank you for the neat mod and the example how to use write for vQmod.

    I found that there is a bug in the display, see the two HOME icons in the breadcrumbs?

    In catalog/controller/product/allproduct.php line 94, change text_home to text_product

    Also, what would I change to pull “All Products” for the top bar from the text_product also?

    opencart Version 2.0.1.2

  4. Thank you for the neat mod and the example how to use write for vQmod.

    I found that there is a bug in the display, see the two HOME icons in the breadcrumbs?

    In catalog/controller/product/allproduct.php line 94, change text_home to text_product

    Also, what would I change to pull “All Products” for the top bar from the text_product also?

    opencart Version 2.0.1.2

  5. I installed vmod and uploaded all files to root folder as well installed the extension through extension installer, still cant see the link on menu bar…
    What more i should do?
    Please guide

  6. I am getting a page error after installation when I click show al product I get this: Warning: imagecreatetruecolor(): Invalid image and it will not load can you help please?

    • Can you please make sure that you set the height and width for images?
      Similarly, check file creation permission.

      Thanks
      Rupak

  7. I am getting a page error after installation when I click show al product I get this: Warning: imagecreatetruecolor(): Invalid image and it will not load can you help please?

      • Thanks Rupak, thats fixed the issue of the error code however slideshow is still not working, it stopped after the first display of the error message.
        Would you advise please?

    • Thanks Rupak, thats fixed the issue of the error code however slideshow is still not working, it stopped after the first display of the error message.
      Would you advise please?

  8. Thanks for your great extension , I need some help get this error :
    when in is installed while refreshing in “admin/modification

    Notice: Trying to get property of non-object in /home/pastelgr/public_html/admin/controller/extension/modification.php on line 145Warning: Cannot modify header information – headers already sent by (output started at /home/pastelgr/public_html/admin/controller/startup/error.php:34) in /home/pastelgr/public_html/system/library/response.php on line 12

  9. Hello,

    I have just added your All Products Mod to my Website,

    When in the all Products screen the Sort By filter no longer works, Do you know how to resolve is?

    Thanks

    Jack

    • Hi Jack,

      Thanks for showing this to me.
      Module updated.

      For those who already installed this module:
      Download the module and go to catalog/controller/product/allproduct.php, copy it.
      Go to your ftp and Override the catalog\controller\product\allproduct.php

      Hope these steps helps all

      Thanks
      Rupak

  10. Hello,

    I have just added your All Products Mod to my Website,

    When in the all Products screen the Sort By filter no longer works, Do you know how to resolve is?

    Thanks

    Jack

  11. I got an issue after installing this. Once I click All Products (and some other sections of the website) I get this long chain before the thing.

    By Chain I mean I get this list in descending order:
    Chain = (
    Login
    Register
    Forgotten Password
    My Account
    Address Book
    Wish List
    Order History
    Downloads
    Recurring payments
    Reward Points
    Returns
    Transactions
    Newsletter
    Login
    Register
    Forgotten Password
    My Account
    Address Book
    Wish List
    Order History
    Downloads
    Recurring payments
    Reward Points
    Returns
    Transactions
    Newsletter
    All Products List)

    Followed by the stuff. I dunno if there called breadcrumbs or the site menu bar? But yeah. Any idea how to fix that?
    http://i.imgur.com/5yKcEMK.png

  12. I install your OpenCart module "Display/Show All Products in one page" but now
    i got this message in error logs
    PHP Notice: Undefined variable: compare in /catalog/view/theme/default/template/product/allproduct.tpl on line 20
    Please help my fix this trouble.

    • Hi Alexandr,

      Thanks for reporting.

      Open catalog\controller\product\allproduct.php

      At around line 79 you will find code like below:

      $data[‘button_grid’] = $this->language->get(‘button_grid’);

      Below that add following line:

      $data[‘compare’] = $this->url->link(‘product/compare’);

      It will resolve the issue.

      Best Regards,

      Rupak

      • Line 20 <a href="” id=”compare-total”>

        Line 79

        Dont code $data[‘button_grid’] = $this->language->get(‘button_grid’);

        Fix ?

  13. Hi, how can I add modules in column left/right now on this page? There is no All Product in Layout… Thanks in advance…

    • Hi Ivan,

      I have added explanation with topic “How to add modules in this page?” in the post.
      Please have a look and add modules to the right or left column of all product show page.

      Thanks
      Rupak

      • Niceeee… great job! I have replaced allproduct.tpl with my one category.tpl with few tweeks, and it looks great. Thanks 😉

  14. Hi, how can I add modules in column left/right now on this page? There is no All Product in Layout… Thanks in advance…

    • Niceeee… great job! I have replaced allproduct.tpl with my one category.tpl with few tweeks, and it looks great. Thanks 😉

  15. Hi,
    This is a great extension and I am enjoying a lot.
    I have a question, how to rewrite the url index.php?route=product/allproduct to /product/allproducts or simply /allproducts/

    • Hi,
      This is a great extension and I am enjoying a lot.
      I have a question, how to rewrite the url index.php?route=product/allproduct to /product/allproducts or simply /allproducts/

  16. Line 20 <a href="” id=”compare-total”>

    Line 79

    Dont code $data[‘button_grid’] = $this->language->get(‘button_grid’);

    Fix ?

  17. Hello, please kindly assist me with the following error for 2.2.0

    2018-01-26 8:13:29 – MOD: Modification Default
    FILE: system/engine/action.php
    REGEX: ~(require|include)(_once)?\(([^)]+)~
    LINE: 34
    FILE: system/engine/loader.php
    REGEX: ~(require|include)(_once)?\(([^)]+)~
    LINE: 41
    LINE: 92
    LINE: 104
    LINE: 142
    FILE: system/library/config.php
    REGEX: ~(require|include)(_once)?\(([^)]+)~
    LINE: 23
    FILE: system/library/language.php
    REGEX: ~(require|include)(_once)?\(([^)]+)~
    LINE: 35
    LINE: 41
    LINE: 47
    FILE: system/library/template/basic.php
    REGEX: ~(require|include)(_once)?\(([^)]+)~
    LINE: 18
    —————————————————————-

    • Hi @Sib,

      For Opencart 2, all.install.ocmod.xml file is the one to modify your menu code and add the URL, for that VQmod installation is needed.

      If you don’t want that then you need to find the place in catalog/view/theme/*/template/common/header.tpl where you have to add the link wherever you want
      https://YOURURL/index.php?route=product/allproduct

LEAVE A REPLY

Please enter your comment!
Please enter your name here