Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / How do you make the model numbers unique?

How do you make the model numbers unique?

Views: 2,600

Results 1 to 14 of 14
30 Sep 2014, 6:38 PM
#1
jokkah avatar

jokkah

New Zenner

Join Date:
Aug 2014
Location:
Northern Virginia
Posts:
81
Plugin Contributions:
0

How do you make the model numbers unique?

On the store I built, the model number field is being used to track inventory. Therefore, the value in this field must always be unique.

How can this be accomplished?

Thank you!

30 Sep 2014, 6:43 PM
#2
picaflor_azul avatar

picaflor_azul

Totally Zenned

Join Date:
Jul 2009
Location:
picaflor-azul.com
Posts:
6,940
Plugin Contributions:
28

Re: How do you make the model numbers unique?

jokkah:

On the store I built, the model number field is being used to track inventory. Therefore, the value in this field must always be unique.

How can this be accomplished?

Thank you!

You should not use the model number field for this. You should use products quantity field.

Thanks,

Anne

30 Sep 2014, 6:46 PM
#3
jokkah avatar

jokkah

New Zenner

Join Date:
Aug 2014
Location:
Northern Virginia
Posts:
81
Plugin Contributions:
0

Re: How do you make the model numbers unique?

picaflor-azul:

You should not use the model number field for this. You should use products quantity field.

Thanks,

Anne

Not tracking inventory meaning quantity, I mean to uniquely identify each product by its own unique product ID (in this case, the value in the model number field).

30 Sep 2014, 6:50 PM
#4
picaflor_azul avatar

picaflor_azul

Totally Zenned

Join Date:
Jul 2009
Location:
picaflor-azul.com
Posts:
6,940
Plugin Contributions:
28

Re: How do you make the model numbers unique?

jokkah:

Not tracking inventory meaning quantity, I mean to uniquely identify each product by its own unique product ID (in this case, the value in the model number field).

Zen cart assigns a unique product id to a product when you add one.

Thanks,

Anne

30 Sep 2014, 6:52 PM
#5
jokkah avatar

jokkah

New Zenner

Join Date:
Aug 2014
Location:
Northern Virginia
Posts:
81
Plugin Contributions:
0

Re: How do you make the model numbers unique?

picaflor-azul:

Zen cart assigns a unique product id to a product when you add one.

Thanks,

Anne

I know this. It is the primary key. However, the products are being tracked by a unique product ID already located on a sticker on the product itself. The model number field is being used to input this number from the sticker on each product.

I just need to know how to make this field unique, that is all.

30 Sep 2014, 6:54 PM
#6
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: How do you make the model numbers unique?

If you're talking about a seperate model number for each attribute (size, color, etc.), Zencart can't do that with the current version. There is a Stock by Attribute mod.

30 Sep 2014, 7:07 PM
#7
jokkah avatar

jokkah

New Zenner

Join Date:
Aug 2014
Location:
Northern Virginia
Posts:
81
Plugin Contributions:
0

Re: How do you make the model numbers unique?

stevesh:

If you're talking about a seperate model number for each attribute (size, color, etc.), Zencart can't do that with the current version. There is a Stock by Attribute mod.

No. Let me give an example.

I have my store, my store has 5 coin's for sale. It is a coin business.

Coin #1 - Model # - 10001
Coin #2 - Model # - 10002
Coin #3 - Model # - 10003
Coin #4 - Model # - 10004
Coin #5 - Model # - 10005

You see, each coin has a unique model #.

I want to PREVENT something being added into products that has the same model # as one already in the system. So someone could NOT enter a product with a model # of 10001 for example.

Is this more clear now?

Thank you

30 Sep 2014, 7:11 PM
#8
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: How do you make the model numbers unique?

In Zen Cart the "products_id" is used to uniquely identify each product (think of this as a Zen Cart specific product SKU). This is used internally by Zen Cart to track inventory, manage orders, etc.

It sounds like you want to use a 3rd party software (such as QuickBooks) to manage your inventory... And in your 3rd party software you are identifying products by "model" (and not by the Zen Cart product SKU) ...

If this is the case, you will need to find additional software to integrate (and provide synchronization inventory / data between) the two pieces of software involved. Most well written synchronization software will be able to MAP the Zen Cart product SKU <==> the 3rd Party product SKU.

NOTE: Of course a poor man's solution may be to alter the database table "products" changing the index "idx_products_model_zen" to unique (enforcing unique model numbers at the database level) and the column "products_model" to not allow NULL values (forcing products to have a model)... But this will complicate the upgrade process in the future... And one will still need to synchronize the inventory model, status, quantity, and other data between Zen Cart and the 3rd party inventory management software... Either by hand or using another 3rd Party tool for integration...

1 Oct 2014, 11:04 AM
#9
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: How do you make the model numbers unique?

lhungil's tiny text suggestion should work, but I don't know what error message you would see (if any) when you tried to add a model number that is in use. Be easy enough to check on a test Zencart installation. There's this for after-the-fact:

http://www.zen-cart.com/downloads.php?do=file&id=1323

1 Oct 2014, 4:38 PM
#10
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,872
Plugin Contributions:
7

Re: How do you make the model numbers unique?

If I wanted to prevent me duplicating model numbers I would use some javascript to check what you put in the model number in the admin product page to check if it exists or not as you type.

I would use this Instant Search mod as a guide how to do it as it searches the db in real time.

http://www.zen-cart.com/downloads.php?do=file&id=1336

Then you don't have to mess with the database or the code of that admin page.
You just have to educate the user to take heed of the warning.

1 Oct 2014, 5:05 PM
#11
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: How do you make the model numbers unique?

torvista:

You just have to educate the user to take heed of the warning.

Easier said than done. ;-)

Cheers
RodG

1 Oct 2014, 6:24 PM
#12
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: How do you make the model numbers unique?

Alternately, in the preview_info.php file in the admin/includes/modules directory for each of the product types a database search could be performed on the model number and if the model number exists, take/display/perform the desired next action whether it be to prevent the accept button from showing or display a message, orwhat have you.

1 Oct 2014, 7:17 PM
#13
jokkah avatar

jokkah

New Zenner

Join Date:
Aug 2014
Location:
Northern Virginia
Posts:
81
Plugin Contributions:
0

Re: How do you make the model numbers unique?

torvista:

If I wanted to prevent me duplicating model numbers I would use some javascript to check what you put in the model number in the admin product page to check if it exists or not as you type.

I would use this Instant Search mod as a guide how to do it as it searches the db in real time.

http://www.zen-cart.com/downloads.php?do=file&id=1336

Then you don't have to mess with the database or the code of that admin page.
You just have to educate the user to take heed of the warning.

Thanks for your suggestion but I am afraid to tell you that Instant Search is not working on 1.5.3....so thats that.

1 Oct 2014, 9:54 PM
#14
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,872
Plugin Contributions:
7

Re: How do you make the model numbers unique?

Instant Search is not working on 1.5.3
Really? Tell the author.
It's working on my 1.53 site. Can't remember if I had to fix anything extra...I customised it long ago.

....so thats that.
No it isn't. That's why (I think) most people use Zen cart or any open source software... anything is fixable. And most mods seem to not work initially, depends on the author.

I suggested Instant Search not as a solution but as something that came to mind that uses javscript and php together to get a real-time result. Easier to copy something than invent it.

Anyway if you want to make your data entry idiot-proof you'll have to do it more thoroughly than just a warning, as Rod says.