Miva Merchant Development by Scot's Scripts

IMAGES: How to Get Current Miva Merchant Image Directory

Miva Random Code Trivia

Want to start an online store? We work with you from start to finish, from commerce platform to design to SEO.
Experience counts, and we have a lot.

WARNING:

This information is offered "AS IS" for internal reference only. Use at your own risk.
Does AI actually understand your Miva Merchant store? Our smart JSON-LD schema generator makes sure it does. Contact us to get started. (more info)
SEO Audit & Inquiries • News & Updates • SEO for Miva Merchant

IMAGES: How to Get Current Miva Merchant Image Directory

THIS CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED;
THE AUTHOR DISCLAIMS ALL LIABILITY FOR ANY DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR STORE DISRUPTIONS ARISING FROM ITS USE.

Scot Ranney • February 24, 2024


Miva Script: This code is buried in the LSK. Seems like it should be a global instead of having to come up with it this way.

<MvIF EXPR = "{ NOT [ g.Module_Library_DB ].StoreKey_Load( 'Images', l.storekey ) }">
	<p>Error: Storekey for images not found, current image directory not set.</p>
<MvELSE>
	<MvASSIGN NAME = "l.imagedir" VALUE = "{ 'graphics/' $ padl( g.Store:id, 8, '0' ) $ '/' $ ( floor( ( l.storekey:maxvalue + 1 ) / 2500 ) + 1 ) $ '/' }">
</MvIF>

Template Code (SMT):

<mvt:do file="g.Module_Library_DB" name="l.success" value="StoreKey_Load('Images', l.storekey)" />

<mvt:if expr="NOT l.success">
	<p>Error: Storekey for images not found, current image directory not set.</p>
<mvt:else>
	<mvt:assign name="l.imagedir" value="'graphics/' $  padl( g.Store:id, 8, '0' ) $ '/' $ ( floor( ( l.storekey:maxvalue + 1 ) / 2500 ) + 1 ) $ '/'" />
</mvt:if>

https://www.scotsscripts.com/mvblog/images-how-to-get-current-miva-merchant-image-directory.html

images mivascript smt