product_types.php details
Does anyone here know about this file (under "admin") in detail?
It looks like it's been setup for creating new product types, and as a relative newcomer to php I thought I'd just ask before going too much further.
Whilst there's some code there for it, it doesn't look very convincing, so unless I'm missing something (which is quite possible) I think it's just the beginnings of something, rather than actually functioning properly. Is that right?
Regards
Mark
Re: product_types.php details
Think your right in your assessment. I have just started creating a new product type - it's more involved than I thought but from what I can gather so far involves the following.
Adding your new type to the product_type table in the db, duplicating or creating a the associated product_type_layout table entries for the data fields your interested in, duplicating and modifying about ten .php files with the new product name.
Then hopefully your type will be available for use - but the reason I'm creating a new type is because I want new data fields and actions and this means you have to modify the type handler to deal with your new fields. I've not got that far yet!
That is the limit of my knowledge I'm afraid.
All the best!
Re: product_types.php details
Re: product_types.php details
Yes, I know there's no available interface for adding product types.
I've got some code that (I think) does the job and I'm now in the process of linking it in to the admin panel.
Whilst in that process I found "insert" code stubs, and I just want to check that they are stubs, and it's not that I'm misunderstanding.
You're right, the process of adding a product type is not very straightforward. There was a thread here about this in which Dr. Byte gave me some useful pointers.
I'm close to producing something that I hope will fit the bill.
I s'pose if it can add then it ought to delete as well... :cry:
Regards
Mark
Re: product_types.php details
Am very interested in what your doing as it could be a quicker route for me. If I can help in any way let me know -I'm not particularly fluent in php cos I'm a hardware eng but can hack my way around a bit.
Re: product_types.php details
Thank you.
I will need to have someone test it. Once I've been able to run it through a few times I will ask you. if that's ok.
Regards
Mark
Re: product_types.php details
Have you downloaded and studied the files for the Book Product Type that is available?
Re: product_types.php details
Re: product_types.php details
Yeah count me in as your personal tester - I'm good at breaking things!
Re: product_types.php details
Not quite the "quick route" either of us had hoped for p'raps :blush:
I've not forgotten about this.
The (main) problem I've come up against so far is entries in the product type layout table. Yeah, I could miss this out, but that makes the exercise even more toothless than it might be anyway, and if you know enough to add the layout keys yourself, you probably know enough to do the whole thing manually.
The configuration key (names of the layout elements) needs to be unique across the whole table (which seems a little perverse to me, but then what do I know).
I could make 'em up, it would be great to think that all the keys contain the name of their corresponding product type and that would be easy to replace, but that's not the way it is at the moment. I don't s'pose there's a sensible way to enforce that even if you wanted to.
Also, it looks to me as if this is presenting the user with more of the technicalities of the internals than anything else does, so I don't have any precedents to go by :no: which is making me hesitate about it too.
Ah, the problems of the creative process :cry: .
Anyone got any (useful) thoughts at this juncture?
Regards
Mark
Re: product_types.php details
Exactly what are you wanting to accomplish?
Re: product_types.php details
I'm trying to accomplish adding configuration keys into the product layout table so that my "add a product type" code isn't a complete waste of time.
Re: product_types.php details
OK, this is the problem, and my solution.
The product type layout table drives the product type settings editing screen.
Without specific entries for the product type that screen has nothing on it.
This makes it a bit useless being able to add a new type.
The new entries have configuration keys, which are effectively the names of the entry lines on that screen, and they have to be unique across the whole table (dammit!). These keys have to match up with something I guess, which means keeping track of the changed names (I've only just thought of that! :( .
The problem with this is that, when generating a new product type, how do I guarantee unique names? If the type I'm using to copy from has sensibly named keys (ie containing the product type name) it's not too hard, but if not?
Alright, what I'm thinking to do is this :
Generating a new product type I ask for a new name and old type to base the new type on.
I'll find all the layout definitions for the product type that I'm copying from,
if I can find the old product type name in the configuration keys I'll replace it with the new product type name.
Otherwise I'll just add the new product type name!
If someone can point me to a piece of code that finds the common text in a whole load of strings that'd help, but this will work anyway. I think.
Comments welcomed.