How can I get the product variant url
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 16
- Joined: 06 Jun 2024, 04:34
How can I get the product variant url
Hello, I noticed this piece of js code in catalog-detail.js and I'd like to know how can I get the correct url so we can make promos on some variants so when people click on the link the product variant is preselected.
Code: Select all
/**
* Check for variants in URL
* Set the variant attributes and trigger select-dropdown´s to show the variant article
*/
onSelectVariant() {
const product = $('article.product');
if(product && product.data('varattributes')) {
$.each(product.data('varattributes'), function (key, val) {
$('#select-' + product.data('id') + '-' + key).val(val).trigger('change');
});
}
},
-
- Posts: 16
- Joined: 06 Jun 2024, 04:34
Re: How can I get the product variant url
got up to this link http://localhost:8081/default/shop/asdf/0/26501?d_articleid=26504 which produces the varattributes in javascript but there's no effect on the ui.
Re: How can I get the product variant url
This is what's relevant for the UI:
Code: Select all
#select-' + product.data('id') + '-' + key
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

-
- Posts: 16
- Joined: 06 Jun 2024, 04:34
Re: How can I get the product variant url
yea I did the console log and it works till there but i think the problem is that .trigger('change') does not work or something since it doesn't select the variant options in the ui (could it be because I'm using radio buttons and not dropdown select?)
Re: How can I get the product variant url
Most likely, the "change" trigger must be added when the document is loaded. Can you check and create a pull request with the necessary change afterwards?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,
