Author Topic: speedup child product loading  (Read 1437 times)

VampiRUS

  • Beginner
  • *
  • Posts: 9
speedup child product loading
« on: May 06, 2015, 02:00:15 am »
Hi.
If in
components\com_virtuemart\assets\js\dynupdate.js
replace
Code: [Select]
url += url.indexOf('&') == -1 ? '?tmpl=component' : '&tmpl=component';with
Code: [Select]
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

  • Beginner
  • *
  • Posts: 34
Re: speedup child product loading
« Reply #1 on: May 06, 2015, 14:57:57 pm »
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9843
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: speedup child product loading
« Reply #2 on: May 06, 2015, 15:02:55 pm »
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?
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

VampiRUS

  • Beginner
  • *
  • Posts: 9
Re: speedup child product loading
« Reply #3 on: May 06, 2015, 16:58:45 pm »
for example
Code: [Select]
<!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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9843
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: speedup child product loading
« Reply #4 on: May 07, 2015, 08:13:12 am »
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
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

fale

  • Beginner
  • *
  • Posts: 34
Re: speedup child product loading
« Reply #5 on: May 07, 2015, 17:18:57 pm »

Shop free, little support - a lot of mistakes.

VampiRUS

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

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27431
  • Always on vacation
    • Jenkin Hill Internet
Re: speedup child product loading
« Reply #6 on: May 07, 2015, 23:37:10 pm »
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

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VM 3.4.3.10057 on Joomla 3.9.8 PHP 7.0.33
Testing VM .3.6.0.10075 on Joomla 3.9.8

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3846
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: speedup child product loading
« Reply #7 on: May 08, 2015, 15:06:19 pm »
Hi,

Hi.
If in
components\com_virtuemart\assets\js\dynupdate.js
replace
Code: [Select]
url += url.indexOf('&') == -1 ? '?tmpl=component' : '&tmpl=component';with
Code: [Select]
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 :
Code: [Select]
{
"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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3846
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: speedup child product loading
« Reply #8 on: May 08, 2015, 15:36:04 pm »
For the Json response, you can do better thinks :
Adding triggers to update plugins and modules using for eg

Code: [Select]
$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);