Is is possible in vQmod to checks if a method exists in a class. Only if it doesn’t exist will it make the change.
E.g at the moment I have a simple vqmod which is causing problems with another extension that is also making the same change and causing the duplicate method error.
<file name="catalog/model/tool/image.php">
<operation>
<search position="after"><![CDATA[
class ModelToolImage extends Model {
]]></search>
<add><![CDATA[
public function get($filename) {
if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
return;
}
if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
return HTTPS_IMAGE . $filename;
} else {
return HTTP_IMAGE . $filename;
}
}
]]></add>
</operation>
</file>
Also is there any way to give priority to one vqmod over another. I need 2 vqmod files to already the code of the vqmod before?
It’s not possible to add only if the method doesn’t exist no. The trick is to “hijack” the original, or rename it. As for priority, they get parsed a to z so if you want it applied first, name it something that comes before the other alphabetically, or just prepend aaa to the name