I’ve been teaching myself the internals of OXID Modules and have hit a bit of a stumbling block:
My main ‘aim’ at the moment, is to add a new tab in the admin-area, where you can add one extra image to each product. I’ve created a new module with a menu.xml which creates a new tab in the product-editor, and I duplicated some code from the “Bilder” tab to make a new upload field. I’ve created a new database table to store the new image (I don’t want to store it in oxarticles if possible).
The problem I have now is how to extend the oxarticle class so I have access to the new image. I’ve created and registered a module but have no idea how to create the oxField object inside it to hold the picture:
This is the code I have so far, but I’m unsure where to put my code. I don’t think save() ever gets called:
<?php
class mypicture_article extends mypicture_article_parent {
public function save() {
$this->oxarticles__testimage = new oxField(basename($this->oxarticles__testimage->value), oxField::T_RAW);
}
}
?>
Can anyone give me a pointer in the right direction? I’m on my 8th cup of coffee and am having trouble holding the mouse still at the moment…
[QUOTE=david;27279]Managed to get this sorted myself. Instead of using save(), I created a new function which loads the needed information directly from the database.[/QUOTE]
Why not [B]just use(!) [/B]"[B]$product->oxarticles__testimage[/B]" in your template?
OXIDs “[B]lazy loading[/B]” will sort that out for you automatically.
No need to do anything in addition, no module, no nothing.
Did you clear your tmp folder ? The field names are being cached there, so if you add new ones or alter any of them you always have to clear up the tmp.