VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: seyi on April 30, 2012, 19:51:17 PM

Title: Address State Does not Autopopulate after Country Selection with SEF
Post by: seyi on April 30, 2012, 19:51:17 PM
I checked SVN before posting.


If I go specifically to this url to edit the billing address:
index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=BT

In my shop, this is an sef url:
shop/user/editaddresscart?addrtype=BT

The ajax for auto populating the State after selecting a Country fails.  I fixed it by updating /components/com_virtuemart/assets/js/vmsite.js and changing this line

$.getJSON('index.php?option=com_virtuemart&view=state&format=json&virtuemart_country_id=' + byAjax,


to this

if(window.vmSiteurl == undefined) window.vmSiteurl = '';
$.getJSON(window.vmSiteurl+'index.php?option=com_virtuemart&view=state&format=json&virtuemart_country_id=' + byAjax,


It works now.
Title: Re: Address State Does not Autopopulate after Country Selection with SEF
Post by: Milbo on May 01, 2012, 21:12:20 PM
I am sorry, what do you mean with autopopulate?
Title: Re: Address State Does not Autopopulate after Country Selection with SEF
Post by: PRO on May 01, 2012, 22:50:12 PM
do you have "vmart states and countries" javascript enabled?

Title: Re: Address State Does not Autopopulate after Country Selection with SEF
Post by: seyi on May 02, 2012, 18:40:15 PM
It certainly does require javascript.  When editing or adding an address, if you select United States, the States dropdown is automatically filled with all the states in the US.  If you select Canada, all the provinces are added to the States dropdown... and so on and so on.
Title: Re: Address State Does not Autopopulate after Country Selection with SEF
Post by: Milbo on May 02, 2012, 18:57:15 PM
It still works for me, so I wonder.

Seyi, which version? and please take a look on our changes to the watinglist, I remember you use it already somehow.
Title: Re: Address State Does not Autopopulate after Country Selection with SEF
Post by: seyi on May 05, 2012, 22:02:25 PM
Version 2.0.6.

Do you have sef enabled?  It works fine for me when the url is:
index.php?option=com_virtuemart&view=user&task=editaddresscart&addrtype=BT

With sef enabled, when the url is
shop/user/editaddresscart?addrtype=BT

It does not work.
I think the ajax appends the url
shop/user/editaddresscart/index.php.....


Whats the problem with the waiting list?
Title: Re: Address State Does not Autopopulate after Country Selection with SEF
Post by: ariplatinum on May 06, 2012, 00:42:44 AM
I also had this problem come up, however it wasn't because of VM SEO option turned on.... Rather it was AceSEF that broke this.

I have since gone back to VMs built in SEO option (should really be renamed SEF in my opinion) and it works again (along with a whole raft of other JS functions like dynamic pricing etc)
Title: Re: Address State Does not Autopopulate after Country Selection with SEF
Post by: seyi on May 06, 2012, 01:15:18 AM
actually yes, Im not using VM's seo, Im using AceSef.  After a few little tweaks, its working fine.
Title: Re: Address State Does not Autopopulate after Country Selection with SEF
Post by: ariplatinum on May 06, 2012, 05:39:42 AM
Perhaps suggest these tweaks to the developer or post them here please... For whatever the reason AceSEF broke:
-Auto State population after country select
-Dynamic pricing calculation
-Offline credit card processor link in cart, kept redirecting to front page
-add to cart button

The developer was nice enough to look into it for me for a few days, however I need my site to go live asap so I couldn't wait any longer for them to try to figure out what was going wrong. I suspect it is a bug in their router causing a clash with VM's JS.
Title: Re: Address State Does not Autopopulate after Country Selection with SEF
Post by: seyi on May 08, 2012, 01:26:26 AM
The only problem I recollect having for adding to cart is when the website is in https.  The javascript ajax did not work, and that was due to vmSiteurl being set to the full url.  For example, I am on this page:
https://www.mysite.com/index.php?option=com_virtuemart....

In the javascript on the page:
vmSiteurl = 'http://www.mysite.com/' ;

To fix it, I set the vmSiteurl to a relative path in helpers/config.php.  That way do not have to worry about the protocol.

Title: Re: Address State Does not Autopopulate after Country Selection with SEF
Post by: qwerty123456789 on May 08, 2012, 08:41:34 AM
I changed that code but still not working, history and cookies cleaned, also I can't choose title : Mr/Mrs , it simply doesn't work.

(http://s14.postimage.org/m60vdpm4h/Zrzut_ekranu_2012_05_8_o_02_50_19.png)
Title: Re: Address State Does not Autopopulate after Country Selection with SEF
Post by: seyi on May 08, 2012, 11:14:05 AM
I just realized I used <?php and ?> within the code.  It is not php, but javascript.  If you used those tags in the code, then that would cause problems, take them out.

To debug load it in google chrome, right click on the page, click 'inspect element', click the console tab and try the dropdown.  Any javascript error will show up there and that should give you an indication of what the problem is.