Copy link to clipboard
Copied
What I am trying to avoid is manually entering poplet image paths for each product in the online store. I have a PHP solution, but that obviously won't work (no server side coding).
Ideally it would look something like:
Look in folder: {tag_productcode}
Pull all image paths
Insert into <img> tags
Insert into html
I'm probably dreaming here, but does anyone know of a work around to making something like this happen?
You can set up a simple naming convention.
You have your large image...
productname-large.jpg
And then another folder which is...
/poplets/
And in there you would have..
productname-poplet1.jpg, productname-poplet2.jpg, productname-poplet3.jpg, productname-poplet4.jpg
You would fetch the path of the large image with javascriptjquery.
You know that -large.jpg is always at the end so you can strip that and store the product name in a variable.
Then you can just run a loop knowing the folder and images will
...Copy link to clipboard
Copied
You can set up a simple naming convention.
You have your large image...
productname-large.jpg
And then another folder which is...
/poplets/
And in there you would have..
productname-poplet1.jpg, productname-poplet2.jpg, productname-poplet3.jpg, productname-poplet4.jpg
You would fetch the path of the large image with javascriptjquery.
You know that -large.jpg is always at the end so you can strip that and store the product name in a variable.
Then you can just run a loop knowing the folder and images will have the same flowing structure and pre-pend the product name value and render them out as you need to.
Copy link to clipboard
Copied
Thanks Liam, this seems like an excellent solution. The one downside is still having to batch rename the images for each product, but the trade-off makes that seem trivial.
I'll give it a shot and post back with any code or increases in efficiency. Thanks.