amazoncode2link

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - 3D-Print/Production
Introduced first in SolidGeometry 5.0, Creation date: 2020-12-13, Last change: 2025-09-15

returns a valid link from the 10-digit alphanumeric codes or opens the amazon product page (german amazon) in the browser

Description

SGLib uses a system for direct access to catalog parts from different suppliers for additional components required for production. Amazon is one such supplier. Amazon uses 10-digit alphanumeric codes in its HTML links, which can be used to call up the product pages directly. This function returns a valid link from the 10-digit alphanumeric codes or opens the amazon product page (default is german amazon) in the browser

See Also: amazonlink2code

Example Illustration

 missing image of amazoncode2link(code,ext)

Syntax

url=amazoncode2link([code,ext])

Input Parameter

code: 10 alphanumerical char code of amazon
ext: default is 'de'; but can be used to open other contries too

Output Parameter

url: url to use as web(url)

Examples


amazoncode2link('B01LCXPGXE')
amazoncode2link('B077ZWB9CP','com')




Copyright 2020-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function, amazoncode2link, is designed to generate a valid Amazon product URL from a given 10-digit alphanumeric code. It can also open the product page in a web browser. The function is part of the SG-Library and was introduced in SolidGeometry 5.0.

Input Parameters

Output

Algorithm Steps

  1. Retrieve the code parameter using getfuncparams with a default empty string.
  2. Retrieve the ext parameter using getfuncparams with a default value of 'de'.
  3. Check if code is empty. If it is, throw an error indicating the code is not valid and provide an example of a valid code.
  4. Construct the URL using the format 'https://www.amazon.' + ext + '/dp/' + code.
  5. If no output argument is specified (nargout==0), open the constructed URL in the default web browser using the web(url) function.

Example Usage

Algorithm explaination created using ChatGPT on 2025-08-19 07:30. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21