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

Price Not Updating on Product Variant **Google Chrome**

Started by kingo_2k2, August 29, 2012, 15:40:55 PM

Previous topic - Next topic

kingo_2k2

I have had someone add a gate builder to a site we are developing, basically the user can select a number of different product variants and the price and image will change to show the customer what they are buying, this works fine in Firefox, in IE the price will change but the images will not change on selection, or Google Chrome the price will not change it you select a variant but the picutres will change, I have no idea whats causing this problem and help would be super!

Joomla: 2.5
VirtueMart 2.0.1
Website: http://www.webworkscms.co.uk/heavenly/index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=34&Itemid=500


ivus

Hi kingo_2k2,

Firstly, this is not technically a VM issue. Because you've had a third party developer create your gate builder software, the onus is really on them to fix your issue.

Having said that. I did have a quick look at it and it seems like there are a few issues. Nothing major.

Firstly there's a tonne of incorrect JSON calls on the page.


http://www.webworkscms.co.uk/heavenly/index.php?option=com_virtuemart&nosef=1&view=productdetails&task=recalculate&format=json&lang=en&customPrice%255B0%255D%255B17%255D%3D456%26customPrice%255B1%255D%255B21%255D%3D459%26customPrice%255B2%255D%255B22%255D%3D470%26customPrice%255B3%255D%255B23%255D%3D463%26customPrice%255B4%255D%255B24%255D%3D487%26customPrice%255B5%255D%255B25%255D%3D539%26customPrice%255B6%255D%255B26%255D%3D562%26customPrice%255B7%255D%255B27%255D%3D466%26customPrice%255B8%255D%255B29%255D%3D483%26customPrice%255B9%255D%255B30%255D%3D480%26customPrice%255B10%255D%255B41%255D%3D532%26customPrice%255B11%255D%255B42%255D%3D536%26customPrice%255B12%255D%255B46%255D%3D512%26quantity%255B%255D%3D1%26option%3Dcom_virtuemart%26virtuemart_product_id%255B%255D%3D34%26virtuemart_manufacturer_id%3DArray%26virtuemart_category_id%255B%255D%3D6


I can't see where it's being triggered, but it doesn't seem to be doing much harm at the moment. This is not the correct way to GET a JSON request.

The problem you're having with the images not updating is because the developer has used a JAVASCRIPT reserved word in on of the function... *tut *tut...

Towards the bottom, there is a function called "function updateImageGate(select){}"




   function updateImageGate(select)
   {
      var imageIndex = 0;
      
      var selects = jQuery('.product-fields select');
      
      var j = 0;
      for(;j<selects.length;j++)
      {
         if(selects[j].id == select)
            break;
      }
      
      var fieldIndex = j;
      
      console.log("field index: "+fieldIndex);
      
      var valueIndex = jQuery('#'+select).children('option').filter(":selected").index();
      
      var options = jQuery('.product-fields select').eq(jQuery('.product-fields select').length-1).children('option');
      
      var imageIndex = -1;
      var imageShow = false;
      var i=0
      
      for(; i<options.length; i++)




The bits in RED is wrong... the developer has used a reserved word where it is also being used in the same function (in GREEN).
There's only the 3 instances of this happening and the rest of the code is fine.

Do a change from select to selectid and everything works.



function updateImageGate(selectid)
{
var imageIndex = 0;

var selects = jQuery('.product-fields select');

var j = 0;
for(;j<selects.length;j++)
{
if(selects[j].id == selectid)
break;
}

var fieldIndex = j;

console.log("field index: "+fieldIndex);

var valueIndex = jQuery('#'+selectid).children('option').filter(":selected").index();

var options = jQuery('.product-fields select').eq(jQuery('.product-fields select').length-1).children('option');

var imageIndex = -1;
var imageShow = false;
var i=0

for(; i<options.length; i++)



This works for me when I update it through Firebug (Firefox) and Inspector (Google Chrome).

Good luck.

kingo_2k2

Thanks alot for your help regarding the image, appologies if I have posted this in the wrong section, regarding the price I thought I would post it here because to me this seems to be a virtuemart problem, the price will update on all other browsers but chrome, once selecting a product variant the price will change to match, on chrome the correct price is actually added to the cart when you check out however the price is not updated on the product page I have no idea why it would work on all other browsers but chrome, unlucky for us this is the browser the client is using and wants this fixing before he will go live with the website :P been abit of a nightmare the whole process hehe

ivus

Right... in that case, this may be the issue:




Firstly there's a tonne of incorrect JSON calls on the page.

http://www.webworkscms.co.uk/heavenly/index.php?option=com_virtuemart&nosef=1&view=productdetails&task=recalculate&format=json&lang=en&customPrice%255B0%255D%255B17%255D%3D456%26customPrice%255B1%255D%255B21%255D%3D459%26customPrice%255B2%255D%255B22%255D%3D470%26customPrice%255B3%255D%255B23%255D%3D463%26customPrice%255B4%255D%255B24%255D%3D487%26customPrice%255B5%255D%255B25%255D%3D539%26customPrice%255B6%255D%255B26%255D%3D562%26customPrice%255B7%255D%255B27%255D%3D466%26customPrice%255B8%255D%255B29%255D%3D483%26customPrice%255B9%255D%255B30%255D%3D480%26customPrice%255B10%255D%255B41%255D%3D532%26customPrice%255B11%255D%255B42%255D%3D536%26customPrice%255B12%255D%255B46%255D%3D512%26quantity%255B%255D%3D1%26option%3Dcom_virtuemart%26virtuemart_product_id%255B%255D%3D34%26virtuemart_manufacturer_id%3DArray%26virtuemart_category_id%255B%255D%3D6

I can't see where it's being triggered, but it doesn't seem to be doing much harm at the moment. This is not the correct way to GET a JSON request.




I think it's the reason why your prices aren't updating because of this parameter in the query string "task=recalculate".

Get the developer to fix it.

Did you sort out the other issue with the images? because that wasn't working on my version of Chrome either.

kingo_2k2

Hi,

I put the code you provided me inplace of what was already there seems to have worked so thanks for that! problem I have is the developer we had is not getting back to us obviously did this quickly and didnt think about these issues, if anyone else can help with this small issue that would be super! thanks for the help so far.