Page 1 of 1

Sudden Sitewide Slowdown after OPC install

PostPosted: Fri Jul 05, 2019 12:57 pm
by derekwebster@.....com
Hi I wonder if you can help - Ive experienced a SUDDEN site wide slowdown after installing OPC. pre install My pages were almost instant refresh page navigation was VERY quick. Now - any Virtuemart page is taking an incredible amount of time to load - or timing out completely.
Ive tried changing templates to standard ones. Still same issue.

Ive now uninstalled OPC and still the same.

Can you think of any reason this could have happened?

Re: Sudden Sitewide Slowdown after OPC install

PostPosted: Mon Jul 08, 2019 1:32 pm
by derekwebster@.....com
Appploies but I think this slowdown was due to another issue.

Under Add the "raleted products' custom field - When I enable "With 'Add to Cart' button" the whole site seems to go into meltdown - lol - Server load went up - pages completely unresponsive. Backend slow. I may have found a VM bug.

Many thanks

Re: Sudden Sitewide Slowdown after OPC install

PostPosted: Mon Jul 29, 2019 2:59 pm
by admin
hello, VM is very ineffecient in handling custom fields and i would suggest to modify sublayout/customfields to prevent any sort of recursion there. the main problem is that it loads related products of related products and then possibly another related products, until your site either crashes or is very slow.

i generally do not suggest to use related products if you cannot have a dev which can fix the above issue for you.

we've got some custom systems that store related products in comma separated columns in custom tables where they get imported from external systems via sync software. then our system at vm templates load this extra information and shows the related products at another positions wherever needed.

example :
Code: Select all

$this->alternative_products_html = '';
if (!empty($this->product->extra['alternative_products_vm'])) {
   $ids = explode(',', $this->product->extra['alternative_products_vm']);
   
   
if (!empty($ids)) {
   $products = $this->product_model->getProducts ($ids);
      if (!class_exists ('vmCustomPlugin')) {
                  require(JPATH_ADMINISTRATOR.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_virtuemart'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR . 'vmcustomplugin.php');
               }
            $this->product_model->addImages($products,1);
            foreach ($products as $k=>$prod) {
               if (empty($prod->images[0])) {
                  if (class_exists('VmMediaHandler')) {
                  $products[$k]->images[0] = new VmMediaHandler();
                  }
                  else {
                     if (class_exists('VmImage')) {
                        $products[$k]->images[0] = new VmImage();
                     }
                     
                  }
               }
               
               
               
               $products[$k]->stock = $this->product_model->getStockIndicator($products[$k]);
               
               
               
               
               
            }
            //shopFunctionsF::sortLoadProductCustomsStockInd($products,$this->product_model);
            ob_start();
            require(JModuleHelper::getLayoutPath('mod_virtuemart_product_custom','default'));
            $this->alternative_products_html = ob_get_clean();
            
            
}

   
}




1. the code above expects the comma separated list of alternative/related/etc products within:
$ids = explode(',', $this->product->extra['alternative_products_vm']);

2. dependencies: $this->product_model = VmModel::getModel('products'); (usually available in product's default template )

3. mod_virtuemart_product_custom (which is a custom mod of mod_virtuemart_product ) (renders products via sublayouts/products.php )

best regards,stan