Post by 63BeetleSmurf » Sat Jul 08, 2017 6:46 am

Hello,

I am setting up a new site using OpenCart 3.0.1.1 and I'm having some trouble with the modifications.

When I upload my modification I keep getting the error "Unique code is required for modification XML!".

I am putting my install.xml file in a zip called "header_links_in_menu.ocmod.zip" and my XML code is as follows;

<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Header Links In Menu</name>
<version>1.0</version>
<author>Murphys Place</author>
<link>http://murphys.place</link>
<file path="catalog/controller/common/menu.php">
<operation>
<search><![CDATA[return $this->load->view('common/menu', $data);]]></search>
<add position="before"><![CDATA[if ($this->customer->isLogged()) {
$this->load->model('account/wishlist');

$data['text_wishlist'] = sprintf($this->language->get('text_wishlist'), $this->model_account_wishlist->getTotalWishlist());
} else {
$data['text_wishlist'] = sprintf($this->language->get('text_wishlist'), (isset($this->session->data['wishlist']) ? count($this->session->data['wishlist']) : 0));
}

$data['wishlist'] = $this->url->link('account/wishlist', '', true);
$data['account'] = $this->url->link('account/account', '', true);
$data['register'] = $this->url->link('account/register', '', true);
$data['login'] = $this->url->link('account/login', '', true);
$data['checkout'] = $this->url->link('checkout/checkout', '', true);

$data['currency'] = $this->load->controller('common/currency');]]></add>
</operation>
</file>
</modification>

I have moved the account, wish list and checkout links down into the menu and everything works great editing the original controller file to add the required variables, but obviously I don't want to edit core files so I'm trying to do it with a modification file.

Cheers.

Newbie

Posts

Joined
Thu Jul 06, 2017 4:58 am

Post by Johnathan » Sat Jul 08, 2017 11:33 pm

You need a <code> tag after the <name> tag. It's not specified in the documentation, because that hasn't been updated for a long time, but it should be. For example:

<code>header_links_in_menu</code>

Image
Image Image Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am

Who is online

Users browsing this forum: No registered users and 2 guests