Product URL in mini basket

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
columbo
Advanced
Posts: 126
Joined: 09 Oct 2019, 09:42

Product URL in mini basket

Post by columbo » 03 Aug 2023, 10:16

Hi,

how can we add the product url in mini basket?
As the url is not part of basket object I added

Code: Select all

data: {'include': 'product'},
parameter, in aimeos.js:

Code: Select all

fetch(jsonurl, {
	method: "OPTIONS",
	headers: {'Content-Type': 'application/json'}
}).then(response => {
	return response.json();
}).then(options => {
	fetch(options.meta.resources['basket'], {

		//added to get the product object with product-url / href 
		data: {'include': 'product'},

		headers: {'Content-Type': 'application/json'}
	}).then(response => {
		return response.json();
	}).then(basket => {
		AimeosBasketMini.updateBasket(basket);
	});
});
but it is not working

Thank you!

User avatar
aimeos
Administrator
Posts: 7907
Joined: 01 Jan 1970, 00:00

Re: Product URL in mini basket

Post by aimeos » 04 Aug 2023, 05:18

You have to add the URL in the template:
https://github.com/aimeos/ai-client-htm ... #L138-L159
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

columbo
Advanced
Posts: 126
Joined: 09 Oct 2019, 09:42

Re: Product URL in mini basket

Post by columbo » 07 Aug 2023, 18:58

ok, now URLs are displayed,
but after adding another product to cart - without reloading the page - all product links are gone

I think .js (aimeos.js, basket-mini.js) has to be edited so that the url gets added to the prototype-item. But I can't find the product url in js.

User avatar
aimeos
Administrator
Posts: 7907
Joined: 01 Jan 1970, 00:00

Re: Product URL in mini basket

Post by aimeos » 08 Aug 2023, 10:36

The mini basket is also updated here using the JSON API but it's not possible to get the generated product URLs from there:
https://github.com/aimeos/ai-client-htm ... .js#L9-L71
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply