Miva Merchant Development by Scot's Scripts

IMAGES: How to Get Current Miva Merchant Image Directory

Miva Knowledge Base
IMAGES: How to Get Current Miva Merchant Image Directory
Important Notice: This information is for internal reference only. Use at your own risk.
Does Google actually understand your Miva Merchant store? Our JSON-LD schema generator makes sure it does. Contact us to get started. (more info)

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