Miva Merchant Modules and Development
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.

IMAGES: How to Get Current Miva Merchant Image Directory

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

mvkb_images mvkb_mivascript mvkb_smt