Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Product
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Apr 2013 at 10:47 UTC
Updated:
22 Jul 2013 at 13:21 UTC
The autocomplete for products is not working with custom international URL's
The issue is caused by splitting up URL into args.
The current split is limited to only 5 args, while with multi country/language setups, you can have more.
Example: http://example.com/BE/en/commerce_product/autocomplete/commerce_product/...
Where "BE" represents the country and "en" represent the language
The rest is of the URL is a normal autocomplete link.
How do I resolve this?
I tried to use make the autocomplete path absolute but this does break the widget '#autocomplete_path' => '/commerce_product/autocomplete/commerce_product/line_item_product_selector/product',
Comments
Comment #1
rszrama commentedCan you explain to me how you split up your language URL argument like that?
Comment #2
thim commentedHi Rszrama,
That's the way the webstore is build-up.
http://shop.schoellerallibert.com/BE/en
Where BE (or NL, LU, DE, ...) stands for the country
And en (or nl, de, fr, ...) stands for the language in that country.
We have 1 central platform which has this country AND language specific context.
For a technical reason, if you are logged-in in the back-end the respects this country and language context.
Which causes that the base URL is always like:
http://shop.schoellerallibert.com/BE/en/admin/commerce/products
This causes the URL args to have an additional 2 more parameters in autocomplete($entity_type, $field_name, $bundle, $string = '') and the autocomplete URL looks like:
http://www.domainname.com/BE/en/commerce_product/autocomplete/commerce_product/line_item_product_selector/product/bigSInce the previous version of Commerce (7.x.1.3), this extra coded was added to the autocomplete function.
Since it fixed to 6 URL arguments, it causes to take the incorrect arguments which causes the function to return no results.
I can take away these lines or increase the number of arguments, but perhaps you have a better solution?
Regards,
Tim
Comment #3
rszrama commentedI was actually looking for more of a tutorial for how to reproduce what you've done with the URLs. Also, is there any way for you to simply ignore the i18n URL prefix for the autocomplete URL?
Comment #4
thim commentedI'll look into it and provide you with some more information
Comment #5
rszrama commentedWell, regardless of how you've configured yours, I created a simple workaround to offset that array_splice() based on the argument position of commerce_product. This will work regardless of how many leading arguments there are.
Commit: http://drupalcode.org/project/commerce.git/commitdiff/cfc8326
Comment #6
thim commentedTested and confirmed this is working as expected.
Comment #7.0
(not verified) commentedCorrected typo's and improved description