Post by Umer.Farooq1993 » Tue Jul 11, 2017 2:57 pm

I want to place the code after the $order_product_id = $this->db->getLastId() which occur 2 times in order.php file. I want to place the code in both places. The OCMOD is placing the code as instructed but it is also adding the code third time and placing it in random place.


<file path="catalog/model/checkout/order.php">
<operation>
<search trim="true" index="0">
<![CDATA[
$order_product_id = $this->db->getLastId();
]]>
</search>
<add position="after">
<![CDATA[
if($product['variation_detail_id']){
$this->db->query("INSERT INTO `oc_order_variation`( `order_id`, `order_product_id`, `product_variation_detail_id`) VALUES (".(int)$order_id.",".(int)$order_product_id.",".(int)$product['variation_detail_id'].")");
}
]]>
</add>
</operation>

</file>

I have also tried using offset but it neglect the first occurrence and place the code in the second occurrence only. Is there a way to add the code in both places?


Posts

Joined
Mon Jul 10, 2017 6:27 pm

Post by opencartboost » Tue Jul 11, 2017 11:22 pm

First, please make you posting at right place. If you are using OC 2.x, you should section Opencart 2.x support.
Second, Are you sure index start with 0?
try remove index="0"

Active Member

Posts

Joined
Thu Jul 09, 2015 5:59 am
Who is online

Users browsing this forum: No registered users and 14 guests