Related Pro by Equotix is an extension for OpenCart that adds additional features of the related products section in your store product page. If you are running this extension, this article will explain how to make it better compatible with NitroPack.

This article relates to version 2.5.0 of Related Pro for OpenCart 2.x. Please check your version of Related Pro before using the recommendation below.

The Issue

Related Pro has a randomizing feature used to display random products on the products page. This feature works fine, but it may iterate through a lot of products before serving you with the random content.

This excessive iteration can lead to excessive links between your pages cached by NitroPack. As a result, any product updates you do may use up more re-optimizations than normal.

The Solution

1. Open this file for editing:

vqmod/xml/related_pro.xml

2. Find the chunk of code saying:

<file name="catalog/controller/product/product.php">
    <operation>
        <search position="replace"><![CDATA[
            $this->model_catalog_product->getProductRelated($this->request->get['product_id']);
        ]]></search>
        <add><![CDATA[
            $this->model_catalog_product->getRelatedProProducts($this->request->get['product_id']);
           
            if ($this->config->get('related_pro_status')) {
                $temporary_array = array();
               
                foreach ($results as $product_id) {
                    $temporary_array[] = $this->model_catalog_product->getProduct($product_id);
                }
               
                $results = $temporary_array;
               
                if ($this->config->get('related_pro_random')) {
                    shuffle($results);
                }
               
                if ($this->config->get('related_pro_limit_tab')) {
                    $results = array_slice($results, 0, $this->config->get('related_pro_limit_tab'));
                } else {
                    $results = array();
                }
            }
        ]]></add>
    </operation>
</file>

3. Replace it with:

<file name="catalog/controller/product/product.php">
    <operation>
        <search position="replace"><![CDATA[
            $this->model_catalog_product->getProductRelated($this->request->get['product_id']);
        ]]></search>
        <add><![CDATA[
            $this->model_catalog_product->getRelatedProProducts($this->request->get['product_id']);
           
            if ($this->config->get('related_pro_status')) {
                if ($this->config->get('related_pro_random')) {
                    shuffle($results);
                }

                if ($this->config->get('related_pro_limit_tab')) {
                    $results = array_slice($results, 0, $this->config->get('related_pro_limit_tab'));

                    $temporary_array = array();

                    foreach ($results as $product_id) {
                        $temporary_array[] = $this->model_catalog_product->getProduct($product_id);
                    }
                   
                    $results = $temporary_array;
                } else {
                    $results = array();
                }
            }
        ]]></add>
    </operation>
</file>

4. Save the file

All fixed!

Did this answer your question?