Zen Cart Logo
Forums / Contribution-Writing Guidelines / New Product Type language definition location?

New Product Type language definition location?

Views: 4,685

Results 1 to 6 of 6
21 Jun 2021, 4:53 PM
#1
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
944
Plugin Contributions:
3

New Product Type language definition location?

I'm effectively trying to recreate a custom product type that I had in v1.5.3 in v.1.5.7c and I'm running into a problem with the language file.

I defined and created a product type called "product_cards_ufs" and have placed it's definition into the admin table. I made a collect info as /admin/includes/modules/product_cards_ufs/collect_info.php and a language file under /admin/includes/languages/english/product_cards_ufs.php.

I'm trying to test out the file now in the admin area but noticed that for some reason, my definitions are not being loaded. Where there is supposed to be the text defined as this:

define('TEXT_UFS_DIFFICULTY', 'Difficulty:');

And I have the text of product_cards_ufs/collect_info.php as this:

<?php echo TEXT_UFS_DIFFICULTY; ?> <br />
<?php echo zen_draw_input_field('difficulty', $pInfo->difficulty, 'class="form-control" id="difficulty" style="text-align:center; width: 105px;" min="0" max="9"', false, "number"); ?>

But on the collect_info in the admin, instead of seeing the defined text, I just see the constant name. Before I throw this language definition into extra_definitions, which I think is less than ideal, is there a place where this is supposed to be?

21 Jun 2021, 5:18 PM
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,690
Plugin Contributions:
56

Re: New Product Type language definition location?

The product_music.php file contents were migrated to admin/includes/languages/english/extra_definitions in 1.5.6, so I think that's your answer.

21 Jun 2021, 5:22 PM
#3
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
944
Plugin Contributions:
3

Re: New Product Type language definition location?

swguy:

The product_music.php file contents were migrated to admin/includes/languages/english/extra_definitions in 1.5.6, so I think that's your answer.

That's what I was afraid of but so be it. Thanks.

21 Jun 2021, 5:45 PM
#4
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,956
Plugin Contributions:
8

Re: New Product Type language definition location?

retched:

That's what I was afraid of but so be it. Thanks.

why is this a problem? (curious minds are curious.)

you can just move the file intact to the extra_definitions folder and you are done. i think....

21 Jun 2021, 6:24 PM
#5
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,690
Plugin Contributions:
56

Re: New Product Type language definition location?

Extra definitions are global. These files are only needed locally when products of that type are being managed.

21 Jun 2021, 6:45 PM
#6
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: New Product Type language definition location?

Alternatively and a way to go around your elbow to get to your thumb sort of way of doing it would be to incorporate this information as a ZC plugin loaded to the zc_plugins directory and using the admin path with the filename as product.php such as:

zc_plugins/PLUGINNAME/VERSION/admin/includes/languages/YOURLANGUAGE/product.php

If your "plugin" gets registered with the system, then this file will load in addition/after the base install of product.php and would allow that file not to be loaded on each page load, but instead only while handling/processing product in the admin.

Alternatively, you could have your collect_info.php file load the language file before use as an alternative as well... Yes it would make/extend the changes made to support your product type, but....

Using the above "plugin" method shouldn't get in the way of its catalog side use (at least for now) because your "install/remove" could handle all of the database manipulation needed to incorporate/remove that product type at least from the database. The catalog side (for now at least) still uses unique filenames for product types.

Now I also thought that either it is in 1.5.7 or perhaps 1.5.8 where an admin filename could have an extension and would also be loaded (such as your product_cards_utf.php) and any language file that begins with "product" would also be loaded... I've half-heartedly been trying to find the discussion I saw on that topic and apologize for spreading rumors of such a capability, but am still interested in finding out how/when I could take advantage of that operation.