Qphoria wrote:
Remember the golden rule.. less is more. Changing this much code means that other mods may not match. In reality you are only changing one small part of the query so try to match on less if possible.
That will actually match in both places that you need it with the single operation (add and edit). And it lessens the chance that another vQmod that alters a different part of that query from breaking.
But other than that, yes you can alter ANY code in ANY php or tpl file except the main index.php file
You are totally right Q. In these days I'm more and more trying to code optimized
vqmod scripts with a particular care in order to avoid conflicts with other mods. To do so, I'm try to avoiding, as much as possible, "replace" function.
For this reason, I think a very good improvement could be the implementation of inline "after", "before" functions (listed in future features). What about their implementation?
At the moment I'm experimenting a sort of workaround in some cases... I'm not sure it is the best way to do things. Let me give you an example for your opinion/feedback.
Code: Select all
<operation>
<search position="after"><![CDATA[
$sql = "SELECT o.order_id, CONCAT(o.firstname, ' ', o.lastname) AS customer, (SELECT os.name FROM " . DB_PREFIX . "order_status os WHERE os.order_status_id = o.order_status_id AND os.language_id = '" . (int)$this->config->get('config_language_id') . "') AS status, o.total, o.currency_code, o.currency_value, o.date_added, o.date_modified FROM `" . DB_PREFIX . "order` o";
]]></search>
<add><![CDATA[
// madimar mod
$sql = str_replace (' FROM `', ', sr.name AS sales_rep FROM `', $sql);
$sql .= " LEFT JOIN " . DB_PREFIX . "sales_rep sr ON (o.sales_rep_id = sr.sales_rep_id) ";
// madimar mod end
]]></add>
</operation>
Basically in this way I mantain the original line unchanged in the code, limiting, hopefully the conflicts with other scripts.
What do you think about? Q, Jay?
Regards,
M