News:

Looking for documentation? Take a look on our wiki

Main Menu

speedup child product loading

Started by VampiRUS, May 06, 2015, 02:00:15 AM

Previous topic - Next topic

VampiRUS

Hi.
If in
components\com_virtuemart\assets\js\dynupdate.js
replace
url += url.indexOf('&') == -1 ? '?tmpl=component' : '&tmpl=component';
with
url += url.indexOf('&') == -1 ? '?tmpl=component&format=raw' : '&tmpl=component&format=raw';
and copy views\productdetails\view.html.php to views\productdetails\view.raw.php
if will be do the same thing but more faster, without generate, loadnig and parsing useless content.

fale

#1
Hello,

I checked. It does not work in the latest version.  (

and copy views\productdetails\view.html.php to views\productdetails\view.raw.php     -  I do not quite understand these lines.

Child product load slowly. Virtuemart 3 - the slowest store I've ever met.

Milbo

Fale, i have times below 100ms. http://demo.virtuemart.net/product-variants/multi-variant-detail

and VampiRus, your change could break other functions (js). I also wonder what you mean with "useless" content. The whole frame is replaced, did you benchmark your changes?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

VampiRUS

for example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr">
<head>
  <base href="http://demo.virtuemart.net/product-variants/multi-variant-11-detail" />
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta name="keywords" content="virtuemart, vm2, joomla, Joomla" />
  <meta name="title" content="Multi Variant Child" />
  <meta name="description" content="Multi Variant Child Product variants Depended Multivariants" />
  <meta name="generator" content="Joomla! - Open Source Content Management" />
  <title>Product variants : Multi Variant Child</title>
  <link href="/product-variants/multi-variant-detail" rel="canonical" />
  <link href="/templates/vmbeez5/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
  <link rel="stylesheet" href="/components/com_virtuemart/assets/css/vm-ltr-common.css?vmver=8836" type="text/css" />
  <link rel="stylesheet" href="/components/com_virtuemart/assets/css/vm-ltr-site.css?vmver=8836" type="text/css" />
  <link rel="stylesheet" href="/components/com_virtuemart/assets/css/vm-ltr-reviews.css?vmver=8836" type="text/css" />
  <link rel="stylesheet" href="/components/com_virtuemart/assets/css/chosen.css?vmver=8836" type="text/css" />
  <link rel="stylesheet" href="/components/com_virtuemart/assets/css/jquery.fancybox-1.3.4.css?vmver=8836" type="text/css" />
  <script src="/components/com_virtuemart/assets/js/jquery.min.js" type="text/javascript"></script>
  <script src="/components/com_virtuemart/assets/js/jquery-migrate.min.js" type="text/javascript"></script>
  <script src="/components/com_virtuemart/assets/js/jquery-ui.min.js" type="text/javascript"></script>
  <script src="/components/com_virtuemart/assets/js/jquery.ui.autocomplete.html.js" type="text/javascript"></script>
  <script src="/components/com_virtuemart/assets/js/jquery.noconflict.js" type="text/javascript" async="async"></script>
  <script src="/components/com_virtuemart/assets/js/vmsite.js?vmver=8836" type="text/javascript"></script>
  <script src="/components/com_virtuemart/assets/js/chosen.jquery.min.js?vmver=8836" type="text/javascript"></script>
  <script src="/components/com_virtuemart/assets/js/dynupdate.js?vmver=8836" type="text/javascript"></script>
  <script src="/components/com_virtuemart/assets/js/vmprices.js?vmver=8836" type="text/javascript"></script>
  <script src="/components/com_virtuemart/assets/js/cvfind.js?vmver=8836" type="text/javascript"></script>
  <script src="/components/com_virtuemart/assets/js/fancybox/jquery.fancybox-1.3.4.pack.js?vmver=8836" type="text/javascript" defer="defer"></script>

<link rel="stylesheet" href="/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="/templates/vmbeez5/css/template.css" type="text/css" />
<link rel="stylesheet" href="/templates/vmbeez5/css/position.css" type="text/css" />
<link rel="stylesheet" href="/templates/vmbeez5/css/layout.css" type="text/css" media="screen,projection" />
<link rel="stylesheet" href="/templates/vmbeez5/css/print.css" type="text/css" media="Print" />
<link rel="stylesheet" href="/templates/vmbeez5/css/vmbeez5.css" type="text/css" />

<link rel="stylesheet" href="/templates/vmbeez5/css/general.css" type="text/css" />

<!--[if lte IE 6]>
<link href="/templates/vmbeez5/css/ieonly.css" rel="stylesheet" type="text/css" />
<![endif]-->
</head>
<body class="contentpane">
<div id="all">
<div id="main">

<div id="system-message-container">
</div>

it takes time to convert it in DOM in javascript but not used
I don't now how it can break other js, function get result and use it, no one more use this result or must to use &format=raw

Milbo

So you mean, using the raw function, does not sent the header (opposite of content!). But good to know, yes.

The js handler got added because the js reloaded in the header is "thrown away". So, yes shouldnt make any js problems. But I prefer to find a solution without copying the code. Thanks for the hint
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

fale


Shop free, little support - a lot of mistakes.

VampiRUS

I did not know what to do to make it faster?

jenkinhill

fale you have already been advised about your slow server speed in http://forum.virtuemart.net/index.php?topic=129784.msg447003#msg447003

Maybe change to a better host?
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Studio 42

#7
Hi,

Quote from: VampiRUS on May 06, 2015, 02:00:15 AM
Hi.
If in
components\com_virtuemart\assets\js\dynupdate.js
replace
url += url.indexOf('&') == -1 ? '?tmpl=component' : '&tmpl=component';
with
url += url.indexOf('&') == -1 ? '?tmpl=component&format=raw' : '&tmpl=component&format=raw';
and copy views\productdetails\view.html.php to views\productdetails\view.raw.php
if will be do the same thing but more faster, without generate, loadnig and parsing useless content.

Sure this is better , because Virtuemart Crop all and only get the main container from the loaded HTML page.
BUt in all '&tmpl=component&format=raw' can be '&format=raw'
But the best solution is to use Json using '&format=json'

BUt you have to know :

for format=raw :
Does not includes Joomla messages(error, warnings ...).
this mean you have to get message and add it before, with a function

for format=json :
YOu have to add Joomla  message in the json response with a function, and add it by a javascript function.

Advantage of json, is that you can provide an object(or array, but this is same for javascript and jQuery) you can then set array of messages, container, javascripts

a sample for json response can be :
{
"id": "45",
"html": "full html child product",
"messages":
[
{"type": "error", "message": "No Access"}
{"type": "warning", "message": "This product have no stock"}
],
"script": "var sku = '123-52-25'"
}




Studio 42

For the Json response, you can do better thinks :
Adding triggers to update plugins and modules using for eg


$result = $this->loadTemplate($tpl);

if ($result instanceof Exception)
{
  // TODO if tmpl is not found return $result;
}

$json->htm = $result;
// trigger for plugin
$valid = $dispatcher->trigger(('onAjaxProductUpdate',array($product, $json);
// implement a specific fonction to check if modules have to be update
$this->checkmodulesUpdate($product,$json);