Reputation: 90
I am working on an opencart project. There is a new module call discounts in the project implemented by another developer. I have copied the related files and related methods in to a new project and it worked well. I have created a discount.ocmod.zip file with the new files related to the discount module and I have created the install.xml file to update a default php file(I'm updating the product.php), but after I install the extension, the files get copied to the correct locations, but product.php doesn't get updated with my new functions. What am I doing wrong here?
This is the modification log.
This is my xml file:
<?xml version="1.0" encoding="UTF-8"?>
-<modification>
<generator>Created with OpenIX - https://openix.io/en/tool/opencart/ocmod</generator>
<name>installment plan</name>
<version>0.1</version>
<code>20778</code>
<author>Thilina</author>
<link>www.test.com</link>
-<file path="admin/controller/catalog/product.php">
-<operation>
-<search>
-<![CDATA[// Image]]>
</search>
-<add position="before">
-<![CDATA[//Credit Cards
if (isset($this->request->post['credit_cards'])) {
$credit_cards = $this->request->post['credit_cards'];
} elseif (isset($this->request->get['product_id'])) {
$credit_cards = $this->model_catalog_product->getCreditCards();
} else {
$data['credit_cards'] = array();
}
$data['credit_cards'] = array();
foreach ($credit_cards as $credit_card) {
$data['credit_cards'][] = array(
'credit_card_id' => $credit_card['credit_card_id'],
'credit_card_name'=> $credit_card['credit_card_name']);
}
//Installment Plan Product Ids
if(!isset($this->request->get['product_id'])){
$data['installment_plans'] = array();
}else{
$data['installment_plans'] = $this->model_catalog_product->getInstallmentPlansOfProduct($this->request->get['product_id']);
}
]]>
</add>
</operation>
</file>
</modification>
Upvotes: 1
Views: 401