News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

VirtueMart not reading custom titles in childs swap

Started by lindapowers, January 02, 2016, 08:08:43 AM

Previous topic - Next topic

lindapowers

Hi

vm 3.0.12 j 3.4.8

Seems changing between child products doesnt load the custom title set in virtuemart product details.

Please check here http://www.comenaranjas.com/es/tienda/fruta-de-temporada/manzana-granny-smith-kg-detail.html

The first meta title will be read but if you choose another child from the dropdown it still shows the initial meta title chosen on first load (corresponding to a different child).


Regards

Studio 42

Hello,
The way Virtuemart change the content is not flexible, to add some parameters(no json used).
But it's possible to update the title, on getting it in from server response and extraction the TITILE tag from the returned html.
See http://www.comenaranjas.com/components/com_virtuemart/assets/js/dynupdate.js?vmver=9058
line 32
var el = $(data).find(Virtuemart.containerSelector);
add after:
var title = $(data).find('title');
$('title').text(title);



But on looking on your code, you have already some problems :
jQuery(window).load(function(){
  jQuery('span.hasTooltip').tooltip();
});

Is loaded 2 time.

<style scoped="scoped">
.product-shipment img{
display: block;
margin: 0 auto !important;
float: none;
}
.product-shipment br{
display: none;
}
</style>

is loaded, but you don't display any shipments.
And same for payments.
javascript vm.countryState_js, vm.countryStateshipto__js is loaded for nothing ?

Happy new year 2016 !
Tchao,
Patrick

lindapowers

Quote from: Studio 42 on January 02, 2016, 13:14:11 PM
Hello,
The way Virtuemart change the content is not flexible, to add some parameters(no json used).
But it's possible to update the title, on getting it in from server response and extraction the TITILE tag from the returned html.
See http://www.comenaranjas.com/components/com_virtuemart/assets/js/dynupdate.js?vmver=9058
line 32
var el = $(data).find(Virtuemart.containerSelector);
add after:
var title = $(data).find('title');
$('title').text(title);



Hi Patrick thanks for suggestion, I tried the propposed code but it shows [object Object] in the meta title when swapping between childs,

Regards

Studio 42

Quote from: lindapowers on January 03, 2016, 08:28:24 AM
Quote from: Studio 42 on January 02, 2016, 13:14:11 PM
Hello,
The way Virtuemart change the content is not flexible, to add some parameters(no json used).
But it's possible to update the title, on getting it in from server response and extraction the TITILE tag from the returned html.
See http://www.comenaranjas.com/components/com_virtuemart/assets/js/dynupdate.js?vmver=9058
line 32
var el = $(data).find(Virtuemart.containerSelector);
add after:
var title = $(data).find('title');
$('title').text(title);



Hi Patrick thanks for suggestion, I tried the propposed code but it shows [object Object] in the meta title when swapping between childs,

Regards


Oups :

var title = $(data).find('title').text();
$('title').text(title);


;)

Spiros Petrakis

Lets start with the last code from Patrick,

you must use filter() on data to get the page title not find() so the code should be


  var title = $(data).filter('title').text();
  $('title').text(title);


To be correct about what we are talking this is the title tag and not the meta title tag,  these are two different things.

QuoteBut on looking on your code, you have already some problems :
These have nothing to do with the page title issue and they are not "problems", problem would be something that breaks the functionality of the site , these just require some code cleanup.

Joomla templates and extensions development
https://www.yourgeek.gr

Studio 42

Quote from: Spyros Petrakis on January 03, 2016, 14:59:54 PM
Lets start with the last code from Patrick,

you must use filter() on data to get the page title not find() so the code should be


  var title = $(data).filter('title').text();
  $('title').text(title);


To be correct about what we are talking this is the title tag and not the meta title tag,  these are two different things.

QuoteBut on looking on your code, you have already some problems :
These have nothing to do with the page title issue and they are not "problems", problem would be something that breaks the functionality of the site , these just require some code cleanup.



My code should work, i forgot the text(); in the first post
$(data) is an object and not an iframe.

QuoteThese have nothing to do with the page title issue and they are not "problems", problem would be something that breaks the functionality of the site , these just require some code cleanup.
Hum, a problem is not a bug, i have inspected the file to check the problem, you mean i do another post about this ? I reported it, because i have seen this, it's all.
I know Manu seend some Years now, this is only friendly help ;)

Greets,
Patrick

lindapowers

Hi guys thanks for help,

Tried both codes and they worked and title was changed however when selecting from the dropdown with the new code applied the shadow loader gets stuck, like this:


Spiros Petrakis

Hi Manu,

i have added the code in your dynupdate.js and it works fine with the preloader working as expected, please clear your browser cache and try again. 
Joomla templates and extensions development
https://www.yourgeek.gr

lindapowers

Quote from: Spyros Petrakis on January 04, 2016, 09:35:13 AM
Hi Manu,

i have added the code in your dynupdate.js and it works fine with the preloader working as expected, please clear your browser cache and try again. 

Thank you, works perfectly!

Regards

Studio 42

#9
This work, But I still believe that a "json" call would be better and faster(as cart update) and this need not os many code changes.

P.S; a little sample for filter and find here > http://www.mkyong.com/jquery/difference-between-filter-and-find-in-jquery/ because i doubt myself for the utility of filter() in your case