Post by mwentosana » Tue Aug 30, 2011 1:42 pm

Hi. Is there any extension or way to make the product/model code auto generate itself? A string of letters and numbers, preferably ascending in a logical order, that generates itself, would be so much easier than typing it yourself.

Thanks in advance.

Newbie

Posts

Joined
Tue Aug 30, 2011 1:31 pm

Post by Concept211 » Thu Dec 01, 2011 11:07 pm

I'm looking for the same feature. I don't really care what the model code is so an auto-gen would be great! Will make adding multiple produts much faster.

User avatar
New member

Posts

Joined
Fri Oct 14, 2011 1:40 am

Post by uksitebuilder » Sat Dec 03, 2011 8:03 pm

easiest way to do it would be to use epoch time in seconds from January 1st 1970

That way it will always be unique and only 1 small file edit is required to accomplish it

edit: admin/view/template/catalog/product_form.tpl

find

Code: Select all

<input type="text" name="model" value="<?php echo $model; ?>" />
change to

Code: Select all

<input type="text" name="model" value="<?php echo ($model==''?time():$model); ?>" />

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by Concept211 » Sat Dec 03, 2011 8:11 pm

Great suggestion, uksitebuilder - thanks!

User avatar
New member

Posts

Joined
Fri Oct 14, 2011 1:40 am

Post by Concept211 » Thu Jan 05, 2012 12:58 am

I went ahead and created a vQmod for uksitebuilder's idea:
http://www.opencart.com/index.php?route ... on_id=4505

Enjoy!

User avatar
New member

Posts

Joined
Fri Oct 14, 2011 1:40 am

Post by harryo40 » Fri Jan 20, 2012 7:17 pm

uksitebuilder wrote: find

Code: Select all

<input type="text" name="model" value="<?php echo $model; ?>" />
change to

Code: Select all

<input type="text" name="model" value="<?php echo ($model==''?time():$model); ?>" />
@ UKSB,
Is there a way of having this line of code to UPDATE or REPLACE any existing number in the model field?
For example, if I have a product template set up & I copy that & then edit the copy, it will have the model number already in, but I would like to replace it using the line of code above if its possible?
cheers ;)

Add To Cart Confirm Ajax Popup for OC 1.5.1.3 --> 1.5.5.1 - Add to Cart Confirmation Popup
Image Map Banner Module - Image Map Banner Module
----------------------------------------------------------------------
Womens Famous Name Fashion Clothing at bargain prices - Next2nowt.com


Active Member

Posts

Joined
Wed Oct 21, 2009 3:37 am
Location - Blackburn, Lancashire

Post by namnhibatbai » Thu Mar 21, 2013 4:43 am

@UKSB

Can you modify auto generate model/product code base product ID?

Thank you.

Newbie

Posts

Joined
Thu Mar 21, 2013 4:38 am

Post by appaji » Fri Jul 19, 2013 9:34 pm

Hi UKSB..
How do I add Aplhabets with Hyphen before the generated number, something like "APP - " then the generated number..
Thank you for the tip already provided...

Newbie

Posts

Joined
Thu Jan 17, 2013 5:34 pm
Who is online

Users browsing this forum: No registered users and 278 guests