1

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.

enter image description here

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>
  • Why do you have the "-" at the beginning of each line? – Daniel Dec 10 '19 at 14:52
  • i have generated this xml from this website https://openix.io/en/tool/opencart/ocmod – Thilina Rathnayake Dec 11 '19 at 03:47
  • Given you comment, on my since deleted answer. What does the OCMOD log say? Please remove those incorrect "-"'s from the question so that it's easier for someone else to debug, since it's not actually in the xml file as you say. – Daniel Dec 12 '19 at 06:27
  • Can you have a look and see if a file exists in this path: `/system/storage/modification/admin/controller/catalog/product.php` if so, download it and see if the modification has been applied – Daniel Dec 12 '19 at 11:27
  • @Daniel yes it's there and it is updated.at first i was checking on admin/controller/catalog/product.php. now only i got know how it works. Thanks. – Thilina Rathnayake Dec 17 '19 at 03:55

0 Answers0