Jump to content

Product Id = image name mod


Guest hobbyofkings

Recommended Posts

Guest hobbyofkings

Hello All, with my shop i have found it easiest to name my images with the same name I aim to use for product ID - easier to administrate as it were. sell product au0026-001 delete image au0026-001 rather than having to lookup product inorder to determine which image should go.

Anyhow rather than double type I moded the produce productId code so that a blank box will assign name from image file name (less last 4 characters so at the mo built for three letter extensions) instead of a random sequence.

What I was wondering is if this would be good for anyone else as if so I will make it neat and modifiable and post it, but if no one cares I won't bother.

Note that this is for CC3

Remember

It's your phone,

It's your choice.

Link to comment
Share on other sites

Guest hobbyofkings

Good Version Now. Move to Mods if it is worth it...

Anyway insert the new bit below into the index.php in admin>products

Hope it is useful for someone

// generate product code

if(empty($_POST['productCode'])){

//Starts here

$imageFormat =strtoupper(ereg_replace(".*\.(.*)$","\\1",$_POST['imageName']));

$len = (strlen($_POST['imageName']) - strlen($imageFormat))-1;

$code = substr($_POST['imageName'],0,$len);

if ($code){

$record["productCode"] = $db->mySQLSafe($code);

}else{

//ends here

$chars = array

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...